@microsoft/typespec-msgraph 0.0.1-Preview.3 → 0.0.1-Preview.5
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 +50 -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/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/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/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 +9 -2
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +9 -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 +30 -0
- package/dist/src/entities/annotations.d.ts.map +1 -0
- package/dist/src/entities/annotations.js +97 -0
- package/dist/src/entities/annotations.js.map +1 -0
- package/dist/src/entities/entity-container.d.ts +3 -24
- package/dist/src/entities/entity-container.d.ts.map +1 -1
- package/dist/src/entities/entity-container.js +24 -118
- package/dist/src/entities/entity-container.js.map +1 -1
- package/dist/src/entities/enum.d.ts.map +1 -1
- package/dist/src/entities/enum.js +3 -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 +7 -2
- package/dist/src/entities/namespace.d.ts.map +1 -1
- package/dist/src/entities/namespace.js +20 -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 +89 -1
- package/dist/src/utils.js.map +1 -1
- package/lib/decorators.tsp +90 -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 +6 -10
- 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,132 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const navigationSources = [...namespace.interfaces]
|
|
7
|
-
.filter(([_, $interface]) => $interface.operations.has("_isNavigationSource"))
|
|
8
|
-
.map(([_, $interface]) => [
|
|
9
|
-
$interface.operations.get("_isNavigationSource").returnType,
|
|
10
|
-
$interface,
|
|
11
|
-
]);
|
|
12
|
-
const entityContainer = {
|
|
13
|
-
AgsAttributes: buildAttributes(program, namespace),
|
|
14
|
-
SingletonElements: getMsGraphSingletonElements(program, navigationSources),
|
|
15
|
-
EntitySetElements: getMsGraphEntitySetElements(program, navigationSources),
|
|
16
|
-
};
|
|
17
|
-
return entityContainer;
|
|
18
|
-
}
|
|
19
|
-
function getMsGraphSingletonElements(program, navigationSources) {
|
|
20
|
-
const singletons = navigationSources
|
|
21
|
-
.filter(([returnType, _]) => returnType.kind === "Model" && returnType.name !== "Array")
|
|
22
|
-
.map(([_, $interface]) => $interface);
|
|
23
|
-
const elements = singletons.map(singleton => getMsGraphSingletonElement(program, singleton));
|
|
1
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
2
|
+
import { getPropertyTypeName, getInterfaceNavigationSourceType, getInterfacesOfKinds, } from "../utils.js";
|
|
3
|
+
export function GetSingletons(program, navigationSources) {
|
|
4
|
+
const singletonMap = getInterfacesOfKinds(program, navigationSources, ["Singleton"]);
|
|
5
|
+
const elements = [...singletonMap].map(([routePath, entity]) => getSingleton(program, routePath, entity));
|
|
24
6
|
return elements;
|
|
25
7
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
const type = singleton
|
|
29
|
-
const
|
|
30
|
-
|
|
8
|
+
function getSingleton(program, routePath, entity) {
|
|
9
|
+
const singleton = entity.theInterface;
|
|
10
|
+
const type = getInterfaceNavigationSourceType(program, singleton);
|
|
11
|
+
const agsAttributes = { ...getOperationAgsAttributes(program, entity.operations), ...buildAttributes(program, singleton) };
|
|
12
|
+
const entry = {
|
|
13
|
+
Name: routePath,
|
|
31
14
|
TypeName: getPropertyTypeName(program, type),
|
|
32
|
-
AgsAttributes:
|
|
33
|
-
HasExpandOperation: false,
|
|
34
|
-
NonExpandableProperties: undefined,
|
|
35
|
-
Description: getDoc(program, singleton)
|
|
15
|
+
AgsAttributes: agsAttributes,
|
|
36
16
|
};
|
|
37
|
-
|
|
38
|
-
operation.parameters.properties.size === 0 &&
|
|
39
|
-
isExpand(program, operation));
|
|
40
|
-
if (expandedOperation) {
|
|
41
|
-
element.HasExpandOperation = true;
|
|
42
|
-
// Destructuring to get the operation from the [string, Operation] expandedOperation tuple
|
|
43
|
-
const [_, operation] = expandedOperation;
|
|
44
|
-
const expandableProperties = getExpand(program, operation);
|
|
45
|
-
const navigationProperties = [...walkPropertiesInherited(type)]
|
|
46
|
-
.filter((property) => isContains(program, property) || isReferences(program, property))
|
|
47
|
-
.map((property) => property.name);
|
|
48
|
-
element.NonExpandableProperties = navigationProperties.filter(property => { var _a; return (_a = !(expandableProperties === null || expandableProperties === void 0 ? void 0 : expandableProperties.includes(property))) !== null && _a !== void 0 ? _a : false; });
|
|
49
|
-
}
|
|
50
|
-
return element;
|
|
17
|
+
return entry;
|
|
51
18
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
.reduce((map, [_, item]) => {
|
|
56
|
-
var _a;
|
|
57
|
-
const key = (_a = getRoutePath(program, item)) === null || _a === void 0 ? void 0 : _a.path.split("/")[0];
|
|
58
|
-
if (!key) {
|
|
59
|
-
return map;
|
|
60
|
-
}
|
|
61
|
-
const items = [...(map.get(key) || []), ...item.operations.values()];
|
|
62
|
-
map.set(key, items);
|
|
63
|
-
return map;
|
|
64
|
-
}, new Map());
|
|
65
|
-
const elements = [...entitySets]
|
|
66
|
-
.map(([_, operations]) => getMsGraphEntitySetElement(program, operations))
|
|
67
|
-
.filter((element) => !!element);
|
|
19
|
+
export function GetEntitySets(program, navigationSources) {
|
|
20
|
+
const entitySetMap = getInterfacesOfKinds(program, navigationSources, ["EntitySet", "EntitySetResource"]);
|
|
21
|
+
const elements = [...entitySetMap].map(([routePath, entity]) => getEntitySet(program, routePath, entity));
|
|
68
22
|
return elements;
|
|
69
23
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
let agsAttributes = operations.reduce((attr, item) => ({ ...attr, ...buildAttributes(program, item) }), {});
|
|
77
|
-
agsAttributes = { ...agsAttributes, ...buildAttributes(program, entitySet) };
|
|
78
|
-
const returnType = entitySet.operations.get("_isNavigationSource").returnType;
|
|
79
|
-
const type = returnType.indexer.value;
|
|
80
|
-
const operationMethods = operations.map((operation) => ({
|
|
81
|
-
operation,
|
|
82
|
-
verb: getOperationVerb(program, operation),
|
|
83
|
-
hasEmptyParameters: operation.parameters.properties.size === 0,
|
|
84
|
-
}));
|
|
24
|
+
function getEntitySet(program, routePath, entity) {
|
|
25
|
+
const entitySet = entity.theInterface;
|
|
26
|
+
const type = getInterfaceNavigationSourceType(program, entitySet);
|
|
27
|
+
const agsAttributes = { ...getOperationAgsAttributes(program, entity.operations), ...buildAttributes(program, entitySet) };
|
|
85
28
|
const entry = {
|
|
86
|
-
Name:
|
|
29
|
+
Name: routePath,
|
|
87
30
|
TypeName: getPropertyTypeName(program, type),
|
|
88
31
|
AgsAttributes: agsAttributes,
|
|
89
|
-
HasGetOnCollection: operationMethods.some(({ verb, hasEmptyParameters }) => hasEmptyParameters && verb === "get"),
|
|
90
|
-
HasGetOnItem: operationMethods.some(({ verb, hasEmptyParameters }) => !hasEmptyParameters && verb === "get"),
|
|
91
|
-
HasPostOnCollection: operationMethods.some(({ verb }) => verb === "post"),
|
|
92
|
-
HasPatchOnItem: operationMethods.some(({ verb }) => verb === "patch"),
|
|
93
|
-
HasDeleteOnItem: operationMethods.some(({ verb }) => verb === "delete"),
|
|
94
|
-
HasCountOperation: [...entitySet.operations].some(([_, operation]) => isCount(program, operation)),
|
|
95
|
-
HasExpandOperation: false,
|
|
96
|
-
NonExpandableProperties: undefined,
|
|
97
|
-
HasSearchOperation: [...entitySet.operations].some(([_, operation]) => isSearch(program, operation)),
|
|
98
|
-
HasSkipOperation: [...entitySet.operations].some(([_, operation]) => isSkip(program, operation)),
|
|
99
|
-
HasSortOperation: false,
|
|
100
|
-
NonSortableProperties: undefined,
|
|
101
|
-
HasTopOperation: [...entitySet.operations].some(([_, operation]) => isTop(program, operation)),
|
|
102
|
-
Description: getDoc(program, entitySet),
|
|
103
32
|
};
|
|
104
|
-
const expandedOperation = [...entitySet.operations].find(([_, operation]) => getOperationVerb(program, operation) === "get" &&
|
|
105
|
-
operation.parameters.properties.size === 0 &&
|
|
106
|
-
isExpand(program, operation));
|
|
107
|
-
if (expandedOperation) {
|
|
108
|
-
entry.HasExpandOperation = true;
|
|
109
|
-
// Destructuring to get the operation from the [string, Operation] expandedOperation tuple
|
|
110
|
-
const [_, operation] = expandedOperation;
|
|
111
|
-
const expandableProperties = getExpand(program, operation);
|
|
112
|
-
const navigationProperties = [...walkPropertiesInherited(type)]
|
|
113
|
-
.filter((property) => isContains(program, property) || isReferences(program, property))
|
|
114
|
-
.map((property) => property.name);
|
|
115
|
-
entry.NonExpandableProperties = navigationProperties.filter(property => { var _a; return (_a = !(expandableProperties === null || expandableProperties === void 0 ? void 0 : expandableProperties.includes(property))) !== null && _a !== void 0 ? _a : false; });
|
|
116
|
-
}
|
|
117
|
-
const sortOperation = [...entitySet.operations].find(([_, operation]) => getOperationVerb(program, operation) === "get" &&
|
|
118
|
-
operation.parameters.properties.size === 0 &&
|
|
119
|
-
isOrderBy(program, operation));
|
|
120
|
-
if (sortOperation) {
|
|
121
|
-
entry.HasSortOperation = true;
|
|
122
|
-
// Destructuring to get the operation from the [string, Operation] orderedOperation tuple
|
|
123
|
-
const [_, operation] = sortOperation;
|
|
124
|
-
const sortableProperties = getOrderBy(program, operation);
|
|
125
|
-
const nonNavigationProperties = [...walkPropertiesInherited(type)]
|
|
126
|
-
.filter((property) => !isContains(program, property) && !isReferences(program, property))
|
|
127
|
-
.map((property) => property.name);
|
|
128
|
-
entry.NonSortableProperties = nonNavigationProperties.filter((property) => !sortableProperties.includes(property));
|
|
129
|
-
}
|
|
130
33
|
return entry;
|
|
131
34
|
}
|
|
35
|
+
function getOperationAgsAttributes(program, operations) {
|
|
36
|
+
return operations.reduce((attr, item) => ({ ...attr, ...buildAttributes(program, item) }), {});
|
|
37
|
+
}
|
|
132
38
|
//# sourceMappingURL=entity-container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-container.js","sourceRoot":"","sources":["../../../src/entities/entity-container.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity-container.js","sourceRoot":"","sources":["../../../src/entities/entity-container.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAChC,oBAAoB,GAErB,MAAM,aAAa,CAAC;AAcrB,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,iBAA8B;IAC5E,MAAM,YAAY,GAAG,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,EAAE,CAAC,WAAW,CAAC,CAAC,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AAI,GAAG,gCAAgC,CAAC,OAAO,EAAE,SAAS,CAAE,CAAC;IAEnE,MAAM,aAAa,GAAG,EAAE,GAAG,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;IAE3H,MAAM,KAAK,GAAc;QACvB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC;QAC5C,aAAa,EAAE,aAAa;KAC7B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,yBAAyB,CAAC,OAAgB,EAAE,UAAuB;IAC1E,OAAO,UAAU,CAAC,MAAM,CACtB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,EAChE,EAAE,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/entities/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAc,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/entities/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAc,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAyB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGrF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,WAAW,CASvF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { buildAttributes } from "../index.js";
|
|
2
1
|
import { GetRevisionDefinition } from "./revision-definition.js";
|
|
2
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
3
3
|
export function GetMsGraphEnumTypeElement(program, enumType) {
|
|
4
4
|
const element = {
|
|
5
5
|
Name: enumType.name,
|
|
6
6
|
AgsAttributes: buildAttributes(program, enumType),
|
|
7
7
|
RevisionDefinition: GetRevisionDefinition(program, enumType, enumType === null || enumType === void 0 ? void 0 : enumType.namespace),
|
|
8
|
-
Elements: [...enumType.members].map(([_, m]) => getMsGraphEnumMember(program, m))
|
|
8
|
+
Elements: [...enumType.members].map(([_, m]) => getMsGraphEnumMember(program, m)),
|
|
9
9
|
};
|
|
10
10
|
return element;
|
|
11
11
|
}
|
|
@@ -15,7 +15,7 @@ function getMsGraphEnumMember(program, member) {
|
|
|
15
15
|
Name: member.name,
|
|
16
16
|
Value: member.value,
|
|
17
17
|
AgsAttributes: buildAttributes(program, member),
|
|
18
|
-
RevisionDefinition: GetRevisionDefinition(program, member, (_a = member.enum) === null || _a === void 0 ? void 0 : _a.namespace)
|
|
18
|
+
RevisionDefinition: GetRevisionDefinition(program, member, (_a = member.enum) === null || _a === void 0 ? void 0 : _a.namespace),
|
|
19
19
|
};
|
|
20
20
|
return element;
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/entities/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/entities/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAgBjE,MAAM,UAAU,yBAAyB,CAAC,OAAgB,EAAE,QAAc;IACxE,MAAM,OAAO,GAAgB;QAC3B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,aAAa,EAAE,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC;QACjD,kBAAkB,EAAE,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAC;QACjF,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;KAClF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAgB,EAAE,MAAkB;;IAChE,MAAM,OAAO,GAAsB;QACjC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,aAAa,EAAE,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC;QAC/C,kBAAkB,EAAE,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAA,MAAM,CAAC,IAAI,0CAAE,SAAS,CAAC;KACnF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
import { Model, ModelProperty, Program } from "@typespec/compiler";
|
|
2
2
|
import { RevisionDefinition } from "./revision-definition.js";
|
|
3
3
|
export interface MsGraphModel {
|
|
4
|
-
Properties: EntityType | ComplexType | undefined;
|
|
5
4
|
Kind: MsGraphModelKind;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
StreamTypes: string[];
|
|
13
|
-
RevisionDefinition: RevisionDefinition | undefined;
|
|
14
|
-
Description: string | undefined;
|
|
15
|
-
}
|
|
16
|
-
export interface ComplexType {
|
|
17
|
-
StructuredType: StructuredType;
|
|
5
|
+
Name: string;
|
|
6
|
+
IsAbstract: true | undefined;
|
|
7
|
+
BaseType: string | undefined;
|
|
8
|
+
IsOpenType: true | undefined;
|
|
9
|
+
HasStream: true | undefined;
|
|
10
|
+
AgsAttributes: Record<string, string>;
|
|
18
11
|
Properties: MsGraphModelProperty[];
|
|
19
12
|
RevisionDefinition: RevisionDefinition | undefined;
|
|
20
13
|
Description: string | undefined;
|
|
14
|
+
KeyProperty: [string, ModelProperty] | undefined;
|
|
15
|
+
AlternateKeys: AlternateKeyProperty[];
|
|
16
|
+
StreamTypes: string[];
|
|
21
17
|
}
|
|
22
18
|
export declare enum MsGraphModelKind {
|
|
23
19
|
Unknown = 0,
|
|
24
20
|
Entity = 1,
|
|
25
21
|
Complex = 2
|
|
26
22
|
}
|
|
27
|
-
export interface StructuredType {
|
|
28
|
-
Name: string;
|
|
29
|
-
Abstract?: string;
|
|
30
|
-
BaseType?: string;
|
|
31
|
-
Children?: any;
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
}
|
|
34
23
|
export interface MsGraphModelProperty {
|
|
35
24
|
Name: string;
|
|
36
25
|
IsNavigation: boolean;
|
|
@@ -43,8 +32,9 @@ export interface MsGraphModelProperty {
|
|
|
43
32
|
RevisionDefinition: RevisionDefinition | undefined;
|
|
44
33
|
Description: string | undefined;
|
|
45
34
|
}
|
|
46
|
-
export interface AlternateKeyProperty
|
|
35
|
+
export interface AlternateKeyProperty {
|
|
47
36
|
IsModel: boolean;
|
|
37
|
+
ModelProperty: ModelProperty;
|
|
48
38
|
}
|
|
49
|
-
export declare function
|
|
39
|
+
export declare function GetMsGraphModels(program: Program, models: Map<string, Model>): MsGraphModel[];
|
|
50
40
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAiB,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/entities/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAiB,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAyB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAsBrF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,IAAI,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,IAAI,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACnD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,SAAS,CAAC;IACjD,aAAa,EAAE,oBAAoB,EAAE,CAAC;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,oBAAY,gBAAgB;IAC1B,OAAO,IAAA;IACP,MAAM,IAAA;IACN,OAAO,IAAA;CACR;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACpC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACnD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAW7F"}
|
|
@@ -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 result = new Array();
|
|
14
|
+
models.forEach(m => {
|
|
15
|
+
const model = getMsGraphModel(program, m);
|
|
16
|
+
if (model) {
|
|
17
|
+
result.push(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 result;
|
|
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) ? true : undefined,
|
|
37
|
+
BaseType: model.baseModel ? getIdForType(program, model.baseModel) : undefined,
|
|
38
|
+
IsOpenType: isOpen(program, model) ? true : undefined,
|
|
39
|
+
HasStream: hasStream(program, model) ? true : undefined,
|
|
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,MAAM,EACN,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,gCAA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
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
10
|
Models: MsGraphModel[];
|
|
10
|
-
|
|
11
|
+
AgsAttributes: Record<string, string>;
|
|
12
|
+
Singletons: Singleton[];
|
|
13
|
+
EntitySets: EntitySet[];
|
|
11
14
|
Operations: MsGraphOperation[];
|
|
15
|
+
EntitySetAnnotations: EntitySetAnnotations[];
|
|
16
|
+
SingletonAnnotations: 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,EAAa,OAAO,EAAQ,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAA6B,WAAW,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/entities/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAQ,MAAM,oBAAoB,CAAC;AAE9D,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,YAAY,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,oBAAoB,EAAE,oBAAoB,EAAE,CAAC;IAC7C,oBAAoB,EAAE,oBAAoB,EAAE,CAAC;CAC9C;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAOzE"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { getNamespaceName, isExcludedCoreType } from "../utils.js";
|
|
1
|
+
import { getNamespaceName, getNavigationSources, isExcludedCoreType } 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,25 @@ function hasChildren(type) {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
function getMsGraphNamespace(program, namespace) {
|
|
25
|
-
const
|
|
27
|
+
const namespaceName = getNamespaceName(program, namespace);
|
|
28
|
+
const navigationSources = getNavigationSources(program, namespace);
|
|
29
|
+
const models = GetMsGraphModels(program, namespace.models);
|
|
26
30
|
const enums = [...namespace.enums].map(([_, e]) => GetMsGraphEnumTypeElement(program, e));
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.filter((o) => !!o);
|
|
31
|
+
const singletons = GetSingletons(program, navigationSources);
|
|
32
|
+
const entitySets = GetEntitySets(program, navigationSources);
|
|
33
|
+
const operations = GetMsGraphOperations(program, namespace.interfaces);
|
|
34
|
+
const entitySetAnnotations = GetEntitySetAnnotations(program, namespaceName, navigationSources);
|
|
35
|
+
const singletonAnnotations = GetSingletonAnnotations(program, namespaceName, navigationSources);
|
|
33
36
|
return {
|
|
34
|
-
Name:
|
|
37
|
+
Name: namespaceName,
|
|
35
38
|
Enums: enums,
|
|
36
39
|
Models: models,
|
|
37
|
-
|
|
40
|
+
AgsAttributes: buildAttributes(program, namespace),
|
|
41
|
+
Singletons: singletons,
|
|
42
|
+
EntitySets: entitySets,
|
|
38
43
|
Operations: operations,
|
|
44
|
+
EntitySetAnnotations: entitySetAnnotations,
|
|
45
|
+
SingletonAnnotations: singletonAnnotations,
|
|
39
46
|
};
|
|
40
47
|
}
|
|
41
48
|
//# 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,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAe,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAgB,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAa,aAAa,EAAE,aAAa,EAAa,M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