@microsoft/typespec-msgraph 0.0.1-Preview.7 → 0.0.1-Preview.9
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/annotations.d.ts +4 -1
- package/dist/src/components/annotations.d.ts.map +1 -1
- package/dist/src/components/annotations.js +22 -4
- package/dist/src/components/annotations.js.map +1 -1
- package/dist/src/components/filter-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/filter-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/filter-restrictions-annotation.js +10 -0
- package/dist/src/components/filter-restrictions-annotation.js.map +1 -0
- package/dist/src/components/immutable-annotation.d.ts +5 -0
- package/dist/src/components/immutable-annotation.d.ts.map +1 -0
- package/dist/src/components/immutable-annotation.js +6 -0
- package/dist/src/components/immutable-annotation.js.map +1 -0
- package/dist/src/components/index.js +3 -3
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/insert-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/insert-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/insert-restrictions-annotation.js +10 -0
- package/dist/src/components/insert-restrictions-annotation.js.map +1 -0
- package/dist/src/components/property-element.d.ts.map +1 -1
- package/dist/src/components/property-element.js +3 -1
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/schema-element.d.ts.map +1 -1
- package/dist/src/components/schema-element.js +6 -7
- package/dist/src/components/schema-element.js.map +1 -1
- package/dist/src/decorators/action.d.ts +10 -0
- package/dist/src/decorators/action.d.ts.map +1 -0
- package/dist/src/decorators/action.js +16 -0
- package/dist/src/decorators/action.js.map +1 -0
- package/dist/src/decorators/allowed-values.d.ts +13 -0
- package/dist/src/decorators/allowed-values.d.ts.map +1 -0
- package/dist/src/decorators/allowed-values.js +35 -0
- package/dist/src/decorators/allowed-values.js.map +1 -0
- package/dist/src/decorators/filter.d.ts +11 -0
- package/dist/src/decorators/filter.d.ts.map +1 -0
- package/dist/src/decorators/filter.js +27 -0
- package/dist/src/decorators/filter.js.map +1 -0
- package/dist/src/decorators/graph-route.d.ts +8 -1
- package/dist/src/decorators/graph-route.d.ts.map +1 -1
- package/dist/src/decorators/graph-route.js +27 -13
- package/dist/src/decorators/graph-route.js.map +1 -1
- package/dist/src/decorators/immutable.d.ts +8 -0
- package/dist/src/decorators/immutable.d.ts.map +1 -0
- package/dist/src/decorators/immutable.js +12 -0
- package/dist/src/decorators/immutable.js.map +1 -0
- package/dist/src/decorators/index.d.ts +6 -0
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +6 -0
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/public-namespace.d.ts +10 -0
- package/dist/src/decorators/public-namespace.d.ts.map +1 -0
- package/dist/src/decorators/public-namespace.js +16 -0
- package/dist/src/decorators/public-namespace.js.map +1 -0
- package/dist/src/decorators/required-for-create.d.ts +10 -0
- package/dist/src/decorators/required-for-create.d.ts.map +1 -0
- package/dist/src/decorators/required-for-create.js +14 -0
- package/dist/src/decorators/required-for-create.js.map +1 -0
- package/dist/src/emitter.d.ts +2 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +3 -1
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/entities/annotations.d.ts +9 -0
- package/dist/src/entities/annotations.d.ts.map +1 -1
- package/dist/src/entities/annotations.js +42 -1
- package/dist/src/entities/annotations.js.map +1 -1
- package/dist/src/entities/model.d.ts +6 -0
- package/dist/src/entities/model.d.ts.map +1 -1
- package/dist/src/entities/model.js +4 -2
- package/dist/src/entities/model.js.map +1 -1
- package/dist/src/entities/namespace.d.ts +3 -3
- package/dist/src/entities/namespace.d.ts.map +1 -1
- package/dist/src/entities/namespace.js +26 -10
- package/dist/src/entities/namespace.js.map +1 -1
- package/dist/src/entities/operation.d.ts.map +1 -1
- package/dist/src/entities/operation.js +2 -3
- package/dist/src/entities/operation.js.map +1 -1
- package/dist/src/entities/property.d.ts.map +1 -1
- package/dist/src/entities/property.js +3 -0
- package/dist/src/entities/property.js.map +1 -1
- package/dist/src/lib.d.ts +45 -2
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +23 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +8 -0
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/allowed-values.d.ts +6 -0
- package/dist/src/rules/allowed-values.d.ts.map +1 -0
- package/dist/src/rules/allowed-values.js +59 -0
- package/dist/src/rules/allowed-values.js.map +1 -0
- package/dist/src/rules/filter.d.ts +4 -0
- package/dist/src/rules/filter.d.ts.map +1 -0
- package/dist/src/rules/filter.js +92 -0
- package/dist/src/rules/filter.js.map +1 -0
- package/dist/src/rules/graph-route.d.ts +6 -0
- package/dist/src/rules/graph-route.d.ts.map +1 -0
- package/dist/src/rules/graph-route.js +88 -0
- package/dist/src/rules/graph-route.js.map +1 -0
- package/dist/src/rules/index.d.ts +6 -0
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +6 -0
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/namespace.d.ts +3 -0
- package/dist/src/rules/namespace.d.ts.map +1 -0
- package/dist/src/rules/namespace.js +58 -0
- package/dist/src/rules/namespace.js.map +1 -0
- package/dist/src/rules/required-for-create.d.ts +2 -0
- package/dist/src/rules/required-for-create.d.ts.map +1 -0
- package/dist/src/rules/required-for-create.js +40 -0
- package/dist/src/rules/required-for-create.js.map +1 -0
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +73 -21
- package/dist/src/utils.js.map +1 -1
- package/lib/decorators.tsp +102 -56
- package/lib/deployment.tsp +1 -1
- package/lib/lib.tsp +5 -16
- package/lib/porcelain.tsp +4 -4
- package/lib/responses.tsp +6 -6
- package/lib/shared-models.tsp +4 -3
- package/package.json +11 -12
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { CollectionAnnotations, ResourceAnnotations } from "../entities/annotations.js";
|
|
2
|
+
import { AllowedValuesAnnotations, CollectionAnnotations, ResourceAnnotations } from "../entities/annotations.js";
|
|
3
3
|
export declare const CollectionAnnotationsList: FC<{
|
|
4
4
|
elements: Map<string, CollectionAnnotations>;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const ResourceAnnotationsList: FC<{
|
|
7
7
|
elements: Map<string, ResourceAnnotations>;
|
|
8
8
|
}>;
|
|
9
|
+
export declare const AllowedValuesAnnotationsList: FC<{
|
|
10
|
+
elements: Map<string, AllowedValuesAnnotations>;
|
|
11
|
+
}>;
|
|
9
12
|
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../src/components/annotations.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAUjC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../src/components/annotations.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAUjC,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAYlH,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;CAAE,CAIrF,CAAA;AAEN,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;CAAE,CAIjF,CAAA;AAEJ,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAA;CAAG,CAI9F,CAAA"}
|
|
@@ -2,15 +2,34 @@ import React from "react";
|
|
|
2
2
|
import { CountRestrictionsAnnotation } from "./count-restrictions-annotation.js";
|
|
3
3
|
import { ExpandRestrictionsAnnotation } from "./expand-restrictions-annotation.js";
|
|
4
4
|
import { SearchRestrictionsAnnotation } from "./search-restrictions-annotation.js";
|
|
5
|
-
import { AnnotationElement, ItemList, PropertyValueElement, RecordElement } from "./common-elements.js";
|
|
5
|
+
import { AnnotationElement, CollectionElement, ItemList, PropertyValueElement, RecordElement } from "./common-elements.js";
|
|
6
6
|
import { SkipSupportedAnnotation } from "./skip-supported-annotation.js";
|
|
7
7
|
import { SortRestrictionsAnnotation } from "./sort-restrictions-annotation.js";
|
|
8
8
|
import { TopSupportedAnnotation } from "./top-supported-annotation.js";
|
|
9
9
|
import { DescriptionAnnotation } from "./description-annotation.js";
|
|
10
10
|
import { UpdateRestrictionsAnnotation } from "./update-restrictions-annotation.js";
|
|
11
|
+
import { InsertRestrictionsAnnotation } from "./insert-restrictions-annotation.js";
|
|
12
|
+
import { FilterRestrictionsAnnotation } from "./filter-restrictions-annotation.js";
|
|
13
|
+
import { getCSDLPrimitiveType } from "../utils.js";
|
|
11
14
|
const AnnotationsElem = (props) => React.createElement("Annotations", props);
|
|
12
15
|
export const CollectionAnnotationsList = ({ elements }) => React.createElement(ItemList, { items: elements, render: (element) => React.createElement(CollectionAnnotationsElement, { element: element }) });
|
|
13
16
|
export const ResourceAnnotationsList = ({ elements }) => React.createElement(ItemList, { items: elements, render: (element) => React.createElement(ResourceAnnotationsElement, { element: element }) });
|
|
17
|
+
export const AllowedValuesAnnotationsList = ({ elements }) => React.createElement(ItemList, { items: elements, render: (element) => React.createElement(AllowedValuesAnnotation, { element: element }) });
|
|
18
|
+
const AllowedValuesAnnotation = ({ element }) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const { Target, allowedValues } = element;
|
|
21
|
+
return (React.createElement(AnnotationsElem, { Target: Target },
|
|
22
|
+
React.createElement(AnnotationElement, { Term: "Org.OData.Validation.V1.AllowedValues" },
|
|
23
|
+
React.createElement(CollectionElement, null, (_a = allowedValues === null || allowedValues === void 0 ? void 0 : allowedValues.values) === null || _a === void 0 ? void 0 : _a.map((value) => {
|
|
24
|
+
const csdlType = getCSDLPrimitiveType(allowedValues.type);
|
|
25
|
+
const props = {
|
|
26
|
+
Property: "Value",
|
|
27
|
+
[csdlType]: value
|
|
28
|
+
};
|
|
29
|
+
return (React.createElement(RecordElement, null,
|
|
30
|
+
React.createElement(PropertyValueElement, { ...props })));
|
|
31
|
+
})))));
|
|
32
|
+
};
|
|
14
33
|
const CollectionAnnotationsElement = ({ element, }) => React.createElement(AnnotationsElem, { Target: element.Target },
|
|
15
34
|
React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.ReadRestrictions" },
|
|
16
35
|
React.createElement(RecordElement, null,
|
|
@@ -18,9 +37,7 @@ const CollectionAnnotationsElement = ({ element, }) => React.createElement(Annot
|
|
|
18
37
|
React.createElement(PropertyValueElement, { Property: "ReadByKeyRestrictions" },
|
|
19
38
|
React.createElement(RecordElement, null,
|
|
20
39
|
React.createElement(PropertyValueElement, { Property: "Readable", Bool: element.HasGetOnResource }))))),
|
|
21
|
-
React.createElement(
|
|
22
|
-
React.createElement(RecordElement, null,
|
|
23
|
-
React.createElement(PropertyValueElement, { Property: "Insertable", Bool: element.HasPostOnCollection }))),
|
|
40
|
+
React.createElement(InsertRestrictionsAnnotation, { hasPostOnCollection: element.HasPostOnCollection, requiredProperties: element.RequiredProperties }),
|
|
24
41
|
React.createElement(UpdateRestrictionsAnnotation, { hasUpdateOperation: element.HasPatchOnResource }),
|
|
25
42
|
React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.DeleteRestrictions" },
|
|
26
43
|
React.createElement(RecordElement, null,
|
|
@@ -29,6 +46,7 @@ const CollectionAnnotationsElement = ({ element, }) => React.createElement(Annot
|
|
|
29
46
|
React.createElement(ExpandRestrictionsAnnotation, { hasExpandOnCollectionOrResource: element.HasExpandOnCollectionOrResource, nonExpandableProperties: element.NonExpandableProperties }),
|
|
30
47
|
React.createElement(SearchRestrictionsAnnotation, { hasSearchOnCollection: element.HasSearchOnCollection }),
|
|
31
48
|
React.createElement(SkipSupportedAnnotation, { hasSkipOnCollection: element.HasSkipOnCollection }),
|
|
49
|
+
React.createElement(FilterRestrictionsAnnotation, { hasFilterOperation: element.HasFilterOperation, nonFilterableProperties: element.NonFilterableProperties }),
|
|
32
50
|
React.createElement(SortRestrictionsAnnotation, { hasSortOnCollection: element.HasSortOnCollection, nonSortableProperties: element.NonSortableProperties }),
|
|
33
51
|
React.createElement(TopSupportedAnnotation, { hasTopOnCollection: element.HasTopOnCollection }),
|
|
34
52
|
React.createElement(DescriptionAnnotation, { description: element.Description }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../src/components/annotations.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../src/components/annotations.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,oBAA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AAC,gBAAgB,GAAI,CAC9D,CACE;IAEpB,oBAAC,4BAA4B,IAAC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,GAAG;IAE/E,oBAAC,iBAAiB,IAAC,IAAI,EAAC,8CAA8C;QACpE,oBAAC,aAAa;YACZ,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,WAAW,EAAC,IAAI,EAAE,OAAO,CAAC,mBAAmB,GAAI,CAClE,CACE;IAEpB,oBAAC,4BAA4B,IAAC,+BAA+B,EAAE,OAAO,CAAC,+BAA+B,EAAE,uBAAuB,EAAE,OAAO,CAAC,uBAAuB,GAAI;IACpK,oBAAC,qBAAqB,IAAC,WAAW,EAAE,OAAO,CAAC,WAAW,GAAI,CAC3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-restrictions-annotation.d.ts","sourceRoot":"","sources":["../../../src/components/filter-restrictions-annotation.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AASlC,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAAC;IAC5C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,uBAAuB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC/C,CAWA,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AnnotationElement, CollectionElement, PropertyPathElement, PropertyValueElement, RecordElement, } from "./common-elements.js";
|
|
3
|
+
export const FilterRestrictionsAnnotation = ({ hasFilterOperation, nonFilterableProperties }) => (React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.FilterRestrictions" },
|
|
4
|
+
React.createElement(RecordElement, null,
|
|
5
|
+
React.createElement(PropertyValueElement, { Property: "Filterable", Bool: hasFilterOperation }),
|
|
6
|
+
hasFilterOperation ? (React.createElement(NonFilterableProperties, { nonFilterableProperties: nonFilterableProperties })) : (React.createElement(React.Fragment, null)))));
|
|
7
|
+
const NonFilterableProperties = ({ nonFilterableProperties, }) => (React.createElement(PropertyValueElement, { Property: "NonFilterableProperties" },
|
|
8
|
+
React.createElement(CollectionElement, null, nonFilterableProperties === null || nonFilterableProperties === void 0 ? void 0 : nonFilterableProperties.map((property) => (React.createElement(PropertyPathElement, { key: property },
|
|
9
|
+
React.createElement(React.Fragment, null, property)))))));
|
|
10
|
+
//# sourceMappingURL=filter-restrictions-annotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-restrictions-annotation.js","sourceRoot":"","sources":["../../../src/components/filter-restrictions-annotation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAE9B,MAAM,CAAC,MAAM,4BAA4B,GAGpC,CAAC,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,EAAE,EAAE,CAAC,CACxD,oBAAC,iBAAiB,IAAC,IAAI,EAAC,8CAA8C;IACpE,oBAAC,aAAa;QACZ,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,YAAY,EAAC,IAAI,EAAE,kBAAkB,GAAI;QACvE,kBAAkB,CAAC,CAAC,CAAC,CACpB,oBAAC,uBAAuB,IAAC,uBAAuB,EAAE,uBAAuB,GAAI,CAC9E,CAAC,CAAC,CAAC,CACF,yCAAK,CACN,CACa,CACE,CACrB,CAAC;AAEF,MAAM,uBAAuB,GAA0D,CAAC,EACtF,uBAAuB,GACxB,EAAE,EAAE,CAAC,CACJ,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,yBAAyB;IACtD,oBAAC,iBAAiB,QACf,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAC1C,oBAAC,mBAAmB,IAAC,GAAG,EAAE,QAAQ;QAChC,0CAAG,QAAQ,CAAI,CACK,CACvB,CAAC,CACgB,CACC,CACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immutable-annotation.d.ts","sourceRoot":"","sources":["../../../src/components/immutable-annotation.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,CAG9C,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AnnotationElement } from "./common-elements.js";
|
|
3
|
+
export const ImmutableAnnotation = ({ isImmutable }) => isImmutable
|
|
4
|
+
? React.createElement(AnnotationElement, { Term: "Org.OData.Core.V1.Immutable", Bool: isImmutable })
|
|
5
|
+
: React.createElement(React.Fragment, null);
|
|
6
|
+
//# sourceMappingURL=immutable-annotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immutable-annotation.js","sourceRoot":"","sources":["../../../src/components/immutable-annotation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CAAC,MAAM,mBAAmB,GAAiC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CACjF,WAAW;IACP,CAAC,CAAC,oBAAC,iBAAiB,IAAC,IAAI,EAAC,6BAA6B,EAAC,IAAI,EAAE,WAAW,GAAI;IAC7E,CAAC,CAAC,yCAAK,CAAA"}
|
|
@@ -2,9 +2,9 @@ import React from "react";
|
|
|
2
2
|
import CsdlRenderer from "../dom/renderer.js";
|
|
3
3
|
import { SchemaElement } from "./schema-element.js";
|
|
4
4
|
export function renderCsdl(namespaces) {
|
|
5
|
-
return CsdlRenderer.getXmlText(React.createElement(
|
|
5
|
+
return CsdlRenderer.getXmlText(React.createElement(GenerateCSDLFromTypeSpec, { namespaces: namespaces }));
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
return React.createElement(React.Fragment, null, namespaces.map((namespace) => React.createElement(SchemaElement, { namespace: namespace })));
|
|
7
|
+
const GenerateCSDLFromTypeSpec = ({ namespaces }) => {
|
|
8
|
+
return React.createElement(React.Fragment, null, namespaces.map((namespace) => React.createElement(SchemaElement, { namespace: namespace, key: namespace.Name })));
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,UAAU,UAAU,CAAC,UAA8B;IACvD,OAAO,YAAY,CAAC,UAAU,CAAC,oBAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,UAAU,UAAU,CAAC,UAA8B;IACvD,OAAO,YAAY,CAAC,UAAU,CAAC,oBAAC,wBAAwB,IAAC,UAAU,EAAE,UAAU,GAAI,CAAC,CAAC;AACvF,CAAC;AAED,MAAM,wBAAwB,GAA2C,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;IAC1F,OAAO,0CAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,oBAAC,aAAa,IAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,CAAC,IAAI,GAAI,CAAE,CAAI,CAAA;AAC5G,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-restrictions-annotation.d.ts","sourceRoot":"","sources":["../../../src/components/insert-restrictions-annotation.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AASlC,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAAC;IAC5C,mBAAmB,EAAE,OAAO,CAAC;IAC7B,kBAAkB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC1C,CAOA,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AnnotationElement, CollectionElement, PropertyPathElement, PropertyValueElement, RecordElement, } from "./common-elements.js";
|
|
3
|
+
export const InsertRestrictionsAnnotation = ({ hasPostOnCollection, requiredProperties }) => (React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.InsertRestrictions" },
|
|
4
|
+
React.createElement(RecordElement, null,
|
|
5
|
+
React.createElement(PropertyValueElement, { Property: "Insertable", Bool: hasPostOnCollection }),
|
|
6
|
+
hasPostOnCollection ? React.createElement(RequiredProperties, { requiredProperties: requiredProperties }) : React.createElement(React.Fragment, null))));
|
|
7
|
+
const RequiredProperties = ({ requiredProperties, }) => (React.createElement(PropertyValueElement, { Property: "RequiredProperties" },
|
|
8
|
+
React.createElement(CollectionElement, null, requiredProperties === null || requiredProperties === void 0 ? void 0 : requiredProperties.map((property) => (React.createElement(PropertyPathElement, { key: property },
|
|
9
|
+
React.createElement(React.Fragment, null, property)))))));
|
|
10
|
+
//# sourceMappingURL=insert-restrictions-annotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-restrictions-annotation.js","sourceRoot":"","sources":["../../../src/components/insert-restrictions-annotation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAE9B,MAAM,CAAC,MAAM,4BAA4B,GAGpC,CAAC,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,CACpD,oBAAC,iBAAiB,IAAC,IAAI,EAAC,8CAA8C;IACpE,oBAAC,aAAa;QACZ,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,YAAY,EAAC,IAAI,EAAE,mBAAmB,GAAI;QACxE,mBAAmB,CAAC,CAAC,CAAC,oBAAC,kBAAkB,IAAC,kBAAkB,EAAE,kBAAkB,GAAI,CAAC,CAAC,CAAC,yCAAK,CAC/E,CACE,CACrB,CAAC;AAEF,MAAM,kBAAkB,GAAqD,CAAC,EAC5E,kBAAkB,GACnB,EAAE,EAAE,CAAC,CACJ,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,oBAAoB;IACjD,oBAAC,iBAAiB,QACf,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACrC,oBAAC,mBAAmB,IAAC,GAAG,EAAE,QAAQ;QAChC,0CAAG,QAAQ,CAAI,CACK,CACvB,CAAC,CACgB,CACC,CACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-element.d.ts","sourceRoot":"","sources":["../../../src/components/property-element.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"property-element.d.ts","sourceRoot":"","sources":["../../../src/components/property-element.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAmB5D,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,oBAAoB,CAAA;CAAE,CAGZ,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { ComputedAnnotation } from "./computed-annotation.js";
|
|
|
3
3
|
import { DescriptionAnnotation } from "./description-annotation.js";
|
|
4
4
|
import { PermissionsAnnotation } from "./permissions-annotation.js";
|
|
5
5
|
import { RevisionsAnnotation } from "./revisions-annotation.js";
|
|
6
|
+
import { ImmutableAnnotation } from "./immutable-annotation.js";
|
|
6
7
|
const Property = (props) => React.createElement("Property", props);
|
|
7
8
|
const NavigationProperty = (props) => React.createElement("NavigationProperty", props);
|
|
8
9
|
export const PropertyElement = ({ property }) => property.IsNavigation
|
|
@@ -18,6 +19,7 @@ const StructuralPropertyElement = ({ property }) => {
|
|
|
18
19
|
React.createElement(ComputedAnnotation, { isComputed: property.IsComputed }),
|
|
19
20
|
React.createElement(PermissionsAnnotation, { permission: property.Permission }),
|
|
20
21
|
React.createElement(RevisionsAnnotation, { definition: property.RevisionDefinition }),
|
|
21
|
-
React.createElement(DescriptionAnnotation, { description: property.Description })
|
|
22
|
+
React.createElement(DescriptionAnnotation, { description: property.Description }),
|
|
23
|
+
React.createElement(ImmutableAnnotation, { isImmutable: property.isImmutable })));
|
|
22
24
|
};
|
|
23
25
|
//# sourceMappingURL=property-element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-element.js","sourceRoot":"","sources":["../../../src/components/property-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"property-element.js","sourceRoot":"","sources":["../../../src/components/property-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,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qBAAqB,IAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,GAAI,CACzC,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAA2C,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzF,OAAO,CACL,oBAAC,QAAQ,IACP,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,IAAI,EAAE,QAAQ,CAAC,gBAAgB,KAC3B,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,KAClD,QAAQ,CAAC,aAAa;QAE1B,oBAAC,kBAAkB,IAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,GAAI;QACvD,oBAAC,qBAAqB,IAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,GAAI;QAC1D,oBAAC,mBAAmB,IAAC,UAAU,EAAE,QAAQ,CAAC,kBAAkB,GAAI;QAChE,oBAAC,qBAAqB,IAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,GAAI;QAC5D,oBAAC,mBAAmB,IAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,GAAG,CAChD,CACZ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-element.d.ts","sourceRoot":"","sources":["../../../src/components/schema-element.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAkB5D,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC;IAAE,SAAS,EAAE,gBAAgB,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"schema-element.d.ts","sourceRoot":"","sources":["../../../src/components/schema-element.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAkB5D,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC;IAAE,SAAS,EAAE,gBAAgB,CAAA;CAAE,CAgB7D,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { EnumTypeList } from "./enum-type-element.js";
|
|
|
5
5
|
import { OperationElement } from "./operation-element.js";
|
|
6
6
|
import { EntityTypeElement, ComplexTypeElement } from "./structured-type-element.js";
|
|
7
7
|
import { MsGraphModelKind } from "../entities/model.js";
|
|
8
|
-
import { CollectionAnnotationsList, ResourceAnnotationsList } from "./annotations.js";
|
|
8
|
+
import { AllowedValuesAnnotationsList, CollectionAnnotationsList, ResourceAnnotationsList } from "./annotations.js";
|
|
9
9
|
const Schema = (props) => React.createElement("Schema", {
|
|
10
10
|
...props,
|
|
11
11
|
xmlns: "http://docs.oasis-open.org/odata/ns/edm",
|
|
@@ -17,13 +17,12 @@ export const SchemaElement = ({ namespace }) => {
|
|
|
17
17
|
React.createElement(ModelList, { models: namespace.Models }),
|
|
18
18
|
React.createElement(OperationList, { operations: namespace.Operations }),
|
|
19
19
|
React.createElement(EntityContainerElement, { singletons: namespace.Singletons, entitySets: namespace.EntitySets, agsAttributes: namespace.AgsAttributes }),
|
|
20
|
-
React.createElement(ResourceAnnotationsList, { elements: namespace.SingletonAnnotations }),
|
|
21
|
-
React.createElement(CollectionAnnotationsList, { elements: namespace.EntitySetAnnotations }),
|
|
22
20
|
React.createElement(ResourceAnnotationsList, { elements: namespace.ResourceAnnotations }),
|
|
23
|
-
React.createElement(CollectionAnnotationsList, { elements: namespace.CollectionAnnotations })
|
|
21
|
+
React.createElement(CollectionAnnotationsList, { elements: namespace.CollectionAnnotations }),
|
|
22
|
+
React.createElement(AllowedValuesAnnotationsList, { elements: namespace.AllowedValuesAnnotations })));
|
|
24
23
|
};
|
|
25
24
|
const ModelList = ({ models }) => {
|
|
26
|
-
return React.createElement(ItemList, { items: models, render: (model) => {
|
|
25
|
+
return (React.createElement(ItemList, { items: models, render: (model) => {
|
|
27
26
|
switch (model.Kind) {
|
|
28
27
|
case MsGraphModelKind.Entity: {
|
|
29
28
|
return React.createElement(EntityTypeElement, { model: model });
|
|
@@ -35,9 +34,9 @@ const ModelList = ({ models }) => {
|
|
|
35
34
|
return React.createElement(React.Fragment, null);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
} });
|
|
37
|
+
} }));
|
|
39
38
|
};
|
|
40
39
|
const OperationList = ({ operations }) => {
|
|
41
|
-
return React.createElement(ItemList, { items: operations, render: (operation) => React.createElement(OperationElement, { element: operation }) });
|
|
40
|
+
return (React.createElement(ItemList, { items: operations, render: (operation) => React.createElement(OperationElement, { element: operation }) }));
|
|
42
41
|
};
|
|
43
42
|
//# sourceMappingURL=schema-element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-element.js","sourceRoot":"","sources":["../../../src/components/schema-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAgB,MAAM,sBAAsB,CAAC;AAEtE,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema-element.js","sourceRoot":"","sources":["../../../src/components/schema-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;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M,EAAE,EAAE,EAAE;IAC1E,OAAO,CACL,oBAAC,QAAQ,IACP,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,QAAQ,KAAK,CAAC,IAAI,EAAE;gBAClB,KAAK,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBAC5B,OAAO,oBAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;iBAC5C;gBACD,KAAK,gBAAgB,CAAC,OAAO,CAAC,CAAC;oBAC7B,OAAO,oBAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;iBAC7C;gBACD,OAAO,CAAC,CAAC;oBACP,OAAO,yCAAK,CAAC;iBACd;aACF;QACH,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,aAAa,GAA2C,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;IAC/E,OAAO,CACL,oBAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,oBAAC,gBAAgB,IAAC,OAAO,EAAE,SAAS,GAAI,GAAI,CACjG,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DecoratorContext, Operation, Program } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@action` - mark an operation as an action
|
|
4
|
+
*
|
|
5
|
+
* `@action` can only be applied to operations.
|
|
6
|
+
*/
|
|
7
|
+
export declare function $action(context: DecoratorContext, target: Operation, name?: string): void;
|
|
8
|
+
export declare function isAction(program: Program, target: Operation): boolean;
|
|
9
|
+
export declare function getAction(program: Program, target: Operation): string | undefined;
|
|
10
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/decorators/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI1E;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,QAElF;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,WAE3D;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEjF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const actionKey = Symbol("action");
|
|
2
|
+
/**
|
|
3
|
+
* `@action` - mark an operation as an action
|
|
4
|
+
*
|
|
5
|
+
* `@action` can only be applied to operations.
|
|
6
|
+
*/
|
|
7
|
+
export function $action(context, target, name) {
|
|
8
|
+
context.program.stateMap(actionKey).set(target, name || target.name);
|
|
9
|
+
}
|
|
10
|
+
export function isAction(program, target) {
|
|
11
|
+
return program.stateMap(actionKey).has(target);
|
|
12
|
+
}
|
|
13
|
+
export function getAction(program, target) {
|
|
14
|
+
return program.stateMap(actionKey).get(target);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/decorators/action.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAyB,EAAE,MAAiB,EAAE,IAAa;IACjF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAiB;IAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAiB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DecoratorContext, ModelProperty, Program } from "@typespec/compiler";
|
|
2
|
+
import { AllowedValues } from "../entities/model.js";
|
|
3
|
+
/**
|
|
4
|
+
* `@allowedValues` - mark a model property with allowedValues
|
|
5
|
+
*
|
|
6
|
+
* `@allowedValues` can only be applied to model properties.
|
|
7
|
+
*/
|
|
8
|
+
export declare function $allowedValues(context: DecoratorContext, target: ModelProperty, ...values: unknown[]): void;
|
|
9
|
+
export declare function hasAllowedValues(program: Program, target: ModelProperty): boolean;
|
|
10
|
+
export declare function getAllowedValues(program: Program, target: ModelProperty): AllowedValues;
|
|
11
|
+
export declare function isAllowedValuesArgumentsEmpty(program: Program, target: ModelProperty): boolean;
|
|
12
|
+
export declare function isAllowedValuesPrimitive(program: Program, target: ModelProperty): boolean;
|
|
13
|
+
//# sourceMappingURL=allowed-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowed-values.d.ts","sourceRoot":"","sources":["../../../src/decorators/allowed-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;;;GAIG;AAEH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,QAEpG;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,WAEvE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,aAAa,CAOvF;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,WAEpF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAQzF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const allowedValuesKey = Symbol("allowedValues");
|
|
2
|
+
/**
|
|
3
|
+
* `@allowedValues` - mark a model property with allowedValues
|
|
4
|
+
*
|
|
5
|
+
* `@allowedValues` can only be applied to model properties.
|
|
6
|
+
*/
|
|
7
|
+
export function $allowedValues(context, target, ...values) {
|
|
8
|
+
context.program.stateMap(allowedValuesKey).set(target, values);
|
|
9
|
+
}
|
|
10
|
+
export function hasAllowedValues(program, target) {
|
|
11
|
+
return program.stateMap(allowedValuesKey).has(target);
|
|
12
|
+
}
|
|
13
|
+
export function getAllowedValues(program, target) {
|
|
14
|
+
var _a;
|
|
15
|
+
const values = program.stateMap(allowedValuesKey).get(target);
|
|
16
|
+
const type = (_a = target.type.node) === null || _a === void 0 ? void 0 : _a.symbol.name;
|
|
17
|
+
return {
|
|
18
|
+
type: type,
|
|
19
|
+
values: values
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function isAllowedValuesArgumentsEmpty(program, target) {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
return ((_b = (_a = getAllowedValues(program, target)) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.length) === 0;
|
|
25
|
+
}
|
|
26
|
+
export function isAllowedValuesPrimitive(program, target) {
|
|
27
|
+
const values = program.stateMap(allowedValuesKey).get(target);
|
|
28
|
+
for (let i = 0; i < (values === null || values === void 0 ? void 0 : values.length); i++) {
|
|
29
|
+
if (typeof values[i] === 'object' || values[i] === null || Array.isArray(values[i]) || typeof values[i] === 'function') {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=allowed-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowed-values.js","sourceRoot":"","sources":["../../../src/decorators/allowed-values.ts"],"names":[],"mappings":"AAGA,MAAM,gBAAgB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACjD;;;;GAIG;AAEH,MAAM,UAAU,cAAc,CAAC,OAAyB,EAAE,MAAqB,EAAE,GAAG,MAAiB;IACnG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,MAAqB;IACtE,OAAO,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,MAAqB;;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC;IAC3C,OAAO;QACL,IAAI,EAAE,IAAK;QACX,MAAM,EAAE,MAAM;KACf,CAAA;AACH,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,OAAgB,EAAE,MAAqB;;IACnF,OAAO,CAAA,MAAA,MAAA,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,0CAAE,MAAM,0CAAE,MAAM,MAAK,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAgB,EAAE,MAAqB;IAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9D,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,IAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA,EAAG,CAAC,EAAE,EAAC;QACnC,IAAG,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,EAAC;YACpH,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DecoratorContext, Operation, Program } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@filter` - Applies to: get operations that return collections of @entity or @complex models.
|
|
4
|
+
* Indicates that the get operation supports OData $filter query parameter.
|
|
5
|
+
*
|
|
6
|
+
* `properties` - List of property names in the model returned from the get operation that can be used in $filter query parameter.
|
|
7
|
+
*/
|
|
8
|
+
export declare function $filter(context: DecoratorContext, target: Operation, ...properties: string[]): void;
|
|
9
|
+
export declare function getFilter(program: Program, target: Operation): string[];
|
|
10
|
+
export declare function isFilter(program: Program, target: Operation): boolean;
|
|
11
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/decorators/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI1E;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,QAG5F;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,EAAE,CAEvE;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,WAE3D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const filterKey = Symbol("filter");
|
|
2
|
+
/**
|
|
3
|
+
* `@filter` - Applies to: get operations that return collections of @entity or @complex models.
|
|
4
|
+
* Indicates that the get operation supports OData $filter query parameter.
|
|
5
|
+
*
|
|
6
|
+
* `properties` - List of property names in the model returned from the get operation that can be used in $filter query parameter.
|
|
7
|
+
*/
|
|
8
|
+
export function $filter(context, target, ...properties) {
|
|
9
|
+
const filterProperties = unpackFilterProperties(properties);
|
|
10
|
+
context.program.stateMap(filterKey).set(target, filterProperties);
|
|
11
|
+
}
|
|
12
|
+
export function getFilter(program, target) {
|
|
13
|
+
return program.stateMap(filterKey).get(target) || [];
|
|
14
|
+
}
|
|
15
|
+
export function isFilter(program, target) {
|
|
16
|
+
return program.stateMap(filterKey).has(target);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Filters out all empty strings that could be part of the properties string array.
|
|
20
|
+
*
|
|
21
|
+
* @param properties string array containing filter parameters.
|
|
22
|
+
* @returns string array of the filter parameters
|
|
23
|
+
*/
|
|
24
|
+
function unpackFilterProperties(properties) {
|
|
25
|
+
return properties ? properties.filter(property => property.trim() !== '') : [];
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/decorators/filter.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAyB,EAAE,MAAiB,EAAE,GAAG,UAAoB;IAC3F,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC5D,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAiB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAiB;IAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;;;;GAKG;AACH,SAAS,sBAAsB,CAAC,UAAoB;IAClD,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAChF,CAAC"}
|
|
@@ -4,6 +4,13 @@ import { DecoratorContext, Interface, Operation, Program, Type } from "@typespec
|
|
|
4
4
|
* `@graphRoute` - Applies to interfaces and operations.
|
|
5
5
|
*/
|
|
6
6
|
export declare function $graphRoute(context: DecoratorContext, target: Interface | Operation, path: string): void;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Extract params to be interpolated(Wrapped in '{' and '}'}) from a path/url.
|
|
9
|
+
* @param path Path/Url
|
|
10
|
+
*
|
|
11
|
+
* @example "foo/{name}/bar" -> ["name"]
|
|
12
|
+
*/
|
|
13
|
+
export declare function extractParamsFromPath(path: string): string[];
|
|
14
|
+
export declare function getGraphRoutePaths(program: Program, target: Type): string[] | undefined;
|
|
8
15
|
export declare function hasGraphRoute(program: Program, target: Type): boolean;
|
|
9
16
|
//# sourceMappingURL=graph-route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-route.d.ts","sourceRoot":"","sources":["../../../src/decorators/graph-route.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,EAIL,MAAM,oBAAoB,CAAC;AAM5B;;;GAGG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"graph-route.d.ts","sourceRoot":"","sources":["../../../src/decorators/graph-route.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,EAIL,MAAM,oBAAoB,CAAC;AAM5B;;;GAGG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,QAgCb;AAmDD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG5D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,SAAS,CAGvF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,WAE3D"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { setRoute } from "@typespec/http";
|
|
2
1
|
import { getNavigationSourceType } from "../utils.js";
|
|
2
|
+
import { $path } from "@typespec/http";
|
|
3
3
|
const graphRouteKey = Symbol("graphRoute");
|
|
4
4
|
/**
|
|
5
5
|
* `@graphRoute` - Allow us to define an HTTP route for an interface or operation.
|
|
6
6
|
* `@graphRoute` - Applies to interfaces and operations.
|
|
7
7
|
*/
|
|
8
8
|
export function $graphRoute(context, target, path) {
|
|
9
|
-
context.program.stateMap(graphRouteKey)
|
|
10
|
-
|
|
11
|
-
path
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const state = context.program.stateMap(graphRouteKey);
|
|
10
|
+
if (state.has(target)) {
|
|
11
|
+
state.set(target, [...state.get(target), path]);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
state.set(target, [path]);
|
|
15
|
+
}
|
|
14
16
|
const routeParams = extractParamsFromPath(path);
|
|
15
17
|
// Modify the operations to inject path parameters and correct resource type from interface base interface.
|
|
16
18
|
// TODO: Using @graphRoute on an operation currently does not work due to the following TypeSpec core issue
|
|
@@ -28,14 +30,14 @@ export function $graphRoute(context, target, path) {
|
|
|
28
30
|
target.operations.forEach((operation) => {
|
|
29
31
|
const returnType = getNavigationSourceType(context.program, operation);
|
|
30
32
|
if (returnType !== undefined) {
|
|
31
|
-
replaceParametersOnOperation(operation, routeParams);
|
|
33
|
+
replaceParametersOnOperation(context, operation, routeParams);
|
|
32
34
|
replaceResourceType(context.program, operation, returnType);
|
|
33
35
|
}
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
function replaceResourceType(program, operation, resourceType) {
|
|
38
|
-
const [calculatedResourceType, _] = program.resolveTypeReference("
|
|
40
|
+
const [calculatedResourceType, _] = program.resolveTypeReference("MsGraph.Automatic.CalculatedResourceType");
|
|
39
41
|
if (!calculatedResourceType) {
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
@@ -52,15 +54,26 @@ function getResourceCoreType(resourceType) {
|
|
|
52
54
|
var _a;
|
|
53
55
|
return resourceType.indexer !== undefined ? (_a = resourceType.indexer) === null || _a === void 0 ? void 0 : _a.value : resourceType;
|
|
54
56
|
}
|
|
55
|
-
function replaceParametersOnOperation(operation, params) {
|
|
57
|
+
function replaceParametersOnOperation(context, operation, params) {
|
|
56
58
|
if (operation.parameters.properties.has("graphRouteParams")) {
|
|
57
59
|
operation.parameters.properties.delete("graphRouteParams");
|
|
58
60
|
params.forEach((param) => {
|
|
59
|
-
|
|
61
|
+
var _a;
|
|
62
|
+
const property = {
|
|
60
63
|
name: param,
|
|
61
64
|
kind: "ModelProperty",
|
|
62
65
|
type: { name: "string", kind: "Scalar" },
|
|
66
|
+
};
|
|
67
|
+
// Instantly apply the @path decorator to the path parameter
|
|
68
|
+
context.call($path, property, param);
|
|
69
|
+
// Manually push the decorator onto the property so that it gets applied
|
|
70
|
+
// to operations which reference the operation with `is`
|
|
71
|
+
property.decorators = (_a = property.decorators) !== null && _a !== void 0 ? _a : [];
|
|
72
|
+
property.decorators.push({
|
|
73
|
+
decorator: $path,
|
|
74
|
+
args: [{ value: context.program.checker.createLiteralType(param), jsValue: param }],
|
|
63
75
|
});
|
|
76
|
+
operation.parameters.properties.set(param, property);
|
|
64
77
|
});
|
|
65
78
|
}
|
|
66
79
|
}
|
|
@@ -70,13 +83,14 @@ function replaceParametersOnOperation(operation, params) {
|
|
|
70
83
|
*
|
|
71
84
|
* @example "foo/{name}/bar" -> ["name"]
|
|
72
85
|
*/
|
|
73
|
-
function extractParamsFromPath(path) {
|
|
86
|
+
export function extractParamsFromPath(path) {
|
|
74
87
|
var _a;
|
|
75
88
|
const matchResults = path.match(/\{\w+\}/g);
|
|
76
89
|
return (_a = matchResults === null || matchResults === void 0 ? void 0 : matchResults.map((s) => s.slice(1, -1))) !== null && _a !== void 0 ? _a : [];
|
|
77
90
|
}
|
|
78
|
-
export function
|
|
79
|
-
|
|
91
|
+
export function getGraphRoutePaths(program, target) {
|
|
92
|
+
const graphRoute = program.stateMap(graphRouteKey).get(target);
|
|
93
|
+
return graphRoute;
|
|
80
94
|
}
|
|
81
95
|
export function hasGraphRoute(program, target) {
|
|
82
96
|
return program.stateMap(graphRouteKey).has(target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-route.js","sourceRoot":"","sources":["../../../src/decorators/graph-route.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"graph-route.js","sourceRoot":"","sources":["../../../src/decorators/gra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model property as immutable
|
|
4
|
+
* '@immutable' can only be applied to Model properties.
|
|
5
|
+
*/
|
|
6
|
+
export declare function $immutable(context: DecoratorContext, target: ModelProperty): void;
|
|
7
|
+
export declare function isImmutable(program: Program, target: ModelProperty): boolean;
|
|
8
|
+
//# sourceMappingURL=immutable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immutable.d.ts","sourceRoot":"","sources":["../../../src/decorators/immutable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI9E;;;GAGG;AAEH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAEjF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,WAElE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const immutableKey = Symbol("immutable");
|
|
2
|
+
/**
|
|
3
|
+
* `@immutable` - mark a model property as immutable
|
|
4
|
+
* '@immutable' can only be applied to Model properties.
|
|
5
|
+
*/
|
|
6
|
+
export function $immutable(context, target) {
|
|
7
|
+
context.program.stateSet(immutableKey).add(target);
|
|
8
|
+
}
|
|
9
|
+
export function isImmutable(program, target) {
|
|
10
|
+
return program.stateSet(immutableKey).has(target);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=immutable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immutable.js","sourceRoot":"","sources":["../../../src/decorators/immutable.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEzC;;;GAGG;AAEH,MAAM,UAAU,UAAU,CAAC,OAAyB,EAAE,MAAqB;IACzE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,MAAqB;IACjE,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC"}
|