@microsoft/typespec-msgraph 0.0.1-Preview.15 → 0.0.1-Preview.17
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/src/components/operation-element.js +1 -1
- package/dist/src/components/operation-element.js.map +1 -1
- package/dist/src/components/property-element.js +1 -1
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/structured-type-element.d.ts.map +1 -1
- package/dist/src/components/structured-type-element.js +4 -4
- package/dist/src/components/structured-type-element.js.map +1 -1
- package/dist/src/decorators/graph-route.d.ts.map +1 -1
- package/dist/src/decorators/graph-route.js +3 -0
- package/dist/src/decorators/graph-route.js.map +1 -1
- package/dist/src/decorators/index.d.ts +12 -10
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +12 -10
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/limited-charset.d.ts +9 -0
- package/dist/src/decorators/limited-charset.d.ts.map +1 -0
- package/dist/src/decorators/limited-charset.js +13 -0
- package/dist/src/decorators/limited-charset.js.map +1 -0
- package/dist/src/decorators/media.d.ts +10 -0
- package/dist/src/decorators/media.d.ts.map +1 -0
- package/dist/src/decorators/media.js +16 -0
- package/dist/src/decorators/media.js.map +1 -0
- package/dist/src/decorators/passthrough-address-url-msa.d.ts +2 -3
- package/dist/src/decorators/passthrough-address-url-msa.d.ts.map +1 -1
- package/dist/src/decorators/passthrough-address-url-msa.js +2 -4
- package/dist/src/decorators/passthrough-address-url-msa.js.map +1 -1
- package/dist/src/decorators/passthrough-address-url.d.ts +2 -3
- package/dist/src/decorators/passthrough-address-url.d.ts.map +1 -1
- package/dist/src/decorators/passthrough-address-url.js +2 -4
- package/dist/src/decorators/passthrough-address-url.js.map +1 -1
- package/dist/src/decorators/workload-namespace.d.ts +10 -0
- package/dist/src/decorators/workload-namespace.d.ts.map +1 -0
- package/dist/src/decorators/workload-namespace.js +19 -0
- package/dist/src/decorators/workload-namespace.js.map +1 -0
- package/dist/src/dom/error-interceptor.d.ts +2 -0
- package/dist/src/dom/error-interceptor.d.ts.map +1 -0
- package/dist/src/dom/error-interceptor.js +13 -0
- package/dist/src/dom/error-interceptor.js.map +1 -0
- package/dist/src/dom/renderer.d.ts +1 -0
- package/dist/src/dom/renderer.d.ts.map +1 -1
- package/dist/src/dom/renderer.js +1 -0
- package/dist/src/dom/renderer.js.map +1 -1
- package/dist/src/entities/address-url.d.ts +3 -2
- package/dist/src/entities/address-url.d.ts.map +1 -1
- package/dist/src/entities/address-url.js +7 -2
- package/dist/src/entities/address-url.js.map +1 -1
- package/dist/src/entities/annotations.d.ts.map +1 -1
- package/dist/src/entities/annotations.js +26 -20
- package/dist/src/entities/annotations.js.map +1 -1
- package/dist/src/entities/model.d.ts +6 -5
- package/dist/src/entities/model.d.ts.map +1 -1
- package/dist/src/entities/model.js +7 -5
- package/dist/src/entities/model.js.map +1 -1
- package/dist/src/entities/ms-graph-route.d.ts.map +1 -1
- package/dist/src/entities/ms-graph-route.js +8 -2
- package/dist/src/entities/ms-graph-route.js.map +1 -1
- package/dist/src/entities/namespace.js +3 -3
- package/dist/src/entities/namespace.js.map +1 -1
- package/dist/src/entities/operation.d.ts +1 -0
- package/dist/src/entities/operation.d.ts.map +1 -1
- package/dist/src/entities/operation.js +3 -2
- package/dist/src/entities/operation.js.map +1 -1
- package/dist/src/lib.d.ts +2 -0
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +1 -0
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +4 -2
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/address-url.d.ts +1 -0
- package/dist/src/rules/address-url.d.ts.map +1 -1
- package/dist/src/rules/address-url.js +62 -0
- package/dist/src/rules/address-url.js.map +1 -1
- package/dist/src/rules/computed.d.ts +0 -2
- package/dist/src/rules/computed.d.ts.map +1 -1
- package/dist/src/rules/computed.js +5 -8
- package/dist/src/rules/computed.js.map +1 -1
- package/dist/src/rules/expand.d.ts.map +1 -1
- package/dist/src/rules/expand.js +3 -1
- package/dist/src/rules/expand.js.map +1 -1
- package/dist/src/rules/filter.d.ts.map +1 -1
- package/dist/src/rules/filter.js +15 -3
- package/dist/src/rules/filter.js.map +1 -1
- package/dist/src/rules/graph-route.d.ts.map +1 -1
- package/dist/src/rules/graph-route.js +19 -11
- package/dist/src/rules/graph-route.js.map +1 -1
- package/dist/src/rules/index.d.ts +2 -1
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +2 -1
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/limited-charset.d.ts +3 -0
- package/dist/src/rules/limited-charset.d.ts.map +1 -0
- package/dist/src/rules/limited-charset.js +42 -0
- package/dist/src/rules/limited-charset.js.map +1 -0
- package/dist/src/rules/media.d.ts +10 -0
- package/dist/src/rules/media.d.ts.map +1 -0
- package/dist/src/rules/media.js +122 -0
- package/dist/src/rules/media.js.map +1 -0
- package/dist/src/rules/namespace.d.ts +1 -0
- package/dist/src/rules/namespace.d.ts.map +1 -1
- package/dist/src/rules/namespace.js +21 -0
- package/dist/src/rules/namespace.js.map +1 -1
- package/dist/src/rules/required-for-create.d.ts.map +1 -1
- package/dist/src/rules/required-for-create.js +3 -2
- package/dist/src/rules/required-for-create.js.map +1 -1
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +81 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/src/validate.d.ts.map +1 -1
- package/dist/src/validate.js +4 -1
- package/dist/src/validate.js.map +1 -1
- package/lib/bodies.tsp +71 -0
- package/lib/decorators.tsp +22 -12
- package/lib/msgraph.tsp +1 -0
- package/lib/porcelain.tsp +43 -18
- package/lib/responses.tsp +4 -52
- package/lib/shared-models.tsp +2 -2
- package/package.json +4 -4
- package/dist/src/decorators/has-stream.d.ts +0 -10
- package/dist/src/decorators/has-stream.d.ts.map +0 -1
- package/dist/src/decorators/has-stream.js +0 -17
- package/dist/src/decorators/has-stream.js.map +0 -1
- package/dist/src/rules/has-stream.d.ts +0 -3
- package/dist/src/rules/has-stream.d.ts.map +0 -1
- package/dist/src/rules/has-stream.js +0 -30
- package/dist/src/rules/has-stream.js.map +0 -1
package/lib/responses.tsp
CHANGED
|
@@ -5,60 +5,12 @@
|
|
|
5
5
|
import "@typespec/http";
|
|
6
6
|
import "@microsoft/typespec-msgraph";
|
|
7
7
|
import "./shared-models.tsp";
|
|
8
|
+
import "./bodies.tsp";
|
|
8
9
|
|
|
9
10
|
using TypeSpec.Http;
|
|
10
11
|
using MsGraph;
|
|
11
12
|
using MsGraph.SharedModels;
|
|
12
|
-
|
|
13
|
-
// Raw body models represent the content of the response body, without any additional metadata.
|
|
14
|
-
// Note that these are primarily marker types. CSDL has no notion of what actual body content is returned in such types,
|
|
15
|
-
// but by passing markers through, HIDI can translate to OpenAPI.
|
|
16
|
-
// The content of the types exists for other future emitters that run directly off TypeSpec.
|
|
17
|
-
namespace MsGraph.Responses.Bodies {
|
|
18
|
-
|
|
19
|
-
/** Complex type to represent a nested error that potentially has other recursive nested errors. */
|
|
20
|
-
@error
|
|
21
|
-
model InnerError {
|
|
22
|
-
code: string;
|
|
23
|
-
innererror: InnerError | null; // Small e for error NOT a typo.
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Complex type to represent a standard Microsoft Graph error. */
|
|
27
|
-
@error
|
|
28
|
-
model GraphError {
|
|
29
|
-
code: string;
|
|
30
|
-
message: string;
|
|
31
|
-
localizedMessage: string;
|
|
32
|
-
target: string | null;
|
|
33
|
-
innererror: InnerError | null; // Small e for error NOT a typo.
|
|
34
|
-
details: GraphError[];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@error
|
|
38
|
-
model ErrorBody {
|
|
39
|
-
error: GraphError;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
model ResourceBody<TResource> {
|
|
43
|
-
...TResource;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
model CollectionBody<TResource> {
|
|
47
|
-
value: TResource[];
|
|
48
|
-
`@odata.count`?: int64;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@pagedCollection
|
|
52
|
-
model PagedCollectionBody<TResource> is CollectionBody<TResource> {
|
|
53
|
-
`@odata.nextLink`?: MsGraph.SharedModels.url;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@pagedCollection
|
|
57
|
-
@deltaCollection
|
|
58
|
-
model DeltaCollectionBody<TResource> is PagedCollectionBody<TResource> {
|
|
59
|
-
`@odata.deltaLink`?: MsGraph.SharedModels.url;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
13
|
+
using MsGraph.Bodies;
|
|
62
14
|
|
|
63
15
|
// Response models represent the response as a whole, including the status code, headers, and body.
|
|
64
16
|
namespace MsGraph.Responses {
|
|
@@ -73,7 +25,7 @@ namespace MsGraph.Responses {
|
|
|
73
25
|
is CollectionResponse<TResource, TStatus, TBody>;
|
|
74
26
|
|
|
75
27
|
/** Response to represent a Microsoft Graph individual resource response payload. */
|
|
76
|
-
model ResourceResponse<TResource, TStatus = 200, TBody =
|
|
28
|
+
model ResourceResponse<TResource, TStatus = 200, TBody = TResource>
|
|
77
29
|
is Http.Response<TStatus> {
|
|
78
30
|
...Http.Body<TBody>;
|
|
79
31
|
}
|
|
@@ -85,7 +37,7 @@ namespace MsGraph.Responses {
|
|
|
85
37
|
}
|
|
86
38
|
|
|
87
39
|
/** Response to represent a Microsoft Graph resource creation response payload. */
|
|
88
|
-
model ResourceCreatedResponse<TResource, TStatus = 201, TBody =
|
|
40
|
+
model ResourceCreatedResponse<TResource, TStatus = 201, TBody = TResource>
|
|
89
41
|
is ResourceResponse<TResource, TStatus, TBody> {
|
|
90
42
|
...Http.LocationHeader
|
|
91
43
|
}
|
package/lib/shared-models.tsp
CHANGED
|
@@ -18,8 +18,8 @@ namespace MsGraph.SharedModels;
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
@doc("Scalar type for URLs that would be expected to work in the browser address bar.")
|
|
21
|
-
scalar webUrl extends
|
|
21
|
+
scalar webUrl extends url;
|
|
22
22
|
|
|
23
23
|
@doc("Scalar type for URLs that represent Graph APIs.")
|
|
24
|
-
scalar
|
|
24
|
+
scalar graphUrl extends url;
|
|
25
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/typespec-msgraph",
|
|
3
|
-
"version": "0.0.1-Preview.
|
|
3
|
+
"version": "0.0.1-Preview.17",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec for Microsoft Graph provides a description of the Microsoft Graph APIs. It is used for generating API description languages, client and service code, documentation, and other assets.",
|
|
6
6
|
"homepage": "https://github.com/microsoftgraph/typespec-msgraph",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@xmldom/xmldom": "~0.8.4",
|
|
56
|
-
"@typespec/compiler": "~0.
|
|
57
|
-
"@typespec/http": "~0.
|
|
56
|
+
"@typespec/compiler": "~0.53.1",
|
|
57
|
+
"@typespec/http": "~0.53.0",
|
|
58
58
|
"prettier": "~3.1.1",
|
|
59
59
|
"react-dom": "~18.2.0",
|
|
60
60
|
"react": "~18.2.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/node": "~18.11.9",
|
|
66
66
|
"@types/react": "~18.0.5",
|
|
67
67
|
"@types/react-reconciler": "~0.28.0",
|
|
68
|
-
"@typespec/eslint-config-typespec": "~0.
|
|
68
|
+
"@typespec/eslint-config-typespec": "~0.53.0",
|
|
69
69
|
"c8": "~8.0.1",
|
|
70
70
|
"eslint": "^8.49.0",
|
|
71
71
|
"mocha": "~10.2.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DecoratorContext, Model, Program } from "@typespec/compiler";
|
|
2
|
-
/**
|
|
3
|
-
* `@hasStream` - indicates that an `@entity` model has a stream.
|
|
4
|
-
*
|
|
5
|
-
* `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
|
|
6
|
-
*/
|
|
7
|
-
export declare function $hasStream(context: DecoratorContext, target: Model, args?: string, ...mediaTypes: string[]): void;
|
|
8
|
-
export declare function hasStream(program: Program, target: Model): boolean;
|
|
9
|
-
export declare function getStreamTypes(program: Program, target: Model): string[];
|
|
10
|
-
//# sourceMappingURL=has-stream.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,UAAU,EAAE,MAAM,EAAE,QAOxB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAElE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,CAExE"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const hasStreamKey = Symbol("hasStream");
|
|
2
|
-
/**
|
|
3
|
-
* `@hasStream` - indicates that an `@entity` model has a stream.
|
|
4
|
-
*
|
|
5
|
-
* `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
|
|
6
|
-
*/
|
|
7
|
-
export function $hasStream(context, target, args, ...mediaTypes) {
|
|
8
|
-
const types = args ? [args, ...mediaTypes] : [];
|
|
9
|
-
context.program.stateMap(hasStreamKey).set(target, types.filter((t) => t.trim()));
|
|
10
|
-
}
|
|
11
|
-
export function hasStream(program, target) {
|
|
12
|
-
return program.stateMap(hasStreamKey).has(target);
|
|
13
|
-
}
|
|
14
|
-
export function getStreamTypes(program, target) {
|
|
15
|
-
return program.stateMap(hasStreamKey).get(target) || [];
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=has-stream.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has-stream.js","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,OAAyB,EACzB,MAAa,EACb,IAAa,EACb,GAAG,UAAoB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CACxC,MAAM,EACN,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAa;IACvD,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAgB,EAAE,MAAa;IAC5D,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/rules/has-stream.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAGvE,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,OAAO,QAsB7D"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { hasStream } from "../decorators/has-stream.js";
|
|
2
|
-
import { isEntity } from "../index.js";
|
|
3
|
-
import { reportDiagnostic } from "../lib.js";
|
|
4
|
-
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
5
|
-
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
6
|
-
export function validateHasStreamOnlyOnEntity(program) {
|
|
7
|
-
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
8
|
-
navigateTypesInNamespace(namespace, {
|
|
9
|
-
model: (model) => {
|
|
10
|
-
if (!hasStream(program, model)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (isEntity(program, model)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
reportDiagnostic(program, {
|
|
17
|
-
code: "decorator-invalid-use",
|
|
18
|
-
target: model,
|
|
19
|
-
messageId: "wrongType",
|
|
20
|
-
format: {
|
|
21
|
-
decorator: "@hasStream",
|
|
22
|
-
target: "@entity model",
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
;
|
|
30
|
-
//# sourceMappingURL=has-stream.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has-stream.js","sourceRoot":"","sources":["../../../src/rules/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAW,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,UAAU,6BAA6B,CAAC,OAAgB;IAC5D,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE;QACtD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC9B,OAAO;iBACR;gBACD,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC5B,OAAO;iBACR;gBACD,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,KAAK;oBACb,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,YAAY;wBACvB,MAAM,EAAE,eAAe;qBACxB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
|