You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
##### This design document focuses on the following -
1
+
##### This design document focuses on the following -
2
+
2
3
1. Separate entry points for node and browser.
3
4
2. Specifying the browser field in package.json.
4
5
3. Changes in the bundling process.
5
6
6
7
##### Terms -
7
8
8
-
* bundler - Module bundlers are tools frontend developers used to bundle JavaScript modules into a single JavaScript files that can be executed in the browser.
9
+
- bundler - Module bundlers are tools frontend developers used to bundle JavaScript modules into a single JavaScript files that can be executed in the browser.
10
+
11
+
- rollup - rollup.js is the module bundler that the JS SDK uses.
9
12
10
-
* rollup - rollup.js is the module bundler that the JS SDK uses.
13
+
- package.json fields -
11
14
12
-
* package.json fields -
13
-
* main - The main field is a module ID that is the primary entry point to your program. Points to the CJS modules.
15
+
- main - The main field is a module ID that is the primary entry point to your program. Points to the CJS modules.
14
16
15
-
* module - The module field is not an official npm feature but a common convention among bundlers to designate how to import an ESM version of a library. Points to the ES modules.
17
+
- module - The module field is not an official npm feature but a common convention among bundlers to designate how to import an ESM version of a library. Points to the ES modules.
16
18
17
-
* browser - If the module is meant to be used client-side, the browser field should be used instead of the main field.
19
+
- browser - If the module is meant to be used client-side, the browser field should be used instead of the main field.
18
20
19
21
##### Current set up -
20
22
21
-
1.
22
-
TypeScript Source Code
23
+
1. TypeScript Source Code
23
24
/ \
24
-
Transpiles into JavaScript
25
+
Transpiles into JavaScript
25
26
'lib' folder
26
27
/ \
27
28
CJS module ES modules
28
-
2. main - `lib/src/index.js`
29
-
module - `lib/es/src/index.js`
29
+
2. main - `lib/src/index.js` module - `lib/es/src/index.js`
30
+
31
+
3. Rollup bundling output
32
+
33
+
-`graph-js-sdk.js` - Bundled and minified file in IIFE format. This file can be directly used in the browser with a `<script>` tag.
34
+
-`graph-es-sdk.js` - Bundled file in ES format.
30
35
31
-
3. Rollup bundling output
32
-
*`graph-js-sdk.js` - Bundled and minified file in IIFE format. This file can be directly used in the browser with a `<script>` tag.
33
-
*`graph-es-sdk.js` - Bundled file in ES format.
34
36
4. Entry point for rollup - `lib/es/src/browser/index.js`.
35
37
36
38
##### Difference between src/index.js and src/browser/index.js
37
-
1.`src/browser/index.js` does not export `RedirectHandler` and `RedirectHandlerOptions`. Redirection is handled by the browser.
39
+
40
+
1.`src/browser/index.js` does not export `RedirectHandler` and `RedirectHandlerOptions`. Redirection is handled by the browser.
3.`src/browser/ImplicitMsalProvider` does not import or require 'msal' dependency. While,
40
-
`src/ImplicitMsalProvider` imports or requires 'msal' in the implementation.
42
+
3.`src/browser/ImplicitMsalProvider` does not import or require 'msal' dependency. While, `src/ImplicitMsalProvider` imports or requires 'msal' in the implementation.
41
43
4. My assumtion is that `src/browser/ImplicitMsalProvider` is implemented specifically for the rollup process and to skip the rollup external dependency while using `graph-js-sdk.js` in the browser.
42
44
43
45
Note - Browser applications using the ES modules from the npm package of the JS SDK refer to the `module` entry point - `lib/es/src/index.js`(not the browser entry point). Example - Graph Explorer.
44
46
45
-
##### Upcoming changes -
47
+
##### Upcoming changes -
46
48
47
49
1. Use the browser field for the following -
48
50
49
-
* The Graph JS SDK currently has two entry files, `src/index` and `src/browser/index`.
50
-
Use the browser field to indicate the browser entry point.
51
-
Example -
51
+
- The Graph JS SDK currently has two entry files, `src/index` and `src/browser/index`. Use the browser field to indicate the browser entry point. Example -
Currently, the main and "module field in the package.json. This will remain the same.
57
-
* Better way to handle environment specific implementation. For example, using the `browser` field as follows -
58
-
"browser":
59
+
60
+
- Better way to handle environment specific implementation. For example, using the `browser` field as follows - "browser":
61
+
59
62
```json
60
-
{
61
-
"stream": "stream-browserify",
62
-
"Feature-Node.js": "Feature-Browser.js"
63
-
}
63
+
{
64
+
"stream": "stream-browserify",
65
+
"Feature-Node.js": "Feature-Browser.js"
66
+
}
64
67
```
65
68
66
-
2. Remove export of `src/browser/ImplicitMsalProvider` from `src/browser/index`.
67
-
* Till `ImplicitMsalProvider` is maintained in the repo, maintain a separate entry point say `rollup-index` for the rollup process which exports `src/browser/index` and `src/browser/ImplicitMsalProvider`.
68
-
* Continue rolling up the `src/browser/ImplicitMsalProvider` as it is currently done and not introduce breaking changes here as it is going to be deprecated.
69
-
* Remove the separate entry point once `ImplicitMsalProvider` is removed and use the browser entry point for roll up thereafter. The goal is to maintain a consistent entry point or usage for browser applications using the JS SDK and the rollup/bundling process.
69
+
2. Remove export of `src/browser/ImplicitMsalProvider` from `src/browser/index`.
70
+
71
+
- Till `ImplicitMsalProvider` is maintained in the repo, maintain a separate entry point say `rollup-index` for the rollup process which exports `src/browser/index` and `src/browser/ImplicitMsalProvider`.
72
+
- Continue rolling up the `src/browser/ImplicitMsalProvider` as it is currently done and not introduce breaking changes here as it is going to be deprecated.
73
+
- Remove the separate entry point once `ImplicitMsalProvider` is removed and use the browser entry point for roll up thereafter. The goal is to maintain a consistent entry point or usage for browser applications using the JS SDK and the rollup/bundling process.
70
74
71
75
3. Bundle the authproviders separately as they are optional.
72
76
73
-
4. Stop bundling in ES format, that is remove `graph-es-sdk.js` as the ES modules are being shipped.
77
+
4. Stop bundling in ES format, that is remove `graph-es-sdk.js` as the ES modules are being shipped.
# Large File Upload Task - Uploading large files to OneDrive
1
+
# Large File Upload Task - Uploading large files to OneDrive, Outlook, Print API.
2
2
3
-
This task simplifies the implementation of OneDrive's [resumable upload](https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession).
3
+
References -
4
+
5
+
-[Outlook's large file attachment](https://docs.microsoft.com/en-us/graph/outlook-large-attachments)
Note - In case of a browser application, you can use [stream-browserify](https://www.npmjs.com/package/stream-browserify) and [buffer](https://www.npmjs.com/package/buffer).
**_Note_** - You can also have a customized `FileObject` implementation which contains the `sliceFile(range: Range)` function which implements the logic to split the file into ranges.
96
+
97
+
**Initiate the LargefileUploadTask options with Progress Handler and Range Size**
`UploadResult` contains the `location`(received in the Outlook API response headers) and the `responseBody` (responseBody received after successful upload.) properties.
123
+
124
+
## OneDriveLargeFileUploadTask.
125
+
126
+
_You can also use `OneDriveLargeFileUploadTask` which provides easier access to upload to OneDrive API_
0 commit comments