@futura-dev/microsoft-sdk 1.2.2 → 2.0.0-alpha.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.
- package/dist/graph-api/dto/response/user.response.dto.d.ts +26 -0
- package/dist/graph-api/dto/response/user.response.dto.d.ts.map +1 -0
- package/dist/graph-api/dto/response/user.response.dto.js +3 -0
- package/dist/graph-api/dto/response/user.response.dto.js.map +1 -0
- package/dist/graph-api/graph-api.module.js +2 -2
- package/dist/graph-api/graph-api.module.js.map +1 -1
- package/dist/graph-api/graph-api.service.d.ts +10 -3
- package/dist/graph-api/graph-api.service.d.ts.map +1 -1
- package/dist/graph-api/graph-api.service.js +24 -15
- package/dist/graph-api/graph-api.service.js.map +1 -1
- package/dist/package.json +14 -13
- package/dist/sharepoint-api/sharepoint-api.module.js +2 -2
- package/dist/sharepoint-api/sharepoint-api.module.js.map +1 -1
- package/dist/sharepoint-api/sharepoint-api.service.d.ts.map +1 -1
- package/dist/sharepoint-api/sharepoint-api.service.js +17 -18
- package/dist/sharepoint-api/sharepoint-api.service.js.map +1 -1
- package/package.json +14 -13
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface BaseUserResponseDTO {
|
|
2
|
+
"id": string;
|
|
3
|
+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity";
|
|
4
|
+
"businessPhones": Array<string>;
|
|
5
|
+
"displayName": string;
|
|
6
|
+
"givenName": string;
|
|
7
|
+
"jobTitle": string;
|
|
8
|
+
"mail": string;
|
|
9
|
+
"mobilePhone": string;
|
|
10
|
+
"officeLocation": string | null;
|
|
11
|
+
"preferredLanguage": string;
|
|
12
|
+
"surname": string;
|
|
13
|
+
"userPrincipalName": string;
|
|
14
|
+
}
|
|
15
|
+
export type UserExpandKeys = keyof UserResponseExpands;
|
|
16
|
+
export type UserResponseExpands = {
|
|
17
|
+
manager?: {
|
|
18
|
+
id: string;
|
|
19
|
+
displayName: string;
|
|
20
|
+
givenName: string;
|
|
21
|
+
jobTitle: string;
|
|
22
|
+
mail: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type UserResponseDTO<ExpandKeys extends UserExpandKeys = never> = ExpandKeys extends UserExpandKeys ? BaseUserResponseDTO & Pick<UserResponseExpands, ExpandKeys> : BaseUserResponseDTO;
|
|
26
|
+
//# sourceMappingURL=user.response.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.response.dto.d.ts","sourceRoot":"","sources":["../../../../src/graph-api/dto/response/user.response.dto.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,0DAA0D,CAAC;IAC7E,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,mBAAmB,CAAC;AACvD,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,CAAC,EAAE;QACN,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KAChB,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,UAAU,SAAS,cAAc,GAAG,KAAK,IACzD,UAAU,SAAS,cAAc,GAC3B,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAC3D,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.response.dto.js","sourceRoot":"","sources":["../../../../src/graph-api/dto/response/user.response.dto.ts"],"names":[],"mappings":""}
|
|
@@ -26,8 +26,8 @@ let GraphApiModule = GraphApiModule_1 = class GraphApiModule {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
GraphApiModule =
|
|
29
|
+
exports.GraphApiModule = GraphApiModule;
|
|
30
|
+
exports.GraphApiModule = GraphApiModule = GraphApiModule_1 = __decorate([
|
|
30
31
|
(0, common_1.Module)({})
|
|
31
32
|
], GraphApiModule);
|
|
32
|
-
exports.GraphApiModule = GraphApiModule;
|
|
33
33
|
//# sourceMappingURL=graph-api.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-api.module.js","sourceRoot":"","sources":["../../src/graph-api/graph-api.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAiE;AACjE,2DAAsD;
|
|
1
|
+
{"version":3,"file":"graph-api.module.js","sourceRoot":"","sources":["../../src/graph-api/graph-api.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAiE;AACjE,2DAAsD;AAU/C,IAAM,cAAc,sBAApB,MAAM,cAAc;IACzB,MAAM,CAAC,UAAU,CAAC,KAAa,EAAE,OAA2B;QAC1D,MAAM,QAAQ,GAAa;YACzB,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,KAAK,IAAI,EAAE;gBACrB,OAAO,IAAI,mCAAe,mBAAM,OAAO,EAAG,CAAC;YAC7C,CAAC;SACF,CAAC;QACF,OAAO;YACL,MAAM,EAAE,gBAAc;YACtB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,CAAC,QAAQ,CAAC;YACrB,OAAO,EAAE,CAAC,QAAQ,CAAC;SACpB,CAAC;IACJ,CAAC;CACF,CAAA;AAfY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAe1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { GraphModuleOptions } from "./graph-api.module";
|
|
2
|
+
import { UserExpandKeys, UserResponseDTO } from "./dto/response/user.response.dto";
|
|
3
3
|
export declare class GraphApiService {
|
|
4
4
|
readonly options: GraphModuleOptions;
|
|
5
5
|
private readonly tenant_id;
|
|
@@ -9,6 +9,13 @@ export declare class GraphApiService {
|
|
|
9
9
|
private readonly msal_client;
|
|
10
10
|
private readonly graph_client;
|
|
11
11
|
constructor(options: GraphModuleOptions);
|
|
12
|
+
/**
|
|
13
|
+
* @param identifier - user email or id
|
|
14
|
+
*/
|
|
15
|
+
getUser: <Expand extends UserExpandKeys = never>(options: {
|
|
16
|
+
identifier: string;
|
|
17
|
+
expand?: Expand;
|
|
18
|
+
}) => Promise<UserResponseDTO<Expand>>;
|
|
12
19
|
/**
|
|
13
20
|
*
|
|
14
21
|
* @param options
|
|
@@ -25,7 +32,7 @@ export declare class GraphApiService {
|
|
|
25
32
|
getListColumns: <T>(options: {
|
|
26
33
|
siteId: string;
|
|
27
34
|
listId: string;
|
|
28
|
-
}) => Promise<
|
|
35
|
+
}) => Promise<any>;
|
|
29
36
|
/**
|
|
30
37
|
*
|
|
31
38
|
* @param options
|
|
@@ -45,7 +52,7 @@ export declare class GraphApiService {
|
|
|
45
52
|
siteId: string;
|
|
46
53
|
listId: string;
|
|
47
54
|
body: {
|
|
48
|
-
fields: Record<string,
|
|
55
|
+
fields: Record<string, any>;
|
|
49
56
|
};
|
|
50
57
|
}) => Promise<any>;
|
|
51
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-api.service.d.ts","sourceRoot":"","sources":["../../src/graph-api/graph-api.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph-api.service.d.ts","sourceRoot":"","sources":["../../src/graph-api/graph-api.service.ts"],"names":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MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;SAAE,CAAA;KACxC,kBAIA;CAGJ"}
|
|
@@ -40,13 +40,21 @@ let GraphApiService = class GraphApiService {
|
|
|
40
40
|
constructor(options) {
|
|
41
41
|
var _a;
|
|
42
42
|
this.options = options;
|
|
43
|
+
/**
|
|
44
|
+
* @param identifier - user email or id
|
|
45
|
+
*/
|
|
46
|
+
this.getUser = async (options) => {
|
|
47
|
+
return this.graph_client
|
|
48
|
+
.api(`https://graph.microsoft.com/v1.0/users('${options.identifier}')?$expand=${options.expand}`)
|
|
49
|
+
.get();
|
|
50
|
+
};
|
|
43
51
|
/**
|
|
44
52
|
*
|
|
45
53
|
* @param options
|
|
46
54
|
*/
|
|
47
55
|
this.getListItem = async (options) => {
|
|
48
56
|
return this.graph_client
|
|
49
|
-
.api(`https://graph.microsoft.com/
|
|
57
|
+
.api(`https://graph.microsoft.com/v1.0/sites/${options.siteId}/lists/${options.listId}/items/${options.itemId}?expand=fields`)
|
|
50
58
|
.get();
|
|
51
59
|
};
|
|
52
60
|
/**
|
|
@@ -55,7 +63,7 @@ let GraphApiService = class GraphApiService {
|
|
|
55
63
|
*/
|
|
56
64
|
this.getListColumns = async (options) => {
|
|
57
65
|
return this.graph_client
|
|
58
|
-
.api(`https://graph.microsoft.com/
|
|
66
|
+
.api(`https://graph.microsoft.com/v1.0/sites/${options.siteId}/lists/${options.listId}/columns`)
|
|
59
67
|
.get();
|
|
60
68
|
};
|
|
61
69
|
/**
|
|
@@ -64,7 +72,7 @@ let GraphApiService = class GraphApiService {
|
|
|
64
72
|
*/
|
|
65
73
|
this.createListItemFile = async (options) => {
|
|
66
74
|
return this.graph_client
|
|
67
|
-
.api(`https://graph.microsoft.com/
|
|
75
|
+
.api(`https://graph.microsoft.com/v1.0/sites/${options.siteId}/drives/${options.driveId}/items/${options.itemId}:/${options.fileName}:/content`)
|
|
68
76
|
.put(options.file);
|
|
69
77
|
};
|
|
70
78
|
/**
|
|
@@ -73,39 +81,40 @@ let GraphApiService = class GraphApiService {
|
|
|
73
81
|
*/
|
|
74
82
|
this.createListItem = async (options) => {
|
|
75
83
|
return this.graph_client
|
|
76
|
-
.api(`https://graph.microsoft.com/
|
|
84
|
+
.api(`https://graph.microsoft.com/v1.0/sites/${options.siteId}/lists/${options.listId}/items`)
|
|
77
85
|
.post(options.body);
|
|
78
86
|
};
|
|
79
87
|
this.tenant_id = options.tenantId;
|
|
80
88
|
this.client_id = options.clientId;
|
|
81
89
|
this.client_secret = options.clientSecret;
|
|
82
|
-
this.scopes = ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.split(" ")) || [
|
|
83
|
-
"https://graph.microsoft.com/.default"
|
|
84
|
-
];
|
|
90
|
+
this.scopes = ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.split(" ")) || ["https://graph.microsoft.com/.default"];
|
|
85
91
|
// init msal client
|
|
86
92
|
this.msal_client = new msal.ConfidentialClientApplication({
|
|
87
93
|
auth: {
|
|
88
94
|
authority: `https://login.microsoftonline.com/${this.tenant_id}`,
|
|
89
95
|
clientId: `${this.client_id}`,
|
|
90
|
-
clientSecret: `${this.client_secret}
|
|
91
|
-
}
|
|
96
|
+
clientSecret: `${this.client_secret}`,
|
|
97
|
+
},
|
|
92
98
|
});
|
|
93
99
|
// init graph client
|
|
94
100
|
this.graph_client = microsoft_graph_client_1.Client.init({
|
|
95
101
|
authProvider: async (resolve) => {
|
|
96
|
-
this.msal_client
|
|
97
|
-
.
|
|
98
|
-
|
|
102
|
+
this.msal_client.acquireTokenByClientCredential({
|
|
103
|
+
scopes: this.scopes,
|
|
104
|
+
})
|
|
105
|
+
.then((token) => {
|
|
106
|
+
if (!token)
|
|
107
|
+
throw new Error();
|
|
108
|
+
resolve(null, token.accessToken);
|
|
99
109
|
})
|
|
100
|
-
.then(token => resolve(null, token.accessToken))
|
|
101
110
|
.catch(error => resolve(error, null));
|
|
102
111
|
}
|
|
103
112
|
});
|
|
104
113
|
}
|
|
105
114
|
};
|
|
106
|
-
GraphApiService =
|
|
115
|
+
exports.GraphApiService = GraphApiService;
|
|
116
|
+
exports.GraphApiService = GraphApiService = __decorate([
|
|
107
117
|
(0, common_1.Injectable)(),
|
|
108
118
|
__metadata("design:paramtypes", [Object])
|
|
109
119
|
], GraphApiService);
|
|
110
|
-
exports.GraphApiService = GraphApiService;
|
|
111
120
|
//# sourceMappingURL=graph-api.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-api.service.js","sourceRoot":"","sources":["../../src/graph-api/graph-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,
|
|
1
|
+
{"version":3,"file":"graph-api.service.js","sourceRoot":"","sources":["../../src/graph-api/graph-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,8EAA0D;AAC1D,uDAAyC;AAIlC,IAAM,eAAe,GAArB,MAAM,eAAe;IASxB,YAAqB,OAA2B;;QAA3B,YAAO,GAAP,OAAO,CAAoB;QA6BhD;;WAEG;QACH,YAAO,GAAG,KAAK,EAAyC,OAAgD,EAAoC,EAAE;YAC1I,OAAO,IAAI,CAAC,YAAY;iBACnB,GAAG,CAAC,2CAA2C,OAAO,CAAC,UAAU,cAAc,OAAO,CAAC,MAAM,EAAE,CAAC;iBAChG,GAAG,EAAE,CAAA;QACd,CAAC,CAAA;QAED;;;WAGG;QACH,gBAAW,GAAG,KAAK,EAAE,OAIpB,EAAE,EAAE;YACD,OAAO,IAAI,CAAC,YAAY;iBACnB,GAAG,CAAC,0CAA0C,OAAO,CAAC,MAAM,UAAU,OAAO,CAAC,MAAM,UAAU,OAAO,CAAC,MAAM,gBAAgB,CAAC;iBAC7H,GAAG,EAAE,CAAA;QACd,CAAC,CAAC;QAEF;;;WAGG;QACH,mBAAc,GAAG,KAAK,EAAK,OAG1B,EAAE,EAAE;YACD,OA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,CAAC,CAAC;QACH,oBAAoB;QACpB,IAAI,CAAC,YAAY,GAAG,+BAAM,CAAC,IAAI,CAAC;YAC5B,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC5B,IAAI,CAAC,WAAW,CAAC,8BAA8B,CAAC;oBAC5C,MAAM,EAAE,IAAI,CAAC,MAAM;iBACtB,CAAC;qBACG,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;oBACZ,IAAI,CAAC,KAAK;wBAAE,MAAM,IAAI,KAAK,EAAE,CAAA;oBAC7B,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;gBACpC,CAAC,CAAC;qBACD,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;YAC7C,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;CAqEJ,CAAA;AAzGY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;;GACA,eAAe,CAyG3B"}
|
package/dist/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@futura-dev/microsoft-sdk",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "A NodeJS implementation of Microsoft SDK to interact with Microsoft APIs",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "2.0.0-alpha.1",
|
|
6
6
|
"main": "dist/index",
|
|
7
7
|
"types": "dist/index",
|
|
8
8
|
"scripts": {
|
|
@@ -24,21 +24,22 @@
|
|
|
24
24
|
"url": "https://github.com/futura-dev/microsoft-sdk"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@azure/identity": "^
|
|
28
|
-
"@azure/msal-node": "^
|
|
29
|
-
"@microsoft/microsoft-graph-client": "^3.0.
|
|
30
|
-
"@nestjs/common": "^
|
|
31
|
-
"@nestjs/core": "^
|
|
27
|
+
"@azure/identity": "^4.5.0",
|
|
28
|
+
"@azure/msal-node": "^2.16.1",
|
|
29
|
+
"@microsoft/microsoft-graph-client": "^3.0.7",
|
|
30
|
+
"@nestjs/common": "^10.4.7",
|
|
31
|
+
"@nestjs/core": "^10.4.7",
|
|
32
32
|
"rxjs": "^7.8.1",
|
|
33
|
-
"typescript": "^5.
|
|
33
|
+
"typescript": "^5.6.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@futura-dev/cosmodrome": "^1.
|
|
37
|
-
"@futura-dev/cosmofactory": "^0.
|
|
38
|
-
"@futura-dev/cosmokeeper": "^0.
|
|
39
|
-
"@futura-dev/eslint-config-typescript": "^0.
|
|
40
|
-
"@types/node": "^
|
|
41
|
-
"
|
|
36
|
+
"@futura-dev/cosmodrome": "^1.5.0-alpha.4",
|
|
37
|
+
"@futura-dev/cosmofactory": "^0.4.0",
|
|
38
|
+
"@futura-dev/cosmokeeper": "^0.3.3",
|
|
39
|
+
"@futura-dev/eslint-config-typescript": "^1.0.3",
|
|
40
|
+
"@types/node": "^22.9.0",
|
|
41
|
+
"npm-check-updates": "^17.1.11",
|
|
42
|
+
"rimraf": "^6.0.1"
|
|
42
43
|
},
|
|
43
44
|
"engines": {
|
|
44
45
|
"node": ">=18"
|
|
@@ -26,8 +26,8 @@ let SharepointApiModule = SharepointApiModule_1 = class SharepointApiModule {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
SharepointApiModule =
|
|
29
|
+
exports.SharepointApiModule = SharepointApiModule;
|
|
30
|
+
exports.SharepointApiModule = SharepointApiModule = SharepointApiModule_1 = __decorate([
|
|
30
31
|
(0, common_1.Module)({})
|
|
31
32
|
], SharepointApiModule);
|
|
32
|
-
exports.SharepointApiModule = SharepointApiModule;
|
|
33
33
|
//# sourceMappingURL=sharepoint-api.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharepoint-api.module.js","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAiE;AACjE,qEAAgE;
|
|
1
|
+
{"version":3,"file":"sharepoint-api.module.js","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAiE;AACjE,qEAAgE;AAWzD,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAC9B,MAAM,CAAC,UAAU,CACf,KAAa,EACb,OAAgC;QAEhC,MAAM,QAAQ,GAAa;YACzB,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,KAAK,IAAI,EAAE;gBACrB,OAAO,IAAI,6CAAoB,mBAAM,OAAO,EAAG,CAAC;YAClD,CAAC;SACF,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,qBAAmB;YAC3B,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,CAAC,QAAQ,CAAC;YACrB,OAAO,EAAE,CAAC,QAAQ,CAAC;SACpB,CAAC;IACJ,CAAC;CACF,CAAA;AAnBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,mBAAmB,CAmB/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharepoint-api.service.d.ts","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"sharepoint-api.service.d.ts","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAIlE,qBACa,oBAAoB;IAUjB,QAAQ,CAAC,OAAO,EAAE,uBAAuB;IARrD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqC;IACjE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;gBAEtB,OAAO,EAAE,uBAAuB;IAkCrD;;;OAGG;IACH,oBAAoB,WAAkB,MAAM,kBAI1C;IAEF;;;;;OAKG;IACH,sBAAsB,WACV,MAAM,mBACG,MAAM,uBACF,MAAM,kBAS9B;IAED;;;;OAIG;IACH,sBAAsB,WAAkB,MAAM,kBAAkB,MAAM,kBAIpE;IAEF;;;OAGG;IACH,WAAW,YAAmB;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,kBAe3D;CACJ"}
|
|
@@ -56,12 +56,10 @@ let SharepointApiService = class SharepointApiService {
|
|
|
56
56
|
*/
|
|
57
57
|
this.createListSubscription = async (listId, notificationUrl, expirationTimestamp) => {
|
|
58
58
|
// read key from files
|
|
59
|
-
return this.sharepoint_client
|
|
60
|
-
|
|
61
|
-
.post({
|
|
62
|
-
resource: "https://futuraitsrl.sharepoint.com/sites/hr/Lists/Recruiting%20Board/AllItems.aspx",
|
|
59
|
+
return this.sharepoint_client.api(`https://futuraitsrl.sharepoint.com/sites/hr/_api/web/lists('${listId}')/subscriptions`).post({
|
|
60
|
+
resource: 'https://futuraitsrl.sharepoint.com/sites/hr/Lists/Recruiting%20Board/AllItems.aspx',
|
|
63
61
|
notificationUrl: `${notificationUrl}`,
|
|
64
|
-
expirationDateTime: new Date(expirationTimestamp).toISOString()
|
|
62
|
+
expirationDateTime: new Date(expirationTimestamp).toISOString(),
|
|
65
63
|
});
|
|
66
64
|
};
|
|
67
65
|
/**
|
|
@@ -81,9 +79,7 @@ let SharepointApiService = class SharepointApiService {
|
|
|
81
79
|
this.getListLogs = async (options) => {
|
|
82
80
|
const startTick = options.from.getTime() * 10000 + 621355968000000000;
|
|
83
81
|
const start = `1;3;${options.listId};${startTick};-1`;
|
|
84
|
-
return this.sharepoint_client
|
|
85
|
-
.api(`https://futuraitsrl.sharepoint.com/sites/hr/_api/web/Lists(guid'${options.listId}')/getChanges`)
|
|
86
|
-
.post({
|
|
82
|
+
return this.sharepoint_client.api(`https://futuraitsrl.sharepoint.com/sites/hr/_api/web/Lists(guid'${options.listId}')/getChanges`).post({
|
|
87
83
|
query: {
|
|
88
84
|
Add: true,
|
|
89
85
|
Alert: true,
|
|
@@ -91,9 +87,9 @@ let SharepointApiService = class SharepointApiService {
|
|
|
91
87
|
Update: true,
|
|
92
88
|
Item: true,
|
|
93
89
|
ChangeTokenStart: {
|
|
94
|
-
StringValue: start
|
|
95
|
-
}
|
|
96
|
-
}
|
|
90
|
+
StringValue: start,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
97
93
|
});
|
|
98
94
|
};
|
|
99
95
|
this.tenant_id = options.tenantId;
|
|
@@ -110,25 +106,28 @@ let SharepointApiService = class SharepointApiService {
|
|
|
110
106
|
thumbprint: this.thumbprint,
|
|
111
107
|
privateKey: this.private_key
|
|
112
108
|
}
|
|
113
|
-
}
|
|
109
|
+
},
|
|
114
110
|
});
|
|
115
111
|
// init graph client
|
|
116
112
|
this.sharepoint_client = microsoft_graph_client_1.Client.init({
|
|
117
113
|
authProvider: async (resolve) => {
|
|
118
|
-
this.msal_client
|
|
119
|
-
.
|
|
120
|
-
|
|
114
|
+
this.msal_client.acquireTokenByClientCredential({
|
|
115
|
+
scopes: this.scopes,
|
|
116
|
+
})
|
|
117
|
+
.then((token) => {
|
|
118
|
+
if (!token)
|
|
119
|
+
throw new Error();
|
|
120
|
+
resolve(null, token.accessToken);
|
|
121
121
|
})
|
|
122
|
-
.then(token => resolve(null, token.accessToken))
|
|
123
122
|
.catch(error => resolve(error, null));
|
|
124
123
|
},
|
|
125
124
|
customHosts: new Set(["futuraitsrl.sharepoint.com"])
|
|
126
125
|
});
|
|
127
126
|
}
|
|
128
127
|
};
|
|
129
|
-
SharepointApiService =
|
|
128
|
+
exports.SharepointApiService = SharepointApiService;
|
|
129
|
+
exports.SharepointApiService = SharepointApiService = __decorate([
|
|
130
130
|
(0, common_1.Injectable)(),
|
|
131
131
|
__metadata("design:paramtypes", [Object])
|
|
132
132
|
], SharepointApiService);
|
|
133
|
-
exports.SharepointApiService = SharepointApiService;
|
|
134
133
|
//# sourceMappingURL=sharepoint-api.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharepoint-api.service.js","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uDAAyC;AAEzC,8EAA2D;
|
|
1
|
+
{"version":3,"file":"sharepoint-api.service.js","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uDAAyC;AAEzC,8EAA2D;AAIpD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAU7B,YAAqB,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;QAkCrD;;;WAGG;QACH,yBAAoB,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE;YAC5C,OAAO,IAAI,CAAC,iBAAiB;iBACxB,GAAG,CAAC,+DAA+D,MAAM,kBAAkB,CAAC;iBAC5F,GAAG,EAAE,CAAA;QACd,CAAC,CAAC;QAEF;;;;;WAKG;QACH,2BAAsB,GAAG,KAAK,EAC1B,MAAc,EACd,eAAuB,EACvB,mBAA2B,EAC7B,EAAE;YACA,sBAAsB;YACtB,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,+DAA+D,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC;gBAC5H,QAAQ,EACJ,oFAAoF;gBACxF,eAAe,EAAE,GAAG,eAAe,EAAE;gBACrC,kBA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IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,6BAA6B,CAAC;YACtD,IAAI,EAAE;gBACF,SAAS,EAAE,qCAAqC,IAAI,CAAC,SAAS,EAAE;gBAChE,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE;gBAC7B,iBAAiB,EAAE;oBACf,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,UAAU,EAAE,IAAI,CAAC,WAAW;iBAC/B;aACJ;SACJ,CAAC,CAAC;QACH,oBAAoB;QACpB,IAAI,CAAC,iBAAiB,GAAG,+BAAM,CAAC,IAAI,CAAC;YACjC,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC5B,IAAI,CAAC,WAAW,CAAC,8BAA8B,CAAC;oBAC5C,MAAM,EAAE,IAAI,CAAC,MAAM;iBACtB,CAAC;qBACG,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;oBACZ,IAAI,CAAC,KAAK;wBAAE,MAAM,IAAI,KAAK,EAAE,CAAA;oBAC7B,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;gBACpC,CAAC,CAAC;qBACD,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;YAC7C,CAAC;YACD,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,4BAA4B,CAAC,CAAC;SACvD,CAAC,CAAA;IACN,CAAC;CA+DJ,CAAA;AAzGY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;;GACA,oBAAoB,CAyGhC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@futura-dev/microsoft-sdk",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "A NodeJS implementation of Microsoft SDK to interact with Microsoft APIs",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "2.0.0-alpha.1",
|
|
6
6
|
"main": "dist/index",
|
|
7
7
|
"types": "dist/index",
|
|
8
8
|
"scripts": {
|
|
@@ -24,21 +24,22 @@
|
|
|
24
24
|
"url": "https://github.com/futura-dev/microsoft-sdk"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@azure/identity": "^
|
|
28
|
-
"@azure/msal-node": "^
|
|
29
|
-
"@microsoft/microsoft-graph-client": "^3.0.
|
|
30
|
-
"@nestjs/common": "^
|
|
31
|
-
"@nestjs/core": "^
|
|
27
|
+
"@azure/identity": "^4.5.0",
|
|
28
|
+
"@azure/msal-node": "^2.16.1",
|
|
29
|
+
"@microsoft/microsoft-graph-client": "^3.0.7",
|
|
30
|
+
"@nestjs/common": "^10.4.7",
|
|
31
|
+
"@nestjs/core": "^10.4.7",
|
|
32
32
|
"rxjs": "^7.8.1",
|
|
33
|
-
"typescript": "^5.
|
|
33
|
+
"typescript": "^5.6.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@futura-dev/cosmodrome": "^1.
|
|
37
|
-
"@futura-dev/cosmofactory": "^0.
|
|
38
|
-
"@futura-dev/cosmokeeper": "^0.
|
|
39
|
-
"@futura-dev/eslint-config-typescript": "^0.
|
|
40
|
-
"@types/node": "^
|
|
41
|
-
"
|
|
36
|
+
"@futura-dev/cosmodrome": "^1.5.0-alpha.4",
|
|
37
|
+
"@futura-dev/cosmofactory": "^0.4.0",
|
|
38
|
+
"@futura-dev/cosmokeeper": "^0.3.3",
|
|
39
|
+
"@futura-dev/eslint-config-typescript": "^1.0.3",
|
|
40
|
+
"@types/node": "^22.9.0",
|
|
41
|
+
"npm-check-updates": "^17.1.11",
|
|
42
|
+
"rimraf": "^6.0.1"
|
|
42
43
|
},
|
|
43
44
|
"engines": {
|
|
44
45
|
"node": ">=18"
|