@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
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { getDoc, walkPropertiesInherited } from "@typespec/compiler";
|
|
2
|
+
import { getInterfaceNavigationSourceType } from "../utils.js";
|
|
3
|
+
import { getOperationVerb } from "@typespec/http";
|
|
4
|
+
import { getExpand, getOrderBy, isContains, isCount, isExpand, isOrderBy, isReferences, isSearch, isSkip, isTop } from "../index.js";
|
|
5
|
+
export function GetSingletonAnnotations(program, namespaceName, navigationSources) {
|
|
6
|
+
const annotations = new Map();
|
|
7
|
+
navigationSources.forEach((entity, routePath) => {
|
|
8
|
+
annotations.set(routePath, getSingletonAnnotations(program, namespaceName, routePath, entity));
|
|
9
|
+
});
|
|
10
|
+
return annotations;
|
|
11
|
+
}
|
|
12
|
+
function getSingletonAnnotations(program, namespaceName, routePath, entity) {
|
|
13
|
+
const singleton = entity.theInterface;
|
|
14
|
+
const type = getInterfaceNavigationSourceType(program, singleton);
|
|
15
|
+
const operationMethods = [...entity.operations].map(operation => ({
|
|
16
|
+
operation,
|
|
17
|
+
verb: getOperationVerb(program, operation),
|
|
18
|
+
}));
|
|
19
|
+
const [hasExpandOperation, nonExpandableProperties] = getExpandProperties(program, type, singleton);
|
|
20
|
+
const annotations = {
|
|
21
|
+
Target: `${namespaceName}.container/${routePath}`,
|
|
22
|
+
HasGetOnItem: operationMethods.some(({ verb }) => verb === "get"),
|
|
23
|
+
HasPatchOnItem: operationMethods.some(({ verb }) => verb === "patch"),
|
|
24
|
+
HasDeleteOnItem: operationMethods.some(({ verb }) => verb === "delete"),
|
|
25
|
+
HasExpandOperation: hasExpandOperation,
|
|
26
|
+
NonExpandableProperties: nonExpandableProperties,
|
|
27
|
+
Description: getDoc(program, singleton),
|
|
28
|
+
};
|
|
29
|
+
return annotations;
|
|
30
|
+
}
|
|
31
|
+
export function GetEntitySetAnnotations(program, namespaceName, sources) {
|
|
32
|
+
const annotations = new Map();
|
|
33
|
+
sources.forEach((entity, routePath) => {
|
|
34
|
+
annotations.set(routePath, getEntitySetAnnotations(program, namespaceName, routePath, entity));
|
|
35
|
+
});
|
|
36
|
+
return annotations;
|
|
37
|
+
}
|
|
38
|
+
function getEntitySetAnnotations(program, namespaceName, routePath, entity) {
|
|
39
|
+
const entitySet = entity.theInterface;
|
|
40
|
+
const type = getInterfaceNavigationSourceType(program, entitySet);
|
|
41
|
+
const operationMethods = entity.operations.map(operation => ({
|
|
42
|
+
operation,
|
|
43
|
+
verb: getOperationVerb(program, operation),
|
|
44
|
+
hasEmptyParameters: operation.parameters.properties.size === 0,
|
|
45
|
+
}));
|
|
46
|
+
const [hasExpandOperation, nonExpandableProperties] = getExpandProperties(program, type, entitySet);
|
|
47
|
+
const [hasSortOperation, nonSortableProperties] = getSortProperties(program, type, entitySet);
|
|
48
|
+
const annotations = {
|
|
49
|
+
Target: `${namespaceName}.container/${routePath}`,
|
|
50
|
+
HasGetOnCollection: operationMethods.some(({ verb, hasEmptyParameters }) => hasEmptyParameters && verb === "get"),
|
|
51
|
+
HasGetOnItem: operationMethods.some(({ verb, hasEmptyParameters }) => !hasEmptyParameters && verb === "get"),
|
|
52
|
+
HasPostOnCollection: operationMethods.some(({ verb }) => verb === "post"),
|
|
53
|
+
HasPatchOnItem: operationMethods.some(({ verb, hasEmptyParameters }) => !hasEmptyParameters && verb === "patch"),
|
|
54
|
+
HasDeleteOnItem: operationMethods.some(({ verb, hasEmptyParameters }) => !hasEmptyParameters && verb === "delete"),
|
|
55
|
+
HasCountOperation: operationMethods.some(({ operation }) => isCount(program, operation)),
|
|
56
|
+
HasSearchOperation: operationMethods.some(({ operation }) => isSearch(program, operation)),
|
|
57
|
+
HasSkipOperation: operationMethods.some(({ operation }) => isSkip(program, operation)),
|
|
58
|
+
HasExpandOperation: hasExpandOperation,
|
|
59
|
+
NonExpandableProperties: nonExpandableProperties,
|
|
60
|
+
HasSortOperation: hasSortOperation,
|
|
61
|
+
NonSortableProperties: nonSortableProperties,
|
|
62
|
+
HasTopOperation: operationMethods.some(({ operation }) => isTop(program, operation)),
|
|
63
|
+
Description: getDoc(program, entitySet),
|
|
64
|
+
};
|
|
65
|
+
return annotations;
|
|
66
|
+
}
|
|
67
|
+
function getExpandProperties(program, type, entity) {
|
|
68
|
+
const expandedOperation = [...entity.operations].find(([_, operation]) => getOperationVerb(program, operation) === "get" &&
|
|
69
|
+
operation.parameters.properties.size === 0 &&
|
|
70
|
+
isExpand(program, operation));
|
|
71
|
+
if (expandedOperation) {
|
|
72
|
+
// Destructuring to get the operation from the [string, Operation] expandedOperation tuple
|
|
73
|
+
const [_, operation] = expandedOperation;
|
|
74
|
+
const expandableProperties = getExpand(program, operation);
|
|
75
|
+
const navigationProperties = [...walkPropertiesInherited(type)]
|
|
76
|
+
.filter((property) => isContains(program, property) || isReferences(program, property))
|
|
77
|
+
.map((property) => property.name);
|
|
78
|
+
const nonExpandableProperties = navigationProperties.filter((property) => { var _a; return (_a = !(expandableProperties === null || expandableProperties === void 0 ? void 0 : expandableProperties.includes(property))) !== null && _a !== void 0 ? _a : false; });
|
|
79
|
+
return [true, nonExpandableProperties];
|
|
80
|
+
}
|
|
81
|
+
return [false, undefined];
|
|
82
|
+
}
|
|
83
|
+
function getSortProperties(program, type, entity) {
|
|
84
|
+
const sortOperation = [...entity.operations].find(([_, operation]) => getOperationVerb(program, operation) === "get" &&
|
|
85
|
+
operation.parameters.properties.size === 0 &&
|
|
86
|
+
isOrderBy(program, operation));
|
|
87
|
+
if (sortOperation) {
|
|
88
|
+
// Destructuring to get the operation from the [string, Operation] orderedOperation tuple
|
|
89
|
+
const [_, operation] = sortOperation;
|
|
90
|
+
const sortableProperties = getOrderBy(program, operation);
|
|
91
|
+
const nonNavigationProperties = [...walkPropertiesInherited(type)]
|
|
92
|
+
.filter((property) => !isContains(program, property) && !isReferences(program, property))
|
|
93
|
+
.map((property) => property.name);
|
|
94
|
+
const nonSortableProperties = nonNavigationProperties.filter((property) => !sortableProperties.includes(property));
|
|
95
|
+
return [true, nonSortableProperties];
|
|
96
|
+
}
|
|
97
|
+
return [false, undefined];
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../src/entities/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,MAAM,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAoB,gCAAgC,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAA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I,EAAE,qBAAqB,CAAC,CAAC;KACtC;IAED,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -1,35 +1,15 @@
|
|
|
1
|
-
import { Program
|
|
2
|
-
|
|
3
|
-
AgsAttributes: Record<string, string>;
|
|
4
|
-
SingletonElements: Singleton[];
|
|
5
|
-
EntitySetElements: EntitySet[];
|
|
6
|
-
}
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
import { MsGraphInterface } from "../utils.js";
|
|
7
3
|
export interface Singleton {
|
|
8
4
|
Name: string | undefined;
|
|
9
5
|
TypeName: string;
|
|
10
6
|
AgsAttributes: Record<string, string>;
|
|
11
|
-
HasExpandOperation: boolean;
|
|
12
|
-
NonExpandableProperties: string[] | undefined;
|
|
13
|
-
Description: string | undefined;
|
|
14
7
|
}
|
|
15
8
|
export interface EntitySet {
|
|
16
9
|
Name: string | undefined;
|
|
17
10
|
TypeName: string;
|
|
18
11
|
AgsAttributes: Record<string, string | boolean | undefined>;
|
|
19
|
-
HasGetOnCollection: boolean;
|
|
20
|
-
HasGetOnItem: boolean;
|
|
21
|
-
HasPostOnCollection: boolean;
|
|
22
|
-
HasPatchOnItem: boolean;
|
|
23
|
-
HasDeleteOnItem: boolean;
|
|
24
|
-
HasCountOperation: boolean;
|
|
25
|
-
HasExpandOperation: boolean;
|
|
26
|
-
NonExpandableProperties: string[] | undefined;
|
|
27
|
-
HasSearchOperation: boolean;
|
|
28
|
-
HasSkipOperation: boolean;
|
|
29
|
-
HasSortOperation: boolean;
|
|
30
|
-
NonSortableProperties: string[] | undefined;
|
|
31
|
-
HasTopOperation: boolean;
|
|
32
|
-
Description: string | undefined;
|
|
33
12
|
}
|
|
34
|
-
export declare function
|
|
13
|
+
export declare function GetSingletons(program: Program, sources: Map<string, MsGraphInterface>): Map<string, Singleton>;
|
|
14
|
+
export declare function GetEntitySets(program: Program, sources: Map<string, MsGraphInterface>): Map<string, EntitySet>;
|
|
35
15
|
//# sourceMappingURL=entity-container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-container.d.ts","sourceRoot":"","sources":["../../../src/entities/entity-container.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"entity-container.d.ts","sourceRoot":"","sources":["../../../src/entities/entity-container.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAER,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGL,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;CAC7D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAQ9G;AAkBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAQ9G"}
|
|
@@ -1,132 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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));
|
|
24
|
-
return elements;
|
|
1
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
2
|
+
import { getPropertyTypeName, getInterfaceNavigationSourceType, } from "../utils.js";
|
|
3
|
+
export function GetSingletons(program, sources) {
|
|
4
|
+
const singletons = new Map();
|
|
5
|
+
sources.forEach((entity, routePath) => {
|
|
6
|
+
singletons.set(routePath, getSingleton(program, routePath, entity));
|
|
7
|
+
});
|
|
8
|
+
return singletons;
|
|
25
9
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
const type = singleton
|
|
29
|
-
const
|
|
30
|
-
|
|
10
|
+
function getSingleton(program, routePath, entity) {
|
|
11
|
+
const singleton = entity.theInterface;
|
|
12
|
+
const type = getInterfaceNavigationSourceType(program, singleton);
|
|
13
|
+
const agsAttributes = { ...getOperationAgsAttributes(program, entity.operations), ...buildAttributes(program, singleton) };
|
|
14
|
+
const entry = {
|
|
15
|
+
Name: routePath,
|
|
31
16
|
TypeName: getPropertyTypeName(program, type),
|
|
32
|
-
AgsAttributes:
|
|
33
|
-
HasExpandOperation: false,
|
|
34
|
-
NonExpandableProperties: undefined,
|
|
35
|
-
Description: getDoc(program, singleton)
|
|
17
|
+
AgsAttributes: agsAttributes,
|
|
36
18
|
};
|
|
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;
|
|
19
|
+
return entry;
|
|
51
20
|
}
|
|
52
|
-
function
|
|
53
|
-
const entitySets =
|
|
54
|
-
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
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);
|
|
68
|
-
return elements;
|
|
21
|
+
export function GetEntitySets(program, sources) {
|
|
22
|
+
const entitySets = new Map();
|
|
23
|
+
sources.forEach((entity, routePath) => {
|
|
24
|
+
entitySets.set(routePath, getEntitySet(program, routePath, entity));
|
|
25
|
+
});
|
|
26
|
+
return entitySets;
|
|
69
27
|
}
|
|
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
|
-
}));
|
|
28
|
+
function getEntitySet(program, routePath, entity) {
|
|
29
|
+
const entitySet = entity.theInterface;
|
|
30
|
+
const type = getInterfaceNavigationSourceType(program, entitySet);
|
|
31
|
+
const agsAttributes = { ...getOperationAgsAttributes(program, entity.operations), ...buildAttributes(program, entitySet) };
|
|
85
32
|
const entry = {
|
|
86
|
-
Name:
|
|
33
|
+
Name: routePath,
|
|
87
34
|
TypeName: getPropertyTypeName(program, type),
|
|
88
35
|
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
36
|
};
|
|
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
37
|
return entry;
|
|
131
38
|
}
|
|
39
|
+
function getOperationAgsAttributes(program, operations) {
|
|
40
|
+
return operations.reduce((attr, item) => ({ ...attr, ...buildAttributes(program, item) }), {});
|
|
41
|
+
}
|
|
132
42
|
//# 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":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,gCAAgC,GAEjC,MAAM,aAAa,CAAC;AAcrB,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,OAAsC;IACpF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEhD,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE;QACpC,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB,EAAE,SAAiB,EAAE,MAAwB;IACjF,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IAEtC,MAAM,IAAI,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,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,OAAsC;IACpF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEhD,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE;QACpC,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB,EAAE,SAAiB,EAAE,MAAwB;IACjF,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IAEtC,MAAM,IAAI,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;AAIrF,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;IAC9B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;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,CAUvF"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { buildAttributes } from "../index.js";
|
|
2
1
|
import { GetRevisionDefinition } from "./revision-definition.js";
|
|
2
|
+
import { buildAttributes } from "../decorators/ags-attribute.js";
|
|
3
|
+
import { isFlags } from "../index.js";
|
|
3
4
|
export function GetMsGraphEnumTypeElement(program, enumType) {
|
|
4
5
|
const element = {
|
|
5
6
|
Name: enumType.name,
|
|
6
7
|
AgsAttributes: buildAttributes(program, enumType),
|
|
7
8
|
RevisionDefinition: GetRevisionDefinition(program, enumType, enumType === null || enumType === void 0 ? void 0 : enumType.namespace),
|
|
8
|
-
Elements: [...enumType.members].map(([_, m]) => getMsGraphEnumMember(program, m))
|
|
9
|
+
Elements: [...enumType.members].map(([_, m]) => getMsGraphEnumMember(program, m)),
|
|
10
|
+
IsFlags: isFlags(program, enumType),
|
|
9
11
|
};
|
|
10
12
|
return element;
|
|
11
13
|
}
|
|
@@ -15,7 +17,7 @@ function getMsGraphEnumMember(program, member) {
|
|
|
15
17
|
Name: member.name,
|
|
16
18
|
Value: member.value,
|
|
17
19
|
AgsAttributes: buildAttributes(program, member),
|
|
18
|
-
RevisionDefinition: GetRevisionDefinition(program, member, (_a = member.enum) === null || _a === void 0 ? void 0 : _a.namespace)
|
|
20
|
+
RevisionDefinition: GetRevisionDefinition(program, member, (_a = member.enum) === null || _a === void 0 ? void 0 : _a.namespace),
|
|
19
21
|
};
|
|
20
22
|
return element;
|
|
21
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/entities/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
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;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAiBtC,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;QACjF,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;KACpC,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: boolean;
|
|
7
|
+
BaseType: string | undefined;
|
|
8
|
+
IsOpenType: boolean;
|
|
9
|
+
HasStream: boolean;
|
|
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>): Map<string, 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,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC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