@azure/arm-resourcegraph 5.0.0-alpha.20220421.1 → 5.0.0-beta.2
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/CHANGELOG.md +2 -2
- package/README.md +13 -1
- package/dist/index.js +47 -8
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist-esm/samples-dev/operationsListSample.d.ts +2 -0
- package/dist-esm/samples-dev/operationsListSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/operationsListSample.js +42 -0
- package/dist-esm/samples-dev/operationsListSample.js.map +1 -0
- package/dist-esm/samples-dev/resourcesHistorySample.d.ts +2 -0
- package/dist-esm/samples-dev/resourcesHistorySample.d.ts.map +1 -0
- package/dist-esm/samples-dev/resourcesHistorySample.js +63 -0
- package/dist-esm/samples-dev/resourcesHistorySample.js.map +1 -0
- package/dist-esm/samples-dev/resourcesSample.d.ts +2 -0
- package/dist-esm/samples-dev/resourcesSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/resourcesSample.js +245 -0
- package/dist-esm/samples-dev/resourcesSample.js.map +1 -0
- package/dist-esm/src/resourceGraphClient.d.ts.map +1 -1
- package/dist-esm/src/resourceGraphClient.js +20 -2
- package/dist-esm/src/resourceGraphClient.js.map +1 -1
- package/package.json +10 -10
- package/rollup.config.js +6 -72
- package/src/resourceGraphClient.ts +27 -2
- package/tsconfig.json +18 -5
- package/LICENSE.txt +0 -21
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
import { __awaiter } from "tslib";
|
|
9
|
+
// Copyright (c) Microsoft Corporation.
|
|
10
|
+
// Licensed under the MIT License.
|
|
11
|
+
import { ResourceGraphClient } from "@azure/arm-resourcegraph";
|
|
12
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
13
|
+
/**
|
|
14
|
+
* This sample demonstrates how to List all snapshots of a resource for a given time interval.
|
|
15
|
+
*
|
|
16
|
+
* @summary List all snapshots of a resource for a given time interval.
|
|
17
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json
|
|
18
|
+
*/
|
|
19
|
+
function resourceHistoryManagementGroupScopeQuery() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const request = {
|
|
22
|
+
managementGroups: ["e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG"],
|
|
23
|
+
options: {
|
|
24
|
+
interval: {
|
|
25
|
+
end: new Date("2020-11-12T01:25:00.0000000Z"),
|
|
26
|
+
start: new Date("2020-11-12T01:00:00.0000000Z")
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
query: "where name =~ 'cpu-utilization' | project id, name, properties"
|
|
30
|
+
};
|
|
31
|
+
const credential = new DefaultAzureCredential();
|
|
32
|
+
const client = new ResourceGraphClient(credential);
|
|
33
|
+
const result = yield client.resourcesHistory(request);
|
|
34
|
+
console.log(result);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
resourceHistoryManagementGroupScopeQuery().catch(console.error);
|
|
38
|
+
/**
|
|
39
|
+
* This sample demonstrates how to List all snapshots of a resource for a given time interval.
|
|
40
|
+
*
|
|
41
|
+
* @summary List all snapshots of a resource for a given time interval.
|
|
42
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json
|
|
43
|
+
*/
|
|
44
|
+
function resourceHistoryQuery() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const request = {
|
|
47
|
+
options: {
|
|
48
|
+
interval: {
|
|
49
|
+
end: new Date("2020-11-12T01:25:00.0000000Z"),
|
|
50
|
+
start: new Date("2020-11-12T01:00:00.0000000Z")
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
query: "where name =~ 'cpu-utilization' | project id, name, properties",
|
|
54
|
+
subscriptions: ["a7f33fdb-e646-4f15-89aa-3a360210861e"]
|
|
55
|
+
};
|
|
56
|
+
const credential = new DefaultAzureCredential();
|
|
57
|
+
const client = new ResourceGraphClient(credential);
|
|
58
|
+
const result = yield client.resourcesHistory(request);
|
|
59
|
+
console.log(result);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
resourceHistoryQuery().catch(console.error);
|
|
63
|
+
//# sourceMappingURL=resourcesHistorySample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourcesHistorySample.js","sourceRoot":"","sources":["../../samples-dev/resourcesHistorySample.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAEL,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;;;GAKG;AACH,SAAe,wCAAwC;;QACrD,MAAM,OAAO,GAA4B;YACvC,gBAAgB,EAAE,CAAC,sCAAsC,EAAE,cAAc,CAAC;YAC1E,OAAO,EAAE;gBACP,QAAQ,EAAE;oBACR,GAAG,EAAE,IAAI,IAAI,CAAC,8BAA8B,CAAC;oBAC7C,KAAK,EAAE,IAAI,IAAI,CAAC,8BAA8B,CAAC;iBAChD;aACF;YACD,KAAK,EAAE,gEAAgE;SACxE,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,sBAAsB,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;CAAA;AAED,wCAAwC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,SAAe,oBAAoB;;QACjC,MAAM,OAAO,GAA4B;YACvC,OAAO,EAAE;gBACP,QAAQ,EAAE;oBACR,GAAG,EAAE,IAAI,IAAI,CAAC,8BAA8B,CAAC;oBAC7C,KAAK,EAAE,IAAI,IAAI,CAAC,8BAA8B,CAAC;iBAChD;aACF;YACD,KAAK,EAAE,gEAAgE;YACvE,aAAa,EAAE,CAAC,sCAAsC,CAAC;SACxD,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,sBAAsB,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;CAAA;AAED,oBAAoB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourcesSample.d.ts","sourceRoot":"","sources":["../../samples-dev/resourcesSample.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
import { __awaiter } from "tslib";
|
|
9
|
+
// Copyright (c) Microsoft Corporation.
|
|
10
|
+
// Licensed under the MIT License.
|
|
11
|
+
import { ResourceGraphClient } from "@azure/arm-resourcegraph";
|
|
12
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
13
|
+
/**
|
|
14
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
15
|
+
*
|
|
16
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
17
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json
|
|
18
|
+
*/
|
|
19
|
+
function accessAPropertiesField() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const query = {
|
|
22
|
+
query: "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)",
|
|
23
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
24
|
+
};
|
|
25
|
+
const credential = new DefaultAzureCredential();
|
|
26
|
+
const client = new ResourceGraphClient(credential);
|
|
27
|
+
const result = yield client.resources(query);
|
|
28
|
+
console.log(result);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
accessAPropertiesField().catch(console.error);
|
|
32
|
+
/**
|
|
33
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
34
|
+
*
|
|
35
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
36
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json
|
|
37
|
+
*/
|
|
38
|
+
function basicManagementGroupQuery() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const query = {
|
|
41
|
+
managementGroups: ["e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG"],
|
|
42
|
+
query: "Resources | project id, name, type, location, tags | limit 3"
|
|
43
|
+
};
|
|
44
|
+
const credential = new DefaultAzureCredential();
|
|
45
|
+
const client = new ResourceGraphClient(credential);
|
|
46
|
+
const result = yield client.resources(query);
|
|
47
|
+
console.log(result);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
basicManagementGroupQuery().catch(console.error);
|
|
51
|
+
/**
|
|
52
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
53
|
+
*
|
|
54
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
55
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json
|
|
56
|
+
*/
|
|
57
|
+
function basicQuery() {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const query = {
|
|
60
|
+
query: "Resources | project id, name, type, location, tags | limit 3",
|
|
61
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
62
|
+
};
|
|
63
|
+
const credential = new DefaultAzureCredential();
|
|
64
|
+
const client = new ResourceGraphClient(credential);
|
|
65
|
+
const result = yield client.resources(query);
|
|
66
|
+
console.log(result);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
basicQuery().catch(console.error);
|
|
70
|
+
/**
|
|
71
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
72
|
+
*
|
|
73
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
74
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json
|
|
75
|
+
*/
|
|
76
|
+
function basicTenantQuery() {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const query = {
|
|
79
|
+
query: "Resources | project id, name, type, location, tags | limit 3"
|
|
80
|
+
};
|
|
81
|
+
const credential = new DefaultAzureCredential();
|
|
82
|
+
const client = new ResourceGraphClient(credential);
|
|
83
|
+
const result = yield client.resources(query);
|
|
84
|
+
console.log(result);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
basicTenantQuery().catch(console.error);
|
|
88
|
+
/**
|
|
89
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
90
|
+
*
|
|
91
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
92
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json
|
|
93
|
+
*/
|
|
94
|
+
function complexQuery() {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
const query = {
|
|
97
|
+
query: "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_",
|
|
98
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
99
|
+
};
|
|
100
|
+
const credential = new DefaultAzureCredential();
|
|
101
|
+
const client = new ResourceGraphClient(credential);
|
|
102
|
+
const result = yield client.resources(query);
|
|
103
|
+
console.log(result);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
complexQuery().catch(console.error);
|
|
107
|
+
/**
|
|
108
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
109
|
+
*
|
|
110
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
111
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json
|
|
112
|
+
*/
|
|
113
|
+
function filterResources() {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const query = {
|
|
116
|
+
query: "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3",
|
|
117
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
118
|
+
};
|
|
119
|
+
const credential = new DefaultAzureCredential();
|
|
120
|
+
const client = new ResourceGraphClient(credential);
|
|
121
|
+
const result = yield client.resources(query);
|
|
122
|
+
console.log(result);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
filterResources().catch(console.error);
|
|
126
|
+
/**
|
|
127
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
128
|
+
*
|
|
129
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
130
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json
|
|
131
|
+
*/
|
|
132
|
+
function firstPageQuery() {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const query = {
|
|
135
|
+
options: { skip: 0, top: 3 },
|
|
136
|
+
query: "Resources | where name contains 'test' | project id, name, type, location",
|
|
137
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
138
|
+
};
|
|
139
|
+
const credential = new DefaultAzureCredential();
|
|
140
|
+
const client = new ResourceGraphClient(credential);
|
|
141
|
+
const result = yield client.resources(query);
|
|
142
|
+
console.log(result);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
firstPageQuery().catch(console.error);
|
|
146
|
+
/**
|
|
147
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
148
|
+
*
|
|
149
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
150
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json
|
|
151
|
+
*/
|
|
152
|
+
function nextPageQuery() {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
const query = {
|
|
155
|
+
options: {
|
|
156
|
+
skipToken: "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ=="
|
|
157
|
+
},
|
|
158
|
+
query: "Resources | where name contains 'test' | project id, name, type, location",
|
|
159
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
160
|
+
};
|
|
161
|
+
const credential = new DefaultAzureCredential();
|
|
162
|
+
const client = new ResourceGraphClient(credential);
|
|
163
|
+
const result = yield client.resources(query);
|
|
164
|
+
console.log(result);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
nextPageQuery().catch(console.error);
|
|
168
|
+
/**
|
|
169
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
170
|
+
*
|
|
171
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
172
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json
|
|
173
|
+
*/
|
|
174
|
+
function queryWithAFacetRequest() {
|
|
175
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
176
|
+
const query = {
|
|
177
|
+
facets: [
|
|
178
|
+
{ expression: "location", options: { top: 3, sortOrder: "desc" } },
|
|
179
|
+
{
|
|
180
|
+
expression: "properties.storageProfile.osDisk.osType",
|
|
181
|
+
options: { top: 3, sortOrder: "desc" }
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
expression: "nonExistingColumn",
|
|
185
|
+
options: { top: 3, sortOrder: "desc" }
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
expression: "resourceGroup",
|
|
189
|
+
options: { top: 3, sortBy: "tolower(resourceGroup)", sortOrder: "asc" }
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
expression: "resourceGroup",
|
|
193
|
+
options: { top: 3, filter: "resourceGroup contains 'test'" }
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
query: "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, properties.storageProfile.osDisk.osType | limit 5",
|
|
197
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
198
|
+
};
|
|
199
|
+
const credential = new DefaultAzureCredential();
|
|
200
|
+
const client = new ResourceGraphClient(credential);
|
|
201
|
+
const result = yield client.resources(query);
|
|
202
|
+
console.log(result);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
queryWithAFacetRequest().catch(console.error);
|
|
206
|
+
/**
|
|
207
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
208
|
+
*
|
|
209
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
210
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json
|
|
211
|
+
*/
|
|
212
|
+
function randomPageQuery() {
|
|
213
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
+
const query = {
|
|
215
|
+
options: { skip: 10, top: 2 },
|
|
216
|
+
query: "Resources | where name contains 'test' | project id, name, type, location",
|
|
217
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
218
|
+
};
|
|
219
|
+
const credential = new DefaultAzureCredential();
|
|
220
|
+
const client = new ResourceGraphClient(credential);
|
|
221
|
+
const result = yield client.resources(query);
|
|
222
|
+
console.log(result);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
randomPageQuery().catch(console.error);
|
|
226
|
+
/**
|
|
227
|
+
* This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
228
|
+
*
|
|
229
|
+
* @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request.
|
|
230
|
+
* x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json
|
|
231
|
+
*/
|
|
232
|
+
function summarizeResourcesByLocation() {
|
|
233
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
const query = {
|
|
235
|
+
query: "Resources | project id, name, type, location | summarize by location",
|
|
236
|
+
subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"]
|
|
237
|
+
};
|
|
238
|
+
const credential = new DefaultAzureCredential();
|
|
239
|
+
const client = new ResourceGraphClient(credential);
|
|
240
|
+
const result = yield client.resources(query);
|
|
241
|
+
console.log(result);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
summarizeResourcesByLocation().catch(console.error);
|
|
245
|
+
//# sourceMappingURL=resourcesSample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourcesSample.js","sourceRoot":"","sources":["../../samples-dev/resourcesSample.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAgB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;;;GAKG;AACH,SAAe,sBAAsB;;QACnC,MAAM,KAAK,GAAiB;YAC1B,KAAK,EACH,wIAAwI;YAC1I,aAAa,EAAE,CAAC,sCAAsC,CAAC;SACxD,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,sBAAsB,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;CAAA;AAED,sBAAsB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,SAAe,yBAAyB;;QACtC,MAAM,KAAK,GAAiB;YAC1B,gBAAgB,EAAE,CAAC,sCAAsC,EAAE,cAAc,CAAC;YAC1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F,MAAM,UAAU,GAAG,IAAI,sBAAsB,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;CAAA;AAED,4BAA4B,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceGraphClient.d.ts","sourceRoot":"","sources":["../../src/resourceGraphClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"resourceGraphClient.d.ts","sourceRoot":"","sources":["../../src/resourceGraphClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,OAAO,EACL,iCAAiC,EACjC,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAElB,qBAAa,mBAAoB,SAAQ,UAAU,CAAC,aAAa;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;gBAED,WAAW,EAAE,QAAQ,CAAC,eAAe,EACrC,OAAO,CAAC,EAAE,iCAAiC;IAgE7C;;;;OAIG;IACH,SAAS,CACP,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,iBAAiB,CAAC;IAO7B;;;;OAIG;IACH,gBAAgB,CACd,OAAO,EAAE,uBAAuB,EAChC,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC,wBAAwB,CAAC;IAOpC,UAAU,EAAE,UAAU,CAAC;CACxB"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
8
|
import * as coreClient from "@azure/core-client";
|
|
9
|
+
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
|
9
10
|
import { OperationsImpl } from "./operations";
|
|
10
11
|
import * as Parameters from "./models/parameters";
|
|
11
12
|
import * as Mappers from "./models/mappers";
|
|
@@ -16,6 +17,7 @@ export class ResourceGraphClient extends coreClient.ServiceClient {
|
|
|
16
17
|
* @param options The parameter options
|
|
17
18
|
*/
|
|
18
19
|
constructor(credentials, options) {
|
|
20
|
+
var _a, _b;
|
|
19
21
|
if (credentials === undefined) {
|
|
20
22
|
throw new Error("'credentials' cannot be null");
|
|
21
23
|
}
|
|
@@ -27,7 +29,7 @@ export class ResourceGraphClient extends coreClient.ServiceClient {
|
|
|
27
29
|
requestContentType: "application/json; charset=utf-8",
|
|
28
30
|
credential: credentials
|
|
29
31
|
};
|
|
30
|
-
const packageDetails = `azsdk-js-arm-resourcegraph/5.0.0-beta.
|
|
32
|
+
const packageDetails = `azsdk-js-arm-resourcegraph/5.0.0-beta.2`;
|
|
31
33
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
32
34
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
33
35
|
: `${packageDetails}`;
|
|
@@ -36,8 +38,24 @@ export class ResourceGraphClient extends coreClient.ServiceClient {
|
|
|
36
38
|
}
|
|
37
39
|
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
|
38
40
|
userAgentPrefix
|
|
39
|
-
}, baseUri: options.endpoint
|
|
41
|
+
}, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
|
|
40
42
|
super(optionsWithDefaults);
|
|
43
|
+
if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
|
|
44
|
+
const pipelinePolicies = options.pipeline.getOrderedPolicies();
|
|
45
|
+
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
|
|
46
|
+
coreRestPipeline.bearerTokenAuthenticationPolicyName);
|
|
47
|
+
if (!bearerTokenAuthenticationPolicyFound) {
|
|
48
|
+
this.pipeline.removePolicy({
|
|
49
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
50
|
+
});
|
|
51
|
+
this.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
52
|
+
scopes: `${optionsWithDefaults.baseUri}/.default`,
|
|
53
|
+
challengeCallbacks: {
|
|
54
|
+
authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
41
59
|
// Assigning values to Constant parameters
|
|
42
60
|
this.$host = options.$host || "https://management.azure.com";
|
|
43
61
|
this.apiVersion = options.apiVersion || "2021-06-01-preview";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceGraphClient.js","sourceRoot":"","sources":["../../src/resourceGraphClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"resourceGraphClient.js","sourceRoot":"","sources":["../../src/resourceGraphClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;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,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,WAAW,EAAE,UAAU,CAAC,KAAK;IAC7B,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,aAAa,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;IACjC,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC;AACF,MAAM,6BAA6B,GAA6B;IAC9D,IAAI,EAAE,qDAAqD;IAC3D,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;aAC/D;SACF;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,WAAW,EAAE,UAAU,CAAC,OAAO;IAC/B,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,aAAa,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;IACjC,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"sdk-type": "mgmt",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "A generated SDK for ResourceGraphClient.",
|
|
6
|
-
"version": "5.0.0-
|
|
6
|
+
"version": "5.0.0-beta.2",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=12.0.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@azure/core-paging": "^1.2.0",
|
|
12
|
-
"@azure/core-client": "^1.
|
|
12
|
+
"@azure/core-client": "^1.5.0",
|
|
13
13
|
"@azure/core-auth": "^1.3.0",
|
|
14
|
-
"@azure/core-rest-pipeline": "^1.
|
|
14
|
+
"@azure/core-rest-pipeline": "^1.8.0",
|
|
15
15
|
"tslib": "^2.2.0"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"types": "./types/arm-resourcegraph.d.ts",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@microsoft/api-extractor": "7.18.11",
|
|
30
|
-
"@rollup/plugin-commonjs": "
|
|
31
|
-
"@rollup/plugin-json": "^4.
|
|
32
|
-
"@rollup/plugin-multi-entry": "^
|
|
33
|
-
"@rollup/plugin-node-resolve": "^
|
|
30
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
31
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
32
|
+
"@rollup/plugin-multi-entry": "^4.1.0",
|
|
33
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
34
34
|
"mkdirp": "^1.0.4",
|
|
35
|
-
"rollup": "^
|
|
36
|
-
"rollup-plugin-sourcemaps": "^0.
|
|
35
|
+
"rollup": "^2.66.1",
|
|
36
|
+
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
37
37
|
"typescript": "~4.2.0",
|
|
38
38
|
"uglify-js": "^3.4.9",
|
|
39
39
|
"rimraf": "^3.0.0",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"//metadata": {
|
|
100
100
|
"constantPaths": [
|
|
101
101
|
{
|
|
102
|
-
"path": "src/
|
|
102
|
+
"path": "src/resourceGraphClient.ts",
|
|
103
103
|
"prefix": "packageDetails"
|
|
104
104
|
}
|
|
105
105
|
]
|
package/rollup.config.js
CHANGED
|
@@ -14,62 +14,14 @@ import json from "@rollup/plugin-json";
|
|
|
14
14
|
|
|
15
15
|
import nodeBuiltins from "builtin-modules";
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
|
|
19
|
-
*
|
|
20
|
-
* NOTE: this manual configuration is only needed because OpenTelemetry uses an
|
|
21
|
-
* __exportStar downleveled helper function to declare its exports which confuses
|
|
22
|
-
* rollup's automatic discovery mechanism.
|
|
23
|
-
*
|
|
24
|
-
* @returns an object reference that can be `...`'d into your cjs() configuration.
|
|
25
|
-
*/
|
|
26
|
-
export function openTelemetryCommonJs() {
|
|
27
|
-
const namedExports = {};
|
|
28
|
-
|
|
29
|
-
for (const key of [
|
|
30
|
-
"@opentelemetry/api",
|
|
31
|
-
"@azure/core-tracing/node_modules/@opentelemetry/api"
|
|
32
|
-
]) {
|
|
33
|
-
namedExports[key] = [
|
|
34
|
-
"SpanKind",
|
|
35
|
-
"TraceFlags",
|
|
36
|
-
"getSpan",
|
|
37
|
-
"setSpan",
|
|
38
|
-
"SpanStatusCode",
|
|
39
|
-
"getSpanContext",
|
|
40
|
-
"setSpanContext"
|
|
41
|
-
];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
|
|
45
|
-
|
|
46
|
-
for (const version of releasedOpenTelemetryVersions) {
|
|
47
|
-
namedExports[
|
|
48
|
-
// working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
|
|
49
|
-
`../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
|
|
50
|
-
] = [
|
|
51
|
-
"SpanKind",
|
|
52
|
-
"TraceFlags",
|
|
53
|
-
"getSpan",
|
|
54
|
-
"setSpan",
|
|
55
|
-
"StatusCode",
|
|
56
|
-
"CanonicalCode",
|
|
57
|
-
"getSpanContext",
|
|
58
|
-
"setSpanContext"
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return namedExports;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
17
|
// #region Warning Handler
|
|
66
18
|
|
|
67
19
|
/**
|
|
68
|
-
* A function that can determine whether a
|
|
20
|
+
* A function that can determine whether a rollup warning should be ignored. If
|
|
69
21
|
* the function returns `true`, then the warning will not be displayed.
|
|
70
22
|
*/
|
|
71
23
|
|
|
72
|
-
function
|
|
24
|
+
function ignoreNiseSinonEval(warning) {
|
|
73
25
|
return (
|
|
74
26
|
warning.code === "EVAL" &&
|
|
75
27
|
warning.id &&
|
|
@@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) {
|
|
|
78
30
|
);
|
|
79
31
|
}
|
|
80
32
|
|
|
81
|
-
function
|
|
33
|
+
function ignoreChaiCircularDependency(warning) {
|
|
82
34
|
return (
|
|
83
35
|
warning.code === "CIRCULAR_DEPENDENCY" &&
|
|
84
36
|
warning.importer && warning.importer.includes("node_modules/chai") === true
|
|
85
37
|
);
|
|
86
38
|
}
|
|
87
39
|
|
|
88
|
-
const warningInhibitors = [
|
|
89
|
-
ignoreChaiCircularDependencyWarnings,
|
|
90
|
-
ignoreNiseSinonEvalWarnings
|
|
91
|
-
];
|
|
40
|
+
const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
|
|
92
41
|
|
|
93
42
|
/**
|
|
94
43
|
* Construct a warning handler for the shared rollup configuration
|
|
@@ -122,22 +71,7 @@ function makeBrowserTestConfig() {
|
|
|
122
71
|
nodeResolve({
|
|
123
72
|
mainFields: ["module", "browser"]
|
|
124
73
|
}),
|
|
125
|
-
cjs(
|
|
126
|
-
namedExports: {
|
|
127
|
-
// Chai's strange internal architecture makes it impossible to statically
|
|
128
|
-
// analyze its exports.
|
|
129
|
-
chai: [
|
|
130
|
-
"version",
|
|
131
|
-
"use",
|
|
132
|
-
"util",
|
|
133
|
-
"config",
|
|
134
|
-
"expect",
|
|
135
|
-
"should",
|
|
136
|
-
"assert"
|
|
137
|
-
],
|
|
138
|
-
...openTelemetryCommonJs()
|
|
139
|
-
}
|
|
140
|
-
}),
|
|
74
|
+
cjs(),
|
|
141
75
|
json(),
|
|
142
76
|
sourcemaps()
|
|
143
77
|
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
|
|
@@ -173,7 +107,7 @@ export function makeConfig(pkg, options) {
|
|
|
173
107
|
],
|
|
174
108
|
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
|
|
175
109
|
preserveSymlinks: false,
|
|
176
|
-
plugins: [sourcemaps(), nodeResolve()
|
|
110
|
+
plugins: [sourcemaps(), nodeResolve()]
|
|
177
111
|
};
|
|
178
112
|
|
|
179
113
|
const config = [baseConfig];
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as coreClient from "@azure/core-client";
|
|
10
|
+
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
|
10
11
|
import * as coreAuth from "@azure/core-auth";
|
|
11
12
|
import { OperationsImpl } from "./operations";
|
|
12
13
|
import { Operations } from "./operationsInterfaces";
|
|
@@ -48,7 +49,7 @@ export class ResourceGraphClient extends coreClient.ServiceClient {
|
|
|
48
49
|
credential: credentials
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
const packageDetails = `azsdk-js-arm-resourcegraph/5.0.0-beta.
|
|
52
|
+
const packageDetails = `azsdk-js-arm-resourcegraph/5.0.0-beta.2`;
|
|
52
53
|
const userAgentPrefix =
|
|
53
54
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
54
55
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
@@ -63,10 +64,34 @@ export class ResourceGraphClient extends coreClient.ServiceClient {
|
|
|
63
64
|
userAgentOptions: {
|
|
64
65
|
userAgentPrefix
|
|
65
66
|
},
|
|
66
|
-
baseUri:
|
|
67
|
+
baseUri:
|
|
68
|
+
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
67
69
|
};
|
|
68
70
|
super(optionsWithDefaults);
|
|
69
71
|
|
|
72
|
+
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
73
|
+
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
|
74
|
+
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
|
75
|
+
(pipelinePolicy) =>
|
|
76
|
+
pipelinePolicy.name ===
|
|
77
|
+
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
78
|
+
);
|
|
79
|
+
if (!bearerTokenAuthenticationPolicyFound) {
|
|
80
|
+
this.pipeline.removePolicy({
|
|
81
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
82
|
+
});
|
|
83
|
+
this.pipeline.addPolicy(
|
|
84
|
+
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
85
|
+
scopes: `${optionsWithDefaults.baseUri}/.default`,
|
|
86
|
+
challengeCallbacks: {
|
|
87
|
+
authorizeRequestOnChallenge:
|
|
88
|
+
coreClient.authorizeRequestOnClaimChallenge
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
70
95
|
// Assigning values to Constant parameters
|
|
71
96
|
this.$host = options.$host || "https://management.azure.com";
|
|
72
97
|
this.apiVersion = options.apiVersion || "2021-06-01-preview";
|
package/tsconfig.json
CHANGED
|
@@ -9,12 +9,25 @@
|
|
|
9
9
|
"esModuleInterop": true,
|
|
10
10
|
"allowSyntheticDefaultImports": true,
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"lib": [
|
|
12
|
+
"lib": [
|
|
13
|
+
"es6",
|
|
14
|
+
"dom"
|
|
15
|
+
],
|
|
13
16
|
"declaration": true,
|
|
14
17
|
"outDir": "./dist-esm",
|
|
15
18
|
"importHelpers": true,
|
|
16
|
-
"paths": {
|
|
19
|
+
"paths": {
|
|
20
|
+
"@azure/arm-resourcegraph": [
|
|
21
|
+
"./src/index"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
17
24
|
},
|
|
18
|
-
"include": [
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
"include": [
|
|
26
|
+
"./src/**/*.ts",
|
|
27
|
+
"./test/**/*.ts",
|
|
28
|
+
"samples-dev/**/*.ts"
|
|
29
|
+
],
|
|
30
|
+
"exclude": [
|
|
31
|
+
"node_modules"
|
|
32
|
+
]
|
|
33
|
+
}
|