@futura-dev/microsoft-sdk 1.2.2 → 1.3.0
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.service.d.ts +10 -2
- package/dist/graph-api/graph-api.service.d.ts.map +1 -1
- package/dist/graph-api/graph-api.service.js +22 -13
- package/dist/graph-api/graph-api.service.js.map +1 -1
- package/dist/package.json +2 -2
- package/dist/sharepoint-api/sharepoint-api.service.d.ts.map +1 -1
- package/dist/sharepoint-api/sharepoint-api.service.js +15 -16
- package/dist/sharepoint-api/sharepoint-api.service.js.map +1 -1
- package/package.json +2 -2
|
@@ -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":""}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { GraphModuleOptions } from "./graph-api.module";
|
|
3
|
+
import { UserResponseDTO } from "./dto/response/user.response.dto";
|
|
3
4
|
export declare class GraphApiService {
|
|
4
5
|
readonly options: GraphModuleOptions;
|
|
5
6
|
private readonly tenant_id;
|
|
@@ -9,6 +10,13 @@ export declare class GraphApiService {
|
|
|
9
10
|
private readonly msal_client;
|
|
10
11
|
private readonly graph_client;
|
|
11
12
|
constructor(options: GraphModuleOptions);
|
|
13
|
+
/**
|
|
14
|
+
* @param identifier - user email or id
|
|
15
|
+
*/
|
|
16
|
+
getUser: <Expand extends "manager" = never>(options: {
|
|
17
|
+
identifier: string;
|
|
18
|
+
expand?: Expand | undefined;
|
|
19
|
+
}) => Promise<UserResponseDTO<Expand>>;
|
|
12
20
|
/**
|
|
13
21
|
*
|
|
14
22
|
* @param options
|
|
@@ -25,7 +33,7 @@ export declare class GraphApiService {
|
|
|
25
33
|
getListColumns: <T>(options: {
|
|
26
34
|
siteId: string;
|
|
27
35
|
listId: string;
|
|
28
|
-
}) => Promise<
|
|
36
|
+
}) => Promise<any>;
|
|
29
37
|
/**
|
|
30
38
|
*
|
|
31
39
|
* @param options
|
|
@@ -45,7 +53,7 @@ export declare class GraphApiService {
|
|
|
45
53
|
siteId: string;
|
|
46
54
|
listId: string;
|
|
47
55
|
body: {
|
|
48
|
-
fields: Record<string,
|
|
56
|
+
fields: Record<string, any>;
|
|
49
57
|
};
|
|
50
58
|
}) => Promise<any>;
|
|
51
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-api.service.d.ts","sourceRoot":"","sources":["../../src/graph-api/graph-api.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-api.service.d.ts","sourceRoot":"","sources":["../../src/graph-api/graph-api.service.ts"],"names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
|
|
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,31 +81,32 @@ 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
|
});
|
|
@@ -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
|
+
{"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,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;YAC7C,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;CAqEJ,CAAA;AAzGY,eAAe;IAD3B,IAAA,mBAAU,GAAE;;GACA,eAAe,CAyG3B;AAzGY,0CAAe"}
|
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": "1.
|
|
5
|
+
"version": "1.3.0",
|
|
6
6
|
"main": "dist/index",
|
|
7
7
|
"types": "dist/index",
|
|
8
8
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"typescript": "^5.0.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@futura-dev/cosmodrome": "^1.
|
|
36
|
+
"@futura-dev/cosmodrome": "^1.3.1",
|
|
37
37
|
"@futura-dev/cosmofactory": "^0.2.0",
|
|
38
38
|
"@futura-dev/cosmokeeper": "^0.1.7",
|
|
39
39
|
"@futura-dev/eslint-config-typescript": "^0.1.3",
|
|
@@ -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,16 +106,19 @@ 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"])
|
|
@@ -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;AAG3D,IACa,oBAAoB,GADjC,MACa,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,kBAAkB,EAAE,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE;aAClE,CAAC,CAAA;QACN,CAAC,CAAA;QAED;;;;WAIG;QACH,2BAAsB,GAAG,KAAK,EAAE,MAAc,EAAE,cAAsB,EAAE,EAAE;YACtE,OAAO,IAAI,CAAC,iBAAiB;iBACxB,GAAG,CAAC,+DAA+D,MAAM,qBAAqB,cA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AAE,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,oBAAoB;IADhC,IAAA,mBAAU,GAAE;;GACA,oBAAoB,CAyGhC;AAzGY,oDAAoB"}
|
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": "1.
|
|
5
|
+
"version": "1.3.0",
|
|
6
6
|
"main": "dist/index",
|
|
7
7
|
"types": "dist/index",
|
|
8
8
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"typescript": "^5.0.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@futura-dev/cosmodrome": "^1.
|
|
36
|
+
"@futura-dev/cosmodrome": "^1.3.1",
|
|
37
37
|
"@futura-dev/cosmofactory": "^0.2.0",
|
|
38
38
|
"@futura-dev/cosmokeeper": "^0.1.7",
|
|
39
39
|
"@futura-dev/eslint-config-typescript": "^0.1.3",
|