@microsoft/typespec-msgraph 0.0.1-Preview.4 → 0.0.1-Preview.6
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/alternate-keys-annotation.js +4 -4
- package/dist/src/components/alternate-keys-annotation.js.map +1 -1
- package/dist/src/components/annotations.d.ts +9 -0
- package/dist/src/components/annotations.d.ts.map +1 -0
- package/dist/src/components/annotations.js +45 -0
- package/dist/src/components/annotations.js.map +1 -0
- package/dist/src/components/common-elements.d.ts +17 -4
- package/dist/src/components/common-elements.d.ts.map +1 -1
- package/dist/src/components/common-elements.js +2 -2
- package/dist/src/components/common-elements.js.map +1 -1
- package/dist/src/components/computed-annotation.js +1 -1
- package/dist/src/components/computed-annotation.js.map +1 -1
- package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/count-restrictions-annotation.js +3 -8
- package/dist/src/components/count-restrictions-annotation.js.map +1 -1
- package/dist/src/components/description-annotation.d.ts.map +1 -1
- package/dist/src/components/description-annotation.js +1 -0
- package/dist/src/components/description-annotation.js.map +1 -1
- package/dist/src/components/entity-container-element.d.ts +18 -3
- package/dist/src/components/entity-container-element.d.ts.map +1 -1
- package/dist/src/components/entity-container-element.js +6 -42
- package/dist/src/components/entity-container-element.js.map +1 -1
- package/dist/src/components/enum-type-element.js +1 -1
- package/dist/src/components/enum-type-element.js.map +1 -1
- package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/expand-restrictions-annotation.js +7 -13
- package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
- package/dist/src/components/operation-element.js +3 -3
- package/dist/src/components/operation-element.js.map +1 -1
- package/dist/src/components/schema-element.d.ts.map +1 -1
- package/dist/src/components/schema-element.js +6 -3
- package/dist/src/components/schema-element.js.map +1 -1
- package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/search-restrictions-annotation.js +3 -8
- package/dist/src/components/search-restrictions-annotation.js.map +1 -1
- package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
- package/dist/src/components/skip-supported-annotation.js +1 -6
- package/dist/src/components/skip-supported-annotation.js.map +1 -1
- package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/sort-restrictions-annotation.js +7 -13
- package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
- package/dist/src/components/structured-type-element.d.ts +4 -7
- package/dist/src/components/structured-type-element.d.ts.map +1 -1
- package/dist/src/components/structured-type-element.js +21 -23
- package/dist/src/components/structured-type-element.js.map +1 -1
- package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
- package/dist/src/components/top-supported-annotation.js +1 -4
- package/dist/src/components/top-supported-annotation.js.map +1 -1
- package/dist/src/components/update-restrictions-annotation.d.ts +5 -0
- package/dist/src/components/update-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/update-restrictions-annotation.js +8 -0
- package/dist/src/components/update-restrictions-annotation.js.map +1 -0
- package/dist/src/decorators/{handlers/custom/additional-query-parameters.d.ts → additional-query-parameters.d.ts} +4 -3
- package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -0
- package/dist/src/decorators/additional-query-parameters.js +21 -0
- package/dist/src/decorators/additional-query-parameters.js.map +1 -0
- package/dist/src/decorators/ags-attribute.d.ts +13 -0
- package/dist/src/decorators/ags-attribute.d.ts.map +1 -0
- package/dist/src/decorators/ags-attribute.js +68 -0
- package/dist/src/decorators/ags-attribute.js.map +1 -0
- package/dist/src/decorators/delta-collection.d.ts +8 -0
- package/dist/src/decorators/delta-collection.d.ts.map +1 -0
- package/dist/src/decorators/delta-collection.js +12 -0
- package/dist/src/decorators/delta-collection.js.map +1 -0
- package/dist/src/decorators/deprecated-definition.d.ts +3 -4
- package/dist/src/decorators/deprecated-definition.d.ts.map +1 -1
- package/dist/src/decorators/deprecated-definition.js +1 -7
- package/dist/src/decorators/deprecated-definition.js.map +1 -1
- package/dist/src/decorators/expand.d.ts +1 -2
- package/dist/src/decorators/expand.d.ts.map +1 -1
- package/dist/src/decorators/expand.js +1 -1
- package/dist/src/decorators/expand.js.map +1 -1
- package/dist/src/decorators/flags.d.ts +9 -0
- package/dist/src/decorators/flags.d.ts.map +1 -0
- package/dist/src/decorators/flags.js +13 -0
- package/dist/src/decorators/flags.js.map +1 -0
- package/dist/src/decorators/function.d.ts +1 -2
- package/dist/src/decorators/function.d.ts.map +1 -1
- package/dist/src/decorators/function.js +1 -1
- package/dist/src/decorators/function.js.map +1 -1
- package/dist/src/decorators/graph-route.d.ts +9 -0
- package/dist/src/decorators/graph-route.d.ts.map +1 -0
- package/dist/src/decorators/graph-route.js +84 -0
- package/dist/src/decorators/graph-route.js.map +1 -0
- package/dist/src/decorators/has-stream.d.ts +1 -2
- package/dist/src/decorators/has-stream.d.ts.map +1 -1
- package/dist/src/decorators/has-stream.js +1 -1
- package/dist/src/decorators/has-stream.js.map +1 -1
- package/dist/src/decorators/index.d.ts +10 -2
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +10 -2
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/is-owner.d.ts +9 -0
- package/dist/src/decorators/is-owner.d.ts.map +1 -0
- package/dist/src/decorators/is-owner.js +14 -0
- package/dist/src/decorators/is-owner.js.map +1 -0
- package/dist/src/decorators/order-by.d.ts +1 -2
- package/dist/src/decorators/order-by.d.ts.map +1 -1
- package/dist/src/decorators/order-by.js +1 -1
- package/dist/src/decorators/order-by.js.map +1 -1
- package/dist/src/decorators/paged-collection.d.ts +8 -0
- package/dist/src/decorators/paged-collection.d.ts.map +1 -0
- package/dist/src/decorators/paged-collection.js +12 -0
- package/dist/src/decorators/paged-collection.js.map +1 -0
- package/dist/src/decorators/private-preview-definition.d.ts +3 -4
- package/dist/src/decorators/private-preview-definition.d.ts.map +1 -1
- package/dist/src/decorators/private-preview-definition.js +1 -6
- package/dist/src/decorators/private-preview-definition.js.map +1 -1
- package/dist/src/decorators/private-preview.d.ts +1 -2
- package/dist/src/decorators/private-preview.d.ts.map +1 -1
- package/dist/src/decorators/private-preview.js +1 -1
- package/dist/src/decorators/private-preview.js.map +1 -1
- package/dist/src/decorators/privileged.d.ts +9 -0
- package/dist/src/decorators/privileged.d.ts.map +1 -0
- package/dist/src/decorators/privileged.js +13 -0
- package/dist/src/decorators/privileged.js.map +1 -0
- package/dist/src/decorators/workload-name-msa.d.ts +9 -0
- package/dist/src/decorators/workload-name-msa.d.ts.map +1 -0
- package/dist/src/decorators/workload-name-msa.js +13 -0
- package/dist/src/decorators/workload-name-msa.js.map +1 -0
- package/dist/src/decorators/workload-name.d.ts +9 -0
- package/dist/src/decorators/workload-name.d.ts.map +1 -0
- package/dist/src/decorators/workload-name.js +13 -0
- package/dist/src/decorators/workload-name.js.map +1 -0
- package/dist/src/entities/annotations.d.ts +31 -0
- package/dist/src/entities/annotations.d.ts.map +1 -0
- package/dist/src/entities/annotations.js +99 -0
- package/dist/src/entities/annotations.js.map +1 -0
- package/dist/src/entities/entity-container.d.ts +4 -24
- package/dist/src/entities/entity-container.d.ts.map +1 -1
- package/dist/src/entities/entity-container.js +30 -120
- package/dist/src/entities/entity-container.js.map +1 -1
- package/dist/src/entities/enum.d.ts +1 -0
- package/dist/src/entities/enum.d.ts.map +1 -1
- package/dist/src/entities/enum.js +5 -3
- package/dist/src/entities/enum.js.map +1 -1
- package/dist/src/entities/model.d.ts +12 -22
- package/dist/src/entities/model.d.ts.map +1 -1
- package/dist/src/entities/model.js +64 -101
- package/dist/src/entities/model.js.map +1 -1
- package/dist/src/entities/namespace.d.ts +8 -3
- package/dist/src/entities/namespace.d.ts.map +1 -1
- package/dist/src/entities/namespace.js +31 -13
- package/dist/src/entities/namespace.js.map +1 -1
- package/dist/src/entities/operation.d.ts +2 -2
- package/dist/src/entities/operation.d.ts.map +1 -1
- package/dist/src/entities/operation.js +30 -14
- package/dist/src/entities/operation.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +25 -25
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/count.d.ts.map +1 -1
- package/dist/src/rules/count.js +3 -1
- package/dist/src/rules/count.js.map +1 -1
- package/dist/src/rules/entity.d.ts.map +1 -1
- package/dist/src/rules/entity.js +4 -1
- package/dist/src/rules/entity.js.map +1 -1
- package/dist/src/rules/expand.d.ts.map +1 -1
- package/dist/src/rules/expand.js +5 -7
- package/dist/src/rules/expand.js.map +1 -1
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +1 -0
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/order-by.d.ts +1 -1
- package/dist/src/rules/order-by.d.ts.map +1 -1
- package/dist/src/rules/order-by.js +11 -10
- package/dist/src/rules/order-by.js.map +1 -1
- package/dist/src/rules/search.d.ts.map +1 -1
- package/dist/src/rules/search.js +3 -1
- package/dist/src/rules/search.js.map +1 -1
- package/dist/src/rules/skip.d.ts.map +1 -1
- package/dist/src/rules/skip.js +3 -1
- package/dist/src/rules/skip.js.map +1 -1
- package/dist/src/rules/top.d.ts.map +1 -1
- package/dist/src/rules/top.js +3 -1
- package/dist/src/rules/top.js.map +1 -1
- package/dist/src/utils.d.ts +16 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +87 -1
- package/dist/src/utils.js.map +1 -1
- package/lib/decorators.tsp +97 -14
- package/lib/deployment.tsp +18 -0
- package/lib/lib.tsp +9 -14
- package/lib/msgraph.tsp +4 -0
- package/lib/porcelain.tsp +135 -0
- package/lib/responses.tsp +82 -0
- package/lib/shared-models.tsp +74 -0
- package/package.json +1 -2
- package/dist/src/decorators/attribute-builder.d.ts +0 -2
- package/dist/src/decorators/attribute-builder.d.ts.map +0 -1
- package/dist/src/decorators/attribute-builder.js +0 -166
- package/dist/src/decorators/attribute-builder.js.map +0 -1
- package/dist/src/decorators/attributes.d.ts +0 -57
- package/dist/src/decorators/attributes.d.ts.map +0 -1
- package/dist/src/decorators/attributes.js +0 -50
- package/dist/src/decorators/attributes.js.map +0 -1
- package/dist/src/decorators/decorator-parameter.d.ts +0 -4
- package/dist/src/decorators/decorator-parameter.d.ts.map +0 -1
- package/dist/src/decorators/decorator-parameter.js +0 -2
- package/dist/src/decorators/decorator-parameter.js.map +0 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js +0 -38
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +0 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +0 -8
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.js +0 -36
- package/dist/src/decorators/handlers/custom/ags-attribute.js.map +0 -1
- package/dist/src/decorators/handlers/custom/index.d.ts +0 -3
- package/dist/src/decorators/handlers/custom/index.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/index.js +0 -3
- package/dist/src/decorators/handlers/custom/index.js.map +0 -1
- package/dist/src/decorators/handlers/index.d.ts +0 -31
- package/dist/src/decorators/handlers/index.d.ts.map +0 -1
- package/dist/src/decorators/handlers/index.js +0 -121
- package/dist/src/decorators/handlers/index.js.map +0 -1
package/lib/lib.tsp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../dist/src/index.js";
|
|
2
|
-
import "@typespec/
|
|
2
|
+
import "@typespec/http";
|
|
3
3
|
|
|
4
4
|
using TypeSpec.Http;
|
|
5
5
|
namespace TypeSpec.MsGraph;
|
|
@@ -8,28 +8,23 @@ scalar date;
|
|
|
8
8
|
|
|
9
9
|
scalar stream;
|
|
10
10
|
|
|
11
|
-
model ResourceResponse {}
|
|
12
|
-
|
|
13
11
|
model EmptyParameters {}
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
// --- Base interfaces for all interfaces that contain operations returning entities.
|
|
14
|
+
interface SingleNavigationSource<T> {}
|
|
15
|
+
interface CollectionNavigationSource<T> {}
|
|
16
16
|
|
|
17
|
-
interface
|
|
18
|
-
@head _isOperation(@path id: string): T;
|
|
17
|
+
interface Resource<T> extends SingleNavigationSource<T> {
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
interface
|
|
22
|
-
@head _isOperation(): T[];
|
|
20
|
+
interface Collection<T> extends CollectionNavigationSource<T> {
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
interface Singleton<T> {
|
|
26
|
-
@head _isNavigationSource(@path id: string): T;
|
|
23
|
+
interface Singleton<T> extends SingleNavigationSource<T> {
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
interface EntitySet<T> {
|
|
30
|
-
@head _isNavigationSource(): T[];
|
|
26
|
+
interface EntitySet<T> extends CollectionNavigationSource<T> {
|
|
31
27
|
}
|
|
32
28
|
|
|
33
|
-
interface EntitySetResource<T> {
|
|
34
|
-
@head _isNavigationSource(@path id: string): T[];
|
|
29
|
+
interface EntitySetResource<T> extends SingleNavigationSource<T> {
|
|
35
30
|
}
|
package/lib/msgraph.tsp
CHANGED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// -------------------------------------------------
|
|
2
|
+
// porcelain.tsp
|
|
3
|
+
// Operation templates to provide a much-simplified syntax for defining standard Graph operations.
|
|
4
|
+
// -------------------------------------------------
|
|
5
|
+
import "@typespec/http";
|
|
6
|
+
import "./lib.tsp";
|
|
7
|
+
import "./shared-models.tsp";
|
|
8
|
+
import "./responses.tsp";
|
|
9
|
+
|
|
10
|
+
using TypeSpec.Http;
|
|
11
|
+
using TypeSpec.MsGraph;
|
|
12
|
+
using TypeSpec.MsGraph.SharedModels;
|
|
13
|
+
using TypeSpec.MsGraph.Responses;
|
|
14
|
+
|
|
15
|
+
namespace TypeSpec.MsGraph;
|
|
16
|
+
|
|
17
|
+
namespace Foundations {
|
|
18
|
+
|
|
19
|
+
@doc("Foundational operations for individual resources and collections.")
|
|
20
|
+
interface GraphFoundations {
|
|
21
|
+
op Operation<TParams, TResponse, TErrorResponse>(
|
|
22
|
+
...TParams
|
|
23
|
+
): TResponse | TErrorResponse;
|
|
24
|
+
|
|
25
|
+
op ResourceOperation<
|
|
26
|
+
TResource extends {},
|
|
27
|
+
TParams,
|
|
28
|
+
TResponse,
|
|
29
|
+
TErrorResponse = ResourceErrorResponse
|
|
30
|
+
> is GraphFoundations.Operation<TParams, TResponse, TErrorResponse>;
|
|
31
|
+
|
|
32
|
+
op CollectionOperation<
|
|
33
|
+
TResource extends {},
|
|
34
|
+
TParams,
|
|
35
|
+
TResponse,
|
|
36
|
+
TErrorResponse = CollectionErrorResponse
|
|
37
|
+
> is GraphFoundations.Operation<TParams, TResponse, TErrorResponse>;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@doc("Primary operation shapes for Microsoft Graph")
|
|
42
|
+
interface GraphOps {
|
|
43
|
+
|
|
44
|
+
// TODO: This is how we should make $select standard for Graph. Define a select decorator and use it here.
|
|
45
|
+
// @select("*")
|
|
46
|
+
@get op GetCollection<
|
|
47
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
48
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
49
|
+
TResponse = CollectionResponse<TResource>,
|
|
50
|
+
TErrorResponse = CollectionErrorResponse
|
|
51
|
+
> is Foundations.GraphFoundations.CollectionOperation<
|
|
52
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
53
|
+
|
|
54
|
+
// @select("*")
|
|
55
|
+
@get op GetPagedCollection<
|
|
56
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
57
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
58
|
+
TResponse = PagedCollectionResponse<TResource>,
|
|
59
|
+
TErrorResponse = CollectionErrorResponse
|
|
60
|
+
> is Foundations.GraphFoundations.CollectionOperation<
|
|
61
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
62
|
+
|
|
63
|
+
// TODO: GetDelta? FUnction etc.?
|
|
64
|
+
|
|
65
|
+
// @select("*")
|
|
66
|
+
@post op Post<
|
|
67
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
68
|
+
TParams = { ... Automatic.GraphRouteParams, @body body: TResource },
|
|
69
|
+
TResponse = ResourceCreatedResponse<TResource>,
|
|
70
|
+
TErrorResponse = CollectionErrorResponse
|
|
71
|
+
> is Foundations.GraphFoundations.CollectionOperation<
|
|
72
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
73
|
+
|
|
74
|
+
// @select("*")
|
|
75
|
+
@get op GetResource<
|
|
76
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
77
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
78
|
+
TResponse = ResourceResponse<TResource>,
|
|
79
|
+
TErrorResponse = ResourceErrorResponse
|
|
80
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
81
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
82
|
+
|
|
83
|
+
@delete op Delete<
|
|
84
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
85
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
86
|
+
TResponse = EmptyResponse,
|
|
87
|
+
TErrorResponse = ResourceErrorResponse
|
|
88
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
89
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
90
|
+
|
|
91
|
+
@patch op PatchNoResponse<
|
|
92
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
93
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
94
|
+
TResponse = EmptyResponse,
|
|
95
|
+
TErrorResponse = ResourceErrorResponse
|
|
96
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
97
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
98
|
+
|
|
99
|
+
// @select("*")
|
|
100
|
+
@patch op PatchWithResponse<
|
|
101
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
102
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
103
|
+
TResponse = ResourceResponse<TResource>,
|
|
104
|
+
TErrorResponse = ResourceErrorResponse
|
|
105
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
106
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
107
|
+
|
|
108
|
+
@put op PutNoResponse<
|
|
109
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
110
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
111
|
+
TResponse = EmptyResponse,
|
|
112
|
+
TErrorResponse = ResourceErrorResponse
|
|
113
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
114
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
115
|
+
|
|
116
|
+
// @select("*")
|
|
117
|
+
@put op PutWithResponse<
|
|
118
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
119
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
120
|
+
TResponse = ResourceResponse<TResource>,
|
|
121
|
+
TErrorResponse = ResourceErrorResponse
|
|
122
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
123
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
namespace Automatic {
|
|
128
|
+
@doc("Marker type to allow injection of parameters from @route decorator.")
|
|
129
|
+
model GraphRouteParams { graphRouteParams: string }
|
|
130
|
+
|
|
131
|
+
// TODO: Needs direct support in the graphRoute decorator code to be able to make use of this.
|
|
132
|
+
@doc("Marker type to indicate to emitter that it should calculate resource from the Resource type of the containing interface's extended interface.")
|
|
133
|
+
model CalculatedResourceType {}
|
|
134
|
+
}
|
|
135
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// -------------------------------------------------
|
|
2
|
+
// responses.tsp
|
|
3
|
+
// Standard responses that Graph will return.
|
|
4
|
+
// -------------------------------------------------
|
|
5
|
+
import "@typespec/http";
|
|
6
|
+
import "@microsoft/typespec-msgraph";
|
|
7
|
+
import "./shared-models.tsp";
|
|
8
|
+
|
|
9
|
+
using TypeSpec.Http;
|
|
10
|
+
using TypeSpec.MsGraph;
|
|
11
|
+
using TypeSpec.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 TypeSpec.MsGraph.Responses.Bodies {
|
|
18
|
+
|
|
19
|
+
@error
|
|
20
|
+
model ErrorBody {
|
|
21
|
+
error: publicError;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
model ResourceBody<TResource> {
|
|
25
|
+
...TResource;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
model CollectionBody<TResource> {
|
|
29
|
+
value: TResource[];
|
|
30
|
+
`@odata.count`?: int64;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@pagedCollection
|
|
34
|
+
model PagedCollectionBody<TResource> is CollectionBody<TResource> {
|
|
35
|
+
`@odata.nextLink`?: url;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@pagedCollection
|
|
39
|
+
@deltaCollection
|
|
40
|
+
model DeltaCollectionBody<TResource> is PagedCollectionBody<TResource> {
|
|
41
|
+
`@odata.deltaLink`?: url;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Response models represent the response as a whole, including the status code, headers, and body.
|
|
46
|
+
namespace TypeSpec.MsGraph.Responses {
|
|
47
|
+
@doc("Response to represent a Microsoft Graph collection response payload.")
|
|
48
|
+
model CollectionResponse<TResource, TStatus = 200, TBody = Bodies.CollectionBody<TResource>>
|
|
49
|
+
is Http.Response<TStatus> {
|
|
50
|
+
...Http.Body<TBody>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@doc("Response to represent a Microsoft Graph paged collection response payload.")
|
|
54
|
+
model PagedCollectionResponse<TResource, TStatus = 200, TBody = Bodies.PagedCollectionBody<TResource>>
|
|
55
|
+
is CollectionResponse<TResource, TStatus, TBody>;
|
|
56
|
+
|
|
57
|
+
@doc("Response to represent a Microsoft Graph individual resource response payload.")
|
|
58
|
+
model ResourceResponse<TResource, TStatus = 200, TBody = Bodies.ResourceBody<TResource>>
|
|
59
|
+
is Http.Response<TStatus> {
|
|
60
|
+
...Http.Body<TBody>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@doc("Response to represent a Microsoft Graph resource creation response payload.")
|
|
64
|
+
model ResourceCreatedResponse<TResource, TStatus = 201, TBody = Bodies.ResourceBody<TResource>>
|
|
65
|
+
is ResourceResponse<TResource, TStatus, TBody> {
|
|
66
|
+
...Http.LocationHeader
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@doc("Response to represent a Microsoft Graph empty response payload.")
|
|
70
|
+
model EmptyResponse
|
|
71
|
+
is Http.Response<204>;
|
|
72
|
+
|
|
73
|
+
@doc("Response to represent a Microsoft Graph error response payload.")
|
|
74
|
+
model ErrorResponse<TStatus>
|
|
75
|
+
is Http.Response<TStatus> {
|
|
76
|
+
...Http.Body<Bodies.ErrorBody>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
alias ResourceErrorResponse = ErrorResponse<400 | 404 | 429>;
|
|
80
|
+
alias CollectionErrorResponse = ErrorResponse<400 | 429>;
|
|
81
|
+
|
|
82
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// -------------------------------------------------
|
|
2
|
+
// shared-models.tsp
|
|
3
|
+
// Common types shared among many workloads on Microsoft Graph
|
|
4
|
+
// -------------------------------------------------
|
|
5
|
+
import "@microsoft/typespec-msgraph";
|
|
6
|
+
|
|
7
|
+
using TypeSpec.MsGraph;
|
|
8
|
+
|
|
9
|
+
namespace TypeSpec.MsGraph.SharedModels;
|
|
10
|
+
|
|
11
|
+
// TODO: Spec how to deal with specified and unspecified ultimate base entities w.r.t. AGS runtime replacement policies. See #140
|
|
12
|
+
@doc("The primary entity base model for Microsoft Graph.")
|
|
13
|
+
@entity
|
|
14
|
+
model msGraphEntity {
|
|
15
|
+
@key id: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@doc("Complex type to represent an identity principal by id, when a human-readable name is also useful.")
|
|
19
|
+
@complex
|
|
20
|
+
@open
|
|
21
|
+
model identity {
|
|
22
|
+
id: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@doc("Complex type to represent a group of identity principals used at a point in time, such as createdBy, lastModifiedBy.")
|
|
27
|
+
@complex
|
|
28
|
+
@open
|
|
29
|
+
model identitySet {
|
|
30
|
+
user: identity | null;
|
|
31
|
+
device: identity | null;
|
|
32
|
+
application: identity | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@doc("Enum for identifying the format of a text string.")
|
|
36
|
+
enum bodyType {
|
|
37
|
+
text,
|
|
38
|
+
html
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@doc("Complex type to represent a chunk of text that could be either plain text or html.")
|
|
42
|
+
@complex
|
|
43
|
+
model itemBody {
|
|
44
|
+
contentType: bodyType;
|
|
45
|
+
content: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@doc("Scalar type for URLs that would be expected to work in the browser address bar.")
|
|
49
|
+
scalar webUrl extends string;
|
|
50
|
+
|
|
51
|
+
@doc("Scalar type for URLs that represent Graph APIs.")
|
|
52
|
+
scalar url extends string;
|
|
53
|
+
|
|
54
|
+
@doc("Complex type to represent a nested error that potentially has other recursive nested errors.")
|
|
55
|
+
@complex
|
|
56
|
+
@open
|
|
57
|
+
model innerError {
|
|
58
|
+
code: string;
|
|
59
|
+
innererror: innerError | null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@doc("""
|
|
63
|
+
Complex type to represent a standard Microsoft Graph error.
|
|
64
|
+
{code}: The error code.
|
|
65
|
+
""")
|
|
66
|
+
@complex
|
|
67
|
+
@error
|
|
68
|
+
model publicError {
|
|
69
|
+
code: string;
|
|
70
|
+
message: string;
|
|
71
|
+
target: string | null;
|
|
72
|
+
innererror: innerError | null;
|
|
73
|
+
details: publicError[];
|
|
74
|
+
}
|
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.6",
|
|
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",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"clean": "rimraf ./dist ./temp",
|
|
41
|
-
"prebuild": "tsx src/decorators/attribute-builder.ts",
|
|
42
41
|
"build": "tsc -p .",
|
|
43
42
|
"watch": "tsc -p . --watch",
|
|
44
43
|
"test": "mocha",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-builder.d.ts","sourceRoot":"","sources":["../../../src/decorators/attribute-builder.ts"],"names":[],"mappings":""}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from "fs";
|
|
2
|
-
import path, { join } from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { attributes } from "./attributes.js";
|
|
5
|
-
const mapTargetToType = (target) => {
|
|
6
|
-
switch (target) {
|
|
7
|
-
case "Model":
|
|
8
|
-
return "Model";
|
|
9
|
-
case "ModelProperty":
|
|
10
|
-
return "ModelProperty";
|
|
11
|
-
case "Enum":
|
|
12
|
-
return "Enum";
|
|
13
|
-
case "EnumMember":
|
|
14
|
-
return "EnumMember";
|
|
15
|
-
case "Operation":
|
|
16
|
-
return "Operation";
|
|
17
|
-
case "Namespace":
|
|
18
|
-
return "Namespace";
|
|
19
|
-
default:
|
|
20
|
-
throw new Error("Should not reach here");
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const writeDecoratorsFile = () => {
|
|
24
|
-
let data = writeHeader();
|
|
25
|
-
data += writeImports();
|
|
26
|
-
attributes.forEach((attribute) => {
|
|
27
|
-
data += writeDecorator(attribute);
|
|
28
|
-
});
|
|
29
|
-
data += writeDecoratorMappings();
|
|
30
|
-
data += writeBuildAttributesFunc();
|
|
31
|
-
const __fileName = fileURLToPath(import.meta.url);
|
|
32
|
-
const __dirname = path.dirname(__fileName);
|
|
33
|
-
writeFileSync(join(__dirname, "handlers", "index.ts"), data, { flag: "w" });
|
|
34
|
-
// eslint-disable-next-line no-console
|
|
35
|
-
console.log("🚀 Success! 🚀");
|
|
36
|
-
};
|
|
37
|
-
const writeHeader = () => {
|
|
38
|
-
return `
|
|
39
|
-
/**
|
|
40
|
-
* NOTICE: This is an autogenerated file and should not be edited directly.
|
|
41
|
-
*/
|
|
42
|
-
`;
|
|
43
|
-
};
|
|
44
|
-
const writeImports = () => {
|
|
45
|
-
return `
|
|
46
|
-
import {
|
|
47
|
-
createDecoratorDefinition,
|
|
48
|
-
DecoratorContext,
|
|
49
|
-
EnumMember,
|
|
50
|
-
Enum,
|
|
51
|
-
Interface,
|
|
52
|
-
Model,
|
|
53
|
-
ModelProperty,
|
|
54
|
-
Namespace,
|
|
55
|
-
Operation,
|
|
56
|
-
Program,
|
|
57
|
-
Type,
|
|
58
|
-
} from "@typespec/compiler";
|
|
59
|
-
import * as customAttribs from "./custom/index.js";
|
|
60
|
-
`;
|
|
61
|
-
};
|
|
62
|
-
let decoratorToMethodMap = [];
|
|
63
|
-
const writeDecoratorMappings = () => {
|
|
64
|
-
const customAttribs = attributes
|
|
65
|
-
.filter((attr) => !!attr.emitter)
|
|
66
|
-
.map((attr) => `${[attr.decorator]}: customAttribs.${attr.emitter}`);
|
|
67
|
-
decoratorToMethodMap = [...decoratorToMethodMap, ...customAttribs];
|
|
68
|
-
return `
|
|
69
|
-
const decoratorToMethodMapper: { [key: string]: (p: Program, t: Type) => boolean | string | { [key: string]: string } | undefined } = {
|
|
70
|
-
${decoratorToMethodMap.join(",\n ")}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const decoratorToAgsAttributeMapper: { [key: string]: string } = {
|
|
74
|
-
${attributes
|
|
75
|
-
.filter((attr) => !attr.emitter)
|
|
76
|
-
.map((attr) => `"${attr.decorator}": "ags:${attr.attribute.name}"`)
|
|
77
|
-
.join(",\n ")}
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
};
|
|
81
|
-
const addGetMethod = (decorator) => {
|
|
82
|
-
const decoratorName = `${decorator[0].toUpperCase()}${decorator.substring(1)}`;
|
|
83
|
-
decoratorToMethodMap.push(`${decorator}: get${decoratorName}`);
|
|
84
|
-
return `
|
|
85
|
-
export function get${decoratorName}(program: Program, target: Type): string | undefined {
|
|
86
|
-
return program.stateMap(${decorator}Key).get(target);
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
};
|
|
90
|
-
const addBoolMethod = (decorator) => {
|
|
91
|
-
const decoratorName = `${decorator[0].toUpperCase()}${decorator.substring(1)}`;
|
|
92
|
-
decoratorToMethodMap.push(`${decorator}: is${decoratorName}`);
|
|
93
|
-
return `
|
|
94
|
-
export function is${decoratorName}(program: Program, target: Type): boolean {
|
|
95
|
-
return program.stateSet(${decorator}Key).has(target);
|
|
96
|
-
}
|
|
97
|
-
`;
|
|
98
|
-
};
|
|
99
|
-
const writeDecorator = (attribute) => {
|
|
100
|
-
var _a, _b;
|
|
101
|
-
if (attribute.emitter) {
|
|
102
|
-
return "";
|
|
103
|
-
}
|
|
104
|
-
return `
|
|
105
|
-
// -- @${attribute.decorator} decorator
|
|
106
|
-
|
|
107
|
-
const ${attribute.decorator}Key = Symbol("${attribute.decorator}");
|
|
108
|
-
const ${attribute.decorator}Decorator = createDecoratorDefinition({
|
|
109
|
-
name: "@${attribute.decorator}",
|
|
110
|
-
target: [${attribute.target.map((item) => `"${item}"`).join(", ")}],
|
|
111
|
-
${attribute.args
|
|
112
|
-
? `args: [ ${attribute.args.map((_) => '{ kind: "String" }').join(", ")} ]`
|
|
113
|
-
: `args: []`}
|
|
114
|
-
} as const);
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* ${attribute.description ? `\`@${attribute.decorator}\` - ${attribute.description}` : ""}
|
|
118
|
-
* \`@${attribute.decorator}\` can be applied to ${attribute.target.join(", ")}.
|
|
119
|
-
*/
|
|
120
|
-
export function $${attribute.decorator}(
|
|
121
|
-
context: DecoratorContext,
|
|
122
|
-
target: ${attribute.target.map((item) => mapTargetToType(item)).join(" | ")},
|
|
123
|
-
${attribute.args ? `${(_a = attribute.args) === null || _a === void 0 ? void 0 : _a.map((item) => `${item}: string`).join(", ")}` : ""}
|
|
124
|
-
) {
|
|
125
|
-
if (!${attribute.decorator}Decorator.validate(context, target, [${((_b = attribute.args) === null || _b === void 0 ? void 0 : _b.join(", ")) || ""}])) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
${attribute.args
|
|
130
|
-
? `context.program.stateMap(${attribute.decorator}Key).set(target, ${attribute.args[0]});`
|
|
131
|
-
: `context.program.stateSet(${attribute.decorator}Key).add(target);`}
|
|
132
|
-
}
|
|
133
|
-
${attribute.args ? addGetMethod(attribute.decorator) : addBoolMethod(attribute.decorator)}
|
|
134
|
-
`;
|
|
135
|
-
};
|
|
136
|
-
const writeBuildAttributesFunc = () => {
|
|
137
|
-
const decorators = attributes.map((attr) => `"${attr.decorator}"`).join(", ");
|
|
138
|
-
// generate a dict of customDecorators which will be used to unpack attribute values
|
|
139
|
-
return `
|
|
140
|
-
export function buildAttributes(
|
|
141
|
-
program: Program,
|
|
142
|
-
type: Model | ModelProperty | Namespace | Interface | Operation | Enum | EnumMember
|
|
143
|
-
) {
|
|
144
|
-
const declaredDecorators: string[] = [${decorators}];
|
|
145
|
-
let attrs = {};
|
|
146
|
-
type.decorators
|
|
147
|
-
// only handle declared decorators
|
|
148
|
-
.filter((d) => declaredDecorators.some((s) => s === d.decorator.name.substring(1)))
|
|
149
|
-
.forEach((d) => {
|
|
150
|
-
const attrName = d.decorator.name.substring(1); // name prefixed with $
|
|
151
|
-
let key = attrName as keyof typeof decoratorToMethodMapper;
|
|
152
|
-
const agsAttrParams = decoratorToMethodMapper[key](program, type);
|
|
153
|
-
if (typeof agsAttrParams === "object") {
|
|
154
|
-
attrs = { ...attrs, ...agsAttrParams };
|
|
155
|
-
} else {
|
|
156
|
-
key = attrName as keyof typeof decoratorToAgsAttributeMapper;
|
|
157
|
-
const agsAttr = decoratorToAgsAttributeMapper[key];
|
|
158
|
-
attrs = { ...attrs, ...{ [agsAttr]: agsAttrParams } };
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
return attrs;
|
|
162
|
-
}
|
|
163
|
-
`;
|
|
164
|
-
};
|
|
165
|
-
writeDecoratorsFile();
|
|
166
|
-
//# sourceMappingURL=attribute-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-builder.js","sourceRoot":"","sources":["../../../src/decorators/attribute-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,UAAU,EAAiB,MAAM,iBAAiB,CAAC;AAE5D,MAAM,eAAe,GAAG,CAAC,MAAc,EAAU,EAAE;IACjD,QAAQ,MAAM,EAAE;QACd,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,eAAe;YAClB,OAAO,eAAe,CAAC;QACzB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,WAAW;YACd,OAA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IAAI,CAAC,CAAC,CAAC,IAAI;QAC1F,CAAC,CAAC,4BAA4B,SAAS,CAAC,SAAS,mBACrD;;EAEA,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC;CACxF,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,GAAG,EAAE;IACpC,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE9E,oFAAoF;IAEpF,OAAO;;;;;0CAKiC,UAAU;;;;;;;;;;;;;;;;;;;GAmBjD,CAAC;AACJ,CAAC,CAAC;AAEF,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines the structure of an attribute
|
|
3
|
-
*/
|
|
4
|
-
export interface AttributeType {
|
|
5
|
-
decorator: string;
|
|
6
|
-
target: string[];
|
|
7
|
-
attribute: any;
|
|
8
|
-
description?: string;
|
|
9
|
-
args?: string[];
|
|
10
|
-
emitter?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* NOTE: If you need custom handlers you declare them here and
|
|
15
|
-
* create a separate file for it in ./decorators/handlers/custom
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* `@attributes` - declares supported ags:attributes
|
|
19
|
-
*/
|
|
20
|
-
export declare const attributes: ({
|
|
21
|
-
decorator: string;
|
|
22
|
-
description: string;
|
|
23
|
-
target: string[];
|
|
24
|
-
attribute: {
|
|
25
|
-
name: string;
|
|
26
|
-
};
|
|
27
|
-
args?: undefined;
|
|
28
|
-
emitter?: undefined;
|
|
29
|
-
} | {
|
|
30
|
-
decorator: string;
|
|
31
|
-
target: string[];
|
|
32
|
-
attribute: {
|
|
33
|
-
name: string;
|
|
34
|
-
};
|
|
35
|
-
description?: undefined;
|
|
36
|
-
args?: undefined;
|
|
37
|
-
emitter?: undefined;
|
|
38
|
-
} | {
|
|
39
|
-
decorator: string;
|
|
40
|
-
args: string[];
|
|
41
|
-
target: string[];
|
|
42
|
-
attribute: {
|
|
43
|
-
name: string;
|
|
44
|
-
};
|
|
45
|
-
description?: undefined;
|
|
46
|
-
emitter?: undefined;
|
|
47
|
-
} | {
|
|
48
|
-
decorator: string;
|
|
49
|
-
args: string[];
|
|
50
|
-
target: string[];
|
|
51
|
-
emitter: string;
|
|
52
|
-
attribute: {
|
|
53
|
-
name: string;
|
|
54
|
-
};
|
|
55
|
-
description?: undefined;
|
|
56
|
-
})[];
|
|
57
|
-
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../src/decorators/attributes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,GAAG,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwCtB,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* NOTE: If you need custom handlers you declare them here and
|
|
4
|
-
* create a separate file for it in ./decorators/handlers/custom
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* `@attributes` - declares supported ags:attributes
|
|
8
|
-
*/
|
|
9
|
-
export const attributes = [
|
|
10
|
-
{
|
|
11
|
-
decorator: "isOwner",
|
|
12
|
-
description: "specify the name of the workload associated with the model",
|
|
13
|
-
target: ["Model", "ModelProperty", "Enum", "EnumMember"],
|
|
14
|
-
attribute: { name: "IsOwner" },
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
decorator: "privileged",
|
|
18
|
-
target: ["Model", "ModelProperty", "Enum", "EnumMember", "Operation", "Namespace"],
|
|
19
|
-
attribute: { name: "IsHidden" },
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
decorator: "workloadName",
|
|
23
|
-
args: ["workloadName"],
|
|
24
|
-
target: ["Model", "ModelProperty", "Enum", "EnumMember"],
|
|
25
|
-
attribute: { name: "WorkloadName" },
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
decorator: "workloadNameMsa",
|
|
29
|
-
args: ["workloadNameMsa"],
|
|
30
|
-
target: ["Model", "ModelProperty", "Enum", "EnumMember"],
|
|
31
|
-
attribute: { name: "WorkloadNameMsa" },
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
decorator: "additionalQueryParameters",
|
|
35
|
-
args: ["name", "value"],
|
|
36
|
-
target: ["Namespace"],
|
|
37
|
-
emitter: "unpackAdditionalQueryParameters",
|
|
38
|
-
attribute: {
|
|
39
|
-
name: "AdditionalQueryParameters",
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
decorator: "agsAttribute",
|
|
44
|
-
args: ["name", "value"],
|
|
45
|
-
target: ["Model", "ModelProperty", "Enum", "EnumMember", "Interface", "Operation"],
|
|
46
|
-
emitter: "unpackAgsAttributes",
|
|
47
|
-
attribute: { name: "AgsAttribute" },
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
//# sourceMappingURL=attributes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../src/decorators/attributes.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AAEH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AAE;KACpC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator-parameter.d.ts","sourceRoot":"","sources":["../../../src/decorators/decorator-parameter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;CACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator-parameter.js","sourceRoot":"","sources":["../../../src/decorators/decorator-parameter.ts"],"names":[],"mappings":""}
|