@gzhangx/googleapi 0.0.76 → 0.0.78

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 (40) hide show
  1. package/lib/google/drive.d.ts +15 -15
  2. package/lib/google/drive.js +54 -45
  3. package/lib/google/drive.js.map +1 -1
  4. package/lib/google/googleApiServiceAccount.d.ts +129 -132
  5. package/lib/google/googleApiServiceAccount.js +411 -551
  6. package/lib/google/googleApiServiceAccount.js.map +1 -1
  7. package/lib/googleApi.d.ts +58 -58
  8. package/lib/googleApi.js +325 -459
  9. package/lib/googleApi.js.map +1 -1
  10. package/lib/httpRequest.d.ts +24 -25
  11. package/lib/httpRequest.js +138 -184
  12. package/lib/httpRequest.js.map +1 -1
  13. package/lib/index.d.ts +24 -24
  14. package/lib/index.js +62 -55
  15. package/lib/index.js.map +1 -1
  16. package/lib/jwt.d.ts +11 -11
  17. package/lib/jwt.js +45 -46
  18. package/lib/jwt.js.map +1 -1
  19. package/lib/msGraph/msExcell.d.ts +47 -47
  20. package/lib/msGraph/msExcell.js +69 -157
  21. package/lib/msGraph/msExcell.js.map +1 -1
  22. package/lib/msGraph/msauth.d.ts +91 -91
  23. package/lib/msGraph/msauth.js +309 -533
  24. package/lib/msGraph/msauth.js.map +1 -1
  25. package/lib/msGraph/msdir.d.ts +124 -125
  26. package/lib/msGraph/msdir.js +171 -263
  27. package/lib/msGraph/msdir.js.map +1 -1
  28. package/lib/msGraph/types.d.ts +4 -4
  29. package/lib/msGraph/types.js +2 -2
  30. package/lib/tests/gtest.d.ts +1 -1
  31. package/lib/tests/gtest.js +170 -234
  32. package/lib/tests/gtest.js.map +1 -1
  33. package/lib/tests/mstest.d.ts +1 -1
  34. package/lib/tests/mstest.js +184 -269
  35. package/lib/tests/mstest.js.map +1 -1
  36. package/lib/tsconfig.tsbuildinfo +1 -1
  37. package/lib/util.d.ts +9 -9
  38. package/lib/util.js +95 -96
  39. package/lib/util.js.map +1 -1
  40. package/package.json +3 -3
@@ -1,91 +1,91 @@
1
- import { OutgoingHttpHeaders, IHttpResponseType } from '../httpRequest';
2
- export declare type ILogger = (...args: any[]) => void;
3
- declare type GMRequestConfig = {
4
- headers: OutgoingHttpHeaders;
5
- followRedirect?: boolean;
6
- };
7
- export interface IMsGraphCreds {
8
- tenantId: string;
9
- client_id: string;
10
- scope?: string;
11
- refresh_token: string;
12
- logger: ILogger;
13
- debugLogger?: ILogger;
14
- loadTokenCache?: () => Promise<ITokenInfoCache>;
15
- saveTokenCache?: (cache: ITokenInfoCache) => Promise<void>;
16
- }
17
- export declare type IRefreshTokenPromptUser = (msg: string, info: ICodeWaitInfo) => void;
18
- export declare type IRefreshTokenSaveToken = (token: IRefreshTokenResult) => Promise<void>;
19
- export interface IAuthOpt extends IMsGraphCreds {
20
- pollTime?: number;
21
- }
22
- export interface IRefreshTokenResult {
23
- token_type: 'Bearer';
24
- scope: string;
25
- expires_in: number;
26
- ext_expires_in: string;
27
- expires_on: string;
28
- not_before: string;
29
- resource: 'https://graph.microsoft.com';
30
- access_token: string;
31
- refresh_token: string;
32
- id_token: string;
33
- error?: string;
34
- }
35
- export interface ICodeWaitInfo {
36
- user_code: string;
37
- device_code: string;
38
- verification_uri: string;
39
- expires_in: number;
40
- interval: number;
41
- message: string;
42
- }
43
- export interface ITokenInfo {
44
- access_token: string;
45
- expires_on: number;
46
- }
47
- interface ITokenInfoCache {
48
- [key: string]: ITokenInfo;
49
- }
50
- export declare function delay(ms: number): Promise<unknown>;
51
- export declare class GGraphError extends Error {
52
- requestUrl: string;
53
- constructor(requestUrl: string);
54
- }
55
- export declare function encodeSharedUrl(sharingUrl: string): string;
56
- export interface IMsDirError {
57
- code: string;
58
- message: string;
59
- }
60
- export interface IDriveItemInfo {
61
- id: string;
62
- name: string;
63
- parentReference: {
64
- driveId: string;
65
- id: string;
66
- path: string;
67
- };
68
- error?: IMsDirError;
69
- }
70
- export declare function getAuth(opt: IMsGraphCreds): {
71
- getRefreshToken: (saveToken: IRefreshTokenSaveToken, promptUser: IRefreshTokenPromptUser) => Promise<IRefreshTokenResult>;
72
- getAccessToken: () => Promise<IRefreshTokenResult>;
73
- refreshTokenSeperated: {
74
- getRefreshTokenPart1GetCodeWaitInfo: () => Promise<ICodeWaitInfo>;
75
- getRefreshTokenPartFinish: (deviceCode: string, saveToken: IRefreshTokenSaveToken, pollTime?: number, maxPollTime?: number) => Promise<IRefreshTokenResult>;
76
- };
77
- };
78
- export interface IMsGraphOps {
79
- getMsGraphBaseUrl: (urlPostFix: string) => string;
80
- getHeaders: () => Promise<GMRequestConfig>;
81
- parseResp: (opts: GMRequestConfig, r: IHttpResponseType) => Promise<any>;
82
- doGet: (urlPostFix: string, fmt?: (cfg: GMRequestConfig) => GMRequestConfig) => Promise<any>;
83
- doPost: (urlPostFix: string, data: object) => Promise<any>;
84
- doPut: (urlPostFix: string, data: object) => Promise<any>;
85
- doPatch: (urlPostFix: string, data: object) => Promise<any>;
86
- doDelete: (urlPostFix: string) => Promise<any>;
87
- getSharedItemInfo: (sharedUrl: string) => Promise<IDriveItemInfo>;
88
- }
89
- export declare function axiosErrorProcessing(err: any): string;
90
- export declare function getMsGraphConn(opt: IMsGraphCreds): Promise<IMsGraphOps>;
91
- export {};
1
+ import { OutgoingHttpHeaders, IHttpResponseType } from '../httpRequest';
2
+ export type ILogger = (...args: any[]) => void;
3
+ type GMRequestConfig = {
4
+ headers: OutgoingHttpHeaders;
5
+ followRedirect?: boolean;
6
+ };
7
+ export interface IMsGraphCreds {
8
+ tenantId: string;
9
+ client_id: string;
10
+ scope?: string;
11
+ refresh_token: string;
12
+ logger: ILogger;
13
+ debugLogger?: ILogger;
14
+ loadTokenCache?: () => Promise<ITokenInfoCache>;
15
+ saveTokenCache?: (cache: ITokenInfoCache) => Promise<void>;
16
+ }
17
+ export type IRefreshTokenPromptUser = (msg: string, info: ICodeWaitInfo) => void;
18
+ export type IRefreshTokenSaveToken = (token: IRefreshTokenResult) => Promise<void>;
19
+ export interface IAuthOpt extends IMsGraphCreds {
20
+ pollTime?: number;
21
+ }
22
+ export interface IRefreshTokenResult {
23
+ token_type: 'Bearer';
24
+ scope: string;
25
+ expires_in: number;
26
+ ext_expires_in: string;
27
+ expires_on: string;
28
+ not_before: string;
29
+ resource: 'https://graph.microsoft.com';
30
+ access_token: string;
31
+ refresh_token: string;
32
+ id_token: string;
33
+ error?: string;
34
+ }
35
+ export interface ICodeWaitInfo {
36
+ user_code: string;
37
+ device_code: string;
38
+ verification_uri: string;
39
+ expires_in: number;
40
+ interval: number;
41
+ message: string;
42
+ }
43
+ export interface ITokenInfo {
44
+ access_token: string;
45
+ expires_on: number;
46
+ }
47
+ interface ITokenInfoCache {
48
+ [key: string]: ITokenInfo;
49
+ }
50
+ export declare function delay(ms: number): Promise<unknown>;
51
+ export declare class GGraphError extends Error {
52
+ requestUrl: string;
53
+ constructor(requestUrl: string);
54
+ }
55
+ export declare function encodeSharedUrl(sharingUrl: string): string;
56
+ export interface IMsDirError {
57
+ code: string;
58
+ message: string;
59
+ }
60
+ export interface IDriveItemInfo {
61
+ id: string;
62
+ name: string;
63
+ parentReference: {
64
+ driveId: string;
65
+ id: string;
66
+ path: string;
67
+ };
68
+ error?: IMsDirError;
69
+ }
70
+ export declare function getAuth(opt: IMsGraphCreds): {
71
+ getRefreshToken: (saveToken: IRefreshTokenSaveToken, promptUser: IRefreshTokenPromptUser) => Promise<IRefreshTokenResult>;
72
+ getAccessToken: () => Promise<IRefreshTokenResult>;
73
+ refreshTokenSeperated: {
74
+ getRefreshTokenPart1GetCodeWaitInfo: () => Promise<ICodeWaitInfo>;
75
+ getRefreshTokenPartFinish: (deviceCode: string, saveToken: IRefreshTokenSaveToken, pollTime?: number, maxPollTime?: number) => Promise<IRefreshTokenResult>;
76
+ };
77
+ };
78
+ export interface IMsGraphOps {
79
+ getMsGraphBaseUrl: (urlPostFix: string) => string;
80
+ getHeaders: () => Promise<GMRequestConfig>;
81
+ parseResp: (opts: GMRequestConfig, r: IHttpResponseType) => Promise<any>;
82
+ doGet: (urlPostFix: string, fmt?: (cfg: GMRequestConfig) => GMRequestConfig) => Promise<any>;
83
+ doPost: (urlPostFix: string, data: object) => Promise<any>;
84
+ doPut: (urlPostFix: string, data: object) => Promise<any>;
85
+ doPatch: (urlPostFix: string, data: object) => Promise<any>;
86
+ doDelete: (urlPostFix: string) => Promise<any>;
87
+ getSharedItemInfo: (sharedUrl: string) => Promise<IDriveItemInfo>;
88
+ }
89
+ export declare function axiosErrorProcessing(err: any): string;
90
+ export declare function getMsGraphConn(opt: IMsGraphCreds): Promise<IMsGraphOps>;
91
+ export {};