@react-native-documents/picker 9.3.1

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 (139) hide show
  1. package/LICENSE.md +21 -0
  2. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  4. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  5. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  6. package/android/.gradle/8.9/gc.properties +0 -0
  7. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  8. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  9. package/android/.gradle/vcs-1/gc.properties +0 -0
  10. package/android/build.gradle +80 -0
  11. package/android/src/main/AndroidManifest.xml +3 -0
  12. package/android/src/main/java/com/reactnativedocumentpicker/CopyDestination.kt +12 -0
  13. package/android/src/main/java/com/reactnativedocumentpicker/DocumentMetadataBuilder.kt +79 -0
  14. package/android/src/main/java/com/reactnativedocumentpicker/FileOperations.kt +203 -0
  15. package/android/src/main/java/com/reactnativedocumentpicker/IntentFactory.kt +36 -0
  16. package/android/src/main/java/com/reactnativedocumentpicker/IsKnownTypeImpl.kt +40 -0
  17. package/android/src/main/java/com/reactnativedocumentpicker/MetadataGetter.kt +150 -0
  18. package/android/src/main/java/com/reactnativedocumentpicker/PickOptions.kt +63 -0
  19. package/android/src/main/java/com/reactnativedocumentpicker/PromiseWrapper.java +105 -0
  20. package/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt +352 -0
  21. package/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerPackage.java +49 -0
  22. package/android/src/paper/java/com/reactnativedocumentpicker/NativeDocumentPickerSpec.java +69 -0
  23. package/ios/RCTConvert+RNDocumentPicker.h +8 -0
  24. package/ios/RCTConvert+RNDocumentPicker.mm +16 -0
  25. package/ios/RNDocumentPicker.h +19 -0
  26. package/ios/RNDocumentPicker.mm +128 -0
  27. package/ios/swift/DocPicker.swift +84 -0
  28. package/ios/swift/DocSaver.swift +41 -0
  29. package/ios/swift/DocumentMetadataBuilder.swift +69 -0
  30. package/ios/swift/FileOperations.swift +68 -0
  31. package/ios/swift/IsKnownTypeImpl.swift +42 -0
  32. package/ios/swift/LocalCopyResponse.swift +27 -0
  33. package/ios/swift/PickerBase.swift +78 -0
  34. package/ios/swift/PickerOptions.swift +44 -0
  35. package/ios/swift/PromiseSupport.swift +2 -0
  36. package/ios/swift/PromiseWrapper.swift +92 -0
  37. package/ios/swift/SaverOptions.swift +30 -0
  38. package/jest/build/jest/setup.js +70 -0
  39. package/jest/build/src/errors.js +47 -0
  40. package/jest/build/src/fileTypes.js +53 -0
  41. package/jest/build/src/index.js +22 -0
  42. package/jest/build/src/isKnownType.js +16 -0
  43. package/jest/build/src/keepLocalCopy.js +17 -0
  44. package/jest/build/src/pick.js +50 -0
  45. package/jest/build/src/pickDirectory.js +31 -0
  46. package/jest/build/src/release.js +22 -0
  47. package/jest/build/src/saveDocuments.js +40 -0
  48. package/jest/build/src/spec/NativeDocumentPicker.js +5 -0
  49. package/jest/build/src/types.js +4 -0
  50. package/jest/build/src/validateTypes.js +23 -0
  51. package/jest/build/tsconfig.tsbuildinfo +1 -0
  52. package/lib/commonjs/errors.js +53 -0
  53. package/lib/commonjs/errors.js.map +1 -0
  54. package/lib/commonjs/fileTypes.js +84 -0
  55. package/lib/commonjs/fileTypes.js.map +1 -0
  56. package/lib/commonjs/index.js +74 -0
  57. package/lib/commonjs/index.js.map +1 -0
  58. package/lib/commonjs/isKnownType.js +27 -0
  59. package/lib/commonjs/isKnownType.js.map +1 -0
  60. package/lib/commonjs/keepLocalCopy.js +34 -0
  61. package/lib/commonjs/keepLocalCopy.js.map +1 -0
  62. package/lib/commonjs/package.json +1 -0
  63. package/lib/commonjs/pick.js +93 -0
  64. package/lib/commonjs/pick.js.map +1 -0
  65. package/lib/commonjs/pickDirectory.js +71 -0
  66. package/lib/commonjs/pickDirectory.js.map +1 -0
  67. package/lib/commonjs/release.js +31 -0
  68. package/lib/commonjs/release.js.map +1 -0
  69. package/lib/commonjs/saveDocuments.js +55 -0
  70. package/lib/commonjs/saveDocuments.js.map +1 -0
  71. package/lib/commonjs/spec/NativeDocumentPicker.js +16 -0
  72. package/lib/commonjs/spec/NativeDocumentPicker.js.map +1 -0
  73. package/lib/commonjs/types.js +37 -0
  74. package/lib/commonjs/types.js.map +1 -0
  75. package/lib/commonjs/validateTypes.js +29 -0
  76. package/lib/commonjs/validateTypes.js.map +1 -0
  77. package/lib/module/errors.js +48 -0
  78. package/lib/module/errors.js.map +1 -0
  79. package/lib/module/fileTypes.js +81 -0
  80. package/lib/module/fileTypes.js.map +1 -0
  81. package/lib/module/index.js +13 -0
  82. package/lib/module/index.js.map +1 -0
  83. package/lib/module/isKnownType.js +24 -0
  84. package/lib/module/isKnownType.js.map +1 -0
  85. package/lib/module/keepLocalCopy.js +31 -0
  86. package/lib/module/keepLocalCopy.js.map +1 -0
  87. package/lib/module/package.json +1 -0
  88. package/lib/module/pick.js +90 -0
  89. package/lib/module/pick.js.map +1 -0
  90. package/lib/module/pickDirectory.js +68 -0
  91. package/lib/module/pickDirectory.js.map +1 -0
  92. package/lib/module/release.js +26 -0
  93. package/lib/module/release.js.map +1 -0
  94. package/lib/module/saveDocuments.js +52 -0
  95. package/lib/module/saveDocuments.js.map +1 -0
  96. package/lib/module/spec/NativeDocumentPicker.js +13 -0
  97. package/lib/module/spec/NativeDocumentPicker.js.map +1 -0
  98. package/lib/module/types.js +33 -0
  99. package/lib/module/types.js.map +1 -0
  100. package/lib/module/validateTypes.js +24 -0
  101. package/lib/module/validateTypes.js.map +1 -0
  102. package/lib/typescript/errors.d.ts +40 -0
  103. package/lib/typescript/errors.d.ts.map +1 -0
  104. package/lib/typescript/fileTypes.d.ts +94 -0
  105. package/lib/typescript/fileTypes.d.ts.map +1 -0
  106. package/lib/typescript/index.d.ts +13 -0
  107. package/lib/typescript/index.d.ts.map +1 -0
  108. package/lib/typescript/isKnownType.d.ts +41 -0
  109. package/lib/typescript/isKnownType.d.ts.map +1 -0
  110. package/lib/typescript/keepLocalCopy.d.ts +46 -0
  111. package/lib/typescript/keepLocalCopy.d.ts.map +1 -0
  112. package/lib/typescript/pick.d.ts +84 -0
  113. package/lib/typescript/pick.d.ts.map +1 -0
  114. package/lib/typescript/pickDirectory.d.ts +62 -0
  115. package/lib/typescript/pickDirectory.d.ts.map +1 -0
  116. package/lib/typescript/release.d.ts +24 -0
  117. package/lib/typescript/release.d.ts.map +1 -0
  118. package/lib/typescript/saveDocuments.d.ts +55 -0
  119. package/lib/typescript/saveDocuments.d.ts.map +1 -0
  120. package/lib/typescript/spec/NativeDocumentPicker.d.ts +29 -0
  121. package/lib/typescript/spec/NativeDocumentPicker.d.ts.map +1 -0
  122. package/lib/typescript/types.d.ts +95 -0
  123. package/lib/typescript/types.d.ts.map +1 -0
  124. package/lib/typescript/validateTypes.d.ts +3 -0
  125. package/lib/typescript/validateTypes.d.ts.map +1 -0
  126. package/package.json +92 -0
  127. package/react-native-document-picker.podspec +30 -0
  128. package/src/errors.ts +49 -0
  129. package/src/fileTypes.ts +92 -0
  130. package/src/index.ts +47 -0
  131. package/src/isKnownType.ts +48 -0
  132. package/src/keepLocalCopy.ts +51 -0
  133. package/src/pick.ts +151 -0
  134. package/src/pickDirectory.ts +93 -0
  135. package/src/release.ts +36 -0
  136. package/src/saveDocuments.ts +99 -0
  137. package/src/spec/NativeDocumentPicker.ts +31 -0
  138. package/src/types.ts +119 -0
  139. package/src/validateTypes.ts +26 -0
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ export { isKnownType } from './isKnownType';
4
+ export { keepLocalCopy } from './keepLocalCopy';
5
+
6
+ // TODO expose from /fileTypes?
7
+ export { types } from './fileTypes';
8
+ export { errorCodes, isErrorWithCode } from './errors';
9
+ export { pickDirectory } from './pickDirectory';
10
+ export { pick } from './pick';
11
+ export { saveDocuments } from './saveDocuments';
12
+ export { releaseLongTermAccess, releaseSecureAccess } from './release';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isKnownType","keepLocalCopy","types","errorCodes","isErrorWithCode","pickDirectory","pick","saveDocuments","releaseLongTermAccess","releaseSecureAccess"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,WAAW,QAA2D,eAAe;AAC9F,SACEC,aAAa,QAIR,iBAAiB;;AAExB;AACA,SAASC,KAAK,QAAkC,aAAa;AAC7D,SAASC,UAAU,EAAEC,eAAe,QAAQ,UAAU;AACtD,SAASC,aAAa,QAAQ,iBAAiB;AAS/C,SAASC,IAAI,QAAwC,QAAQ;AAC7D,SACEC,aAAa,QAGR,iBAAiB;AAiBxB,SACEC,qBAAqB,EACrBC,mBAAmB,QAEd,WAAW","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ import { NativeDocumentPicker } from './spec/NativeDocumentPicker';
4
+
5
+ /**
6
+ * The result of calling {@link isKnownType}
7
+ * */
8
+
9
+ /**
10
+ *
11
+ * Checks if the given value (which can be a file extension, UTType identifier or mime) is known to the system.
12
+ * Also returns the mime type which you can use to filter files on Android.
13
+ *
14
+ * @group DocumentPicker
15
+ * */
16
+ export function isKnownType(options) {
17
+ const {
18
+ kind,
19
+ value
20
+ } = options;
21
+ const result = NativeDocumentPicker.isKnownType(kind, value);
22
+ return result;
23
+ }
24
+ //# sourceMappingURL=isKnownType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeDocumentPicker","isKnownType","options","kind","value","result"],"sourceRoot":"../../src","sources":["isKnownType.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,6BAA6B;;AAElE;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAACC,OAA2B,EAAuB;EAC5E,MAAM;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGF,OAAO;EAC/B,MAAMG,MAAM,GAAGL,oBAAoB,CAACC,WAAW,CAACE,IAAI,EAAEC,KAAK,CAAwB;EACnF,OAAOC,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ import { NativeDocumentPicker } from './spec/NativeDocumentPicker';
4
+
5
+ /**
6
+ * Parameter of {@link keepLocalCopy}. Object type representing the file(s) whose copy should be kept in the app's storage.
7
+ * */
8
+
9
+ /**
10
+ * options for {@link keepLocalCopy}
11
+ *
12
+ * */
13
+
14
+ /**
15
+ * Result of the call to {@link keepLocalCopy}. Please note the promise always resolves, even if there was an error processing any uri(s) (as indicated by the `status` field, and `copyError` field).
16
+ * */
17
+
18
+ /**
19
+ * Makes the file available in the app's storage. The behavior is different on iOS and Android, and for simple use cases (such as uploading file to remote server), you may not need to call this method at all.
20
+ *
21
+ * On Android, it can be used to "convert" a `content://` Uri into a local file. It also "exports" virtual files (such as Google docs or sheets) into local files.
22
+ *
23
+ * However, note that for some use cases, such as uploading the picked file to a server, you may not need to call `keepLocalCopy` at all. React Native's `fetch` can handle `content://` uris.
24
+ *
25
+ * @group DocumentPicker
26
+ * */
27
+ export function keepLocalCopy(options) {
28
+ const response = NativeDocumentPicker.keepLocalCopy(options);
29
+ return response;
30
+ }
31
+ //# sourceMappingURL=keepLocalCopy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeDocumentPicker","keepLocalCopy","options","response"],"sourceRoot":"../../src","sources":["keepLocalCopy.ts"],"mappings":";;AACA,SAAiCA,oBAAoB,QAAQ,6BAA6B;;AAE1F;AACA;AACA;;AAmBA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,OAA6B,EAAkC;EAC3F,MAAMC,QAAQ,GAAGH,oBAAoB,CAACC,aAAa,CAACC,OAAO,CAAC;EAC5D,OAAOC,QAAQ;AACjB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ import { NativeDocumentPicker } from './spec/NativeDocumentPicker';
4
+ import { types } from './fileTypes';
5
+ import { Platform } from 'react-native';
6
+ import { safeValidate } from './validateTypes';
7
+
8
+ /**
9
+ * Base options object for the document picker.
10
+ * You'd rarely use this type directly, but instead use one of
11
+ *
12
+ * {@link DocumentPickerOptionsImport}, {@link DocumentPickerOptionsOpenOnce} or {@link DocumentPickerOptionsOpenLongTerm}
13
+ *
14
+ * which extend this type
15
+ * @group pick() types
16
+ */
17
+
18
+ /**
19
+ * Present the document picker in import mode.
20
+ *
21
+ * @group pick() types
22
+ */
23
+
24
+ /**
25
+ * Present the document picker in open mode, with permissions to access the file for a limited time (until the app terminates).
26
+ *
27
+ * @group pick() types
28
+ */
29
+
30
+ /**
31
+ * Present the document picker in open mode, with long-term permissions to access the opened file.
32
+ *
33
+ * @group pick() types
34
+ */
35
+
36
+ /**
37
+ * @hidden
38
+ */
39
+
40
+ /**
41
+ * The result of calling {@link pick} with `mode: 'open'` and `requestLongTermAccess: true`
42
+ *
43
+ * @group pick() types
44
+ */
45
+
46
+ // TODO not entirely sure this is a good idea but let's try
47
+
48
+ /**
49
+ * The method for picking a file, both for `import` and `open` modes.
50
+ *
51
+ * For result types, see {@link DocumentPickerResponse} or {@link DocumentPickerResponseOpenLongTerm}.
52
+ *
53
+ * For options, see {@link DocumentPickerOptionsImport}, {@link DocumentPickerOptionsOpenOnce} or {@link DocumentPickerOptionsOpenLongTerm}.
54
+ *
55
+ * @group DocumentPicker
56
+ * */
57
+ export async function pick(options) {
58
+ const type = (() => {
59
+ if (!options?.type) {
60
+ return [types.allFiles];
61
+ }
62
+ const newType = Array.isArray(options.type) ? options.type : [options.type];
63
+ return newType.flat().map(it => it.trim());
64
+ })();
65
+ const newOpts = {
66
+ mode: 'import',
67
+ // allowMultiSelection must be false to maintain old (v5) behavior
68
+ allowMultiSelection: false,
69
+ allowVirtualFiles: false,
70
+ ...options,
71
+ type
72
+ };
73
+ if (!newOpts.type.every(it => typeof it === 'string')) {
74
+ throw new TypeError(`Unexpected type option in ${newOpts.type}, did you try using a DocumentPicker.types.* that does not exist?`);
75
+ }
76
+ if ('mode' in newOpts && !['import', 'open'].includes(newOpts.mode)) {
77
+ throw new TypeError('Invalid mode option: ' + newOpts.mode);
78
+ }
79
+ const response = NativeDocumentPicker.pick(newOpts);
80
+ const awaitedResult = await response;
81
+ for (const res of awaitedResult) {
82
+ if (Platform.OS === 'android') {
83
+ res.hasRequestedType = safeValidate(newOpts.type, res);
84
+ } else {
85
+ res.hasRequestedType = true;
86
+ }
87
+ }
88
+ return awaitedResult;
89
+ }
90
+ //# sourceMappingURL=pick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeDocumentPicker","types","Platform","safeValidate","pick","options","type","allFiles","newType","Array","isArray","flat","map","it","trim","newOpts","mode","allowMultiSelection","allowVirtualFiles","every","TypeError","includes","response","awaitedResult","res","OS","hasRequestedType"],"sourceRoot":"../../src","sources":["pick.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,6BAA6B;AAElE,SAA8BC,KAAK,QAAQ,aAAa;AAQxD,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,YAAY,QAAQ,iBAAiB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAGA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,IAAIA,CAAkCC,OAAW,EAAmB;EACxF,MAAMC,IAAc,GAAG,CAAC,MAAM;IAC5B,IAAI,CAACD,OAAO,EAAEC,IAAI,EAAE;MAClB,OAAO,CAACL,KAAK,CAACM,QAAQ,CAAC;IACzB;IACA,MAAMC,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACL,OAAO,CAACC,IAAI,CAAC,GAAGD,OAAO,CAACC,IAAI,GAAG,CAACD,OAAO,CAACC,IAAI,CAAC;IAC3E,OAAOE,OAAO,CAACG,IAAI,CAAC,CAAC,CAACC,GAAG,CAAEC,EAAE,IAAKA,EAAE,CAACC,IAAI,CAAC,CAAC,CAAC;EAC9C,CAAC,EAAE,CAAC;EACJ,MAAMC,OAAsB,GAAG;IAC7BC,IAAI,EAAE,QAAQ;IACd;IACAC,mBAAmB,EAAE,KAAK;IAC1BC,iBAAiB,EAAE,KAAK;IACxB,GAAGb,OAAO;IACVC;EACF,CAAC;EAED,IAAI,CAACS,OAAO,CAACT,IAAI,CAACa,KAAK,CAAEN,EAAW,IAAK,OAAOA,EAAE,KAAK,QAAQ,CAAC,EAAE;IAChE,MAAM,IAAIO,SAAS,CACjB,6BAA6BL,OAAO,CAACT,IAAI,mEAC3C,CAAC;EACH;EAEA,IAAI,MAAM,IAAIS,OAAO,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAACM,QAAQ,CAACN,OAAO,CAACC,IAAI,CAAC,EAAE;IACnE,MAAM,IAAII,SAAS,CAAC,uBAAuB,GAAGL,OAAO,CAACC,IAAI,CAAC;EAC7D;EAEA,MAAMM,QAA2C,GAAGtB,oBAAoB,CAACI,IAAI,CAACW,OAAO,CAAC;EACtF,MAAMQ,aAAa,GAAG,MAAMD,QAAQ;EACpC,KAAK,MAAME,GAAG,IAAID,aAAa,EAAE;IAC/B,IAAIrB,QAAQ,CAACuB,EAAE,KAAK,SAAS,EAAE;MAC7BD,GAAG,CAACE,gBAAgB,GAAGvB,YAAY,CAACY,OAAO,CAACT,IAAI,EAAEkB,GAAG,CAAC;IACxD,CAAC,MAAM;MACLA,GAAG,CAACE,gBAAgB,GAAG,IAAI;IAC7B;EACF;EAEA,OAAOH,aAAa;AACtB","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ import { Platform } from 'react-native';
4
+ import { NativeDocumentPicker } from './spec/NativeDocumentPicker';
5
+
6
+ /**
7
+ * Base options object for the directory picker. They only slightly influence the appearance of the picker modal on iOS.
8
+ * You'd rarely use this type directly, but instead use {@link DirectoryPickerOptions}
9
+ *
10
+ * which extend this type
11
+ * @group pickDirectory() types
12
+ */
13
+
14
+ /**
15
+ * @hidden
16
+ * */
17
+
18
+ /**
19
+ * Options for {@link pickDirectory}.
20
+ *
21
+ * @group pickDirectory() types
22
+ * */
23
+
24
+ /**
25
+ * This object represents the response from the directory picker, when long-term access was not requested.
26
+ *
27
+ * @group pickDirectory() types
28
+ * */
29
+
30
+ /**
31
+ * This object represents the response from the directory picker, when long-term access was requested.
32
+ *
33
+ * @group pickDirectory() types
34
+ * */
35
+
36
+ // TODO not entirely sure this is a good idea but let's try
37
+ /**
38
+ * You likely won't use this type directly, but instead use {@link DirectoryPickerResponse} or {@link DirectoryPickerResponseLongTerm}.
39
+ *
40
+ * @group pickDirectory() types
41
+ * */
42
+
43
+ /**
44
+ * Opens a directory picker.
45
+ *
46
+ * @group DocumentPicker
47
+ * */
48
+ export async function pickDirectory(options) {
49
+ const optionsOverride = (() => {
50
+ if (Platform.OS === 'ios') {
51
+ return {
52
+ ...options,
53
+ mode: 'open',
54
+ allowMultiSelection: false,
55
+ type: ['public.folder']
56
+ };
57
+ } else {
58
+ return {
59
+ // technically, "mode" is ignored here, and we shouldn't need to specify anything but the PickOptions data class
60
+ // requires mode to be set
61
+ mode: 'open',
62
+ ...options
63
+ };
64
+ }
65
+ })();
66
+ return NativeDocumentPicker.pickDirectory(optionsOverride);
67
+ }
68
+ //# sourceMappingURL=pickDirectory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","NativeDocumentPicker","pickDirectory","options","optionsOverride","OS","mode","allowMultiSelection","type"],"sourceRoot":"../../src","sources":["pickDirectory.ts"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,oBAAoB,QAAQ,6BAA6B;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,aAAaA,CACjCC,OAAW,EACe;EAC1B,MAAMC,eAAe,GAAG,CAAC,MAAM;IAC7B,IAAIJ,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE;MACzB,OAAO;QACL,GAAGF,OAAO;QACVG,IAAI,EAAE,MAAM;QACZC,mBAAmB,EAAE,KAAK;QAC1BC,IAAI,EAAE,CAAC,eAAe;MACxB,CAAC;IACH,CAAC,MAAM;MACL,OAAO;QACL;QACA;QACAF,IAAI,EAAE,MAAM;QACZ,GAAGH;MACL,CAAC;IACH;EACF,CAAC,EAAE,CAAC;EACJ,OAAOF,oBAAoB,CAACC,aAAa,CAACE,eAAe,CAAC;AAG5D","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ import { NativeDocumentPicker } from './spec/NativeDocumentPicker';
4
+
5
+ /**
6
+ * For each uri whose release was requested, the result will contain an object with the uri and a status.
7
+ * */
8
+
9
+ /**
10
+ * Android only - Releases long-term access to the given URIs. There's no need to call this method on iOS - there's no iOS equivalent.
11
+ *
12
+ * See [Android documentation](https://developer.android.com/reference/android/content/ContentResolver#releasePersistableUriPermission(android.net.Uri,%20int)) for more information.
13
+ */
14
+ export const releaseLongTermAccess = async uris => {
15
+ return NativeDocumentPicker.releaseLongTermAccess(uris);
16
+ };
17
+
18
+ /**
19
+ * iOS only - Releases (stops) secure access to the given URIs. Use with URIs obtained with Open mode or with the Directory Picker.
20
+ * See [iOS documentation](https://developer.apple.com/documentation/foundation/nsurl/1413736-stopaccessingsecurityscopedresou) for more information.
21
+ * There's no need to call this method on Android - there's no equivalent method on Android.
22
+ * */
23
+ export const releaseSecureAccess = async uris => {
24
+ return NativeDocumentPicker.releaseSecureAccess(uris);
25
+ };
26
+ //# sourceMappingURL=release.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeDocumentPicker","releaseLongTermAccess","uris","releaseSecureAccess"],"sourceRoot":"../../src","sources":["release.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,6BAA6B;;AAElE;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAG,MACnCC,IAAc,IAC2B;EACzC,OAAOF,oBAAoB,CAACC,qBAAqB,CAACC,IAAI,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,MAAOD,IAAc,IAAoB;EAC1E,OAAOF,oBAAoB,CAACG,mBAAmB,CAACD,IAAI,CAAC;AACvD,CAAC","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ import { NativeDocumentPicker } from './spec/NativeDocumentPicker';
4
+ import { Platform } from 'react-native';
5
+
6
+ /**
7
+ * Options object for the {@link saveDocuments} method. `sourceUris` is the only required field.
8
+ *
9
+ * @group saveDocuments() types
10
+ */
11
+
12
+ /**
13
+ * The result of calling {@link saveDocuments}. It is very unlikely that the metadata fields would be `null`, but in theory, it can happen.
14
+ *
15
+ * @group saveDocuments() types
16
+ */
17
+
18
+ /**
19
+ * The method for opening a "save as" dialog and saving source file(s) to a new location.
20
+ *
21
+ * On Android, only one file can be saved at a time.
22
+ *
23
+ * @group DocumentPicker
24
+ * */
25
+ export async function saveDocuments(options) {
26
+ const writeDocumentResponse = await (async () => {
27
+ if (Platform.OS === 'android') {
28
+ const length = options.sourceUris.length;
29
+ if (length > 1) {
30
+ console.warn(`DocumentPicker.saveDocuments: Android only allows to save one file at a time.\n
31
+ You provided an array with ${length} entries.`);
32
+ }
33
+ // making this division into 2 calls might be an overkill... but who knows
34
+ const objectWithSingleUri = await NativeDocumentPicker.saveDocument(options);
35
+ const response = await NativeDocumentPicker.writeDocuments(objectWithSingleUri);
36
+ return response;
37
+ } else {
38
+ return NativeDocumentPicker.writeDocuments(options);
39
+ }
40
+ })();
41
+ return writeDocumentResponse.map(keepOnlySpecifiedFields);
42
+ }
43
+ function keepOnlySpecifiedFields(source) {
44
+ return {
45
+ uri: source.uri,
46
+ name: source.name,
47
+ error: source.error
48
+ // type: source.type,
49
+ // nativeType: source.nativeType,
50
+ };
51
+ }
52
+ //# sourceMappingURL=saveDocuments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeDocumentPicker","Platform","saveDocuments","options","writeDocumentResponse","OS","length","sourceUris","console","warn","objectWithSingleUri","saveDocument","response","writeDocuments","map","keepOnlySpecifiedFields","source","uri","name","error"],"sourceRoot":"../../src","sources":["saveDocuments.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,6BAA6B;AAGlE,SAASC,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AACA;AACA;AACA;;AAwBA;AACA;AACA;AACA;AACA;;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,aAAaA,CACjCC,OAA6B,EACkB;EAC/C,MAAMC,qBAAqB,GAAG,MAAM,CAAC,YAAY;IAC/C,IAAIH,QAAQ,CAACI,EAAE,KAAK,SAAS,EAAE;MAC7B,MAAMC,MAAM,GAAGH,OAAO,CAACI,UAAU,CAACD,MAAM;MACxC,IAAIA,MAAM,GAAG,CAAC,EAAE;QACdE,OAAO,CAACC,IAAI,CAAC;AACrB,mCAAmCH,MAAM,WAAW,CAAC;MAC/C;MACA;MACA,MAAMI,mBAAmB,GAAG,MAAMV,oBAAoB,CAACW,YAAY,CAACR,OAAO,CAAC;MAC5E,MAAMS,QAAQ,GAAG,MAAMZ,oBAAoB,CAACa,cAAc,CAACH,mBAAmB,CAAC;MAC/E,OAAOE,QAAQ;IACjB,CAAC,MAAM;MACL,OAAOZ,oBAAoB,CAACa,cAAc,CAACV,OAAO,CAAC;IAGrD;EACF,CAAC,EAAE,CAAC;EACJ,OAAOC,qBAAqB,CAACU,GAAG,CAACC,uBAAuB,CAAC;AAC3D;AAEA,SAASA,uBAAuBA,CAACC,MAA8B,EAAyB;EACtF,OAAO;IACLC,GAAG,EAAED,MAAM,CAACC,GAAG;IACfC,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBC,KAAK,EAAEH,MAAM,CAACG;IACd;IACA;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+
5
+ /**
6
+ * Indicates, for each Uri that was passed to {@link keepLocalCopy}, whether the local copy was successfully created or not.
7
+ *
8
+ * If the copy was successful, the status field is `success` and `localUri` contains the local Uri.
9
+ * If the copy was not successful, the status field is `error` and `copyError` field contains the error message.
10
+ * */
11
+
12
+ export const NativeDocumentPicker = TurboModuleRegistry.getEnforcing('RNDocumentPicker');
13
+ //# sourceMappingURL=NativeDocumentPicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","NativeDocumentPicker","getEnforcing"],"sourceRoot":"../../../src","sources":["spec/NativeDocumentPicker.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;;AAGlD;AACA;AACA;AACA;AACA;AACA;;AAqBA,OAAO,MAAMC,oBAAoB,GAAGD,mBAAmB,CAACE,YAAY,CAAO,kBAAkB,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * If you've requested long-term access to a directory or file, this object will be returned in the response.
5
+ * In order to access the same directory or file in the future, you must store the `bookmark` opaque string,
6
+ * and then pass it to the document viewer if you want to preview the file.
7
+ *
8
+ * See the Document viewer source on how to retrieve the file from the bookmark, if you need to do that (advanced use case).
9
+ * */
10
+
11
+ /**
12
+ * @group pick() types
13
+ */
14
+
15
+ /**
16
+ * @group pick() types
17
+ */
18
+
19
+ /**
20
+ * iOS only. Configure the transition style of the picker.
21
+ * */
22
+
23
+ /**
24
+ * iOS only. Configure the presentation style of the picker.
25
+ * */
26
+
27
+ /*
28
+ * really, PresentationStyle shouldn't be here and we should just use ModalPropsIOS['presentationStyle']>
29
+ * but I'm not sure how to get that working with TypeDoc producing a nice output so we duplicate it here
30
+ * */
31
+
32
+ export const typesAreEqual = true;
33
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["typesAreEqual"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;;AAkBA;AACA;AACA;;AAiDA;AACA;AACA;;AAQA;AACA;AACA;;AAOA;AACA;AACA;AACA;;AAIA,OAAO,MAAMA,aAAoF,GAC/F,IAAI","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ export const safeValidate = (requestedTypes, singlePickResult) => {
4
+ const {
5
+ nativeType
6
+ } = singlePickResult;
7
+ return requestedTypes.some(it => nativeTypeMatches(it, nativeType));
8
+ };
9
+ const nativeTypeMatches = (requiredType, actualType) => {
10
+ if (requiredType === actualType || requiredType === '*/*') {
11
+ return true;
12
+ }
13
+ if (actualType === null) {
14
+ return false;
15
+ }
16
+ if (requiredType.endsWith('/*')) {
17
+ const requiredTypeWithoutStar = requiredType.slice(0, -2);
18
+ if (actualType.startsWith(requiredTypeWithoutStar)) {
19
+ return true;
20
+ }
21
+ }
22
+ return false;
23
+ };
24
+ //# sourceMappingURL=validateTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["safeValidate","requestedTypes","singlePickResult","nativeType","some","it","nativeTypeMatches","requiredType","actualType","endsWith","requiredTypeWithoutStar","slice","startsWith"],"sourceRoot":"../../src","sources":["validateTypes.ts"],"mappings":";;AAEA,OAAO,MAAMA,YAAY,GAAGA,CAC1BC,cAAwB,EACxBC,gBAA4D,KACzD;EACH,MAAM;IAAEC;EAAW,CAAC,GAAGD,gBAAgB;EACvC,OAAOD,cAAc,CAACG,IAAI,CAAEC,EAAE,IAAKC,iBAAiB,CAACD,EAAE,EAAEF,UAAU,CAAC,CAAC;AACvE,CAAC;AAED,MAAMG,iBAAiB,GAAGA,CAACC,YAAoB,EAAEC,UAAyB,KAAK;EAC7E,IAAID,YAAY,KAAKC,UAAU,IAAID,YAAY,KAAK,KAAK,EAAE;IACzD,OAAO,IAAI;EACb;EACA,IAAIC,UAAU,KAAK,IAAI,EAAE;IACvB,OAAO,KAAK;EACd;EACA,IAAID,YAAY,CAACE,QAAQ,CAAC,IAAI,CAAC,EAAE;IAC/B,MAAMC,uBAAuB,GAAGH,YAAY,CAACI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,IAAIH,UAAU,CAACI,UAAU,CAACF,uBAAuB,CAAC,EAAE;MAClD,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ export interface NativeModuleError extends Error {
2
+ code: string;
3
+ }
4
+ /**
5
+ * Error codes that can be returned by the module, and are available on the `code` property of the error.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const handleError = (err: unknown) => {
10
+ * if (isErrorWithCode(err)) {
11
+ * switch (err.code) {
12
+ * case errorCodes.IN_PROGRESS:
13
+ * ...
14
+ * break
15
+ * case errorCodes.UNABLE_TO_OPEN_FILE_TYPE:
16
+ * ...
17
+ * break
18
+ * case errorCodes.OPERATION_CANCELED:
19
+ * // ignore
20
+ * break
21
+ * default:
22
+ * console.error(err)
23
+ * }
24
+ * } else {
25
+ * console.error(err)
26
+ * }
27
+ * }
28
+ * ```
29
+ * */
30
+ export declare const errorCodes: Readonly<{
31
+ OPERATION_CANCELED: "OPERATION_CANCELED";
32
+ IN_PROGRESS: "ASYNC_OP_IN_PROGRESS";
33
+ UNABLE_TO_OPEN_FILE_TYPE: "UNABLE_TO_OPEN_FILE_TYPE";
34
+ }>;
35
+ /**
36
+ * TypeScript helper to check if an object has the `code` property.
37
+ * This is used to avoid `as` casting when you access the `code` property on errors returned by the module.
38
+ */
39
+ export declare const isErrorWithCode: (error: any) => error is NativeModuleError;
40
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAkB,SAAQ,KAAK;IAC9C,IAAI,EAAE,MAAM,CAAA;CACb;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;KAyBK;AACL,eAAO,MAAM,UAAU;;;;EAIrB,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,UAAW,GAAG,KAAG,KAAK,IAAI,iBAIrD,CAAA"}
@@ -0,0 +1,94 @@
1
+ declare const mimeTypes: Readonly<{
2
+ readonly allFiles: "*/*";
3
+ readonly audio: "audio/*";
4
+ readonly csv: readonly ["text/csv", "text/comma-separated-values"];
5
+ readonly doc: "application/msword";
6
+ readonly docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
7
+ readonly images: "image/*";
8
+ readonly pdf: "application/pdf";
9
+ readonly plainText: "text/plain";
10
+ readonly json: "application/json";
11
+ readonly ppt: "application/vnd.ms-powerpoint";
12
+ readonly pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
13
+ readonly video: "video/*";
14
+ readonly xls: "application/vnd.ms-excel";
15
+ readonly xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
16
+ readonly zip: "application/zip";
17
+ }>;
18
+ declare const utis: Readonly<{
19
+ readonly allFiles: "public.item";
20
+ readonly audio: "public.audio";
21
+ readonly csv: "public.comma-separated-values-text";
22
+ readonly doc: "com.microsoft.word.doc";
23
+ readonly docx: "org.openxmlformats.wordprocessingml.document";
24
+ readonly images: "public.image";
25
+ readonly pdf: "com.adobe.pdf";
26
+ readonly plainText: "public.plain-text";
27
+ readonly json: "public.json";
28
+ readonly ppt: "com.microsoft.powerpoint.ppt";
29
+ readonly pptx: "org.openxmlformats.presentationml.presentation";
30
+ readonly video: "public.movie";
31
+ readonly xls: "com.microsoft.excel.xls";
32
+ readonly xlsx: "org.openxmlformats.spreadsheetml.sheet";
33
+ readonly zip: "public.zip-archive";
34
+ }>;
35
+ /**
36
+ * @hidden
37
+ * */
38
+ export declare const types: Readonly<{
39
+ readonly allFiles: "*/*";
40
+ readonly audio: "audio/*";
41
+ readonly csv: readonly ["text/csv", "text/comma-separated-values"];
42
+ readonly doc: "application/msword";
43
+ readonly docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
44
+ readonly images: "image/*";
45
+ readonly pdf: "application/pdf";
46
+ readonly plainText: "text/plain";
47
+ readonly json: "application/json";
48
+ readonly ppt: "application/vnd.ms-powerpoint";
49
+ readonly pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
50
+ readonly video: "video/*";
51
+ readonly xls: "application/vnd.ms-excel";
52
+ readonly xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
53
+ readonly zip: "application/zip";
54
+ }> | Readonly<{
55
+ readonly allFiles: "public.item";
56
+ readonly audio: "public.audio";
57
+ readonly csv: "public.comma-separated-values-text";
58
+ readonly doc: "com.microsoft.word.doc";
59
+ readonly docx: "org.openxmlformats.wordprocessingml.document";
60
+ readonly images: "public.image";
61
+ readonly pdf: "com.adobe.pdf";
62
+ readonly plainText: "public.plain-text";
63
+ readonly json: "public.json";
64
+ readonly ppt: "com.microsoft.powerpoint.ppt";
65
+ readonly pptx: "org.openxmlformats.presentationml.presentation";
66
+ readonly video: "public.movie";
67
+ readonly xls: "com.microsoft.excel.xls";
68
+ readonly xlsx: "org.openxmlformats.spreadsheetml.sheet";
69
+ readonly zip: "public.zip-archive";
70
+ }>;
71
+ type ValuesOf<T> = T[keyof T];
72
+ type Flatten<T> = T extends Array<infer U> ? U : T;
73
+ type AllMimeTypes = Flatten<ValuesOf<typeof mimeTypes>>;
74
+ type AllAppleUTIs = ValuesOf<typeof utis>;
75
+ /**
76
+ * You'd rarely use this type directly.
77
+ * It represents the predefined file types which are exported as `types` and can be used to limit the kinds of files that can be picked.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * import {
82
+ * pick,
83
+ * types,
84
+ * } from '@react-native-documents/picker'
85
+ * // ...
86
+ * const result = await pick({
87
+ * type: [types.pdf, types.docx],
88
+ * })
89
+ * ```
90
+ * */
91
+ export type PredefinedFileTypes = Flatten<AllMimeTypes> | AllAppleUTIs;
92
+ export declare const typesAreEqual: true;
93
+ export {};
94
+ //# sourceMappingURL=fileTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileTypes.d.ts","sourceRoot":"","sources":["../../src/fileTypes.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;EAgBJ,CAAA;AAEX,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;EAgBC,CAAA;AAWX;;KAEK;AACL,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgC,CAAA;AAElD,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAC7B,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAElD,KAAK,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC,CAAA;AACvD,KAAK,YAAY,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAEzC;;;;;;;;;;;;;;;KAeK;AACL,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAA;AAetE,eAAO,MAAM,aAAa,MAAuB,CAAA"}
@@ -0,0 +1,13 @@
1
+ export { isKnownType, type IsKnownTypeResponse, type IsKnownTypeOptions } from './isKnownType';
2
+ export { keepLocalCopy, type KeepLocalCopyOptions, type KeepLocalCopyResponse, type FileToCopy, } from './keepLocalCopy';
3
+ export { types, type PredefinedFileTypes } from './fileTypes';
4
+ export { errorCodes, isErrorWithCode } from './errors';
5
+ export { pickDirectory } from './pickDirectory';
6
+ export type { PickDirectoryResponse, DirectoryPickerOptions, DirectoryPickerOptionsLongTerm, DirectoryPickerResponse, DirectoryPickerResponseLongTerm, DirectoryPickerOptionsBase, } from './pickDirectory';
7
+ export { pick, type DocumentPickerOptionsBase } from './pick';
8
+ export { saveDocuments, type SaveDocumentsResponse, type SaveDocumentsOptions, } from './saveDocuments';
9
+ export type { NonEmptyArray, TransitionStyle, BookmarkingResponse, DocumentPickerResponse, PresentationStyle, VirtualFileMeta, } from './types';
10
+ export type { DocumentPickerOptions, DocumentPickerOptionsImport, DocumentPickerOptionsOpenOnce, DocumentPickerOptionsOpenLongTerm, DocumentPickerResponseOpenLongTerm, } from './pick';
11
+ export type { LocalCopyResponse } from './spec/NativeDocumentPicker';
12
+ export { releaseLongTermAccess, releaseSecureAccess, type ReleaseLongTermAccessResult, } from './release';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAC9F,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EAAE,KAAK,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,EAC9B,uBAAuB,EACvB,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,IAAI,EAAE,KAAK,yBAAyB,EAAE,MAAM,QAAQ,CAAA;AAC7D,OAAO,EACL,aAAa,EACb,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAA;AAChB,YAAY,EACV,qBAAqB,EACrB,2BAA2B,EAC3B,6BAA6B,EAC7B,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,QAAQ,CAAA;AACf,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,2BAA2B,GACjC,MAAM,WAAW,CAAA"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The result of calling {@link isKnownType}
3
+ * */
4
+ export type IsKnownTypeResponse = {
5
+ /**
6
+ * On iOS, this is true if the type is known to the device. That means it can be used with the document picker to filter what files can be picked.
7
+ * On Android, this is true if the internal mime type database contains the given value.
8
+ * */
9
+ isKnown: boolean;
10
+ /**
11
+ * the preferred filename extension for the given value, if any
12
+ * */
13
+ preferredFilenameExtension: string | null;
14
+ /**
15
+ * the mime type for the given value, if any
16
+ * */
17
+ mimeType: string | null;
18
+ /**
19
+ * the UTType identifier for the given value, if any
20
+ * */
21
+ UTType: string | null;
22
+ };
23
+ export type IsKnownTypeOptions = {
24
+ /**
25
+ * the kind of value you're passing
26
+ * */
27
+ kind: 'UTType' | 'mimeType' | 'extension';
28
+ /**
29
+ * the value you're checking, for example: application/pdf, com.adobe.pdf, pdf
30
+ * */
31
+ value: string;
32
+ };
33
+ /**
34
+ *
35
+ * Checks if the given value (which can be a file extension, UTType identifier or mime) is known to the system.
36
+ * Also returns the mime type which you can use to filter files on Android.
37
+ *
38
+ * @group DocumentPicker
39
+ * */
40
+ export declare function isKnownType(options: IsKnownTypeOptions): IsKnownTypeResponse;
41
+ //# sourceMappingURL=isKnownType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isKnownType.d.ts","sourceRoot":"","sources":["../../src/isKnownType.ts"],"names":[],"mappings":"AAEA;;KAEK;AACL,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;SAGK;IACL,OAAO,EAAE,OAAO,CAAA;IAChB;;SAEK;IACL,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC;;SAEK;IACL,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB;;SAEK;IACL,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;SAEK;IACL,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA;IACzC;;SAEK;IACL,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;KAMK;AACL,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,mBAAmB,CAI5E"}