@nocobase/plugin-file-manager 2.0.0-alpha.9 → 2.0.0-beta.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.
Files changed (371) hide show
  1. package/dist/client/index.d.ts +1 -1
  2. package/dist/client/index.js +1 -1
  3. package/dist/client/models/DisplayPreviewFieldModel.d.ts +1 -0
  4. package/dist/client/models/UploadActionModel.d.ts +3 -1
  5. package/dist/client/schemas/storageTypes/ali-oss.d.ts +12 -0
  6. package/dist/client/schemas/storageTypes/common.d.ts +12 -0
  7. package/dist/client/schemas/storageTypes/index.d.ts +48 -0
  8. package/dist/client/schemas/storageTypes/local.d.ts +12 -0
  9. package/dist/client/schemas/storageTypes/s3.d.ts +12 -0
  10. package/dist/client/schemas/storageTypes/tx-cos.d.ts +12 -0
  11. package/dist/client/templates/file.d.ts +4 -0
  12. package/dist/common/collections/storages.d.ts +11 -0
  13. package/dist/common/collections/storages.js +6 -0
  14. package/dist/externalVersion.js +8 -8
  15. package/dist/locale/de-DE.json +42 -29
  16. package/dist/locale/en-US.json +43 -30
  17. package/dist/locale/es-ES.json +54 -0
  18. package/dist/locale/fr-FR.json +45 -12
  19. package/dist/locale/hu-HU.json +48 -0
  20. package/dist/locale/id-ID.json +48 -0
  21. package/dist/locale/it-IT.json +43 -28
  22. package/dist/locale/ja-JP.json +43 -30
  23. package/dist/locale/ko-KR.json +46 -24
  24. package/dist/locale/nl-NL.json +53 -39
  25. package/dist/locale/pt-BR.json +54 -0
  26. package/dist/locale/ru-RU.json +47 -11
  27. package/dist/locale/tr-TR.json +47 -10
  28. package/dist/locale/uk-UA.json +54 -0
  29. package/dist/locale/vi-VN.json +48 -0
  30. package/dist/locale/zh-CN.json +41 -31
  31. package/dist/locale/zh-TW.json +54 -0
  32. package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
  33. package/dist/node_modules/@aws-sdk/lib-storage/LICENSE +201 -0
  34. package/dist/node_modules/{multer-s3 → @aws-sdk/lib-storage/dist-cjs}/index.js +574 -6229
  35. package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.browser.js +8 -0
  36. package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.js +10 -0
  37. package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.native.js +8 -0
  38. package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.shared.js +6 -0
  39. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/Upload.js +304 -0
  40. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/bytelength.js +27 -0
  41. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunker.js +24 -0
  42. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getChunkStream.js +24 -0
  43. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getChunkUint8Array.js +19 -0
  44. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getDataReadable.js +11 -0
  45. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getDataReadableStream.js +24 -0
  46. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/index.js +2 -0
  47. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.browser.js +5 -0
  48. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.js +7 -0
  49. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.native.js +5 -0
  50. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.shared.js +3 -0
  51. package/dist/node_modules/@aws-sdk/lib-storage/dist-es/types.js +1 -0
  52. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/Upload.d.ts +59 -0
  53. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/bytelength.d.ts +1 -0
  54. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunker.d.ts +3 -0
  55. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getChunkStream.d.ts +2 -0
  56. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getChunkUint8Array.d.ts +2 -0
  57. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getDataReadable.d.ts +3 -0
  58. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getDataReadableStream.d.ts +1 -0
  59. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/index.d.ts +2 -0
  60. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.browser.d.ts +7 -0
  61. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.d.ts +8 -0
  62. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.native.d.ts +7 -0
  63. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.shared.d.ts +6 -0
  64. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/Upload.d.ts +43 -0
  65. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/bytelength.d.ts +1 -0
  66. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunker.d.ts +6 -0
  67. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getChunkStream.d.ts +6 -0
  68. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getChunkUint8Array.d.ts +5 -0
  69. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getDataReadable.d.ts +4 -0
  70. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getDataReadableStream.d.ts +3 -0
  71. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/index.d.ts +2 -0
  72. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.browser.d.ts +4 -0
  73. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.d.ts +4 -0
  74. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.native.d.ts +4 -0
  75. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.shared.d.ts +3 -0
  76. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/types.d.ts +22 -0
  77. package/dist/node_modules/@aws-sdk/lib-storage/dist-types/types.d.ts +51 -0
  78. package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -0
  79. package/dist/node_modules/{multer-s3 → ali-oss}/LICENSE +1 -2
  80. package/dist/node_modules/ali-oss/dist/aliyun-oss-sdk.js +44018 -0
  81. package/dist/node_modules/ali-oss/dist/aliyun-oss-sdk.min.js +4 -0
  82. package/dist/node_modules/ali-oss/lib/browser/bucket.js +296 -0
  83. package/dist/node_modules/ali-oss/lib/browser/client.js +452 -0
  84. package/dist/node_modules/ali-oss/lib/browser/managed-upload.js +360 -0
  85. package/dist/node_modules/ali-oss/lib/browser/object.js +385 -0
  86. package/dist/node_modules/ali-oss/lib/browser/version.js +1 -0
  87. package/dist/node_modules/ali-oss/lib/browser.js +6 -0
  88. package/dist/node_modules/ali-oss/lib/bucket.js +337 -0
  89. package/dist/node_modules/{multer-aliyun-oss/index.js → ali-oss/lib/client.js} +2 -2
  90. package/dist/node_modules/ali-oss/lib/cluster.js +228 -0
  91. package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.d.ts +4 -0
  92. package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.js +14 -0
  93. package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.ts +12 -0
  94. package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.d.ts +4 -0
  95. package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.js +14 -0
  96. package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.ts +12 -0
  97. package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketEncryption.js +20 -0
  98. package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.d.ts +10 -0
  99. package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.js +22 -0
  100. package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.ts +21 -0
  101. package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketLifecycle.js +13 -0
  102. package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketPolicy.js +21 -0
  103. package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketTags.js +21 -0
  104. package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketWebsite.js +13 -0
  105. package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.d.ts +4 -0
  106. package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.js +23 -0
  107. package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.ts +21 -0
  108. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketEncryption.js +21 -0
  109. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.d.ts +11 -0
  110. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.js +25 -0
  111. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.ts +24 -0
  112. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketLifecycle.js +33 -0
  113. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketPolicy.js +28 -0
  114. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketRequestPayment.js +25 -0
  115. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.d.ts +23 -0
  116. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.js +17 -0
  117. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.ts +34 -0
  118. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketTags.js +23 -0
  119. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketVersioning.js +22 -0
  120. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWebsite.js +28 -0
  121. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.d.ts +1 -0
  122. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.js +20 -0
  123. package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.ts +22 -0
  124. package/dist/node_modules/ali-oss/lib/common/bucket/index.js +34 -0
  125. package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.d.ts +5 -0
  126. package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.js +24 -0
  127. package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.ts +23 -0
  128. package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.d.ts +13 -0
  129. package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.js +29 -0
  130. package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.ts +32 -0
  131. package/dist/node_modules/ali-oss/lib/common/bucket/putBucket.js +31 -0
  132. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketEncryption.js +36 -0
  133. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.d.ts +36 -0
  134. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.js +58 -0
  135. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.ts +84 -0
  136. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketLifecycle.js +127 -0
  137. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketPolicy.js +27 -0
  138. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketRequestPayment.js +40 -0
  139. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketTags.js +39 -0
  140. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketVersioning.js +35 -0
  141. package/dist/node_modules/ali-oss/lib/common/bucket/putBucketWebsite.js +50 -0
  142. package/dist/node_modules/ali-oss/lib/common/callback.js +27 -0
  143. package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.d.ts +1 -0
  144. package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.js +52 -0
  145. package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.ts +51 -0
  146. package/dist/node_modules/ali-oss/lib/common/client/initOptions.js +72 -0
  147. package/dist/node_modules/ali-oss/lib/common/image/index.js +5 -0
  148. package/dist/node_modules/ali-oss/lib/common/image/processObjectSave.js +45 -0
  149. package/dist/node_modules/ali-oss/lib/common/multipart-copy.js +240 -0
  150. package/dist/node_modules/ali-oss/lib/common/multipart.js +271 -0
  151. package/dist/node_modules/ali-oss/lib/common/object/asyncSignatureUrl.js +57 -0
  152. package/dist/node_modules/ali-oss/lib/common/object/calculatePostSignature.js +35 -0
  153. package/dist/node_modules/ali-oss/lib/common/object/copyObject.js +74 -0
  154. package/dist/node_modules/ali-oss/lib/common/object/delete.js +22 -0
  155. package/dist/node_modules/ali-oss/lib/common/object/deleteMulti.js +57 -0
  156. package/dist/node_modules/ali-oss/lib/common/object/deleteObjectTagging.js +22 -0
  157. package/dist/node_modules/ali-oss/lib/common/object/generateObjectUrl.js +28 -0
  158. package/dist/node_modules/ali-oss/lib/common/object/get.js +64 -0
  159. package/dist/node_modules/ali-oss/lib/common/object/getACL.js +30 -0
  160. package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.d.ts +1 -0
  161. package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.js +26 -0
  162. package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.ts +25 -0
  163. package/dist/node_modules/ali-oss/lib/common/object/getBucketVersions.js +98 -0
  164. package/dist/node_modules/ali-oss/lib/common/object/getObjectMeta.js +23 -0
  165. package/dist/node_modules/ali-oss/lib/common/object/getObjectTagging.js +34 -0
  166. package/dist/node_modules/ali-oss/lib/common/object/getObjectUrl.js +21 -0
  167. package/dist/node_modules/ali-oss/lib/common/object/getSymlink.js +23 -0
  168. package/dist/node_modules/ali-oss/lib/common/object/head.js +40 -0
  169. package/dist/node_modules/ali-oss/lib/common/object/index.js +26 -0
  170. package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.d.ts +1 -0
  171. package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.js +44 -0
  172. package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.ts +46 -0
  173. package/dist/node_modules/ali-oss/lib/common/object/putACL.js +27 -0
  174. package/dist/node_modules/ali-oss/lib/common/object/putObjectTagging.js +43 -0
  175. package/dist/node_modules/ali-oss/lib/common/object/putSymlink.js +33 -0
  176. package/dist/node_modules/ali-oss/lib/common/object/signatureUrl.js +52 -0
  177. package/dist/node_modules/ali-oss/lib/common/object/signatureUrlV4.js +70 -0
  178. package/dist/node_modules/ali-oss/lib/common/parallel.js +177 -0
  179. package/dist/node_modules/ali-oss/lib/common/signUtils.js +355 -0
  180. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.d.ts +1 -0
  181. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.js +9 -0
  182. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.ts +6 -0
  183. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.d.ts +1 -0
  184. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.js +14 -0
  185. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.ts +12 -0
  186. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.d.ts +1 -0
  187. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.js +49 -0
  188. package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.ts +52 -0
  189. package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.d.ts +1 -0
  190. package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.js +30 -0
  191. package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.ts +27 -0
  192. package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.d.ts +1 -0
  193. package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.js +9 -0
  194. package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.ts +5 -0
  195. package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.d.ts +1 -0
  196. package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.js +50 -0
  197. package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.ts +53 -0
  198. package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.d.ts +1 -0
  199. package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.js +7 -0
  200. package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.ts +4 -0
  201. package/dist/node_modules/ali-oss/lib/common/utils/checkValid.d.ts +1 -0
  202. package/dist/node_modules/ali-oss/lib/common/utils/checkValid.js +14 -0
  203. package/dist/node_modules/ali-oss/lib/common/utils/checkValid.ts +9 -0
  204. package/dist/node_modules/ali-oss/lib/common/utils/createRequest.d.ts +8 -0
  205. package/dist/node_modules/ali-oss/lib/common/utils/createRequest.js +139 -0
  206. package/dist/node_modules/ali-oss/lib/common/utils/createRequest.ts +169 -0
  207. package/dist/node_modules/ali-oss/lib/common/utils/dataFix.d.ts +12 -0
  208. package/dist/node_modules/ali-oss/lib/common/utils/dataFix.js +63 -0
  209. package/dist/node_modules/ali-oss/lib/common/utils/dataFix.ts +78 -0
  210. package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.d.ts +2 -0
  211. package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.js +41 -0
  212. package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.ts +47 -0
  213. package/dist/node_modules/ali-oss/lib/common/utils/encodeString.d.ts +1 -0
  214. package/dist/node_modules/ali-oss/lib/common/utils/encodeString.js +12 -0
  215. package/dist/node_modules/ali-oss/lib/common/utils/encodeString.ts +7 -0
  216. package/dist/node_modules/ali-oss/lib/common/utils/encoder.d.ts +2 -0
  217. package/dist/node_modules/ali-oss/lib/common/utils/encoder.js +9 -0
  218. package/dist/node_modules/ali-oss/lib/common/utils/encoder.ts +6 -0
  219. package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.d.ts +1 -0
  220. package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.js +45 -0
  221. package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.ts +41 -0
  222. package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.d.ts +6 -0
  223. package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.js +34 -0
  224. package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.ts +35 -0
  225. package/dist/node_modules/ali-oss/lib/common/utils/formatTag.d.ts +1 -0
  226. package/dist/node_modules/ali-oss/lib/common/utils/formatTag.js +22 -0
  227. package/dist/node_modules/ali-oss/lib/common/utils/formatTag.ts +20 -0
  228. package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.d.ts +1 -0
  229. package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.js +7 -0
  230. package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.ts +3 -0
  231. package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.d.ts +1 -0
  232. package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.js +17 -0
  233. package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.ts +12 -0
  234. package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.d.ts +1 -0
  235. package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.js +18 -0
  236. package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.ts +14 -0
  237. package/dist/node_modules/ali-oss/lib/common/utils/isArray.d.ts +1 -0
  238. package/dist/node_modules/ali-oss/lib/common/utils/isArray.js +6 -0
  239. package/dist/node_modules/ali-oss/lib/common/utils/isArray.ts +3 -0
  240. package/dist/node_modules/ali-oss/lib/common/utils/isBlob.d.ts +1 -0
  241. package/dist/node_modules/ali-oss/lib/common/utils/isBlob.js +7 -0
  242. package/dist/node_modules/ali-oss/lib/common/utils/isBlob.ts +3 -0
  243. package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.d.ts +1 -0
  244. package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.js +7 -0
  245. package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.ts +3 -0
  246. package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.d.ts +1 -0
  247. package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.js +10 -0
  248. package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.ts +6 -0
  249. package/dist/node_modules/ali-oss/lib/common/utils/isFile.d.ts +1 -0
  250. package/dist/node_modules/ali-oss/lib/common/utils/isFile.js +6 -0
  251. package/dist/node_modules/ali-oss/lib/common/utils/isFile.ts +3 -0
  252. package/dist/node_modules/ali-oss/lib/common/utils/isFunction.d.ts +1 -0
  253. package/dist/node_modules/ali-oss/lib/common/utils/isFunction.js +6 -0
  254. package/dist/node_modules/ali-oss/lib/common/utils/isFunction.ts +3 -0
  255. package/dist/node_modules/ali-oss/lib/common/utils/isIP.d.ts +6 -0
  256. package/dist/node_modules/ali-oss/lib/common/utils/isIP.js +14 -0
  257. package/dist/node_modules/ali-oss/lib/common/utils/isIP.ts +12 -0
  258. package/dist/node_modules/ali-oss/lib/common/utils/isObject.d.ts +1 -0
  259. package/dist/node_modules/ali-oss/lib/common/utils/isObject.js +6 -0
  260. package/dist/node_modules/ali-oss/lib/common/utils/isObject.ts +3 -0
  261. package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.d.ts +1 -0
  262. package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.js +14 -0
  263. package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.ts +11 -0
  264. package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.d.ts +1 -0
  265. package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.js +43 -0
  266. package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.ts +37 -0
  267. package/dist/node_modules/ali-oss/lib/common/utils/omit.d.ts +1 -0
  268. package/dist/node_modules/ali-oss/lib/common/utils/omit.js +11 -0
  269. package/dist/node_modules/ali-oss/lib/common/utils/omit.ts +9 -0
  270. package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.d.ts +1 -0
  271. package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.js +21 -0
  272. package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.ts +15 -0
  273. package/dist/node_modules/ali-oss/lib/common/utils/retry.d.ts +1 -0
  274. package/dist/node_modules/ali-oss/lib/common/utils/retry.js +30 -0
  275. package/dist/node_modules/ali-oss/lib/common/utils/retry.ts +26 -0
  276. package/dist/node_modules/ali-oss/lib/common/utils/setRegion.d.ts +3 -0
  277. package/dist/node_modules/ali-oss/lib/common/utils/setRegion.js +20 -0
  278. package/dist/node_modules/ali-oss/lib/common/utils/setRegion.ts +15 -0
  279. package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.d.ts +2 -0
  280. package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.js +36 -0
  281. package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.ts +32 -0
  282. package/dist/node_modules/ali-oss/lib/global.d.ts +6 -0
  283. package/dist/node_modules/ali-oss/lib/image.js +146 -0
  284. package/dist/node_modules/ali-oss/lib/managed-upload.js +380 -0
  285. package/dist/node_modules/ali-oss/lib/object.js +420 -0
  286. package/dist/node_modules/ali-oss/lib/rtmp.js +295 -0
  287. package/dist/node_modules/ali-oss/lib/setConfig.d.ts +3 -0
  288. package/dist/node_modules/ali-oss/lib/setConfig.js +42 -0
  289. package/dist/node_modules/ali-oss/lib/setConfig.ts +52 -0
  290. package/dist/node_modules/ali-oss/lib/sts.js +156 -0
  291. package/dist/node_modules/ali-oss/lib/types/experimental.d.ts +1 -0
  292. package/dist/node_modules/ali-oss/lib/types/experimental.js +2 -0
  293. package/dist/node_modules/ali-oss/lib/types/experimental.ts +1 -0
  294. package/dist/node_modules/ali-oss/node_modules/bowser/.editorconfig +17 -0
  295. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/.name +1 -0
  296. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/bowser.iml +8 -0
  297. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/encodings.xml +6 -0
  298. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/inspectionProfiles/Project_Default.xml +6 -0
  299. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/jsLibraryMappings.xml +8 -0
  300. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-exported-files.xml +8 -0
  301. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-navigator/profiles_settings.xml +3 -0
  302. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-navigator.xml +67 -0
  303. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/misc.xml +6 -0
  304. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/modules.xml +8 -0
  305. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/vcs.xml +6 -0
  306. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/watcherTasks.xml +4 -0
  307. package/dist/node_modules/ali-oss/node_modules/bowser/.idea/workspace.xml +696 -0
  308. package/dist/node_modules/ali-oss/node_modules/bowser/.travis.yml +8 -0
  309. package/dist/node_modules/ali-oss/node_modules/bowser/bower.json +33 -0
  310. package/dist/node_modules/ali-oss/node_modules/bowser/bowser.js +644 -0
  311. package/dist/node_modules/ali-oss/node_modules/bowser/bowser.min.js +6 -0
  312. package/dist/node_modules/ali-oss/node_modules/bowser/package.json +38 -0
  313. package/dist/node_modules/ali-oss/node_modules/bowser/src/bowser.js +644 -0
  314. package/dist/node_modules/ali-oss/node_modules/bowser/test/test.js +151 -0
  315. package/dist/node_modules/ali-oss/node_modules/bowser/typings.d.ts +115 -0
  316. package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/ProjectSettings.json +3 -0
  317. package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/config/applicationhost.config +1031 -0
  318. package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/node-dateformat/v15/.suo +0 -0
  319. package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/slnx.sqlite +0 -0
  320. package/dist/node_modules/ali-oss/node_modules/dateformat/lib/dateformat.js +226 -0
  321. package/dist/node_modules/ali-oss/node_modules/dateformat/package.json +30 -0
  322. package/dist/node_modules/ali-oss/node_modules/mime/Mime.js +97 -0
  323. package/dist/node_modules/ali-oss/node_modules/mime/cli.js +46 -0
  324. package/dist/node_modules/ali-oss/node_modules/mime/index.js +4 -0
  325. package/dist/node_modules/ali-oss/node_modules/mime/lite.js +4 -0
  326. package/dist/node_modules/ali-oss/node_modules/mime/package.json +52 -0
  327. package/dist/node_modules/ali-oss/node_modules/mime/types/other.js +1 -0
  328. package/dist/node_modules/ali-oss/node_modules/mime/types/standard.js +1 -0
  329. package/dist/node_modules/ali-oss/package.json +1 -0
  330. package/dist/node_modules/ali-oss/shims/crypto/crypto.js +98 -0
  331. package/dist/node_modules/ali-oss/shims/crypto/helpers.js +36 -0
  332. package/dist/node_modules/ali-oss/shims/crypto/md5.js +152 -0
  333. package/dist/node_modules/ali-oss/shims/crypto/sha.js +91 -0
  334. package/dist/node_modules/ali-oss/shims/crypto/sha256.js +163 -0
  335. package/dist/node_modules/ali-oss/shims/debug.js +3 -0
  336. package/dist/node_modules/ali-oss/shims/is-type-of.js +18 -0
  337. package/dist/node_modules/ali-oss/shims/process.js +35 -0
  338. package/dist/node_modules/ali-oss/shims/stream-http/index.js +82 -0
  339. package/dist/node_modules/ali-oss/shims/stream-http/lib/capability.js +72 -0
  340. package/dist/node_modules/ali-oss/shims/stream-http/lib/request.js +320 -0
  341. package/dist/node_modules/ali-oss/shims/stream-http/lib/response.js +217 -0
  342. package/dist/node_modules/ali-oss/shims/url/index.js +696 -0
  343. package/dist/node_modules/ali-oss/shims/url/util.js +16 -0
  344. package/dist/node_modules/ali-oss/shims/utility.js +25 -0
  345. package/dist/node_modules/ali-oss/shims/xhr.js +798 -0
  346. package/dist/node_modules/mime-match/package.json +1 -1
  347. package/dist/node_modules/mime-types/package.json +1 -1
  348. package/dist/node_modules/mkdirp/package.json +1 -1
  349. package/dist/node_modules/multer-cos/package.json +1 -1
  350. package/dist/node_modules/url-join/package.json +1 -1
  351. package/dist/server/actions/storages.js +4 -6
  352. package/dist/server/server.js +1 -0
  353. package/dist/server/storages/ali-oss.d.ts +15 -1
  354. package/dist/server/storages/ali-oss.js +66 -2
  355. package/dist/server/storages/index.d.ts +1 -0
  356. package/dist/server/storages/local.js +1 -1
  357. package/dist/server/storages/s3.d.ts +10 -3
  358. package/dist/server/storages/s3.js +121 -29
  359. package/dist/server/storages/tx-cos.js +1 -1
  360. package/dist/server/utils.d.ts +1 -0
  361. package/dist/server/utils.js +43 -0
  362. package/package.json +7 -3
  363. package/dist/node_modules/multer-aliyun-oss/package.json +0 -1
  364. package/dist/node_modules/multer-s3/.gitattributes +0 -1
  365. package/dist/node_modules/multer-s3/.travis.yml +0 -6
  366. package/dist/node_modules/multer-s3/package.json +0 -1
  367. package/dist/node_modules/multer-s3/test/basic.js +0 -293
  368. package/dist/node_modules/multer-s3/test/files/a.txt +0 -1
  369. package/dist/node_modules/multer-s3/test/files/test.svg +0 -3
  370. package/dist/node_modules/multer-s3/test/files/test2.svg +0 -9
  371. package/dist/node_modules/multer-s3/test/util/mock-s3.js +0 -17
@@ -0,0 +1,696 @@
1
+ // Copyright Joyent, Inc. and other Node contributors.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a
4
+ // copy of this software and associated documentation files (the
5
+ // "Software"), to deal in the Software without restriction, including
6
+ // without limitation the rights to use, copy, modify, merge, publish,
7
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ // persons to whom the Software is furnished to do so, subject to the
9
+ // following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included
12
+ // in all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ 'use strict';
23
+
24
+ var punycode = require('punycode');
25
+ var util = require('./util');
26
+
27
+ exports.parse = urlParse;
28
+ exports.resolve = urlResolve;
29
+ exports.resolveObject = urlResolveObject;
30
+ exports.format = urlFormat;
31
+
32
+ exports.Url = Url;
33
+
34
+ function Url() {
35
+ this.protocol = null;
36
+ this.slashes = null;
37
+ this.auth = null;
38
+ this.host = null;
39
+ this.port = null;
40
+ this.hostname = null;
41
+ this.hash = null;
42
+ this.search = null;
43
+ this.query = null;
44
+ this.pathname = null;
45
+ this.path = null;
46
+ this.href = null;
47
+ }
48
+
49
+ // Reference: RFC 3986, RFC 1808, RFC 2396
50
+
51
+ // define these here so at least they only have to be
52
+ // compiled once on the first module load.
53
+ var protocolPattern = /^([a-z0-9.+-]+:)/i,
54
+ portPattern = /:[0-9]*$/,
55
+ // Special case for a simple path URL
56
+ simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
57
+ // RFC 2396: characters reserved for delimiting URLs.
58
+ // We actually just auto-escape these.
59
+ delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
60
+ // RFC 2396: characters not allowed for various reasons.
61
+ unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
62
+ // Allowed by RFCs, but cause of XSS attacks. Always escape these.
63
+ autoEscape = ["'"].concat(unwise),
64
+ // Characters that are never ever allowed in a hostname.
65
+ // Note that any invalid chars are also handled, but these
66
+ // are the ones that are *expected* to be seen, so we fast-path
67
+ // them.
68
+ nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
69
+ hostEndingChars = ['/', '?', '#'],
70
+ hostnameMaxLen = 255,
71
+ hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
72
+ hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
73
+ // protocols that can allow "unsafe" and "unwise" chars.
74
+ unsafeProtocol = {
75
+ javascript: true,
76
+ 'javascript:': true
77
+ },
78
+ // protocols that never have a hostname.
79
+ hostlessProtocol = {
80
+ javascript: true,
81
+ 'javascript:': true
82
+ },
83
+ // protocols that always contain a // bit.
84
+ slashedProtocol = {
85
+ http: true,
86
+ https: true,
87
+ ftp: true,
88
+ gopher: true,
89
+ file: true,
90
+ 'http:': true,
91
+ 'https:': true,
92
+ 'ftp:': true,
93
+ 'gopher:': true,
94
+ 'file:': true
95
+ },
96
+ querystring = require('querystring');
97
+
98
+ function urlParse(url, parseQueryString, slashesDenoteHost) {
99
+ if (url && util.isObject(url) && url instanceof Url) return url;
100
+
101
+ var u = new Url();
102
+ u.parse(url, parseQueryString, slashesDenoteHost);
103
+ return u;
104
+ }
105
+
106
+ Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
107
+ if (!util.isString(url)) {
108
+ throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
109
+ }
110
+
111
+ // Copy chrome, IE, opera backslash-handling behavior.
112
+ // Back slashes before the query string get converted to forward slashes
113
+ // See: https://code.google.com/p/chromium/issues/detail?id=25916
114
+ var queryIndex = url.indexOf('?'),
115
+ splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',
116
+ uSplit = url.split(splitter),
117
+ slashRegex = /\\/g;
118
+ uSplit[0] = uSplit[0].replace(slashRegex, '/');
119
+ url = uSplit.join(splitter);
120
+
121
+ var rest = url;
122
+
123
+ // trim before proceeding.
124
+ // This is to support parse stuff like " http://foo.com \n"
125
+ rest = rest.trim();
126
+
127
+ if (!slashesDenoteHost && url.split('#').length === 1) {
128
+ // Try fast path regexp
129
+ var simplePath = simplePathPattern.exec(rest);
130
+ if (simplePath) {
131
+ this.path = rest;
132
+ this.href = rest;
133
+ this.pathname = simplePath[1];
134
+ if (simplePath[2]) {
135
+ this.search = simplePath[2];
136
+ if (parseQueryString) {
137
+ this.query = querystring.parse(this.search.substr(1));
138
+ } else {
139
+ this.query = this.search.substr(1);
140
+ }
141
+ } else if (parseQueryString) {
142
+ this.search = '';
143
+ this.query = {};
144
+ }
145
+ return this;
146
+ }
147
+ }
148
+
149
+ var proto = protocolPattern.exec(rest);
150
+ if (proto) {
151
+ proto = proto[0];
152
+ var lowerProto = proto.toLowerCase();
153
+ this.protocol = lowerProto;
154
+ rest = rest.substr(proto.length);
155
+ }
156
+
157
+ // figure out if it's got a host
158
+ // user@server is *always* interpreted as a hostname, and url
159
+ // resolution will treat //foo/bar as host=foo,path=bar because that's
160
+ // how the browser resolves relative URLs.
161
+ if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
162
+ var slashes = rest.substr(0, 2) === '//';
163
+ if (slashes && !(proto && hostlessProtocol[proto])) {
164
+ rest = rest.substr(2);
165
+ this.slashes = true;
166
+ }
167
+ }
168
+
169
+ if (!hostlessProtocol[proto] && (slashes || (proto && !slashedProtocol[proto]))) {
170
+ // there's a hostname.
171
+ // the first instance of /, ?, ;, or # ends the host.
172
+ //
173
+ // If there is an @ in the hostname, then non-host chars *are* allowed
174
+ // to the left of the last @ sign, unless some host-ending character
175
+ // comes *before* the @-sign.
176
+ // URLs are obnoxious.
177
+ //
178
+ // ex:
179
+ // http://a@b@c/ => user:a@b host:c
180
+ // http://a@b?@c => user:a host:c path:/?@c
181
+
182
+ // v0.12 TODO(isaacs): This is not quite how Chrome does things.
183
+ // Review our test case against browsers more comprehensively.
184
+
185
+ // find the first instance of any hostEndingChars
186
+ var hostEnd = -1;
187
+ for (var i = 0; i < hostEndingChars.length; i++) {
188
+ var hec = rest.indexOf(hostEndingChars[i]);
189
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
190
+ }
191
+
192
+ // at this point, either we have an explicit point where the
193
+ // auth portion cannot go past, or the last @ char is the decider.
194
+ var auth, atSign;
195
+ if (hostEnd === -1) {
196
+ // atSign can be anywhere.
197
+ atSign = rest.lastIndexOf('@');
198
+ } else {
199
+ // atSign must be in auth portion.
200
+ // http://a@b/c@d => host:b auth:a path:/c@d
201
+ atSign = rest.lastIndexOf('@', hostEnd);
202
+ }
203
+
204
+ // Now we have a portion which is definitely the auth.
205
+ // Pull that off.
206
+ if (atSign !== -1) {
207
+ auth = rest.slice(0, atSign);
208
+ rest = rest.slice(atSign + 1);
209
+ this.auth = decodeURIComponent(auth);
210
+ }
211
+
212
+ // the host is the remaining to the left of the first non-host char
213
+ hostEnd = -1;
214
+ for (var i = 0; i < nonHostChars.length; i++) {
215
+ var hec = rest.indexOf(nonHostChars[i]);
216
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
217
+ }
218
+ // if we still have not hit it, then the entire thing is a host.
219
+ if (hostEnd === -1) hostEnd = rest.length;
220
+
221
+ this.host = rest.slice(0, hostEnd);
222
+ rest = rest.slice(hostEnd);
223
+
224
+ // pull out port.
225
+ this.parseHost();
226
+
227
+ // we've indicated that there is a hostname,
228
+ // so even if it's empty, it has to be present.
229
+ this.hostname = this.hostname || '';
230
+
231
+ // if hostname begins with [ and ends with ]
232
+ // assume that it's an IPv6 address.
233
+ var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']';
234
+
235
+ // validate a little.
236
+ if (!ipv6Hostname) {
237
+ var hostparts = this.hostname.split('.');
238
+ for (var i = 0, l = hostparts.length; i < l; i++) {
239
+ var part = hostparts[i];
240
+ if (!part) continue;
241
+ if (!part.match(hostnamePartPattern)) {
242
+ var newpart = '';
243
+ for (var j = 0, k = part.length; j < k; j++) {
244
+ if (part.charCodeAt(j) > 127) {
245
+ // we replace non-ASCII char with a temporary placeholder
246
+ // we need this to make sure size of hostname is not
247
+ // broken by replacing non-ASCII by nothing
248
+ newpart += 'x';
249
+ } else {
250
+ newpart += part[j];
251
+ }
252
+ }
253
+ // we test again with ASCII char only
254
+ if (!newpart.match(hostnamePartPattern)) {
255
+ var validParts = hostparts.slice(0, i);
256
+ var notHost = hostparts.slice(i + 1);
257
+ var bit = part.match(hostnamePartStart);
258
+ if (bit) {
259
+ validParts.push(bit[1]);
260
+ notHost.unshift(bit[2]);
261
+ }
262
+ if (notHost.length) {
263
+ rest = '/' + notHost.join('.') + rest;
264
+ }
265
+ this.hostname = validParts.join('.');
266
+ break;
267
+ }
268
+ }
269
+ }
270
+ }
271
+
272
+ if (this.hostname.length > hostnameMaxLen) {
273
+ this.hostname = '';
274
+ } else {
275
+ // hostnames are always lower case.
276
+ this.hostname = this.hostname.toLowerCase();
277
+ }
278
+
279
+ if (!ipv6Hostname) {
280
+ // IDNA Support: Returns a punycoded representation of "domain".
281
+ // It only converts parts of the domain name that
282
+ // have non-ASCII characters, i.e. it doesn't matter if
283
+ // you call it with a domain that already is ASCII-only.
284
+ this.hostname = punycode.toASCII(this.hostname);
285
+ }
286
+
287
+ var p = this.port ? ':' + this.port : '';
288
+ var h = this.hostname || '';
289
+ this.host = h + p;
290
+ this.href += this.host;
291
+
292
+ // strip [ and ] from the hostname
293
+ // the host field still retains them, though
294
+ if (ipv6Hostname) {
295
+ this.hostname = this.hostname.substr(1, this.hostname.length - 2);
296
+ if (rest[0] !== '/') {
297
+ rest = '/' + rest;
298
+ }
299
+ }
300
+ }
301
+
302
+ // now rest is set to the post-host stuff.
303
+ // chop off any delim chars.
304
+ if (!unsafeProtocol[lowerProto]) {
305
+ // First, make 100% sure that any "autoEscape" chars get
306
+ // escaped, even if encodeURIComponent doesn't think they
307
+ // need to be.
308
+ for (var i = 0, l = autoEscape.length; i < l; i++) {
309
+ var ae = autoEscape[i];
310
+ if (rest.indexOf(ae) === -1) continue;
311
+ var esc = encodeURIComponent(ae);
312
+ if (esc === ae) {
313
+ esc = escape(ae);
314
+ }
315
+ rest = rest.split(ae).join(esc);
316
+ }
317
+ }
318
+
319
+ // chop off from the tail first.
320
+ var hash = rest.indexOf('#');
321
+ if (hash !== -1) {
322
+ // got a fragment string.
323
+ this.hash = rest.substr(hash);
324
+ rest = rest.slice(0, hash);
325
+ }
326
+ var qm = rest.indexOf('?');
327
+ if (qm !== -1) {
328
+ this.search = rest.substr(qm);
329
+ this.query = rest.substr(qm + 1);
330
+ if (parseQueryString) {
331
+ this.query = querystring.parse(this.query);
332
+ }
333
+ rest = rest.slice(0, qm);
334
+ } else if (parseQueryString) {
335
+ // no query string, but parseQueryString still requested
336
+ this.search = '';
337
+ this.query = {};
338
+ }
339
+ if (rest) this.pathname = rest;
340
+ if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
341
+ this.pathname = '/';
342
+ }
343
+
344
+ //to support http.request
345
+ if (this.pathname || this.search) {
346
+ var p = this.pathname || '';
347
+ var s = this.search || '';
348
+ this.path = p + s;
349
+ }
350
+
351
+ // finally, reconstruct the href based on what has been validated.
352
+ this.href = this.format();
353
+ return this;
354
+ };
355
+
356
+ // format a parsed object into a url string
357
+ function urlFormat(obj) {
358
+ // ensure it's an object, and not a string url.
359
+ // If it's an obj, this is a no-op.
360
+ // this way, you can call url_format() on strings
361
+ // to clean up potentially wonky urls.
362
+ if (util.isString(obj)) obj = urlParse(obj);
363
+ if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
364
+ return obj.format();
365
+ }
366
+
367
+ Url.prototype.format = function () {
368
+ var auth = this.auth || '';
369
+ if (auth) {
370
+ auth = encodeURIComponent(auth);
371
+ auth = auth.replace(/%3A/i, ':');
372
+ auth += '@';
373
+ }
374
+
375
+ var protocol = this.protocol || '',
376
+ pathname = this.pathname || '',
377
+ hash = this.hash || '',
378
+ host = false,
379
+ query = '';
380
+
381
+ if (this.host) {
382
+ host = auth + this.host;
383
+ } else if (this.hostname) {
384
+ host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');
385
+ if (this.port) {
386
+ host += ':' + this.port;
387
+ }
388
+ }
389
+
390
+ if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
391
+ query = querystring.stringify(this.query);
392
+ }
393
+
394
+ var search = this.search || (query && '?' + query) || '';
395
+
396
+ if (protocol && protocol.substr(-1) !== ':') protocol += ':';
397
+
398
+ // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
399
+ // unless they had them to begin with.
400
+ if (this.slashes || ((!protocol || slashedProtocol[protocol]) && host !== false)) {
401
+ host = '//' + (host || '');
402
+ if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
403
+ } else if (!host) {
404
+ host = '';
405
+ }
406
+
407
+ if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
408
+ if (search && search.charAt(0) !== '?') search = '?' + search;
409
+
410
+ pathname = pathname.replace(/[?#]/g, function (match) {
411
+ return encodeURIComponent(match);
412
+ });
413
+ search = search.replace('#', '%23');
414
+
415
+ return protocol + host + pathname + search + hash;
416
+ };
417
+
418
+ function urlResolve(source, relative) {
419
+ return urlParse(source, false, true).resolve(relative);
420
+ }
421
+
422
+ Url.prototype.resolve = function (relative) {
423
+ return this.resolveObject(urlParse(relative, false, true)).format();
424
+ };
425
+
426
+ function urlResolveObject(source, relative) {
427
+ if (!source) return relative;
428
+ return urlParse(source, false, true).resolveObject(relative);
429
+ }
430
+
431
+ Url.prototype.resolveObject = function (relative) {
432
+ if (util.isString(relative)) {
433
+ var rel = new Url();
434
+ rel.parse(relative, false, true);
435
+ relative = rel;
436
+ }
437
+
438
+ var result = new Url();
439
+ var tkeys = Object.keys(this);
440
+ for (var tk = 0; tk < tkeys.length; tk++) {
441
+ var tkey = tkeys[tk];
442
+ result[tkey] = this[tkey];
443
+ }
444
+
445
+ // hash is always overridden, no matter what.
446
+ // even href="" will remove it.
447
+ result.hash = relative.hash;
448
+
449
+ // if the relative url is empty, then there's nothing left to do here.
450
+ if (relative.href === '') {
451
+ result.href = result.format();
452
+ return result;
453
+ }
454
+
455
+ // hrefs like //foo/bar always cut to the protocol.
456
+ if (relative.slashes && !relative.protocol) {
457
+ // take everything except the protocol from relative
458
+ var rkeys = Object.keys(relative);
459
+ for (var rk = 0; rk < rkeys.length; rk++) {
460
+ var rkey = rkeys[rk];
461
+ if (rkey !== 'protocol') result[rkey] = relative[rkey];
462
+ }
463
+
464
+ //urlParse appends trailing / to urls like http://www.example.com
465
+ if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
466
+ result.path = result.pathname = '/';
467
+ }
468
+
469
+ result.href = result.format();
470
+ return result;
471
+ }
472
+
473
+ if (relative.protocol && relative.protocol !== result.protocol) {
474
+ // if it's a known url protocol, then changing
475
+ // the protocol does weird things
476
+ // first, if it's not file:, then we MUST have a host,
477
+ // and if there was a path
478
+ // to begin with, then we MUST have a path.
479
+ // if it is file:, then the host is dropped,
480
+ // because that's known to be hostless.
481
+ // anything else is assumed to be absolute.
482
+ if (!slashedProtocol[relative.protocol]) {
483
+ var keys = Object.keys(relative);
484
+ for (var v = 0; v < keys.length; v++) {
485
+ var k = keys[v];
486
+ result[k] = relative[k];
487
+ }
488
+ result.href = result.format();
489
+ return result;
490
+ }
491
+
492
+ result.protocol = relative.protocol;
493
+ if (!relative.host && !hostlessProtocol[relative.protocol]) {
494
+ var relPath = (relative.pathname || '').split('/');
495
+ while (relPath.length && !(relative.host = relPath.shift()));
496
+ if (!relative.host) relative.host = '';
497
+ if (!relative.hostname) relative.hostname = '';
498
+ if (relPath[0] !== '') relPath.unshift('');
499
+ if (relPath.length < 2) relPath.unshift('');
500
+ result.pathname = relPath.join('/');
501
+ } else {
502
+ result.pathname = relative.pathname;
503
+ }
504
+ result.search = relative.search;
505
+ result.query = relative.query;
506
+ result.host = relative.host || '';
507
+ result.auth = relative.auth;
508
+ result.hostname = relative.hostname || relative.host;
509
+ result.port = relative.port;
510
+ // to support http.request
511
+ if (result.pathname || result.search) {
512
+ var p = result.pathname || '';
513
+ var s = result.search || '';
514
+ result.path = p + s;
515
+ }
516
+ result.slashes = result.slashes || relative.slashes;
517
+ result.href = result.format();
518
+ return result;
519
+ }
520
+
521
+ var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',
522
+ isRelAbs = relative.host || (relative.pathname && relative.pathname.charAt(0) === '/'),
523
+ mustEndAbs = isRelAbs || isSourceAbs || (result.host && relative.pathname),
524
+ removeAllDots = mustEndAbs,
525
+ srcPath = (result.pathname && result.pathname.split('/')) || [],
526
+ relPath = (relative.pathname && relative.pathname.split('/')) || [],
527
+ psychotic = result.protocol && !slashedProtocol[result.protocol];
528
+
529
+ // if the url is a non-slashed url, then relative
530
+ // links like ../.. should be able
531
+ // to crawl up to the hostname, as well. This is strange.
532
+ // result.protocol has already been set by now.
533
+ // Later on, put the first path part into the host field.
534
+ if (psychotic) {
535
+ result.hostname = '';
536
+ result.port = null;
537
+ if (result.host) {
538
+ if (srcPath[0] === '') srcPath[0] = result.host;
539
+ else srcPath.unshift(result.host);
540
+ }
541
+ result.host = '';
542
+ if (relative.protocol) {
543
+ relative.hostname = null;
544
+ relative.port = null;
545
+ if (relative.host) {
546
+ if (relPath[0] === '') relPath[0] = relative.host;
547
+ else relPath.unshift(relative.host);
548
+ }
549
+ relative.host = null;
550
+ }
551
+ mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
552
+ }
553
+
554
+ if (isRelAbs) {
555
+ // it's absolute.
556
+ result.host = relative.host || relative.host === '' ? relative.host : result.host;
557
+ result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
558
+ result.search = relative.search;
559
+ result.query = relative.query;
560
+ srcPath = relPath;
561
+ // fall through to the dot-handling below.
562
+ } else if (relPath.length) {
563
+ // it's relative
564
+ // throw away the existing file, and take the new path instead.
565
+ if (!srcPath) srcPath = [];
566
+ srcPath.pop();
567
+ srcPath = srcPath.concat(relPath);
568
+ result.search = relative.search;
569
+ result.query = relative.query;
570
+ } else if (!util.isNullOrUndefined(relative.search)) {
571
+ // just pull out the search.
572
+ // like href='?foo'.
573
+ // Put this after the other two cases because it simplifies the booleans
574
+ if (psychotic) {
575
+ result.hostname = result.host = srcPath.shift();
576
+ //occationaly the auth can get stuck only in host
577
+ //this especially happens in cases like
578
+ //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
579
+ var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
580
+ if (authInHost) {
581
+ result.auth = authInHost.shift();
582
+ result.host = result.hostname = authInHost.shift();
583
+ }
584
+ }
585
+ result.search = relative.search;
586
+ result.query = relative.query;
587
+ //to support http.request
588
+ if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
589
+ result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
590
+ }
591
+ result.href = result.format();
592
+ return result;
593
+ }
594
+
595
+ if (!srcPath.length) {
596
+ // no path at all. easy.
597
+ // we've already handled the other stuff above.
598
+ result.pathname = null;
599
+ //to support http.request
600
+ if (result.search) {
601
+ result.path = '/' + result.search;
602
+ } else {
603
+ result.path = null;
604
+ }
605
+ result.href = result.format();
606
+ return result;
607
+ }
608
+
609
+ // if a url ENDs in . or .., then it must get a trailing slash.
610
+ // however, if it ends in anything else non-slashy,
611
+ // then it must NOT get a trailing slash.
612
+ var last = srcPath.slice(-1)[0];
613
+ var hasTrailingSlash =
614
+ ((result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..')) || last === '';
615
+
616
+ // strip single dots, resolve double dots to parent dir
617
+ // if the path tries to go above the root, `up` ends up > 0
618
+ var up = 0;
619
+ for (var i = srcPath.length; i >= 0; i--) {
620
+ last = srcPath[i];
621
+ if (last === '.') {
622
+ srcPath.splice(i, 1);
623
+ } else if (last === '..') {
624
+ srcPath.splice(i, 1);
625
+ up++;
626
+ } else if (up) {
627
+ srcPath.splice(i, 1);
628
+ up--;
629
+ }
630
+ }
631
+
632
+ // if the path is allowed to go above the root, restore leading ..s
633
+ if (!mustEndAbs && !removeAllDots) {
634
+ for (; up--; up) {
635
+ srcPath.unshift('..');
636
+ }
637
+ }
638
+
639
+ if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
640
+ srcPath.unshift('');
641
+ }
642
+
643
+ if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {
644
+ srcPath.push('');
645
+ }
646
+
647
+ var isAbsolute = srcPath[0] === '' || (srcPath[0] && srcPath[0].charAt(0) === '/');
648
+
649
+ // put the host back
650
+ if (psychotic) {
651
+ result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : '';
652
+ //occationaly the auth can get stuck only in host
653
+ //this especially happens in cases like
654
+ //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
655
+ var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
656
+ if (authInHost) {
657
+ result.auth = authInHost.shift();
658
+ result.host = result.hostname = authInHost.shift();
659
+ }
660
+ }
661
+
662
+ mustEndAbs = mustEndAbs || (result.host && srcPath.length);
663
+
664
+ if (mustEndAbs && !isAbsolute) {
665
+ srcPath.unshift('');
666
+ }
667
+
668
+ if (!srcPath.length) {
669
+ result.pathname = null;
670
+ result.path = null;
671
+ } else {
672
+ result.pathname = srcPath.join('/');
673
+ }
674
+
675
+ //to support request.http
676
+ if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
677
+ result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
678
+ }
679
+ result.auth = relative.auth || result.auth;
680
+ result.slashes = result.slashes || relative.slashes;
681
+ result.href = result.format();
682
+ return result;
683
+ };
684
+
685
+ Url.prototype.parseHost = function () {
686
+ var host = this.host;
687
+ var port = portPattern.exec(host);
688
+ if (port) {
689
+ port = port[0];
690
+ if (port !== ':') {
691
+ this.port = port.substr(1);
692
+ }
693
+ host = host.substr(0, host.length - port.length);
694
+ }
695
+ if (host) this.hostname = host;
696
+ };