@microsoft/typespec-msgraph 0.0.1-Preview.1 → 0.0.1-Preview.3
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/acceptable-media-types-annotation.d.ts +3 -4
- package/dist/src/components/acceptable-media-types-annotation.d.ts.map +1 -1
- package/dist/src/components/acceptable-media-types-annotation.js +2 -6
- package/dist/src/components/acceptable-media-types-annotation.js.map +1 -1
- package/dist/src/components/alternate-keys-annotation.d.ts +4 -4
- package/dist/src/components/alternate-keys-annotation.d.ts.map +1 -1
- package/dist/src/components/alternate-keys-annotation.js +5 -13
- package/dist/src/components/alternate-keys-annotation.js.map +1 -1
- package/dist/src/components/common-elements.d.ts +0 -71
- package/dist/src/components/common-elements.d.ts.map +1 -1
- package/dist/src/components/common-elements.js +10 -24
- package/dist/src/components/common-elements.js.map +1 -1
- package/dist/src/components/computed-annotation.d.ts +3 -4
- package/dist/src/components/computed-annotation.d.ts.map +1 -1
- package/dist/src/components/computed-annotation.js +4 -10
- package/dist/src/components/computed-annotation.js.map +1 -1
- package/dist/src/components/count-restrictions-annotation.d.ts +3 -4
- package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/count-restrictions-annotation.js +2 -6
- package/dist/src/components/count-restrictions-annotation.js.map +1 -1
- package/dist/src/components/description-annotation.d.ts +3 -4
- package/dist/src/components/description-annotation.d.ts.map +1 -1
- package/dist/src/components/description-annotation.js +4 -11
- package/dist/src/components/description-annotation.js.map +1 -1
- package/dist/src/components/entity-container-element.d.ts +6 -0
- package/dist/src/components/entity-container-element.d.ts.map +1 -0
- package/dist/src/components/entity-container-element.js +58 -0
- package/dist/src/components/entity-container-element.js.map +1 -0
- package/dist/src/components/enum-type-element.d.ts +6 -0
- package/dist/src/components/enum-type-element.d.ts.map +1 -0
- package/dist/src/components/enum-type-element.js +17 -0
- package/dist/src/components/enum-type-element.js.map +1 -0
- package/dist/src/components/expand-restrictions-annotation.d.ts +4 -5
- package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/expand-restrictions-annotation.js +5 -20
- package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
- package/dist/src/components/index.d.ts +2 -14
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +9 -14
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/operation-element.d.ts +6 -0
- package/dist/src/components/operation-element.d.ts.map +1 -0
- package/dist/src/components/operation-element.js +70 -0
- package/dist/src/components/operation-element.js.map +1 -0
- package/dist/src/components/permissions-annotation.d.ts +3 -4
- package/dist/src/components/permissions-annotation.d.ts.map +1 -1
- package/dist/src/components/permissions-annotation.js +2 -10
- package/dist/src/components/permissions-annotation.js.map +1 -1
- package/dist/src/components/property-element.d.ts +4 -4
- package/dist/src/components/property-element.d.ts.map +1 -1
- package/dist/src/components/property-element.js +14 -32
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/revisions-annotation.d.ts +4 -5
- package/dist/src/components/revisions-annotation.d.ts.map +1 -1
- package/dist/src/components/revisions-annotation.js +7 -51
- package/dist/src/components/revisions-annotation.js.map +1 -1
- package/dist/src/components/schema-element.d.ts +6 -0
- package/dist/src/components/schema-element.d.ts.map +1 -0
- package/dist/src/components/schema-element.js +38 -0
- package/dist/src/components/schema-element.js.map +1 -0
- package/dist/src/components/search-restrictions-annotation.d.ts +3 -4
- package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/search-restrictions-annotation.js +2 -6
- package/dist/src/components/search-restrictions-annotation.js.map +1 -1
- package/dist/src/components/skip-supported-annotation.d.ts +3 -4
- package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
- package/dist/src/components/skip-supported-annotation.js +2 -6
- package/dist/src/components/skip-supported-annotation.js.map +1 -1
- package/dist/src/components/sort-restrictions-annotation.d.ts +4 -5
- package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/sort-restrictions-annotation.js +5 -20
- package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
- package/dist/src/components/structured-type-element.d.ts +10 -4
- package/dist/src/components/structured-type-element.d.ts.map +1 -1
- package/dist/src/components/structured-type-element.js +18 -58
- package/dist/src/components/structured-type-element.js.map +1 -1
- package/dist/src/components/top-supported-annotation.d.ts +3 -4
- package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
- package/dist/src/components/top-supported-annotation.js +2 -6
- package/dist/src/components/top-supported-annotation.js.map +1 -1
- package/dist/src/decorators/abstract.d.ts.map +1 -1
- package/dist/src/decorators/abstract.js +0 -6
- package/dist/src/decorators/abstract.js.map +1 -1
- package/dist/src/decorators/complex.d.ts.map +1 -1
- package/dist/src/decorators/complex.js +0 -6
- package/dist/src/decorators/complex.js.map +1 -1
- package/dist/src/decorators/decorator-parameter.d.ts +4 -0
- package/dist/src/decorators/decorator-parameter.d.ts.map +1 -0
- package/dist/src/decorators/decorator-parameter.js +2 -0
- package/dist/src/decorators/decorator-parameter.js.map +1 -0
- package/dist/src/decorators/deprecated-definition.d.ts +4 -3
- package/dist/src/decorators/deprecated-definition.d.ts.map +1 -1
- package/dist/src/decorators/deprecated-definition.js +7 -1
- package/dist/src/decorators/deprecated-definition.js.map +1 -1
- package/dist/src/decorators/entity.d.ts.map +1 -1
- package/dist/src/decorators/entity.js +0 -6
- package/dist/src/decorators/entity.js.map +1 -1
- package/dist/src/decorators/expand.d.ts +2 -1
- 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 +11 -0
- package/dist/src/decorators/function.d.ts.map +1 -0
- package/dist/src/decorators/function.js +16 -0
- package/dist/src/decorators/function.js.map +1 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts +2 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +1 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js +3 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +1 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +2 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +1 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.js +3 -3
- package/dist/src/decorators/handlers/custom/ags-attribute.js.map +1 -1
- package/dist/src/decorators/handlers/index.d.ts +4 -3
- package/dist/src/decorators/handlers/index.d.ts.map +1 -1
- package/dist/src/decorators/handlers/index.js +4 -4
- package/dist/src/decorators/handlers/index.js.map +1 -1
- package/dist/src/decorators/has-stream.d.ts +3 -3
- package/dist/src/decorators/has-stream.d.ts.map +1 -1
- package/dist/src/decorators/has-stream.js +2 -15
- package/dist/src/decorators/has-stream.js.map +1 -1
- package/dist/src/decorators/index.d.ts +5 -1
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +5 -1
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/open.d.ts.map +1 -1
- package/dist/src/decorators/open.js +0 -6
- package/dist/src/decorators/open.js.map +1 -1
- package/dist/src/decorators/{routed-interfaces.d.ts → operation-parameters.d.ts} +3 -11
- package/dist/src/decorators/operation-parameters.d.ts.map +1 -0
- package/dist/src/decorators/operation-parameters.js +15 -0
- package/dist/src/decorators/operation-parameters.js.map +1 -0
- package/dist/src/decorators/order-by.d.ts +2 -1
- 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/private-preview-definition.d.ts +4 -3
- package/dist/src/decorators/private-preview-definition.d.ts.map +1 -1
- package/dist/src/decorators/private-preview-definition.js +6 -1
- package/dist/src/decorators/private-preview-definition.js.map +1 -1
- package/dist/src/decorators/private-preview.d.ts +2 -1
- package/dist/src/decorators/private-preview.d.ts.map +1 -1
- package/dist/src/decorators/private-preview.js +1 -11
- package/dist/src/decorators/private-preview.js.map +1 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +4 -2
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/entities/entity-container.d.ts +35 -0
- package/dist/src/entities/entity-container.d.ts.map +1 -0
- package/dist/src/entities/entity-container.js +132 -0
- package/dist/src/entities/entity-container.js.map +1 -0
- package/dist/src/entities/enum.d.ts +16 -0
- package/dist/src/entities/enum.d.ts.map +1 -0
- package/dist/src/entities/enum.js +22 -0
- package/dist/src/entities/enum.js.map +1 -0
- package/dist/src/entities/model.d.ts +50 -0
- package/dist/src/entities/model.d.ts.map +1 -0
- package/dist/src/entities/model.js +119 -0
- package/dist/src/entities/model.js.map +1 -0
- package/dist/src/entities/namespace.d.ts +14 -0
- package/dist/src/entities/namespace.d.ts.map +1 -0
- package/dist/src/entities/namespace.js +41 -0
- package/dist/src/entities/namespace.js.map +1 -0
- package/dist/src/entities/operation.d.ts +28 -0
- package/dist/src/entities/operation.d.ts.map +1 -0
- package/dist/src/entities/operation.js +88 -0
- package/dist/src/entities/operation.js.map +1 -0
- package/dist/src/entities/property.d.ts +3 -0
- package/dist/src/entities/property.d.ts.map +1 -0
- package/dist/src/entities/property.js +54 -0
- package/dist/src/entities/property.js.map +1 -0
- package/dist/src/entities/revision-definition.d.ts +9 -0
- package/dist/src/entities/revision-definition.d.ts.map +1 -0
- package/dist/src/entities/revision-definition.js +42 -0
- package/dist/src/entities/revision-definition.js.map +1 -0
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/rules/entity.d.ts +1 -0
- package/dist/src/rules/entity.d.ts.map +1 -1
- package/dist/src/rules/entity.js +36 -0
- package/dist/src/rules/entity.js.map +1 -1
- package/dist/src/rules/enum.d.ts +2 -0
- package/dist/src/rules/enum.d.ts.map +1 -0
- package/dist/src/rules/enum.js +26 -0
- package/dist/src/rules/enum.js.map +1 -0
- package/dist/src/rules/function.d.ts +2 -0
- package/dist/src/rules/function.d.ts.map +1 -0
- package/dist/src/rules/function.js +26 -0
- package/dist/src/rules/function.js.map +1 -0
- package/dist/src/rules/index.d.ts +3 -4
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +40 -111
- package/dist/src/rules/index.js.map +1 -1
- package/lib/decorators.tsp +29 -22
- package/package.json +29 -13
- package/dist/src/components/program-context.d.ts +0 -4
- package/dist/src/components/program-context.d.ts.map +0 -1
- package/dist/src/components/program-context.js +0 -3
- package/dist/src/components/program-context.js.map +0 -1
- package/dist/src/csdl.d.ts +0 -8
- package/dist/src/csdl.d.ts.map +0 -1
- package/dist/src/csdl.js +0 -298
- package/dist/src/csdl.js.map +0 -1
- package/dist/src/decorators/routed-interfaces.d.ts.map +0 -1
- package/dist/src/decorators/routed-interfaces.js +0 -43
- package/dist/src/decorators/routed-interfaces.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,IAAI,CAAC,EAAE,kBAAkB,EACzB,GAAG,UAAU,EAAE,kBAAkB,EAAE,QAOpC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAElE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,CAExE"}
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
import { createDecoratorDefinition } from "@typespec/compiler";
|
|
2
|
-
// -- @hasStream decorator
|
|
3
1
|
const hasStreamKey = Symbol("hasStream");
|
|
4
|
-
// TODO: Remove this and move to extern dec once Model type is defined in TypeSpec.Reflection https://github.com/microsoft/typespec/issues/1655
|
|
5
|
-
const hasStreamDecorator = createDecoratorDefinition({
|
|
6
|
-
name: "@hasStream",
|
|
7
|
-
target: ["Model"],
|
|
8
|
-
args: [],
|
|
9
|
-
spreadArgs: { kind: "String" },
|
|
10
|
-
});
|
|
11
2
|
/**
|
|
12
3
|
* `@hasStream` - indicates that an `@entity` model has a stream.
|
|
13
4
|
*
|
|
14
|
-
* `mediaTypes` - list of media types supported by the stream.
|
|
15
|
-
* If not specified, the stream supports any media type.
|
|
5
|
+
* `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
|
|
16
6
|
*/
|
|
17
7
|
export function $hasStream(context, target, args, ...mediaTypes) {
|
|
18
|
-
const types = args ? [args, ...mediaTypes] : [];
|
|
19
|
-
if (!hasStreamDecorator.validate(context, target, types)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
8
|
+
const types = args ? [args.value, ...mediaTypes.map(m => m.value)] : [];
|
|
22
9
|
context.program.stateMap(hasStreamKey).set(target, types.filter((t) => t.trim()));
|
|
23
10
|
}
|
|
24
11
|
export function hasStream(program, target) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-stream.js","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"has-stream.js","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,OAAyB,EACzB,MAAa,EACb,IAAyB,EACzB,GAAG,UAAgC;IAEnC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CACxC,MAAM,EACN,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAa;IACvD,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAgB,EAAE,MAAa;IAC5D,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -7,13 +7,17 @@ export * from "./count.js";
|
|
|
7
7
|
export * from "./deprecated-definition.js";
|
|
8
8
|
export * from "./entity.js";
|
|
9
9
|
export * from "./expand.js";
|
|
10
|
+
export * from "./function.js";
|
|
11
|
+
export * from "./handlers/custom/index.js";
|
|
12
|
+
export * from "./handlers/index.js";
|
|
13
|
+
export * from "./has-stream.js";
|
|
10
14
|
export * from "./open.js";
|
|
15
|
+
export * from "./operation-parameters.js";
|
|
11
16
|
export * from "./order-by.js";
|
|
12
17
|
export * from "./private-preview-definition.js";
|
|
13
18
|
export * from "./private-preview.js";
|
|
14
19
|
export * from "./read-only.js";
|
|
15
20
|
export * from "./references.js";
|
|
16
|
-
export * from "./routed-interfaces.js";
|
|
17
21
|
export * from "./search.js";
|
|
18
22
|
export * from "./skip.js";
|
|
19
23
|
export * from "./top.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
|
@@ -7,13 +7,17 @@ export * from "./count.js";
|
|
|
7
7
|
export * from "./deprecated-definition.js";
|
|
8
8
|
export * from "./entity.js";
|
|
9
9
|
export * from "./expand.js";
|
|
10
|
+
export * from "./function.js";
|
|
11
|
+
export * from "./handlers/custom/index.js";
|
|
12
|
+
export * from "./handlers/index.js";
|
|
13
|
+
export * from "./has-stream.js";
|
|
10
14
|
export * from "./open.js";
|
|
15
|
+
export * from "./operation-parameters.js";
|
|
11
16
|
export * from "./order-by.js";
|
|
12
17
|
export * from "./private-preview-definition.js";
|
|
13
18
|
export * from "./private-preview.js";
|
|
14
19
|
export * from "./read-only.js";
|
|
15
20
|
export * from "./references.js";
|
|
16
|
-
export * from "./routed-interfaces.js";
|
|
17
21
|
export * from "./search.js";
|
|
18
22
|
export * from "./skip.js";
|
|
19
23
|
export * from "./top.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/decorators/open.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/decorators/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,QAE7D;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,WAErD"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// -- @open decorator
|
|
2
|
-
import { validateDecoratorTarget } from "@typespec/compiler";
|
|
3
1
|
const openKey = Symbol("open");
|
|
4
2
|
/**
|
|
5
3
|
* `@open` - mark a model type as open
|
|
@@ -7,10 +5,6 @@ const openKey = Symbol("open");
|
|
|
7
5
|
* `@open` can only be applied to models.
|
|
8
6
|
*/
|
|
9
7
|
export function $open(context, entity) {
|
|
10
|
-
// TODO: Remove this and move to extern dec once Model type is defined in TypeSpec.Reflection https://github.com/microsoft/typespec/issues/1655
|
|
11
|
-
if (!validateDecoratorTarget(context, entity, "@open", "Model")) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
8
|
context.program.stateSet(openKey).add(entity);
|
|
15
9
|
}
|
|
16
10
|
export function isOpen(program, entity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/decorators/open.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/decorators/open.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,OAAyB,EAAE,MAAa;IAC5D,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAgB,EAAE,MAAa;IACpD,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import { DecoratorContext, Model,
|
|
2
|
-
/**
|
|
3
|
-
* `@function` - mark an operation as a function
|
|
4
|
-
*
|
|
5
|
-
* `@function` can only be applied to operations.
|
|
6
|
-
*/
|
|
7
|
-
export declare function $function(context: DecoratorContext, target: Operation, name?: string): void;
|
|
8
|
-
export declare function isFunction(program: Program, target: Operation): boolean;
|
|
9
|
-
export declare function getFunction(program: Program, target: Operation): string | undefined;
|
|
1
|
+
import { DecoratorContext, Model, Program } from "@typespec/compiler";
|
|
10
2
|
/**
|
|
11
3
|
* `@operationParameters` - A model with this decorator will not be generated in the CSDL
|
|
12
4
|
* and can't be reused by other models through inheritance,
|
|
@@ -14,6 +6,6 @@ export declare function getFunction(program: Program, target: Operation): string
|
|
|
14
6
|
* The purpose of this model is only to define model parameters that would be too verbose.
|
|
15
7
|
* This decorator will be the equivalent of inlining the properties of the model into parameters of the operation.
|
|
16
8
|
*/
|
|
17
|
-
export declare function $operationParameters(context: DecoratorContext, model:
|
|
9
|
+
export declare function $operationParameters(context: DecoratorContext, model: Model): void;
|
|
18
10
|
export declare function isOperationParameters(program: Program, model: Model): boolean;
|
|
19
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=operation-parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-parameters.d.ts","sourceRoot":"","sources":["../../../src/decorators/operation-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGtE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,QAE3E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,WAEnE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const operationParametersKey = Symbol("operationParameters");
|
|
2
|
+
/**
|
|
3
|
+
* `@operationParameters` - A model with this decorator will not be generated in the CSDL
|
|
4
|
+
* and can't be reused by other models through inheritance,
|
|
5
|
+
* or any other way except through being a parameter for an action operation.
|
|
6
|
+
* The purpose of this model is only to define model parameters that would be too verbose.
|
|
7
|
+
* This decorator will be the equivalent of inlining the properties of the model into parameters of the operation.
|
|
8
|
+
*/
|
|
9
|
+
export function $operationParameters(context, model) {
|
|
10
|
+
context.program.stateSet(operationParametersKey).add(model);
|
|
11
|
+
}
|
|
12
|
+
export function isOperationParameters(program, model) {
|
|
13
|
+
return program.stateSet(operationParametersKey).has(model);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=operation-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-parameters.js","sourceRoot":"","sources":["../../../src/decorators/operation-parameters.ts"],"names":[],"mappings":"AAEA,MAAM,sBAAsB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAC7D;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAyB,EAAE,KAAY;IAC1E,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAgB,EAAE,KAAY;IAClE,OAAO,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DecoratorContext, Operation, Program } from "@typespec/compiler";
|
|
2
|
+
import { DecoratorParameter } from "./decorator-parameter.js";
|
|
2
3
|
/**
|
|
3
4
|
* `@orderBy` - Applies to: get operations that return collections of @entity or @complex models.
|
|
4
5
|
* Indicates that the get operation supports the OData $orderBy query parameter.
|
|
5
6
|
*
|
|
6
7
|
* `properties` - List of property names in the model returned from the get operation that can be used in a $orderBy query parameter.
|
|
7
8
|
*/
|
|
8
|
-
export declare function $orderBy(context: DecoratorContext, target: Operation, ...properties:
|
|
9
|
+
export declare function $orderBy(context: DecoratorContext, target: Operation, ...properties: DecoratorParameter[]): void;
|
|
9
10
|
export declare function getOrderBy(program: Program, target: Operation): string[];
|
|
10
11
|
export declare function isOrderBy(program: Program, target: Operation): boolean;
|
|
11
12
|
//# sourceMappingURL=order-by.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-by.d.ts","sourceRoot":"","sources":["../../../src/decorators/order-by.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"order-by.d.ts","sourceRoot":"","sources":["../../../src/decorators/order-by.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,kBAAkB,EAAE,QAEzG;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,EAAE,CAExE;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAEtE"}
|
|
@@ -6,7 +6,7 @@ const orderByKey = Symbol("orderBy");
|
|
|
6
6
|
* `properties` - List of property names in the model returned from the get operation that can be used in a $orderBy query parameter.
|
|
7
7
|
*/
|
|
8
8
|
export function $orderBy(context, target, ...properties) {
|
|
9
|
-
context.program.stateMap(orderByKey).set(target, properties);
|
|
9
|
+
context.program.stateMap(orderByKey).set(target, properties.map(p => p.value));
|
|
10
10
|
}
|
|
11
11
|
export function getOrderBy(program, target) {
|
|
12
12
|
return program.stateMap(orderByKey).get(target) || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-by.js","sourceRoot":"","sources":["../../../src/decorators/order-by.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"order-by.js","sourceRoot":"","sources":["../../../src/decorators/order-by.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAyB,EAAE,MAAiB,EAAE,GAAG,UAAgC;IACxG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,MAAiB;IAC5D,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAiB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DecoratorContext, Namespace, Program } from "@typespec/compiler";
|
|
2
|
+
import { DecoratorParameter } from "./decorator-parameter.js";
|
|
2
3
|
/**
|
|
3
4
|
* `@privatePreviewDefinition` - create a reusable private preview definition.
|
|
4
5
|
*
|
|
5
6
|
* `@privatePreviewDefinition` can only be applied to namespaces.
|
|
6
7
|
*/
|
|
7
|
-
export interface
|
|
8
|
+
export interface PrivatePreviewDecoratorParameters {
|
|
8
9
|
name: string;
|
|
9
10
|
announcementDate: string;
|
|
10
11
|
removalDate: string;
|
|
@@ -14,6 +15,6 @@ export interface PrivatePreviewDefinitionParameters {
|
|
|
14
15
|
* `@privatePreviewDefinition` - Allow us create a reusable private preview definition.
|
|
15
16
|
* `@privatePreviewDefinition` - Applies only to namespaces.
|
|
16
17
|
*/
|
|
17
|
-
export declare function $privatePreviewDefinition(context: DecoratorContext, target: Namespace, name:
|
|
18
|
-
export declare function getPrivatePreviewDefinitions(program: Program, target: Namespace): Map<string,
|
|
18
|
+
export declare function $privatePreviewDefinition(context: DecoratorContext, target: Namespace, name: DecoratorParameter, announcementDate: DecoratorParameter, removalDate: DecoratorParameter, owner: DecoratorParameter): void;
|
|
19
|
+
export declare function getPrivatePreviewDefinitions(program: Program, target: Namespace): Map<string, PrivatePreviewDecoratorParameters>;
|
|
19
20
|
//# sourceMappingURL=private-preview-definition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-preview-definition.d.ts","sourceRoot":"","sources":["../../../src/decorators/private-preview-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"private-preview-definition.d.ts","sourceRoot":"","sources":["../../../src/decorators/private-preview-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,kBAAkB,EACxB,gBAAgB,EAAE,kBAAkB,EACpC,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,kBAAkB,QAW1B;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,GAChB,GAAG,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAKhD"}
|
|
@@ -5,7 +5,12 @@ const privatePreviewDefinitionKey = Symbol("privatePreviewDefinition");
|
|
|
5
5
|
*/
|
|
6
6
|
export function $privatePreviewDefinition(context, target, name, announcementDate, removalDate, owner) {
|
|
7
7
|
const definitions = getPrivatePreviewDefinitions(context.program, target);
|
|
8
|
-
definitions.set(name, {
|
|
8
|
+
definitions.set(name.value, {
|
|
9
|
+
name: name.value,
|
|
10
|
+
announcementDate: announcementDate.value,
|
|
11
|
+
removalDate: removalDate.value,
|
|
12
|
+
owner: owner.value
|
|
13
|
+
});
|
|
9
14
|
context.program.stateMap(privatePreviewDefinitionKey).set(target, definitions);
|
|
10
15
|
}
|
|
11
16
|
export function getPrivatePreviewDefinitions(program, target) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-preview-definition.js","sourceRoot":"","sources":["../../../src/decorators/private-preview-definition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private-preview-definition.js","sourceRoot":"","sources":["../../../src/decorators/private-preview-definition.ts"],"names":[],"mappings":"AAeA,MAAM,2BAA2B,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAyB,EACzB,MAAiB,EACjB,IAAwB,EACxB,gBAAoC,EACpC,WAA+B,EAC/B,KAAyB;IAEzB,MAAM,WAAW,GAAG,4BAA4B,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1E,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE;QAC1B,IAAI,EAAE,IAAI,CAAC,KAAK;QAChB,gBAAgB,EAAE,gBAAgB,CAAC,KAAK;QACxC,WAAW,EAAE,WAAW,CAAC,KAAK;QAC9B,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,OAAgB,EAChB,MAAiB;IAEjB,OAAO,CACL,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;QACzD,IAAI,GAAG,EAA6C,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { DecoratorContext, Enum, EnumMember, Model, ModelProperty, Namespace, Operation, Program, Type } from "@typespec/compiler";
|
|
2
|
+
import { DecoratorParameter } from "./decorator-parameter.js";
|
|
2
3
|
/**
|
|
3
4
|
* `@privatePreview` - Allow us to deprecate a defined element.
|
|
4
5
|
* `@privatePreview` - Applies to models, model properties, enums, enum members, namespaces and operations.
|
|
5
6
|
*/
|
|
6
|
-
export declare function $privatePreview(context: DecoratorContext, target: Model | ModelProperty | EnumMember | Enum | Operation | Namespace, name:
|
|
7
|
+
export declare function $privatePreview(context: DecoratorContext, target: Model | ModelProperty | EnumMember | Enum | Operation | Namespace, name: DecoratorParameter): void;
|
|
7
8
|
export declare function getPrivatePreview(program: Program, target: Type): string;
|
|
8
9
|
export declare function isPrivatePreview(program: Program, target: Type): boolean;
|
|
9
10
|
//# sourceMappingURL=private-preview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-preview.d.ts","sourceRoot":"","sources":["../../../src/decorators/private-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,KAAK,EACL,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,
|
|
1
|
+
{"version":3,"file":"private-preview.d.ts","sourceRoot":"","sources":["../../../src/decorators/private-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,KAAK,EACL,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,EACL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,EACzE,IAAI,EAAE,kBAAkB,QAGzB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,CAExE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,WAE9D"}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import { createDecoratorDefinition, } from "@typespec/compiler";
|
|
2
1
|
const privatePreviewKey = Symbol("privatePreview");
|
|
3
|
-
// TODO: Remove this and move to extern dec once Model type is defined in TypeSpec.Reflection https://github.com/microsoft/typespec/issues/1655
|
|
4
|
-
const privatePreviewDecorator = createDecoratorDefinition({
|
|
5
|
-
name: "@privatePreview",
|
|
6
|
-
target: ["Model", "ModelProperty", "Enum", "EnumMember", "Operation", "Namespace"],
|
|
7
|
-
args: [{ kind: "String" }],
|
|
8
|
-
});
|
|
9
2
|
/**
|
|
10
3
|
* `@privatePreview` - Allow us to deprecate a defined element.
|
|
11
4
|
* `@privatePreview` - Applies to models, model properties, enums, enum members, namespaces and operations.
|
|
12
5
|
*/
|
|
13
6
|
export function $privatePreview(context, target, name) {
|
|
14
|
-
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
context.program.stateMap(privatePreviewKey).set(target, name);
|
|
7
|
+
context.program.stateMap(privatePreviewKey).set(target, name.value);
|
|
18
8
|
}
|
|
19
9
|
export function getPrivatePreview(program, target) {
|
|
20
10
|
return program.stateMap(privatePreviewKey).get(target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-preview.js","sourceRoot":"","sources":["../../../src/decorators/private-preview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private-preview.js","sourceRoot":"","sources":["../../../src/decorators/private-preview.ts"],"names":[],"mappings":"AAaA,MAAM,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAyB,EACzB,MAAyE,EACzE,IAAwB;IAExB,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,MAAY;IAC9D,OAAO,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,MAAY;IAC7D,OAAO,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,oBAAoB,CAAC;AAI9D,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAEnD,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,iBAUjD"}
|
package/dist/src/emitter.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { resolvePath } from "@typespec/compiler";
|
|
2
|
-
import { renderCsdl } from "./
|
|
2
|
+
import { renderCsdl } from "./components/index.js";
|
|
3
|
+
import { GetMsGraphNamespaces } from "./entities/namespace.js";
|
|
3
4
|
export const defaultCsdlFileName = "workload.csdl";
|
|
4
5
|
export async function $onEmit(context) {
|
|
5
6
|
const program = context.program;
|
|
6
|
-
const
|
|
7
|
+
const namespaces = GetMsGraphNamespaces(program);
|
|
8
|
+
const csdl = renderCsdl(namespaces);
|
|
7
9
|
await program.host.mkdirp(program.compilerOptions.outputDir);
|
|
8
10
|
const csdlPath = resolvePath(program.compilerOptions.outputDir, defaultCsdlFileName);
|
|
9
11
|
await program.host.writeFile(csdlPath, csdl);
|
package/dist/src/emitter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAoB;IAChD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAA;IAEhD,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAEpC,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,SAAU,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,SAAU,EAAE,mBAAmB,CAAC,CAAC;IAEtF,MAAM,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Program, Namespace } from "@typespec/compiler";
|
|
2
|
+
export interface EntityContainer {
|
|
3
|
+
AgsAttributes: Record<string, string>;
|
|
4
|
+
SingletonElements: Singleton[];
|
|
5
|
+
EntitySetElements: EntitySet[];
|
|
6
|
+
}
|
|
7
|
+
export interface Singleton {
|
|
8
|
+
Name: string | undefined;
|
|
9
|
+
TypeName: string;
|
|
10
|
+
AgsAttributes: Record<string, string>;
|
|
11
|
+
HasExpandOperation: boolean;
|
|
12
|
+
NonExpandableProperties: string[] | undefined;
|
|
13
|
+
Description: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface EntitySet {
|
|
16
|
+
Name: string | undefined;
|
|
17
|
+
TypeName: string;
|
|
18
|
+
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
|
+
}
|
|
34
|
+
export declare function GetEntityContainer(program: Program, namespace: Namespace): EntityContainer;
|
|
35
|
+
//# sourceMappingURL=entity-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-container.d.ts","sourceRoot":"","sources":["../../../src/entities/entity-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAK3H,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,iBAAiB,EAAE,SAAS,EAAE,CAAA;IAC9B,iBAAiB,EAAE,SAAS,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,kBAAkB,EAAE,OAAO,CAAA;IAC3B,uBAAuB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC7C,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IAC3D,kBAAkB,EAAE,OAAO,CAAA;IAC3B,YAAY,EAAE,OAAO,CAAA;IACrB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;IACvB,eAAe,EAAE,OAAO,CAAA;IACxB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,kBAAkB,EAAE,OAAO,CAAA;IAC3B,uBAAuB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC7C,kBAAkB,EAAE,OAAO,CAAA;IAC3B,gBAAgB,EAAE,OAAO,CAAA;IACzB,gBAAgB,EAAE,OAAO,CAAA;IACzB,qBAAqB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC3C,eAAe,EAAE,OAAO,CAAA;IACxB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,eAAe,CAe1F"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { getDoc, walkPropertiesInherited } from "@typespec/compiler";
|
|
2
|
+
import { getRoutePath, getOperationVerb } from "@typespec/http";
|
|
3
|
+
import { buildAttributes, isExpand, getExpand, isContains, isReferences, isCount, isSearch, isSkip, isTop, isOrderBy, getOrderBy } from "../index.js";
|
|
4
|
+
import { getPropertyTypeName } from "../utils.js";
|
|
5
|
+
export function GetEntityContainer(program, namespace) {
|
|
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));
|
|
24
|
+
return elements;
|
|
25
|
+
}
|
|
26
|
+
function getMsGraphSingletonElement(program, singleton) {
|
|
27
|
+
const routePath = getRoutePath(program, singleton);
|
|
28
|
+
const type = singleton.operations.get("_isNavigationSource").returnType;
|
|
29
|
+
const element = {
|
|
30
|
+
Name: routePath === null || routePath === void 0 ? void 0 : routePath.path.split("/")[0],
|
|
31
|
+
TypeName: getPropertyTypeName(program, type),
|
|
32
|
+
AgsAttributes: buildAttributes(program, singleton),
|
|
33
|
+
HasExpandOperation: false,
|
|
34
|
+
NonExpandableProperties: undefined,
|
|
35
|
+
Description: getDoc(program, singleton)
|
|
36
|
+
};
|
|
37
|
+
const expandedOperation = [...singleton.operations].find(([_, operation]) => getOperationVerb(program, operation) === "get" &&
|
|
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;
|
|
51
|
+
}
|
|
52
|
+
function getMsGraphEntitySetElements(program, navigationSources) {
|
|
53
|
+
const entitySets = navigationSources
|
|
54
|
+
.filter(([returnType, _]) => returnType.kind === "Model" && returnType.name === "Array")
|
|
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);
|
|
68
|
+
return elements;
|
|
69
|
+
}
|
|
70
|
+
function getMsGraphEntitySetElement(program, operations) {
|
|
71
|
+
var _a;
|
|
72
|
+
const entitySet = operations[0].interface;
|
|
73
|
+
if (entitySet === undefined) {
|
|
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
|
+
}));
|
|
85
|
+
const entry = {
|
|
86
|
+
Name: (_a = getRoutePath(program, entitySet)) === null || _a === void 0 ? void 0 : _a.path.split("/")[0],
|
|
87
|
+
TypeName: getPropertyTypeName(program, type),
|
|
88
|
+
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
|
+
};
|
|
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
|
+
return entry;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=entity-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-container.js","sourceRoot":"","sources":["../../../src/entities/entity-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,EAAE,uBAAuB,EAAyC,MAAM,oBAAoB,CAAA;AAC3H,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EA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AC;KACH;IAED,OAAO,KAAK,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Program, Enum } from "@typespec/compiler";
|
|
2
|
+
import { RevisionDefinition } from "./revision-definition.js";
|
|
3
|
+
export interface MsGraphEnum {
|
|
4
|
+
Name: string;
|
|
5
|
+
AgsAttributes: Record<string, string>;
|
|
6
|
+
RevisionDefinition: RevisionDefinition | undefined;
|
|
7
|
+
Elements: MsGraphEnumMember[];
|
|
8
|
+
}
|
|
9
|
+
export interface MsGraphEnumMember {
|
|
10
|
+
Name: string;
|
|
11
|
+
Value: string | number | undefined;
|
|
12
|
+
AgsAttributes: Record<string, string>;
|
|
13
|
+
RevisionDefinition: RevisionDefinition | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare function GetMsGraphEnumTypeElement(program: Program, enumType: Enum): MsGraphEnum;
|
|
16
|
+
//# sourceMappingURL=enum.d.ts.map
|
|
@@ -0,0 +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,CAAA;AAE9D,OAAO,EAAyB,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAEpF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAA;IAClD,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IAClC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAA;CACnD;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,WAAW,CASvF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { buildAttributes } from "../index.js";
|
|
2
|
+
import { GetRevisionDefinition } from "./revision-definition.js";
|
|
3
|
+
export function GetMsGraphEnumTypeElement(program, enumType) {
|
|
4
|
+
const element = {
|
|
5
|
+
Name: enumType.name,
|
|
6
|
+
AgsAttributes: buildAttributes(program, enumType),
|
|
7
|
+
RevisionDefinition: GetRevisionDefinition(program, enumType, enumType === null || enumType === void 0 ? void 0 : enumType.namespace),
|
|
8
|
+
Elements: [...enumType.members].map(([_, m]) => getMsGraphEnumMember(program, m))
|
|
9
|
+
};
|
|
10
|
+
return element;
|
|
11
|
+
}
|
|
12
|
+
function getMsGraphEnumMember(program, member) {
|
|
13
|
+
var _a;
|
|
14
|
+
const element = {
|
|
15
|
+
Name: member.name,
|
|
16
|
+
Value: member.value,
|
|
17
|
+
AgsAttributes: buildAttributes(program, member),
|
|
18
|
+
RevisionDefinition: GetRevisionDefinition(program, member, (_a = member.enum) === null || _a === void 0 ? void 0 : _a.namespace)
|
|
19
|
+
};
|
|
20
|
+
return element;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/entities/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAA;AAgBpF,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,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,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,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|