@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
|
@@ -1,119 +1,82 @@
|
|
|
1
1
|
import { getDoc, isKey } from "@typespec/compiler";
|
|
2
2
|
import { GetRevisionDefinition } from "./revision-definition.js";
|
|
3
|
-
import {
|
|
4
|
-
import { isNavigationProperty, isTypeNullable, getPropertyTypeName, getIdForType } from "../utils.js";
|
|
3
|
+
import { isContains, isComputed, isReadOnly, isWriteOnly, isAlternateKey, isComplex, getStreamTypes, isEntity, isOpen, hasStream, isAbstract, } from "../index.js";
|
|
4
|
+
import { isNavigationProperty, isTypeNullable, getPropertyTypeName, getIdForType, } from "../utils.js";
|
|
5
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
5
6
|
export var MsGraphModelKind;
|
|
6
7
|
(function (MsGraphModelKind) {
|
|
7
8
|
MsGraphModelKind[MsGraphModelKind["Unknown"] = 0] = "Unknown";
|
|
8
9
|
MsGraphModelKind[MsGraphModelKind["Entity"] = 1] = "Entity";
|
|
9
10
|
MsGraphModelKind[MsGraphModelKind["Complex"] = 2] = "Complex";
|
|
10
11
|
})(MsGraphModelKind = MsGraphModelKind || (MsGraphModelKind = {}));
|
|
11
|
-
export function
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Properties: {
|
|
18
|
-
StructuredType: getStructuredType(program, model),
|
|
19
|
-
KeyProperty: [...model.properties].find(([_, property]) => isKey(program, property)),
|
|
20
|
-
Properties: [...model.properties]
|
|
21
|
-
.map(([_, v]) => {
|
|
22
|
-
var _a;
|
|
23
|
-
return {
|
|
24
|
-
Name: v.name,
|
|
25
|
-
IsNavigation: isNavigationProperty(program, v),
|
|
26
|
-
IsNullable: isTypeNullable(program, v.type),
|
|
27
|
-
AgsAttributes: buildAttributes(program, v),
|
|
28
|
-
PropertyTypeName: getPropertyTypeName(program, v.type),
|
|
29
|
-
IsContained: isContains(program, v),
|
|
30
|
-
IsComputed: isComputed(program, v),
|
|
31
|
-
Permission: isReadOnly(program, v)
|
|
32
|
-
? "Read"
|
|
33
|
-
: isWriteOnly(program, v)
|
|
34
|
-
? "Write"
|
|
35
|
-
: null,
|
|
36
|
-
RevisionDefinition: GetRevisionDefinition(program, v, (_a = v.model) === null || _a === void 0 ? void 0 : _a.namespace),
|
|
37
|
-
Description: getDoc(program, v)
|
|
38
|
-
};
|
|
39
|
-
}),
|
|
40
|
-
AlternateKeys: [...model.properties]
|
|
41
|
-
.filter(([_, v]) => isAlternateKey(program, v))
|
|
42
|
-
.map(([_, key]) => {
|
|
43
|
-
const altProp = key;
|
|
44
|
-
altProp.IsModel = key.type.kind === "Model" && !isComplex(program, key.type);
|
|
45
|
-
return altProp;
|
|
46
|
-
}),
|
|
47
|
-
StreamTypes: getStreamTypes(program, model),
|
|
48
|
-
RevisionDefinition: GetRevisionDefinition(program, model, model.namespace),
|
|
49
|
-
Description: getDoc(program, model)
|
|
50
|
-
}
|
|
51
|
-
};
|
|
12
|
+
export function GetMsGraphModels(program, models) {
|
|
13
|
+
const map = new Map();
|
|
14
|
+
models.forEach((m, key) => {
|
|
15
|
+
const model = getMsGraphModel(program, m);
|
|
16
|
+
if (model) {
|
|
17
|
+
map.set(key, model);
|
|
52
18
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Kind: kind,
|
|
56
|
-
Properties: {
|
|
57
|
-
StructuredType: getStructuredType(program, model),
|
|
58
|
-
Properties: [...model.properties]
|
|
59
|
-
.map(([_, v]) => {
|
|
60
|
-
var _a;
|
|
61
|
-
return {
|
|
62
|
-
Name: v.name,
|
|
63
|
-
IsNavigation: isNavigationProperty(program, v),
|
|
64
|
-
IsNullable: isTypeNullable(program, v.type),
|
|
65
|
-
AgsAttributes: buildAttributes(program, v),
|
|
66
|
-
PropertyTypeName: getPropertyTypeName(program, v.type),
|
|
67
|
-
IsContained: isContains(program, v),
|
|
68
|
-
IsComputed: isComputed(program, v),
|
|
69
|
-
Permission: isReadOnly(program, v)
|
|
70
|
-
? "Read"
|
|
71
|
-
: isWriteOnly(program, v)
|
|
72
|
-
? "Write"
|
|
73
|
-
: null,
|
|
74
|
-
RevisionDefinition: GetRevisionDefinition(program, v, (_a = v.model) === null || _a === void 0 ? void 0 : _a.namespace),
|
|
75
|
-
Description: getDoc(program, v)
|
|
76
|
-
};
|
|
77
|
-
}),
|
|
78
|
-
RevisionDefinition: GetRevisionDefinition(program, model, model.namespace),
|
|
79
|
-
Description: getDoc(program, model)
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
default: {
|
|
84
|
-
return {
|
|
85
|
-
Kind: kind,
|
|
86
|
-
Properties: undefined,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
19
|
+
});
|
|
20
|
+
return map;
|
|
90
21
|
}
|
|
91
|
-
function
|
|
22
|
+
function getMsGraphModel(program, model) {
|
|
23
|
+
let kind = MsGraphModelKind.Unknown;
|
|
92
24
|
if (isEntity(program, model)) {
|
|
93
|
-
|
|
25
|
+
kind = MsGraphModelKind.Entity;
|
|
94
26
|
}
|
|
95
27
|
else if (isComplex(program, model)) {
|
|
96
|
-
|
|
28
|
+
kind = MsGraphModelKind.Complex;
|
|
97
29
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
30
|
+
else {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
Kind: kind,
|
|
102
35
|
Name: model.name,
|
|
36
|
+
IsAbstract: isAbstract(program, model),
|
|
37
|
+
BaseType: model.baseModel ? getIdForType(program, model.baseModel) : undefined,
|
|
38
|
+
IsOpenType: isOpen(program, model),
|
|
39
|
+
HasStream: hasStream(program, model),
|
|
40
|
+
AgsAttributes: buildAttributes(program, model),
|
|
41
|
+
RevisionDefinition: GetRevisionDefinition(program, model, model.namespace),
|
|
42
|
+
Description: getDoc(program, model),
|
|
43
|
+
KeyProperty: kind === MsGraphModelKind.Entity ? [...model.properties].find(([_, property]) => isKey(program, property)) : undefined,
|
|
44
|
+
AlternateKeys: kind === MsGraphModelKind.Entity ? getAlternateKeys(program, model.properties) : [],
|
|
45
|
+
StreamTypes: kind === MsGraphModelKind.Entity ? getStreamTypes(program, model) : [],
|
|
46
|
+
Properties: getModelProperties(program, model.properties),
|
|
103
47
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
48
|
+
}
|
|
49
|
+
function getModelProperties(program, properties) {
|
|
50
|
+
return [...properties].map(([_, v]) => {
|
|
51
|
+
var _a;
|
|
52
|
+
return {
|
|
53
|
+
Name: v.name,
|
|
54
|
+
IsNavigation: isNavigationProperty(program, v),
|
|
55
|
+
IsNullable: isTypeNullable(program, v.type),
|
|
56
|
+
AgsAttributes: buildAttributes(program, v),
|
|
57
|
+
PropertyTypeName: getPropertyTypeName(program, v.type),
|
|
58
|
+
IsContained: isContains(program, v),
|
|
59
|
+
IsComputed: isComputed(program, v),
|
|
60
|
+
Permission: isReadOnly(program, v)
|
|
61
|
+
? "Read"
|
|
62
|
+
: isWriteOnly(program, v)
|
|
63
|
+
? "Write"
|
|
64
|
+
: null,
|
|
65
|
+
RevisionDefinition: GetRevisionDefinition(program, v, (_a = v.model) === null || _a === void 0 ? void 0 : _a.namespace),
|
|
66
|
+
Description: getDoc(program, v),
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function getAlternateKeys(program, properties) {
|
|
71
|
+
const result = new Array();
|
|
72
|
+
properties.forEach(v => {
|
|
73
|
+
if (isAlternateKey(program, v)) {
|
|
74
|
+
result.push({
|
|
75
|
+
IsModel: v.type.kind === "Model" && !isComplex(program, v.type),
|
|
76
|
+
ModelProperty: v,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return result;
|
|
118
81
|
}
|
|
119
82
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAC;AACrF,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,cAAc,EACd,QAAQ,EACR,MA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program } from "@typespec/compiler";
|
|
2
2
|
import { MsGraphEnum } from "./enum.js";
|
|
3
3
|
import { MsGraphModel } from "./model.js";
|
|
4
|
-
import {
|
|
4
|
+
import { EntitySet, Singleton } from "./entity-container.js";
|
|
5
5
|
import { MsGraphOperation } from "./operation.js";
|
|
6
|
+
import { EntitySetAnnotations, SingletonAnnotations } from "./annotations.js";
|
|
6
7
|
export interface MsGraphNamespace {
|
|
7
8
|
Name: string;
|
|
8
9
|
Enums: MsGraphEnum[];
|
|
9
|
-
Models: MsGraphModel
|
|
10
|
-
|
|
10
|
+
Models: Map<string, MsGraphModel>;
|
|
11
|
+
AgsAttributes: Record<string, string>;
|
|
12
|
+
Singletons: Map<string, Singleton>;
|
|
13
|
+
EntitySets: Map<string, EntitySet>;
|
|
11
14
|
Operations: MsGraphOperation[];
|
|
15
|
+
EntitySetAnnotations: Map<string, EntitySetAnnotations>;
|
|
16
|
+
SingletonAnnotations: Map<string, SingletonAnnotations>;
|
|
12
17
|
}
|
|
13
18
|
export declare function GetMsGraphNamespaces(program: Program): MsGraphNamespace[];
|
|
14
19
|
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,OAAO,EAAQ,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAA6B,WAAW,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAoB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAgC,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAwB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAoD,MAAM,kBAAkB,CAAC;AAGhI,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACxD,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACzD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAOzE"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { getNamespaceName, isExcludedCoreType } from "../utils.js";
|
|
1
|
+
import { getInterfacesOfKinds, getNamespaceName, isExcludedCoreType, isNavigationSource } from "../utils.js";
|
|
2
2
|
import { GetMsGraphEnumTypeElement } from "./enum.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { GetMsGraphModels } from "./model.js";
|
|
4
|
+
import { GetEntitySets, GetSingletons } from "./entity-container.js";
|
|
5
|
+
import { GetMsGraphOperations } from "./operation.js";
|
|
6
|
+
import { GetEntitySetAnnotations, GetSingletonAnnotations } from "./annotations.js";
|
|
7
|
+
import { buildAttributes } from "../index.js";
|
|
6
8
|
export function GetMsGraphNamespaces(program) {
|
|
7
9
|
const root = program.checker.getGlobalNamespaceType();
|
|
8
10
|
const namespaces = expandNamespaces(root)
|
|
@@ -22,20 +24,36 @@ function hasChildren(type) {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
function getMsGraphNamespace(program, namespace) {
|
|
25
|
-
const
|
|
27
|
+
const namespaceName = getNamespaceName(program, namespace);
|
|
28
|
+
const models = GetMsGraphModels(program, namespace.models);
|
|
26
29
|
const enums = [...namespace.enums].map(([_, e]) => GetMsGraphEnumTypeElement(program, e));
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const sources = getNavigationSources(namespace.interfaces);
|
|
31
|
+
const singletonSources = getInterfacesOfKinds(program, sources, ["Singleton"]);
|
|
32
|
+
const entitySetSources = getInterfacesOfKinds(program, sources, ["EntitySet", "EntitySetResource"]);
|
|
33
|
+
const singletons = GetSingletons(program, singletonSources);
|
|
34
|
+
const entitySets = GetEntitySets(program, entitySetSources);
|
|
35
|
+
const singletonAnnotations = GetSingletonAnnotations(program, namespaceName, singletonSources);
|
|
36
|
+
const entitySetAnnotations = GetEntitySetAnnotations(program, namespaceName, entitySetSources);
|
|
37
|
+
const operations = GetMsGraphOperations(program, namespace.interfaces);
|
|
33
38
|
return {
|
|
34
|
-
Name:
|
|
39
|
+
Name: namespaceName,
|
|
35
40
|
Enums: enums,
|
|
36
41
|
Models: models,
|
|
37
|
-
|
|
42
|
+
AgsAttributes: buildAttributes(program, namespace),
|
|
43
|
+
Singletons: singletons,
|
|
44
|
+
EntitySets: entitySets,
|
|
45
|
+
SingletonAnnotations: singletonAnnotations,
|
|
46
|
+
EntitySetAnnotations: entitySetAnnotations,
|
|
38
47
|
Operations: operations,
|
|
39
48
|
};
|
|
40
49
|
}
|
|
50
|
+
function getNavigationSources(interfaces) {
|
|
51
|
+
const navigationSources = new Map();
|
|
52
|
+
interfaces.forEach((theInterface, key) => {
|
|
53
|
+
if (isNavigationSource(theInterface)) {
|
|
54
|
+
navigationSources.set(key, theInterface);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return navigationSources;
|
|
58
|
+
}
|
|
41
59
|
//# sourceMappingURL=namespace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAE,yBAAyB,EAAe,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAgB,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAa,aAAa,EAAE,aAAa,EAAa,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAoB,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAA8C,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChI,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAc9C,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAQ,CAAC,sBAAsB,EAAE,CAAC;IACvD,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC;SACtC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC;SACxF,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/D,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,gBAAgB,CAAC,SAAoB;IAC5C,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,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,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,OAAO,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAE/F,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAEvE,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,MAAM;QACd,aAAa,EAAE,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC;QAClD,UAAU,EAAE,UAAU;QACtB,UAAU,EAAE,UAAU;QACtB,oBAAoB,EAAE,oBAAoB;QAC1C,oBAAoB,EAAE,oBAAoB;QAC1C,UAAU,EAAE,UAAU;KACvB,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAkC;IAC9D,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEvD,UAAU,CAAC,OAAO,CAAC,CAAC,YAAuB,EAAE,GAAW,EAAE,EAAE;QAC1D,IAAI,kBAAkB,CAAC,YAAY,CAAC,EAAE;YACpC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;SAC1C;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Program,
|
|
1
|
+
import { Program, Interface } from "@typespec/compiler";
|
|
2
2
|
export declare enum OperationKind {
|
|
3
3
|
Unknown = 0,
|
|
4
4
|
Action = 1,
|
|
@@ -24,5 +24,5 @@ export interface MsGraphOperationProperty {
|
|
|
24
24
|
DefaultValue: Record<string, unknown> | undefined;
|
|
25
25
|
Description: string | undefined;
|
|
26
26
|
}
|
|
27
|
-
export declare function
|
|
27
|
+
export declare function GetMsGraphOperations(program: Program, interfaces: Map<string, Interface>): MsGraphOperation[];
|
|
28
28
|
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuD,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQ7G,oBAAY,aAAa;IACvB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,QAAQ,IAAA;CACT;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,wBAAwB,EAAE,CAAC;IACvC,eAAe,EAAE,wBAAwB,EAAE,EAAE,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,MAAM,WAAW,wBAAwB;IAEvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAClD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAgB,EAAE,CAuB7G"}
|
|
@@ -1,34 +1,49 @@
|
|
|
1
1
|
import { isVoidType, getDoc } from "@typespec/compiler";
|
|
2
2
|
import { isPathParam } from "@typespec/http";
|
|
3
3
|
import { getAction } from "@typespec/rest";
|
|
4
|
-
import {
|
|
5
|
-
import { isTypeNullable, getPropertyTypeName, extractTypesFromUnion } from "../utils.js";
|
|
4
|
+
import { getFunction, isOperationParameters } from "../index.js";
|
|
5
|
+
import { isTypeNullable, getPropertyTypeName, extractTypesFromUnion, getInterfaceNavigationSourceType } from "../utils.js";
|
|
6
6
|
import { getDefaultPropertyValue } from "./property.js";
|
|
7
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
7
8
|
export var OperationKind;
|
|
8
9
|
(function (OperationKind) {
|
|
9
10
|
OperationKind[OperationKind["Unknown"] = 0] = "Unknown";
|
|
10
11
|
OperationKind[OperationKind["Action"] = 1] = "Action";
|
|
11
12
|
OperationKind[OperationKind["Function"] = 2] = "Function";
|
|
12
13
|
})(OperationKind = OperationKind || (OperationKind = {}));
|
|
13
|
-
export function
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export function GetMsGraphOperations(program, interfaces) {
|
|
15
|
+
const operations = new Array();
|
|
16
|
+
[...interfaces].flatMap(([_, $interface]) => [...$interface.operations].filter(([_, $operation]) => [...$operation.decorators].filter(($decoratorApplication) => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return ((_a = $decoratorApplication.definition) === null || _a === void 0 ? void 0 : _a.name) === "@function" ||
|
|
19
|
+
((_b = $decoratorApplication.definition) === null || _b === void 0 ? void 0 : _b.name) === "@action";
|
|
20
|
+
}).length))
|
|
21
|
+
.forEach(([_, operation]) => {
|
|
22
|
+
const bindingTypeName = getBindingTypeName(program, operation);
|
|
23
|
+
if (!bindingTypeName) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
operations.push(GetMsGraphOperation(program, bindingTypeName, operation));
|
|
27
|
+
});
|
|
28
|
+
return operations;
|
|
29
|
+
}
|
|
30
|
+
function GetMsGraphOperation(program, bindingTypeName, operation) {
|
|
18
31
|
const element = {
|
|
19
32
|
Name: "",
|
|
20
33
|
Kind: OperationKind.Unknown,
|
|
21
34
|
BindingTypeName: bindingTypeName,
|
|
22
35
|
AgsAttributes: buildAttributes(program, operation),
|
|
23
36
|
Properties: getParameterProperties(program, operation.parameters.properties),
|
|
24
|
-
UnionProperties: new Array,
|
|
37
|
+
UnionProperties: new Array(),
|
|
25
38
|
IsVoid: isVoidType(operation.returnType),
|
|
26
39
|
IsNullable: false,
|
|
27
40
|
ReturnTypeName: "",
|
|
28
|
-
Description: getDoc(program, operation)
|
|
41
|
+
Description: getDoc(program, operation),
|
|
29
42
|
};
|
|
30
43
|
if (!element.IsVoid) {
|
|
31
|
-
const returnType = operation.returnType.kind === "Model" &&
|
|
44
|
+
const returnType = operation.returnType.kind === "Model" &&
|
|
45
|
+
!!operation.returnType.templateMapper &&
|
|
46
|
+
!!operation.returnType.templateMapper.args.length
|
|
32
47
|
? operation.returnType.templateMapper.args[0]
|
|
33
48
|
: operation.returnType;
|
|
34
49
|
if (!returnType || isVoidType(returnType)) {
|
|
@@ -59,8 +74,7 @@ export function GetMsGraphOperation(program, operation) {
|
|
|
59
74
|
return element;
|
|
60
75
|
}
|
|
61
76
|
function getBindingTypeName(program, operation) {
|
|
62
|
-
|
|
63
|
-
const bindingType = (_b = (_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.get("_isOperation")) === null || _b === void 0 ? void 0 : _b.returnType;
|
|
77
|
+
const bindingType = getInterfaceNavigationSourceType(program, operation.interface);
|
|
64
78
|
if (!bindingType) {
|
|
65
79
|
return undefined;
|
|
66
80
|
}
|
|
@@ -74,14 +88,16 @@ function getParameterProperties(program, parameters) {
|
|
|
74
88
|
if (property.type.kind === "Model" && isOperationParameters(program, property.type)) {
|
|
75
89
|
return getParameterProperties(program, property.type.properties);
|
|
76
90
|
}
|
|
77
|
-
return [
|
|
91
|
+
return [
|
|
92
|
+
{
|
|
78
93
|
Name: property.name,
|
|
79
94
|
IsNullable: isTypeNullable(program, property.type),
|
|
80
95
|
PropertyTypeName: getPropertyTypeName(program, property.type),
|
|
81
96
|
IsOptional: property.optional,
|
|
82
97
|
DefaultValue: getDefaultPropertyValue(program, property),
|
|
83
98
|
Description: getDoc(program, property),
|
|
84
|
-
}
|
|
99
|
+
},
|
|
100
|
+
];
|
|
85
101
|
});
|
|
86
102
|
return properties;
|
|
87
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/entities/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAE,MAAM,EAAmC,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,uDAAO,CAAA;IACP,qDAAM,CAAA;IACN,yDAAQ,CAAA;AACV,CAAC,EAJW,aAAa,GAAb,aAAa,KAAb,aAAa,QAIxB;AAyBD,MAAM,UAAU,oBAAoB,CAAC,OAAgB,EAAE,UAAkC;IACvF,MAAM,UAAU,GAAG,IAAI,KAAK,EAAoB,CAAC;IAEjD,CAAC,GAAG,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,CACxC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,M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,uBAAuB,CAAC,OAAO,EAAE,QAAQ,CAAC;gBACxD,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC;aACvC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/src/linter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAoC7C,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAG3C"}
|
package/dist/src/linter.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { getLinter } from "@typespec/lint";
|
|
2
2
|
import { $lib } from "./lib.js";
|
|
3
|
-
import
|
|
3
|
+
import * as theRules from "./rules/index.js";
|
|
4
4
|
const linter = getLinter($lib);
|
|
5
5
|
linter.registerRules([
|
|
6
|
-
abstractOnlyAppliesToStructuredTypeRule,
|
|
7
|
-
alternateKeyOnKeyRule,
|
|
8
|
-
alternateKeyOnPrimitivePropertyRule,
|
|
9
|
-
alternateKeyRequiresKeyRule,
|
|
10
|
-
computedCannotBeCombinedWithRule,
|
|
11
|
-
containsOnlyAppliesToNavigationPropertyRule,
|
|
12
|
-
countAppliesToGetOperationsThatReturnCollectionsRule,
|
|
13
|
-
disallowedTypeSpecDecoratorsRule,
|
|
14
|
-
entityMustHaveKeyRule,
|
|
15
|
-
expandOnlyNavigationPropertiesRule,
|
|
16
|
-
expandOnlyOnGetNavigationSourceRule,
|
|
17
|
-
extendsOnSameTypeRule,
|
|
18
|
-
hasStreamOnlyOnEntity,
|
|
19
|
-
keyOnlyOnEntityNonNullablePrimitivePropertyRule,
|
|
20
|
-
openOnlyAppliesToStructuredType,
|
|
21
|
-
operationInsideInterfaceRule,
|
|
22
|
-
orderByOnlyNonNavigationPropertiesRule,
|
|
23
|
-
|
|
24
|
-
referencesOnlyAppliesToNavigationPropertyRule,
|
|
25
|
-
searchAppliesToGetOperationsThatReturnCollectionsRule,
|
|
26
|
-
skipAppliesToGetOperationsThatReturnCollectionsRule,
|
|
27
|
-
topAppliesToGetOperationsThatReturnCollectionsRule,
|
|
28
|
-
useEvolvableEnumRule,
|
|
29
|
-
voidFunctionRule,
|
|
6
|
+
theRules.abstractOnlyAppliesToStructuredTypeRule,
|
|
7
|
+
theRules.alternateKeyOnKeyRule,
|
|
8
|
+
theRules.alternateKeyOnPrimitivePropertyRule,
|
|
9
|
+
theRules.alternateKeyRequiresKeyRule,
|
|
10
|
+
theRules.computedCannotBeCombinedWithRule,
|
|
11
|
+
theRules.containsOnlyAppliesToNavigationPropertyRule,
|
|
12
|
+
theRules.countAppliesToGetOperationsThatReturnCollectionsRule,
|
|
13
|
+
theRules.disallowedTypeSpecDecoratorsRule,
|
|
14
|
+
theRules.entityMustHaveKeyRule,
|
|
15
|
+
theRules.expandOnlyNavigationPropertiesRule,
|
|
16
|
+
theRules.expandOnlyOnGetNavigationSourceRule,
|
|
17
|
+
theRules.extendsOnSameTypeRule,
|
|
18
|
+
theRules.hasStreamOnlyOnEntity,
|
|
19
|
+
theRules.keyOnlyOnEntityNonNullablePrimitivePropertyRule,
|
|
20
|
+
theRules.openOnlyAppliesToStructuredType,
|
|
21
|
+
theRules.operationInsideInterfaceRule,
|
|
22
|
+
theRules.orderByOnlyNonNavigationPropertiesRule,
|
|
23
|
+
theRules.orderByAppliesToGetOperationsThatReturnCollectionsRule,
|
|
24
|
+
theRules.referencesOnlyAppliesToNavigationPropertyRule,
|
|
25
|
+
theRules.searchAppliesToGetOperationsThatReturnCollectionsRule,
|
|
26
|
+
theRules.skipAppliesToGetOperationsThatReturnCollectionsRule,
|
|
27
|
+
theRules.topAppliesToGetOperationsThatReturnCollectionsRule,
|
|
28
|
+
theRules.useEvolvableEnumRule,
|
|
29
|
+
theRules.voidFunctionRule,
|
|
30
30
|
], { autoEnable: true });
|
|
31
31
|
export function $onValidate(program) {
|
|
32
32
|
linter.autoEnableRules();
|
package/dist/src/linter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,
|
|
1
|
+
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAQ,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAC/B,MAAM,CAAC,aAAa,CAClB;IACE,QAAQ,CAAC,uCAAuC;IAChD,QAAQ,CAAC,qBAAqB;IAC9B,QAAQ,CAAC,mCAAmC;IAC5C,QAAQ,CAAC,2BAA2B;IACpC,QAAQ,CAAC,gCAAgC;IACzC,QAAQ,CAAC,2CAA2C;IACpD,QAAQ,CAAC,oDAAoD;IAC7D,QAAQ,CAAC,gCAAgC;IACzC,QAAQ,CAAC,qBAAqB;IAC9B,QAAQ,CAAC,kCAAkC;IAC3C,QAAQ,CAAC,mCAAmC;IAC5C,QAAQ,CAAC,qBAAqB;IAC9B,QAAQ,CAAC,qBAAqB;IAC9B,QAAQ,CAAC,+CAA+C;IACxD,QAAQ,CAAC,+BAA+B;IACxC,QAAQ,CAAC,4BAA4B;IACrC,QAAQ,CAAC,sCAAsC;IAC/C,QAAQ,CAAC,sDAAsD;IAC/D,QAAQ,CAAC,6CAA6C;IACtD,QAAQ,CAAC,qDAAqD;IAC9D,QAAQ,CAAC,mDAAmD;IAC5D,QAAQ,CAAC,kDAAkD;IAC3D,QAAQ,CAAC,oBAAoB;IAC7B,QAAQ,CAAC,gBAAgB;CAC1B,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,CAAC,eAAe,EAAE,CAAC;IACzB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../src/rules/count.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../src/rules/count.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,oDAAoD,mCA6B/D,CAAC"}
|
package/dist/src/rules/count.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRule } from "@typespec/lint";
|
|
2
2
|
import { getOperationVerb } from "@typespec/http";
|
|
3
3
|
import { isCount } from "../index.js";
|
|
4
|
+
import { isReturnTypeCollection } from "../utils.js";
|
|
4
5
|
import { reportDiagnostic } from "../lib.js";
|
|
5
6
|
/**
|
|
6
7
|
* @count applies to get operations that return collections.
|
|
@@ -15,7 +16,8 @@ export const countAppliesToGetOperationsThatReturnCollectionsRule = createRule({
|
|
|
15
16
|
}
|
|
16
17
|
if (getOperationVerb(program, operation) === "get") {
|
|
17
18
|
const returnType = operation.returnType;
|
|
18
|
-
|
|
19
|
+
const isCollection = isReturnTypeCollection(program, returnType);
|
|
20
|
+
if (isCollection) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"count.js","sourceRoot":"","sources":["../../../src/rules/count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBACjE,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,QAAQ;wBACnB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/rules/entity.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,mCA2BhC,CAAC;AAEH,eAAO,MAAM,+CAA+C,
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/rules/entity.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,mCA2BhC,CAAC;AAEH,eAAO,MAAM,+CAA+C,mCA4C1D,CAAC"}
|
package/dist/src/rules/entity.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isKey, walkPropertiesInherited } from "@typespec/compiler";
|
|
|
2
2
|
import { createRule } from "@typespec/lint";
|
|
3
3
|
import { isEntity } from "../index.js";
|
|
4
4
|
import { reportDiagnostic } from "../lib.js";
|
|
5
|
-
import { isTypeNullable } from "../utils.js";
|
|
5
|
+
import { isTypeNullable, isExcludedLibraryType } from "../utils.js";
|
|
6
6
|
export const entityMustHaveKeyRule = createRule({
|
|
7
7
|
name: "entity-must-have-key",
|
|
8
8
|
create({ program }) {
|
|
@@ -37,6 +37,9 @@ export const keyOnlyOnEntityNonNullablePrimitivePropertyRule = createRule({
|
|
|
37
37
|
if (!property.model || !isKey(program, property)) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
+
if (isExcludedLibraryType(program, property.model)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
40
43
|
if (!isEntity(program, property.model)) {
|
|
41
44
|
reportDiagnostic(program, {
|
|
42
45
|
code: "decorator-missing-dependencies",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/rules/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/rules/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;IAC9C,IAAI,EAAE,sBAAsB;IAC5B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC7B,OAAO;iBACR;gBAED,KAAK,MAAM,QAAQ,IAAI,uBAAuB,CAAC,KAAK,CAAC,EAAE;oBACrD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C7B,MAAM,EAAE,QAAQ;wBAChB,SAAS,EAAE,KAAK;wBAChB,MAAM,EAAE,EAAE;qBACX,CAAC,CAAC;oBAEH,OAAO;iBACR;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mCAAmC,mCA2B9C,CAAC;AAEH,eAAO,MAAM,kCAAkC,mCAwC7C,CAAC"}
|