@futura-dev/microsoft-sdk 0.0.3 → 1.1.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 (48) hide show
  1. package/.github/workflows/deploy-npm-package.yml +19 -0
  2. package/dist/graph-api/graph-api.module.d.ts +12 -0
  3. package/dist/graph-api/graph-api.module.d.ts.map +1 -0
  4. package/dist/graph-api/graph-api.module.js +33 -0
  5. package/dist/graph-api/graph-api.module.js.map +1 -0
  6. package/dist/graph-api/graph-api.service.d.ts +53 -0
  7. package/dist/graph-api/graph-api.service.d.ts.map +1 -0
  8. package/dist/graph-api/graph-api.service.js +112 -0
  9. package/dist/graph-api/graph-api.service.js.map +1 -0
  10. package/dist/{microsoft-api → graph-api}/types.d.ts +60 -0
  11. package/dist/graph-api/types.d.ts.map +1 -0
  12. package/dist/{microsoft-api → graph-api}/types.js.map +1 -1
  13. package/dist/index.d.ts +5 -5
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +10 -5
  16. package/dist/index.js.map +1 -1
  17. package/dist/sharepoint-api/sharepoint-api.module.d.ts +12 -0
  18. package/dist/sharepoint-api/sharepoint-api.module.d.ts.map +1 -0
  19. package/dist/sharepoint-api/sharepoint-api.module.js +33 -0
  20. package/dist/sharepoint-api/sharepoint-api.module.js.map +1 -0
  21. package/dist/sharepoint-api/sharepoint-api.service.d.ts +39 -0
  22. package/dist/sharepoint-api/sharepoint-api.service.d.ts.map +1 -0
  23. package/dist/sharepoint-api/sharepoint-api.service.js +132 -0
  24. package/dist/sharepoint-api/sharepoint-api.service.js.map +1 -0
  25. package/dist/sharepoint-api/types.d.ts +163 -0
  26. package/dist/sharepoint-api/types.d.ts.map +1 -0
  27. package/dist/sharepoint-api/types.js +3 -0
  28. package/dist/sharepoint-api/types.js.map +1 -0
  29. package/package.json +10 -6
  30. package/src/graph-api/graph-api.module.ts +29 -0
  31. package/src/graph-api/graph-api.service.ts +104 -0
  32. package/src/{microsoft-api → graph-api}/types.ts +4 -0
  33. package/src/index.ts +6 -5
  34. package/src/sharepoint-api/sharepoint-api.module.ts +30 -0
  35. package/src/sharepoint-api/sharepoint-api.service.ts +113 -0
  36. package/src/sharepoint-api/types.ts +108 -0
  37. package/dist/microsoft-api/microsoft-api.module.d.ts +0 -3
  38. package/dist/microsoft-api/microsoft-api.module.d.ts.map +0 -1
  39. package/dist/microsoft-api/microsoft-api.module.js +0 -27
  40. package/dist/microsoft-api/microsoft-api.module.js.map +0 -1
  41. package/dist/microsoft-api/microsoft-api.service.d.ts +0 -36
  42. package/dist/microsoft-api/microsoft-api.service.d.ts.map +0 -1
  43. package/dist/microsoft-api/microsoft-api.service.js +0 -273
  44. package/dist/microsoft-api/microsoft-api.service.js.map +0 -1
  45. package/dist/microsoft-api/types.d.ts.map +0 -1
  46. package/src/microsoft-api/microsoft-api.module.ts +0 -14
  47. package/src/microsoft-api/microsoft-api.service.ts +0 -299
  48. /package/dist/{microsoft-api → graph-api}/types.js +0 -0
@@ -0,0 +1,19 @@
1
+ name: Publish Package to npmjs
2
+ on:
3
+ release:
4
+ types: [published]
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v3
10
+ # Setup .npmrc file to publish to npm
11
+ - uses: actions/setup-node@v3
12
+ with:
13
+ node-version: '18.16.0'
14
+ registry-url: 'https://registry.npmjs.org'
15
+ - run: npm ci
16
+ - run: npm run build
17
+ - run: npm publish
18
+ env:
19
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,12 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ export type GraphModuleOptions = {
3
+ tenantId: string;
4
+ clientId: string;
5
+ clientSecret: string;
6
+ grantType: 'authorization_code' | 'client_credentials';
7
+ scopes: string;
8
+ };
9
+ export declare class GraphApiModule {
10
+ static forFeature(token: string, options: GraphModuleOptions): DynamicModule;
11
+ }
12
+ //# sourceMappingURL=graph-api.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-api.module.d.ts","sourceRoot":"","sources":["../../src/graph-api/graph-api.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAS,MAAM,gBAAgB,CAAC;AAGrD,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,oBAAoB,GAAG,oBAAoB,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC;CAClB,CAAA;AAED,qBACa,cAAc;IACvB,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,aAAa;CAe/E"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var GraphApiModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.GraphApiModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const graph_api_service_1 = require("./graph-api.service");
13
+ let GraphApiModule = GraphApiModule_1 = class GraphApiModule {
14
+ static forFeature(token, options) {
15
+ const provider = {
16
+ provide: token,
17
+ useFactory: async () => {
18
+ return new graph_api_service_1.GraphApiService(Object.assign({}, options));
19
+ }
20
+ };
21
+ return {
22
+ module: GraphApiModule_1,
23
+ imports: [],
24
+ providers: [provider],
25
+ exports: [provider]
26
+ };
27
+ }
28
+ };
29
+ GraphApiModule = GraphApiModule_1 = __decorate([
30
+ (0, common_1.Module)({})
31
+ ], GraphApiModule);
32
+ exports.GraphApiModule = GraphApiModule;
33
+ //# sourceMappingURL=graph-api.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-api.module.js","sourceRoot":"","sources":["../../src/graph-api/graph-api.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAqD;AACrD,2DAAoD;AAWpD,IAAa,cAAc,sBAA3B,MAAa,cAAc;IACvB,MAAM,CAAC,UAAU,CAAC,KAAa,EAAE,OAA2B;QAExD,MAAM,QAAQ,GAAG;YACb,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,KAAK,IAAI,EAAE;gBACnB,OAAO,IAAI,mCAAe,mBAAK,OAAO,EAAE,CAAC;YAC7C,CAAC;SACJ,CAAA;QACD,OAAO;YACH,MAAM,EAAE,gBAAc;YACtB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,CAAC,QAAQ,CAAC;YACrB,OAAO,EAAE,CAAC,QAAQ,CAAC;SACtB,CAAA;IACL,CAAC;CACJ,CAAA;AAhBY,cAAc;IAD1B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAgB1B;AAhBY,wCAAc"}
@@ -0,0 +1,53 @@
1
+ /// <reference types="node" />
2
+ import { GraphModuleOptions } from "./graph-api.module";
3
+ export declare class GraphApiService {
4
+ readonly options: GraphModuleOptions;
5
+ private readonly tenant_id;
6
+ private readonly client_id;
7
+ private readonly client_secret;
8
+ private readonly scopes;
9
+ private readonly grant_type;
10
+ private readonly msal_client;
11
+ private readonly graph_client;
12
+ constructor(options: GraphModuleOptions);
13
+ /**
14
+ *
15
+ * @param options
16
+ */
17
+ getListItem: (options: {
18
+ siteId: string;
19
+ listId: string;
20
+ itemId: string;
21
+ }) => Promise<any>;
22
+ /**
23
+ *
24
+ * @param options
25
+ */
26
+ getListColumns: <T>(options: {
27
+ siteId: string;
28
+ listId: string;
29
+ }) => Promise<any>;
30
+ /**
31
+ *
32
+ * @param options
33
+ */
34
+ createListItemFile: (options: {
35
+ siteId: string;
36
+ driveId: string;
37
+ itemId: string;
38
+ fileName: string;
39
+ file: Buffer;
40
+ }) => Promise<any>;
41
+ /**
42
+ *
43
+ * @param options
44
+ */
45
+ createListItem: (options: {
46
+ siteId: string;
47
+ listId: string;
48
+ body: {
49
+ fields: Record<string, any>;
50
+ };
51
+ }) => Promise<any>;
52
+ }
53
+ //# sourceMappingURL=graph-api.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-api.service.d.ts","sourceRoot":"","sources":["../../src/graph-api/graph-api.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAItD,qBACa,eAAe;IAUZ,QAAQ,CAAC,OAAO,EAAE,kBAAkB;IARhD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqC;IACjE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAEjB,OAAO,EAAE,kBAAkB;IA6BhD;;;OAGG;IACH,WAAW,YAAmB;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAClB,kBAIC;IAEF;;;OAGG;IACH,cAAc,eAAsB;QAChC,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,CAAA;KACjB,kBAIA;IAED;;;OAGG;IACH,kBAAkB,YAAmB;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,MAAM,CAAA;KACf,kBAIA;IAED;;;OAGG;IACH,cAAc,YAAmB;QAC7B,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE;YAAE,MAAM,EAAE,OAAO,MAAM,EAAE,GAAG,CAAC,CAAA;SAAE,CAAA;KACxC,kBAIA;CAGJ"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.GraphApiService = void 0;
36
+ const common_1 = require("@nestjs/common");
37
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
38
+ const msal = __importStar(require("@azure/msal-node"));
39
+ let GraphApiService = class GraphApiService {
40
+ constructor(options) {
41
+ this.options = options;
42
+ /**
43
+ *
44
+ * @param options
45
+ */
46
+ this.getListItem = async (options) => {
47
+ return this.graph_client
48
+ .api(`https://graph.microsoft.com/beta/sites/${options.siteId}/lists/${options.listId}/items/${options.itemId}?expand=fields`)
49
+ .get();
50
+ };
51
+ /**
52
+ *
53
+ * @param options
54
+ */
55
+ this.getListColumns = async (options) => {
56
+ return this.graph_client
57
+ .api(`https://graph.microsoft.com/beta/sites/${options.siteId}/lists/${options.listId}/columns`)
58
+ .get();
59
+ };
60
+ /**
61
+ *
62
+ * @param options
63
+ */
64
+ this.createListItemFile = async (options) => {
65
+ return this.graph_client
66
+ .api(`https://graph.microsoft.com/beta/sites/${options.siteId}/drives/${options.driveId}/items/${options.itemId}:/${options.fileName}:/content`)
67
+ .put(options.file);
68
+ };
69
+ /**
70
+ *
71
+ * @param options
72
+ */
73
+ this.createListItem = async (options) => {
74
+ return this.graph_client
75
+ .api(`https://graph.microsoft.com/beta/sites/${options.siteId}/lists/${options.listId}/items`)
76
+ .post(options.body);
77
+ };
78
+ this.tenant_id = options.tenantId;
79
+ this.client_id = options.clientId;
80
+ this.client_secret = options.clientSecret;
81
+ this.scopes = options.scopes;
82
+ this.grant_type = options.grantType;
83
+ // init msal client
84
+ this.msal_client = new msal.ConfidentialClientApplication({
85
+ auth: {
86
+ knownAuthorities: [
87
+ `https://login.microsoftonline.com/${this.tenant_id}`,
88
+ ],
89
+ clientId: `${this.client_id}`,
90
+ clientSecret: `${this.client_secret}`
91
+ },
92
+ });
93
+ // init graph client
94
+ this.graph_client = microsoft_graph_client_1.Client.init({
95
+ authProvider: async (resolve) => {
96
+ var _a;
97
+ this.msal_client.acquireTokenByClientCredential({
98
+ authority: `https://login.microsoftonline.com/${this.tenant_id}`,
99
+ scopes: ((_a = this.scopes) === null || _a === void 0 ? void 0 : _a.split(" ")) || ["https://graph.microsoft.com/.default"],
100
+ })
101
+ .then((token) => resolve(null, token.accessToken))
102
+ .catch(error => resolve(error, null));
103
+ }
104
+ });
105
+ }
106
+ };
107
+ GraphApiService = __decorate([
108
+ (0, common_1.Injectable)(),
109
+ __metadata("design:paramtypes", [Object])
110
+ ], GraphApiService);
111
+ exports.GraphApiService = GraphApiService;
112
+ //# sourceMappingURL=graph-api.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-api.service.js","sourceRoot":"","sources":["../../src/graph-api/graph-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA0C;AAE1C,8EAAwD;AACxD,uDAAyC;AAEzC,IACa,eAAe,GAD5B,MACa,eAAe;IAUxB,YAAqB,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;QA6BhD;;;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,OAAO,IAAI,CAAC,YAAY;iBACnB,GAAG,CAAC,0CAA0C,OAAO,CAAC,MAAM,UAAU,OAAO,CAAC,MAAM,UAAU,CAAC;iBAC/F,GAAG,EAAE,CAAC;QACf,CAAC,CAAA;QAED;;;WAGG;QACH,uBAAk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8B,CAAC;oBAC5C,SAAS,EAAE,qCAAqC,IAAI,CAAC,SAAS,EAAE;oBAChE,MAAM,EAAE,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,CAAC,GAAG,CAAC,KAAI,CAAC,sCAAsC,CAAC;iBAC9E,CAAC;qBACG,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;qBACjD,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;YAC7C,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;CA4DJ,CAAA;AAjGY,eAAe;IAD3B,IAAA,mBAAU,GAAE;;GACA,eAAe,CAiG3B;AAjGY,0CAAe"}
@@ -99,5 +99,65 @@ export type HRListItem = ListItem<{
99
99
  _ComplianceTagWrittenTime: string;
100
100
  _ComplianceTagUserId: string;
101
101
  }>;
102
+ export type ColumnValue = {
103
+ columnGroup: string;
104
+ description: string;
105
+ displayName: string;
106
+ enforceUniqueValues: boolean;
107
+ hidden: boolean;
108
+ id: string;
109
+ indexed: boolean;
110
+ name: string;
111
+ readOnly: boolean;
112
+ required: boolean;
113
+ geolocation?: Record<string, never>;
114
+ boolean?: Record<string, never>;
115
+ calculated?: {
116
+ format: string;
117
+ formula: string;
118
+ outputType: 'boolean' | 'currency' | 'dateTime' | 'number' | 'text';
119
+ };
120
+ choice?: {
121
+ allowTextEntry: boolean;
122
+ choices: string[];
123
+ displayAs: 'checkBoxes' | 'dropDownMenu' | 'radioButtons';
124
+ };
125
+ currency?: {
126
+ locale: string;
127
+ };
128
+ dateTime?: {
129
+ displayAs: 'default' | 'friendly' | 'standard';
130
+ format: string;
131
+ };
132
+ lookup?: {
133
+ allowMultipleValues: boolean;
134
+ allowUnlimitedLength: boolean;
135
+ columnName: string;
136
+ listId: string;
137
+ primaryLookupColumnId: string;
138
+ };
139
+ number?: {
140
+ decimalPlaces: string;
141
+ displayAs: 'number' | 'percentage';
142
+ maximum: number;
143
+ minimum: number;
144
+ };
145
+ personOrGroup?: {
146
+ allowMultipleSelection: boolean;
147
+ displayAs: string;
148
+ chooseFromType: 'peopleAndGroups' | 'peopleOnly';
149
+ };
150
+ text?: {
151
+ allowMultipleLines: boolean;
152
+ appendChangesToExistingText: boolean;
153
+ linesForEditing: number;
154
+ maxLength: number;
155
+ textType: 'plain' | 'richText';
156
+ };
157
+ };
158
+ export type GetColumnsResponse = {
159
+ '@odata.context': string;
160
+ value: ColumnValue[];
161
+ };
102
162
  export {};
103
163
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graph-api/types.ts"],"names":[],"mappings":"AAAA,KAAK,yBAAyB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE;QACL,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,IAAI,CAAC;QAClB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE;QACX,WAAW,EAAE,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;KAClE,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,M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,CAAC;QAAC,2BAA2B,EAAE,OAAO,CAAC;QAAC,eAAe,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC;KAAE,CAAC;CAAE,CAAC;AAAC,MAAM,MAAM,kBAAkB,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,EAAE,CAAC;CAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/microsoft-api/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/graph-api/types.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { MicrosoftApiModule } from "./microsoft-api/microsoft-api.module";
2
- import { MicrosoftApiService } from "./microsoft-api/microsoft-api.service";
3
- import { ListLog, ListWebhook, ListItem, HRListItem } from './microsoft-api/types';
4
- export { MicrosoftApiModule, MicrosoftApiService };
5
- export type { ListWebhook, ListLog, ListItem, HRListItem };
1
+ import { GraphApiService } from "./graph-api/graph-api.service";
2
+ import { GraphApiModule } from "./graph-api/graph-api.module";
3
+ import { SharepointApiService } from "./sharepoint-api/sharepoint-api.service";
4
+ import { SharepointApiModule } from "./sharepoint-api/sharepoint-api.module";
5
+ export { GraphApiService, GraphApiModule, SharepointApiService, SharepointApiModule };
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,CAAA;AAClD,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAA"}
package/dist/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MicrosoftApiService = exports.MicrosoftApiModule = void 0;
4
- const microsoft_api_module_1 = require("./microsoft-api/microsoft-api.module");
5
- Object.defineProperty(exports, "MicrosoftApiModule", { enumerable: true, get: function () { return microsoft_api_module_1.MicrosoftApiModule; } });
6
- const microsoft_api_service_1 = require("./microsoft-api/microsoft-api.service");
7
- Object.defineProperty(exports, "MicrosoftApiService", { enumerable: true, get: function () { return microsoft_api_service_1.MicrosoftApiService; } });
3
+ exports.SharepointApiModule = exports.SharepointApiService = exports.GraphApiModule = exports.GraphApiService = void 0;
4
+ const graph_api_service_1 = require("./graph-api/graph-api.service");
5
+ Object.defineProperty(exports, "GraphApiService", { enumerable: true, get: function () { return graph_api_service_1.GraphApiService; } });
6
+ const graph_api_module_1 = require("./graph-api/graph-api.module");
7
+ Object.defineProperty(exports, "GraphApiModule", { enumerable: true, get: function () { return graph_api_module_1.GraphApiModule; } });
8
+ const sharepoint_api_service_1 = require("./sharepoint-api/sharepoint-api.service");
9
+ Object.defineProperty(exports, "SharepointApiService", { enumerable: true, get: function () { return sharepoint_api_service_1.SharepointApiService; } });
10
+ const sharepoint_api_module_1 = require("./sharepoint-api/sharepoint-api.module");
11
+ Object.defineProperty(exports, "SharepointApiModule", { enumerable: true, get: function () { return sharepoint_api_module_1.SharepointApiModule; } });
12
+ // export type { ListWebhook, ListLog, ListItem, HRListItem }
8
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+EAA0E;AAIjE,mGAJA,yCAAkB,OAIA;AAH3B,iFAA4E;AAG/C,oGAHpB,2CAAmB,OAGoB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAgE;AAKvD,gGALA,mCAAe,OAKA;AAJxB,mEAA8D;AAIpC,+FAJjB,iCAAc,OAIiB;AAHxC,oFAA+E;AAGrC,qGAHjC,6CAAoB,OAGiC;AAF9D,kFAA6E;AAEb,oGAFvD,2CAAmB,OAEuD;AACnF,6DAA6D"}
@@ -0,0 +1,12 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ export type SharepointModuleOptions = {
3
+ tenantId: string;
4
+ clientId: string;
5
+ thumbprint: string;
6
+ privateKey: string;
7
+ scopes: string[];
8
+ };
9
+ export declare class SharepointApiModule {
10
+ static forFeature(token: string, options: SharepointModuleOptions): DynamicModule;
11
+ }
12
+ //# sourceMappingURL=sharepoint-api.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharepoint-api.module.d.ts","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAG/D,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AAED,qBACa,mBAAmB;IAC9B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,aAAa;CAgBlF"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var SharepointApiModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.SharepointApiModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const sharepoint_api_service_1 = require("./sharepoint-api.service");
13
+ let SharepointApiModule = SharepointApiModule_1 = class SharepointApiModule {
14
+ static forFeature(token, options) {
15
+ const provider = {
16
+ provide: token,
17
+ useFactory: async () => {
18
+ return new sharepoint_api_service_1.SharepointApiService(Object.assign({}, options));
19
+ }
20
+ };
21
+ return {
22
+ module: SharepointApiModule_1,
23
+ imports: [],
24
+ providers: [provider],
25
+ exports: [provider]
26
+ };
27
+ }
28
+ };
29
+ SharepointApiModule = SharepointApiModule_1 = __decorate([
30
+ (0, common_1.Module)({})
31
+ ], SharepointApiModule);
32
+ exports.SharepointApiModule = SharepointApiModule;
33
+ //# sourceMappingURL=sharepoint-api.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharepoint-api.module.js","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+D;AAC/D,qEAAgE;AAWhE,IAAa,mBAAmB,2BAAhC,MAAa,mBAAmB;IAC9B,MAAM,CAAC,UAAU,CAAC,KAAa,EAAE,OAAgC;QAE/D,MAAM,QAAQ,GAAa;YACzB,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,KAAK,IAAI,EAAE;gBACrB,OAAO,IAAI,6CAAoB,mBAAM,OAAO,EAAG,CAAC;YAClD,CAAC;SACF,CAAA;QAED,OAAO;YACL,MAAM,EAAE,qBAAmB;YAC3B,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,CAAC,QAAQ,CAAC;YACrB,OAAO,EAAE,CAAC,QAAQ,CAAC;SACpB,CAAA;IACH,CAAC;CACF,CAAA;AAjBY,mBAAmB;IAD/B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,mBAAmB,CAiB/B;AAjBY,kDAAmB"}
@@ -0,0 +1,39 @@
1
+ import { SharepointModuleOptions } from "./sharepoint-api.module";
2
+ export declare class SharepointApiService {
3
+ readonly options: SharepointModuleOptions;
4
+ private readonly tenant_id;
5
+ private readonly client_id;
6
+ private readonly thumbprint;
7
+ private readonly private_key;
8
+ private readonly scopes;
9
+ private readonly msal_client;
10
+ private readonly sharepoint_client;
11
+ constructor(options: SharepointModuleOptions);
12
+ /**
13
+ *
14
+ * @param listId
15
+ */
16
+ getListSubscriptions: (listId: string) => Promise<any>;
17
+ /**
18
+ *
19
+ * @param listId
20
+ * @param notificationUrl
21
+ * @param expirationTimestamp
22
+ */
23
+ createListSubscription: (listId: string, notificationUrl: string, expirationTimestamp: number) => Promise<any>;
24
+ /**
25
+ *
26
+ * @param listId
27
+ * @param subscriptionId
28
+ */
29
+ deleteListSubscription: (listId: string, subscriptionId: string) => Promise<any>;
30
+ /**
31
+ *
32
+ * @param options
33
+ */
34
+ getListLogs: (options: {
35
+ listId: string;
36
+ from: Date;
37
+ }) => Promise<any>;
38
+ }
39
+ //# sourceMappingURL=sharepoint-api.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharepoint-api.service.d.ts","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAIhE,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;IAgCrD;;;OAGG;IACH,oBAAoB,WAAkB,MAAM,kBAI1C;IAEF;;;;;OAKG;IACH,sBAAsB,WACV,MAAM,mBACG,MAAM,uBACF,MAAM,kBAU9B;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;CAEJ"}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.SharepointApiService = void 0;
36
+ const common_1 = require("@nestjs/common");
37
+ const msal = __importStar(require("@azure/msal-node"));
38
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
39
+ let SharepointApiService = class SharepointApiService {
40
+ constructor(options) {
41
+ this.options = options;
42
+ /**
43
+ *
44
+ * @param listId
45
+ */
46
+ this.getListSubscriptions = async (listId) => {
47
+ return this.sharepoint_client
48
+ .api(`https://futuraitsrl.sharepoint.com/sites/hr/_api/web/lists('${listId}')/subscriptions`)
49
+ .get();
50
+ };
51
+ /**
52
+ *
53
+ * @param listId
54
+ * @param notificationUrl
55
+ * @param expirationTimestamp
56
+ */
57
+ this.createListSubscription = async (listId, notificationUrl, expirationTimestamp) => {
58
+ console.log('[SUBSCRIPTION REQUEST]:', listId, notificationUrl);
59
+ // read key from files
60
+ return this.sharepoint_client.api(`https://futuraitsrl.sharepoint.com/sites/hr/_api/web/lists('${listId}')/subscriptions`).post({
61
+ resource: 'https://futuraitsrl.sharepoint.com/sites/hr/Lists/Recruiting%20Board/AllItems.aspx',
62
+ notificationUrl: `${notificationUrl}`,
63
+ expirationDateTime: new Date(expirationTimestamp).toISOString(),
64
+ });
65
+ };
66
+ /**
67
+ *
68
+ * @param listId
69
+ * @param subscriptionId
70
+ */
71
+ this.deleteListSubscription = async (listId, subscriptionId) => {
72
+ return this.sharepoint_client
73
+ .api(`https://futuraitsrl.sharepoint.com/sites/hr/_api/web/lists('${listId}')/subscriptions('${subscriptionId}')`)
74
+ .delete();
75
+ };
76
+ /**
77
+ *
78
+ * @param options
79
+ */
80
+ this.getListLogs = async (options) => {
81
+ const startTick = options.from.getTime() * 10000 + 621355968000000000;
82
+ const start = `1;3;${options.listId};${startTick};-1`;
83
+ return this.sharepoint_client.api(`https://futuraitsrl.sharepoint.com/sites/hr/_api/web/Lists(guid'${options.listId}')/getChanges`).post({
84
+ query: {
85
+ Add: true,
86
+ Alert: true,
87
+ DeleteObject: true,
88
+ Update: true,
89
+ Item: true,
90
+ ChangeTokenStart: {
91
+ StringValue: start,
92
+ },
93
+ },
94
+ });
95
+ };
96
+ this.tenant_id = options.tenantId;
97
+ this.client_id = options.clientId;
98
+ this.scopes = options.scopes;
99
+ this.thumbprint = options.thumbprint;
100
+ this.private_key = options.privateKey;
101
+ // init msal client
102
+ this.msal_client = new msal.ConfidentialClientApplication({
103
+ auth: {
104
+ knownAuthorities: [
105
+ `https://login.microsoftonline.com/${this.tenant_id}`,
106
+ ],
107
+ clientId: `${this.client_id}`,
108
+ clientCertificate: {
109
+ thumbprint: this.thumbprint,
110
+ privateKey: this.private_key
111
+ }
112
+ },
113
+ });
114
+ // init graph client
115
+ this.sharepoint_client = microsoft_graph_client_1.Client.init({
116
+ authProvider: async (resolve) => {
117
+ this.msal_client.acquireTokenByClientCredential({
118
+ authority: `https://login.microsoftonline.com/${this.tenant_id}`,
119
+ scopes: this.scopes,
120
+ })
121
+ .then((token) => resolve(null, token.accessToken))
122
+ .catch(error => resolve(error, null));
123
+ }
124
+ });
125
+ }
126
+ };
127
+ SharepointApiService = __decorate([
128
+ (0, common_1.Injectable)(),
129
+ __metadata("design:paramtypes", [Object])
130
+ ], SharepointApiService);
131
+ exports.SharepointApiService = SharepointApiService;
132
+ //# sourceMappingURL=sharepoint-api.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharepoint-api.service.js","sourceRoot":"","sources":["../../src/sharepoint-api/sharepoint-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA0C;AAC1C,uDAAyC;AAEzC,8EAAyD;AAGzD,IACa,oBAAoB,GADjC,MACa,oBAAoB;IAU7B,YAAqB,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;QAgCrD;;;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,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;YAChE,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,kBAAkB,EAAE,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE;aAClE,CAAC,CAAA;QACN,CAAC,CAAA;QAED;;;;WAIG;QACH,2BAAsB,GAAG,KAAK,EAAE,MAAc,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