@microsoft/typespec-msgraph 0.0.1-Preview.1
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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/src/components/acceptable-media-types-annotation.d.ts +6 -0
- package/dist/src/components/acceptable-media-types-annotation.d.ts.map +1 -0
- package/dist/src/components/acceptable-media-types-annotation.js +15 -0
- package/dist/src/components/acceptable-media-types-annotation.js.map +1 -0
- package/dist/src/components/alternate-keys-annotation.d.ts +6 -0
- package/dist/src/components/alternate-keys-annotation.d.ts.map +1 -0
- package/dist/src/components/alternate-keys-annotation.js +30 -0
- package/dist/src/components/alternate-keys-annotation.js.map +1 -0
- package/dist/src/components/common-elements.d.ts +128 -0
- package/dist/src/components/common-elements.d.ts.map +1 -0
- package/dist/src/components/common-elements.js +38 -0
- package/dist/src/components/common-elements.js.map +1 -0
- package/dist/src/components/computed-annotation.d.ts +6 -0
- package/dist/src/components/computed-annotation.d.ts.map +1 -0
- package/dist/src/components/computed-annotation.js +12 -0
- package/dist/src/components/computed-annotation.js.map +1 -0
- package/dist/src/components/count-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/count-restrictions-annotation.js +15 -0
- package/dist/src/components/count-restrictions-annotation.js.map +1 -0
- package/dist/src/components/description-annotation.d.ts +6 -0
- package/dist/src/components/description-annotation.d.ts.map +1 -0
- package/dist/src/components/description-annotation.js +13 -0
- package/dist/src/components/description-annotation.js.map +1 -0
- package/dist/src/components/expand-restrictions-annotation.d.ts +7 -0
- package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/expand-restrictions-annotation.js +31 -0
- package/dist/src/components/expand-restrictions-annotation.js.map +1 -0
- package/dist/src/components/index.d.ts +15 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +15 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/permissions-annotation.d.ts +6 -0
- package/dist/src/components/permissions-annotation.d.ts.map +1 -0
- package/dist/src/components/permissions-annotation.js +20 -0
- package/dist/src/components/permissions-annotation.js.map +1 -0
- package/dist/src/components/program-context.d.ts +4 -0
- package/dist/src/components/program-context.d.ts.map +1 -0
- package/dist/src/components/program-context.js +3 -0
- package/dist/src/components/program-context.js.map +1 -0
- package/dist/src/components/property-element.d.ts +6 -0
- package/dist/src/components/property-element.d.ts.map +1 -0
- package/dist/src/components/property-element.js +41 -0
- package/dist/src/components/property-element.js.map +1 -0
- package/dist/src/components/revisions-annotation.d.ts +7 -0
- package/dist/src/components/revisions-annotation.d.ts.map +1 -0
- package/dist/src/components/revisions-annotation.js +60 -0
- package/dist/src/components/revisions-annotation.js.map +1 -0
- package/dist/src/components/search-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/search-restrictions-annotation.js +15 -0
- package/dist/src/components/search-restrictions-annotation.js.map +1 -0
- package/dist/src/components/skip-supported-annotation.d.ts +6 -0
- package/dist/src/components/skip-supported-annotation.d.ts.map +1 -0
- package/dist/src/components/skip-supported-annotation.js +13 -0
- package/dist/src/components/skip-supported-annotation.js.map +1 -0
- package/dist/src/components/sort-restrictions-annotation.d.ts +7 -0
- package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/sort-restrictions-annotation.js +31 -0
- package/dist/src/components/sort-restrictions-annotation.js.map +1 -0
- package/dist/src/components/structured-type-element.d.ts +6 -0
- package/dist/src/components/structured-type-element.d.ts.map +1 -0
- package/dist/src/components/structured-type-element.js +77 -0
- package/dist/src/components/structured-type-element.js.map +1 -0
- package/dist/src/components/top-supported-annotation.d.ts +6 -0
- package/dist/src/components/top-supported-annotation.d.ts.map +1 -0
- package/dist/src/components/top-supported-annotation.js +13 -0
- package/dist/src/components/top-supported-annotation.js.map +1 -0
- package/dist/src/csdl.d.ts +8 -0
- package/dist/src/csdl.d.ts.map +1 -0
- package/dist/src/csdl.js +298 -0
- package/dist/src/csdl.js.map +1 -0
- package/dist/src/decorators/abstract.d.ts +9 -0
- package/dist/src/decorators/abstract.d.ts.map +1 -0
- package/dist/src/decorators/abstract.js +19 -0
- package/dist/src/decorators/abstract.js.map +1 -0
- package/dist/src/decorators/alternate-key.d.ts +9 -0
- package/dist/src/decorators/alternate-key.d.ts.map +1 -0
- package/dist/src/decorators/alternate-key.js +13 -0
- package/dist/src/decorators/alternate-key.js.map +1 -0
- package/dist/src/decorators/attribute-builder.d.ts +2 -0
- package/dist/src/decorators/attribute-builder.d.ts.map +1 -0
- package/dist/src/decorators/attribute-builder.js +166 -0
- package/dist/src/decorators/attribute-builder.js.map +1 -0
- package/dist/src/decorators/attributes.d.ts +57 -0
- package/dist/src/decorators/attributes.d.ts.map +1 -0
- package/dist/src/decorators/attributes.js +50 -0
- package/dist/src/decorators/attributes.js.map +1 -0
- package/dist/src/decorators/complex.d.ts +9 -0
- package/dist/src/decorators/complex.d.ts.map +1 -0
- package/dist/src/decorators/complex.js +19 -0
- package/dist/src/decorators/complex.js.map +1 -0
- package/dist/src/decorators/computed.d.ts +9 -0
- package/dist/src/decorators/computed.d.ts.map +1 -0
- package/dist/src/decorators/computed.js +13 -0
- package/dist/src/decorators/computed.js.map +1 -0
- package/dist/src/decorators/contains.d.ts +9 -0
- package/dist/src/decorators/contains.d.ts.map +1 -0
- package/dist/src/decorators/contains.js +13 -0
- package/dist/src/decorators/contains.js.map +1 -0
- package/dist/src/decorators/count.d.ts +9 -0
- package/dist/src/decorators/count.d.ts.map +1 -0
- package/dist/src/decorators/count.js +13 -0
- package/dist/src/decorators/count.js.map +1 -0
- package/dist/src/decorators/deprecated-definition.d.ts +21 -0
- package/dist/src/decorators/deprecated-definition.d.ts.map +1 -0
- package/dist/src/decorators/deprecated-definition.js +18 -0
- package/dist/src/decorators/deprecated-definition.js.map +1 -0
- package/dist/src/decorators/entity.d.ts +10 -0
- package/dist/src/decorators/entity.d.ts.map +1 -0
- package/dist/src/decorators/entity.js +23 -0
- package/dist/src/decorators/entity.js.map +1 -0
- package/dist/src/decorators/expand.d.ts +11 -0
- package/dist/src/decorators/expand.d.ts.map +1 -0
- package/dist/src/decorators/expand.js +17 -0
- package/dist/src/decorators/expand.js.map +1 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts +14 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +1 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js +36 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +1 -0
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +7 -0
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +1 -0
- package/dist/src/decorators/handlers/custom/ags-attribute.js +36 -0
- package/dist/src/decorators/handlers/custom/ags-attribute.js.map +1 -0
- package/dist/src/decorators/handlers/custom/index.d.ts +3 -0
- package/dist/src/decorators/handlers/custom/index.d.ts.map +1 -0
- package/dist/src/decorators/handlers/custom/index.js +3 -0
- package/dist/src/decorators/handlers/custom/index.js.map +1 -0
- package/dist/src/decorators/handlers/index.d.ts +30 -0
- package/dist/src/decorators/handlers/index.d.ts.map +1 -0
- package/dist/src/decorators/handlers/index.js +121 -0
- package/dist/src/decorators/handlers/index.js.map +1 -0
- package/dist/src/decorators/has-stream.d.ts +11 -0
- package/dist/src/decorators/has-stream.d.ts.map +1 -0
- package/dist/src/decorators/has-stream.js +30 -0
- package/dist/src/decorators/has-stream.js.map +1 -0
- package/dist/src/decorators/index.d.ts +21 -0
- package/dist/src/decorators/index.d.ts.map +1 -0
- package/dist/src/decorators/index.js +21 -0
- package/dist/src/decorators/index.js.map +1 -0
- package/dist/src/decorators/open.d.ts +9 -0
- package/dist/src/decorators/open.d.ts.map +1 -0
- package/dist/src/decorators/open.js +19 -0
- package/dist/src/decorators/open.js.map +1 -0
- package/dist/src/decorators/order-by.d.ts +11 -0
- package/dist/src/decorators/order-by.d.ts.map +1 -0
- package/dist/src/decorators/order-by.js +17 -0
- package/dist/src/decorators/order-by.js.map +1 -0
- package/dist/src/decorators/private-preview-definition.d.ts +19 -0
- package/dist/src/decorators/private-preview-definition.d.ts.map +1 -0
- package/dist/src/decorators/private-preview-definition.js +15 -0
- package/dist/src/decorators/private-preview-definition.js.map +1 -0
- package/dist/src/decorators/private-preview.d.ts +9 -0
- package/dist/src/decorators/private-preview.d.ts.map +1 -0
- package/dist/src/decorators/private-preview.js +25 -0
- package/dist/src/decorators/private-preview.js.map +1 -0
- package/dist/src/decorators/read-only.d.ts +9 -0
- package/dist/src/decorators/read-only.d.ts.map +1 -0
- package/dist/src/decorators/read-only.js +13 -0
- package/dist/src/decorators/read-only.js.map +1 -0
- package/dist/src/decorators/references.d.ts +9 -0
- package/dist/src/decorators/references.d.ts.map +1 -0
- package/dist/src/decorators/references.js +13 -0
- package/dist/src/decorators/references.js.map +1 -0
- package/dist/src/decorators/routed-interfaces.d.ts +19 -0
- package/dist/src/decorators/routed-interfaces.d.ts.map +1 -0
- package/dist/src/decorators/routed-interfaces.js +43 -0
- package/dist/src/decorators/routed-interfaces.js.map +1 -0
- package/dist/src/decorators/search.d.ts +8 -0
- package/dist/src/decorators/search.d.ts.map +1 -0
- package/dist/src/decorators/search.js +12 -0
- package/dist/src/decorators/search.js.map +1 -0
- package/dist/src/decorators/skip.d.ts +8 -0
- package/dist/src/decorators/skip.d.ts.map +1 -0
- package/dist/src/decorators/skip.js +12 -0
- package/dist/src/decorators/skip.js.map +1 -0
- package/dist/src/decorators/top.d.ts +8 -0
- package/dist/src/decorators/top.d.ts.map +1 -0
- package/dist/src/decorators/top.js +12 -0
- package/dist/src/decorators/top.js.map +1 -0
- package/dist/src/decorators/write-only.d.ts +9 -0
- package/dist/src/decorators/write-only.d.ts.map +1 -0
- package/dist/src/decorators/write-only.js +13 -0
- package/dist/src/decorators/write-only.js.map +1 -0
- package/dist/src/dom/reconciler.d.ts +10 -0
- package/dist/src/dom/reconciler.d.ts.map +1 -0
- package/dist/src/dom/reconciler.js +95 -0
- package/dist/src/dom/reconciler.js.map +1 -0
- package/dist/src/dom/renderer.d.ts +6 -0
- package/dist/src/dom/renderer.d.ts.map +1 -0
- package/dist/src/dom/renderer.js +33 -0
- package/dist/src/dom/renderer.js.map +1 -0
- package/dist/src/dom/types.d.ts +33 -0
- package/dist/src/dom/types.d.ts.map +1 -0
- package/dist/src/dom/types.js +2 -0
- package/dist/src/dom/types.js.map +1 -0
- package/dist/src/emitter.d.ts +4 -0
- package/dist/src/emitter.d.ts.map +1 -0
- package/dist/src/emitter.js +11 -0
- package/dist/src/emitter.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib.d.ts +138 -0
- package/dist/src/lib.d.ts.map +1 -0
- package/dist/src/lib.js +55 -0
- package/dist/src/lib.js.map +1 -0
- package/dist/src/linter.d.ts +3 -0
- package/dist/src/linter.d.ts.map +1 -0
- package/dist/src/linter.js +35 -0
- package/dist/src/linter.js.map +1 -0
- package/dist/src/rules/abstract.d.ts +5 -0
- package/dist/src/rules/abstract.d.ts.map +1 -0
- package/dist/src/rules/abstract.js +31 -0
- package/dist/src/rules/abstract.js.map +1 -0
- package/dist/src/rules/alternate-key.d.ts +4 -0
- package/dist/src/rules/alternate-key.d.ts.map +1 -0
- package/dist/src/rules/alternate-key.js +81 -0
- package/dist/src/rules/alternate-key.js.map +1 -0
- package/dist/src/rules/computed.d.ts +7 -0
- package/dist/src/rules/computed.d.ts.map +1 -0
- package/dist/src/rules/computed.js +47 -0
- package/dist/src/rules/computed.js.map +1 -0
- package/dist/src/rules/contains.d.ts +5 -0
- package/dist/src/rules/contains.d.ts.map +1 -0
- package/dist/src/rules/contains.js +32 -0
- package/dist/src/rules/contains.js.map +1 -0
- package/dist/src/rules/count.d.ts +5 -0
- package/dist/src/rules/count.d.ts.map +1 -0
- package/dist/src/rules/count.js +35 -0
- package/dist/src/rules/count.js.map +1 -0
- package/dist/src/rules/entity.d.ts +2 -0
- package/dist/src/rules/entity.d.ts.map +1 -0
- package/dist/src/rules/entity.js +31 -0
- package/dist/src/rules/entity.js.map +1 -0
- package/dist/src/rules/expand.d.ts +3 -0
- package/dist/src/rules/expand.d.ts.map +1 -0
- package/dist/src/rules/expand.js +69 -0
- package/dist/src/rules/expand.js.map +1 -0
- package/dist/src/rules/has-stream.d.ts +2 -0
- package/dist/src/rules/has-stream.d.ts.map +1 -0
- package/dist/src/rules/has-stream.js +29 -0
- package/dist/src/rules/has-stream.js.map +1 -0
- package/dist/src/rules/index.d.ts +21 -0
- package/dist/src/rules/index.d.ts.map +1 -0
- package/dist/src/rules/index.js +176 -0
- package/dist/src/rules/index.js.map +1 -0
- package/dist/src/rules/open.d.ts +5 -0
- package/dist/src/rules/open.d.ts.map +1 -0
- package/dist/src/rules/open.js +31 -0
- package/dist/src/rules/open.js.map +1 -0
- package/dist/src/rules/order-by.d.ts +3 -0
- package/dist/src/rules/order-by.d.ts.map +1 -0
- package/dist/src/rules/order-by.js +69 -0
- package/dist/src/rules/order-by.js.map +1 -0
- package/dist/src/rules/references.d.ts +5 -0
- package/dist/src/rules/references.d.ts.map +1 -0
- package/dist/src/rules/references.js +32 -0
- package/dist/src/rules/references.js.map +1 -0
- package/dist/src/rules/search.d.ts +5 -0
- package/dist/src/rules/search.d.ts.map +1 -0
- package/dist/src/rules/search.js +35 -0
- package/dist/src/rules/search.js.map +1 -0
- package/dist/src/rules/skip.d.ts +5 -0
- package/dist/src/rules/skip.d.ts.map +1 -0
- package/dist/src/rules/skip.js +35 -0
- package/dist/src/rules/skip.js.map +1 -0
- package/dist/src/rules/top.d.ts +5 -0
- package/dist/src/rules/top.d.ts.map +1 -0
- package/dist/src/rules/top.js +35 -0
- package/dist/src/rules/top.js.map +1 -0
- package/dist/src/testing/index.d.ts +3 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +24 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/utils.d.ts +27 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +186 -0
- package/dist/src/utils.js.map +1 -0
- package/lib/decorators.tsp +164 -0
- package/lib/lib.tsp +35 -0
- package/lib/msgraph.tsp +2 -0
- package/package.json +68 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { validateDecoratorTarget } from "@typespec/compiler";
|
|
2
|
+
const entityKey = Symbol("entity");
|
|
3
|
+
/**
|
|
4
|
+
* `@entity` - mark a model as an entity type
|
|
5
|
+
*
|
|
6
|
+
* `@entity` can only be applied to models.
|
|
7
|
+
*/
|
|
8
|
+
export function $entity(context, entity) {
|
|
9
|
+
// TODO: Remove this and move to extern dec once Model type is defined in TypeSpec.Reflection https://github.com/microsoft/typespec/issues/1655
|
|
10
|
+
if (!validateDecoratorTarget(context, entity, "@entity", "Model")) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// Register the entity property
|
|
14
|
+
context.program.stateSet(entityKey).add(entity);
|
|
15
|
+
}
|
|
16
|
+
export function isEntity(program, entity) {
|
|
17
|
+
return program.stateSet(entityKey).has(entity);
|
|
18
|
+
}
|
|
19
|
+
export function getEntity(program, name) {
|
|
20
|
+
const matches = [...program.stateSet(entityKey)].filter((type) => type.kind === "Model" && type.name === name);
|
|
21
|
+
return matches.length ? matches[0] : undefined;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/decorators/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAyB,EAAE,MAAa;IAC9D,+IAA+I;IAC/I,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE;QACjE,OAAO;KACR;IAED,+BAA+B;IAC/B,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAa;IACtD,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,IAAY;IACtD,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CACrD,CAAC,IAAI,EAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CACrE,CAAC;IAEF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DecoratorContext, Operation, Program } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@expand` - Applies to: get operations that return collections or individual instances of models that contain @contains or @references properties.
|
|
4
|
+
* Indicates that the get operation supports the OData $expand query parameter.
|
|
5
|
+
*
|
|
6
|
+
* `properties` - Property names in the model returned from the get operation that can be used in a $expand query parameter.
|
|
7
|
+
*/
|
|
8
|
+
export declare function $expand(context: DecoratorContext, target: Operation, ...properties: string[]): void;
|
|
9
|
+
export declare function getExpand(program: Program, target: Operation): string[];
|
|
10
|
+
export declare function isExpand(program: Program, target: Operation): boolean;
|
|
11
|
+
//# sourceMappingURL=expand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/decorators/expand.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,QAE5F;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,GAAG,OAAO,CAErE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const expandKey = Symbol("expand");
|
|
2
|
+
/**
|
|
3
|
+
* `@expand` - Applies to: get operations that return collections or individual instances of models that contain @contains or @references properties.
|
|
4
|
+
* Indicates that the get operation supports the OData $expand query parameter.
|
|
5
|
+
*
|
|
6
|
+
* `properties` - Property names in the model returned from the get operation that can be used in a $expand query parameter.
|
|
7
|
+
*/
|
|
8
|
+
export function $expand(context, target, ...properties) {
|
|
9
|
+
context.program.stateMap(expandKey).set(target, properties);
|
|
10
|
+
}
|
|
11
|
+
export function getExpand(program, target) {
|
|
12
|
+
return program.stateMap(expandKey).get(target) || [];
|
|
13
|
+
}
|
|
14
|
+
export function isExpand(program, target) {
|
|
15
|
+
return program.stateMap(expandKey).has(target);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/decorators/expand.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,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC9D,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DecoratorContext, Namespace, Program, Type } from "@typespec/compiler";
|
|
2
|
+
export interface QueryParameter {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* \`@additionalQueryParameters\` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace..
|
|
8
|
+
*/
|
|
9
|
+
export declare function $additionalQueryParameters(context: DecoratorContext, target: Namespace, name: string, value: string): void;
|
|
10
|
+
export declare function getAdditionalQueryParameters(program: Program, target: Namespace): QueryParameter[];
|
|
11
|
+
export declare function unpackAdditionalQueryParameters(program: Program, target: Type): {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=additional-query-parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additional-query-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/decorators/handlers/custom/additional-query-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,IAAI,EACL,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AASD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,QAkBd;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,GAChB,cAAc,EAAE,CAElB;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,IAAI,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAM3B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createDecoratorDefinition, } from "@typespec/compiler";
|
|
2
|
+
const additionalQueryParametersKey = Symbol("additionalQueryParameters");
|
|
3
|
+
const additionalQueryParametersDecorator = createDecoratorDefinition({
|
|
4
|
+
name: "@additionalQueryParameters",
|
|
5
|
+
target: "Namespace",
|
|
6
|
+
args: [{ kind: "String" }, { kind: "String" }],
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* \`@additionalQueryParameters\` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace..
|
|
10
|
+
*/
|
|
11
|
+
export function $additionalQueryParameters(context, target, name, value) {
|
|
12
|
+
if (!additionalQueryParametersDecorator.validate(context, target, [name, value])) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
let queryParameters = context.program
|
|
16
|
+
.stateMap(additionalQueryParametersKey)
|
|
17
|
+
.get(target);
|
|
18
|
+
if (queryParameters === undefined) {
|
|
19
|
+
queryParameters = [];
|
|
20
|
+
context.program.stateMap(additionalQueryParametersKey).set(target, queryParameters);
|
|
21
|
+
}
|
|
22
|
+
queryParameters.push({
|
|
23
|
+
name,
|
|
24
|
+
value,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function getAdditionalQueryParameters(program, target) {
|
|
28
|
+
return program.stateMap(additionalQueryParametersKey).get(target) || [];
|
|
29
|
+
}
|
|
30
|
+
export function unpackAdditionalQueryParameters(program, target) {
|
|
31
|
+
const additionalQueryParameters = getAdditionalQueryParameters(program, target);
|
|
32
|
+
const queryParameters = additionalQueryParameters &&
|
|
33
|
+
additionalQueryParameters.map((p) => `${p.name}=${p.value}`).join("&");
|
|
34
|
+
return { "ags:AdditionalQueryParameters": queryParameters };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=additional-query-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additional-query-parameters.js","sourceRoot":"","sources":["../../../../../src/decorators/handlers/custom/additional-query-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAK1B,MAAM,oBAAoB,CAAC;AAM5B,MAAM,4BAA4B,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAEzE,MAAM,kCAAkC,GAAG,yBAAyB,CAAC;IACnE,IAAI,EAAE,4BAA4B;IAClC,MAAM,EAAE,WAAW;IACnB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;CACtC,CAAC,CAAC;AAEZ;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAyB,EACzB,MAAiB,EACjB,IAAY,EACZ,KAAa;IAEb,IAAI,CAAC,kCAAkC,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE;QAChF,OAAO;KACR;IAED,IAAI,eAAe,GAAqB,OAAO,CAAC,OAAO;SACpD,QAAQ,CAAC,4BAA4B,CAAC;SACtC,GAAG,CAAC,MAAM,CAAC,CAAC;IACf,IAAI,eAAe,KAAK,SAAS,EAAE;QACjC,eAAe,GAAG,EAAE,CAAC;QACrB,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;KACrF;IAED,eAAe,CAAC,IAAI,CAAC;QACnB,IAAI;QACJ,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,OAAgB,EAChB,MAAiB;IAEjB,OAAO,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,OAAgB,EAChB,MAAY;IAEZ,MAAM,yBAAyB,GAAG,4BAA4B,CAAC,OAAO,EAAE,MAAmB,CAAC,CAAC;IAC7F,MAAM,eAAe,GACnB,yBAAyB;QACzB,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzE,OAAO,EAAE,+BAA+B,EAAE,eAAe,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DecoratorContext, Enum, EnumMember, Interface, Model, ModelProperty, Operation, Program, Type } from "@typespec/compiler";
|
|
2
|
+
export declare function $agsAttribute(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember | Operation | Interface, name: string, value: string): void;
|
|
3
|
+
export declare function getAgsAttributes(program: Program, target: Model | ModelProperty | Enum | EnumMember | Operation | Interface): Map<string, string> | undefined;
|
|
4
|
+
export declare function unpackAgsAttributes(program: Program, target: Type): {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=ags-attribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ags-attribute.d.ts","sourceRoot":"","sources":["../../../../../src/decorators/handlers/custom/ags-attribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,SAAS,EACT,KAAK,EACL,aAAa,EACb,SAAS,EACT,OAAO,EACP,IAAI,EACL,MAAM,oBAAoB,CAAC;AAe5B,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,EACzE,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,QAiBd;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GACxE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAEjC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAK7F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createDecoratorDefinition, } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
|
|
4
|
+
* `@agsAttribute` - Applies to models.
|
|
5
|
+
*/
|
|
6
|
+
const agsAttributeKey = Symbol("agsAttribute");
|
|
7
|
+
const agsAttributeDecorator = createDecoratorDefinition({
|
|
8
|
+
name: "@agsAttribute",
|
|
9
|
+
target: ["Enum", "EnumMember", "Model", "ModelProperty", "Operation", "Interface"],
|
|
10
|
+
args: [{ kind: "String" }, { kind: "String" }],
|
|
11
|
+
});
|
|
12
|
+
export function $agsAttribute(context, target, name, value) {
|
|
13
|
+
if (!agsAttributeDecorator.validate(context, target, [name, value])) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
let attributeParameters = context.program
|
|
17
|
+
.stateMap(agsAttributeKey)
|
|
18
|
+
.get(target);
|
|
19
|
+
if (attributeParameters) {
|
|
20
|
+
attributeParameters.set(name, value);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
attributeParameters = new Map([[name, value]]);
|
|
24
|
+
}
|
|
25
|
+
context.program.stateMap(agsAttributeKey).set(target, attributeParameters);
|
|
26
|
+
}
|
|
27
|
+
export function getAgsAttributes(program, target) {
|
|
28
|
+
return program.stateMap(agsAttributeKey).get(target);
|
|
29
|
+
}
|
|
30
|
+
export function unpackAgsAttributes(program, target) {
|
|
31
|
+
const attributes = getAgsAttributes(program, target);
|
|
32
|
+
let params = {};
|
|
33
|
+
attributes === null || attributes === void 0 ? void 0 : attributes.forEach((value, name) => (params = { ...params, ...{ [`ags:${name}`]: value } }));
|
|
34
|
+
return params || {};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=ags-attribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ags-attribute.js","sourceRoot":"","sources":["../../../../../src/decorators/handlers/custom/ags-attribute.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAU1B,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AAEH,MAAM,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE/C,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;IACtD,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,CAAC;IAClF,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;CACtC,CAAC,CAAC;AAEZ,MAAM,UAAU,aAAa,CAC3B,OAAyB,EACzB,MAAyE,EACzE,IAAY,EACZ,KAAa;IAEb,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE;QACnE,OAAO;KACR;IAED,IAAI,mBAAmB,GAAwB,OAAO,CAAC,OAAO;SAC3D,QAAQ,CAAC,eAAe,CAAC;SACzB,GAAG,CAAC,MAAM,CAAC,CAAC;IAEf,IAAI,mBAAmB,EAAE;QACvB,mBAAmB,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KACtC;SAAM;QACL,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;KAChD;IAED,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,OAAgB,EAChB,MAAyE;IAEzE,OAAO,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,MAAY;IAChE,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAA2E,CAAC,CAAC;IAC1H,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9F,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/decorators/handlers/custom/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/decorators/handlers/custom/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTICE: This is an autogenerated file and should not be edited directly.
|
|
3
|
+
*/
|
|
4
|
+
import { DecoratorContext, EnumMember, Enum, Interface, Model, ModelProperty, Namespace, Operation, Program, Type } from "@typespec/compiler";
|
|
5
|
+
/**
|
|
6
|
+
* `@isOwner` - specify the name of the workload associated with the model
|
|
7
|
+
* `@isOwner` can be applied to Model, ModelProperty, Enum, EnumMember.
|
|
8
|
+
*/
|
|
9
|
+
export declare function $isOwner(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember): void;
|
|
10
|
+
export declare function isIsOwner(program: Program, target: Type): boolean;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
|
|
14
|
+
*/
|
|
15
|
+
export declare function $privileged(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace): void;
|
|
16
|
+
export declare function isPrivileged(program: Program, target: Type): boolean;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* `@workloadName` can be applied to Model, ModelProperty, Enum, EnumMember.
|
|
20
|
+
*/
|
|
21
|
+
export declare function $workloadName(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember, workloadName: string): void;
|
|
22
|
+
export declare function getWorkloadName(program: Program, target: Type): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* `@workloadNameMsa` can be applied to Model, ModelProperty, Enum, EnumMember.
|
|
26
|
+
*/
|
|
27
|
+
export declare function $workloadNameMsa(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember, workloadNameMsa: string): void;
|
|
28
|
+
export declare function getWorkloadNameMsa(program: Program, target: Type): string | undefined;
|
|
29
|
+
export declare function buildAttributes(program: Program, type: Model | ModelProperty | Namespace | Interface | Operation | Enum | EnumMember): {};
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/decorators/handlers/index.ts"],"names":[],"mappings":"AACE;;GAEG;AAEL,OAAO,EAEL,gBAAgB,EAChB,UAAU,EACV,IAAI,EACJ,SAAS,EACT,KAAK,EACL,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,EACL,MAAM,oBAAoB,CAAC;AAY5B;;;EAGE;AACF,wBAAgB,QAAQ,CACtB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,QAQlD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,OAAO,CAEjE;AAYD;;;EAGE;AACF,wBAAgB,WAAW,CACzB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,QAQ1E;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,OAAO,CAEpE;AAYD;;;EAGE;AACF,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,EACjD,YAAY,EAAE,MAAM,QAOrB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAElF;AAYD;;;EAGE;AACF,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,EACjD,eAAe,EAAE,MAAM,QAOxB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAErF;AAmBD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,UAAU,MAoBpF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTICE: This is an autogenerated file and should not be edited directly.
|
|
3
|
+
*/
|
|
4
|
+
import { createDecoratorDefinition, } from "@typespec/compiler";
|
|
5
|
+
import * as customAttribs from "./custom/index.js";
|
|
6
|
+
// -- @isOwner decorator
|
|
7
|
+
const isOwnerKey = Symbol("isOwner");
|
|
8
|
+
const isOwnerDecorator = createDecoratorDefinition({
|
|
9
|
+
name: "@isOwner",
|
|
10
|
+
target: ["Model", "ModelProperty", "Enum", "EnumMember"],
|
|
11
|
+
args: []
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* `@isOwner` - specify the name of the workload associated with the model
|
|
15
|
+
* `@isOwner` can be applied to Model, ModelProperty, Enum, EnumMember.
|
|
16
|
+
*/
|
|
17
|
+
export function $isOwner(context, target) {
|
|
18
|
+
if (!isOwnerDecorator.validate(context, target, [])) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
context.program.stateSet(isOwnerKey).add(target);
|
|
22
|
+
}
|
|
23
|
+
export function isIsOwner(program, target) {
|
|
24
|
+
return program.stateSet(isOwnerKey).has(target);
|
|
25
|
+
}
|
|
26
|
+
// -- @privileged decorator
|
|
27
|
+
const privilegedKey = Symbol("privileged");
|
|
28
|
+
const privilegedDecorator = createDecoratorDefinition({
|
|
29
|
+
name: "@privileged",
|
|
30
|
+
target: ["Model", "ModelProperty", "Enum", "EnumMember", "Operation", "Namespace"],
|
|
31
|
+
args: []
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
|
|
36
|
+
*/
|
|
37
|
+
export function $privileged(context, target) {
|
|
38
|
+
if (!privilegedDecorator.validate(context, target, [])) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
context.program.stateSet(privilegedKey).add(target);
|
|
42
|
+
}
|
|
43
|
+
export function isPrivileged(program, target) {
|
|
44
|
+
return program.stateSet(privilegedKey).has(target);
|
|
45
|
+
}
|
|
46
|
+
// -- @workloadName decorator
|
|
47
|
+
const workloadNameKey = Symbol("workloadName");
|
|
48
|
+
const workloadNameDecorator = createDecoratorDefinition({
|
|
49
|
+
name: "@workloadName",
|
|
50
|
+
target: ["Model", "ModelProperty", "Enum", "EnumMember"],
|
|
51
|
+
args: [{ kind: "String" }]
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* `@workloadName` can be applied to Model, ModelProperty, Enum, EnumMember.
|
|
56
|
+
*/
|
|
57
|
+
export function $workloadName(context, target, workloadName) {
|
|
58
|
+
if (!workloadNameDecorator.validate(context, target, [workloadName])) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
context.program.stateMap(workloadNameKey).set(target, workloadName);
|
|
62
|
+
}
|
|
63
|
+
export function getWorkloadName(program, target) {
|
|
64
|
+
return program.stateMap(workloadNameKey).get(target);
|
|
65
|
+
}
|
|
66
|
+
// -- @workloadNameMsa decorator
|
|
67
|
+
const workloadNameMsaKey = Symbol("workloadNameMsa");
|
|
68
|
+
const workloadNameMsaDecorator = createDecoratorDefinition({
|
|
69
|
+
name: "@workloadNameMsa",
|
|
70
|
+
target: ["Model", "ModelProperty", "Enum", "EnumMember"],
|
|
71
|
+
args: [{ kind: "String" }]
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* `@workloadNameMsa` can be applied to Model, ModelProperty, Enum, EnumMember.
|
|
76
|
+
*/
|
|
77
|
+
export function $workloadNameMsa(context, target, workloadNameMsa) {
|
|
78
|
+
if (!workloadNameMsaDecorator.validate(context, target, [workloadNameMsa])) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
context.program.stateMap(workloadNameMsaKey).set(target, workloadNameMsa);
|
|
82
|
+
}
|
|
83
|
+
export function getWorkloadNameMsa(program, target) {
|
|
84
|
+
return program.stateMap(workloadNameMsaKey).get(target);
|
|
85
|
+
}
|
|
86
|
+
const decoratorToMethodMapper = {
|
|
87
|
+
isOwner: isIsOwner,
|
|
88
|
+
privileged: isPrivileged,
|
|
89
|
+
workloadName: getWorkloadName,
|
|
90
|
+
workloadNameMsa: getWorkloadNameMsa,
|
|
91
|
+
additionalQueryParameters: customAttribs.unpackAdditionalQueryParameters,
|
|
92
|
+
agsAttribute: customAttribs.unpackAgsAttributes
|
|
93
|
+
};
|
|
94
|
+
const decoratorToAgsAttributeMapper = {
|
|
95
|
+
"isOwner": "ags:IsOwner",
|
|
96
|
+
"privileged": "ags:IsHidden",
|
|
97
|
+
"workloadName": "ags:WorkloadName",
|
|
98
|
+
"workloadNameMsa": "ags:WorkloadNameMsa"
|
|
99
|
+
};
|
|
100
|
+
export function buildAttributes(program, type) {
|
|
101
|
+
const declaredDecorators = ["isOwner", "privileged", "workloadName", "workloadNameMsa", "additionalQueryParameters", "agsAttribute"];
|
|
102
|
+
let attrs = {};
|
|
103
|
+
type.decorators
|
|
104
|
+
// only handle declared decorators
|
|
105
|
+
.filter((d) => declaredDecorators.some((s) => s === d.decorator.name.substring(1)))
|
|
106
|
+
.forEach((d) => {
|
|
107
|
+
const attrName = d.decorator.name.substring(1); // name prefixed with $
|
|
108
|
+
let key = attrName;
|
|
109
|
+
const agsAttrParams = decoratorToMethodMapper[key](program, type);
|
|
110
|
+
if (typeof agsAttrParams === "object") {
|
|
111
|
+
attrs = { ...attrs, ...agsAttrParams };
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
key = attrName;
|
|
115
|
+
const agsAttr = decoratorToAgsAttributeMapper[key];
|
|
116
|
+
attrs = { ...attrs, ...{ [agsAttr]: agsAttrParams } };
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
return attrs;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/handlers/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DecoratorContext, Model, Program } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@hasStream` - indicates that an `@entity` model has a stream.
|
|
4
|
+
*
|
|
5
|
+
* `mediaTypes` - list of media types supported by the stream.
|
|
6
|
+
* If not specified, the stream supports any media type.
|
|
7
|
+
*/
|
|
8
|
+
export declare function $hasStream(context: DecoratorContext, target: Model, args?: string, ...mediaTypes: string[]): void;
|
|
9
|
+
export declare function hasStream(program: Program, target: Model): boolean;
|
|
10
|
+
export declare function getStreamTypes(program: Program, target: Model): string[];
|
|
11
|
+
//# sourceMappingURL=has-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAajG;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,UAAU,EAAE,MAAM,EAAE,QAWxB;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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createDecoratorDefinition } from "@typespec/compiler";
|
|
2
|
+
// -- @hasStream decorator
|
|
3
|
+
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
|
+
/**
|
|
12
|
+
* `@hasStream` - indicates that an `@entity` model has a stream.
|
|
13
|
+
*
|
|
14
|
+
* `mediaTypes` - list of media types supported by the stream.
|
|
15
|
+
* If not specified, the stream supports any media type.
|
|
16
|
+
*/
|
|
17
|
+
export function $hasStream(context, target, args, ...mediaTypes) {
|
|
18
|
+
const types = args ? [args, ...mediaTypes] : [];
|
|
19
|
+
if (!hasStreamDecorator.validate(context, target, types)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
context.program.stateMap(hasStreamKey).set(target, types.filter((t) => t.trim()));
|
|
23
|
+
}
|
|
24
|
+
export function hasStream(program, target) {
|
|
25
|
+
return program.stateMap(hasStreamKey).has(target);
|
|
26
|
+
}
|
|
27
|
+
export function getStreamTypes(program, target) {
|
|
28
|
+
return program.stateMap(hasStreamKey).get(target) || [];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=has-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-stream.js","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAoC,MAAM,oBAAoB,CAAC;AAEjG,0BAA0B;AAC1B,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEzC,+IAA+I;AAC/I,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;IACnD,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,CAAC,OAAO,CAAC;IACjB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;CACtB,CAAC,CAAC;AAEZ;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACxB,OAAyB,EACzB,MAAa,EACb,IAAa,EACb,GAAG,UAAoB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE;QACxD,OAAO;KACR;IAED,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from "./abstract.js";
|
|
2
|
+
export * from "./alternate-key.js";
|
|
3
|
+
export * from "./complex.js";
|
|
4
|
+
export * from "./computed.js";
|
|
5
|
+
export * from "./contains.js";
|
|
6
|
+
export * from "./count.js";
|
|
7
|
+
export * from "./deprecated-definition.js";
|
|
8
|
+
export * from "./entity.js";
|
|
9
|
+
export * from "./expand.js";
|
|
10
|
+
export * from "./open.js";
|
|
11
|
+
export * from "./order-by.js";
|
|
12
|
+
export * from "./private-preview-definition.js";
|
|
13
|
+
export * from "./private-preview.js";
|
|
14
|
+
export * from "./read-only.js";
|
|
15
|
+
export * from "./references.js";
|
|
16
|
+
export * from "./routed-interfaces.js";
|
|
17
|
+
export * from "./search.js";
|
|
18
|
+
export * from "./skip.js";
|
|
19
|
+
export * from "./top.js";
|
|
20
|
+
export * from "./write-only.js";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from "./abstract.js";
|
|
2
|
+
export * from "./alternate-key.js";
|
|
3
|
+
export * from "./complex.js";
|
|
4
|
+
export * from "./computed.js";
|
|
5
|
+
export * from "./contains.js";
|
|
6
|
+
export * from "./count.js";
|
|
7
|
+
export * from "./deprecated-definition.js";
|
|
8
|
+
export * from "./entity.js";
|
|
9
|
+
export * from "./expand.js";
|
|
10
|
+
export * from "./open.js";
|
|
11
|
+
export * from "./order-by.js";
|
|
12
|
+
export * from "./private-preview-definition.js";
|
|
13
|
+
export * from "./private-preview.js";
|
|
14
|
+
export * from "./read-only.js";
|
|
15
|
+
export * from "./references.js";
|
|
16
|
+
export * from "./routed-interfaces.js";
|
|
17
|
+
export * from "./search.js";
|
|
18
|
+
export * from "./skip.js";
|
|
19
|
+
export * from "./top.js";
|
|
20
|
+
export * from "./write-only.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DecoratorContext, Model, Program } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@open` - mark a model type as open
|
|
4
|
+
*
|
|
5
|
+
* `@open` can only be applied to models.
|
|
6
|
+
*/
|
|
7
|
+
export declare function $open(context: DecoratorContext, entity: Model): void;
|
|
8
|
+
export declare function isOpen(program: Program, entity: Model): boolean;
|
|
9
|
+
//# sourceMappingURL=open.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/decorators/open.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAA2B,MAAM,oBAAoB,CAAC;AAI/F;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,QAO7D;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,WAErD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// -- @open decorator
|
|
2
|
+
import { validateDecoratorTarget } from "@typespec/compiler";
|
|
3
|
+
const openKey = Symbol("open");
|
|
4
|
+
/**
|
|
5
|
+
* `@open` - mark a model type as open
|
|
6
|
+
*
|
|
7
|
+
* `@open` can only be applied to models.
|
|
8
|
+
*/
|
|
9
|
+
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
|
+
context.program.stateSet(openKey).add(entity);
|
|
15
|
+
}
|
|
16
|
+
export function isOpen(program, entity) {
|
|
17
|
+
return program.stateSet(openKey).has(entity);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/decorators/open.ts"],"names":[],"mappings":"AAAA,qBAAqB;AAErB,OAAO,EAAoC,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,OAAyB,EAAE,MAAa;IAC5D,+IAA+I;IAC/I,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;QAC/D,OAAO;KACR;IAED,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DecoratorContext, Operation, Program } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@orderBy` - Applies to: get operations that return collections of @entity or @complex models.
|
|
4
|
+
* Indicates that the get operation supports the OData $orderBy query parameter.
|
|
5
|
+
*
|
|
6
|
+
* `properties` - List of property names in the model returned from the get operation that can be used in a $orderBy query parameter.
|
|
7
|
+
*/
|
|
8
|
+
export declare function $orderBy(context: DecoratorContext, target: Operation, ...properties: string[]): void;
|
|
9
|
+
export declare function getOrderBy(program: Program, target: Operation): string[];
|
|
10
|
+
export declare function isOrderBy(program: Program, target: Operation): boolean;
|
|
11
|
+
//# sourceMappingURL=order-by.d.ts.map
|
|
@@ -0,0 +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;AAI1E;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,QAE7F;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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const orderByKey = Symbol("orderBy");
|
|
2
|
+
/**
|
|
3
|
+
* `@orderBy` - Applies to: get operations that return collections of @entity or @complex models.
|
|
4
|
+
* Indicates that the get operation supports the OData $orderBy query parameter.
|
|
5
|
+
*
|
|
6
|
+
* `properties` - List of property names in the model returned from the get operation that can be used in a $orderBy query parameter.
|
|
7
|
+
*/
|
|
8
|
+
export function $orderBy(context, target, ...properties) {
|
|
9
|
+
context.program.stateMap(orderByKey).set(target, properties);
|
|
10
|
+
}
|
|
11
|
+
export function getOrderBy(program, target) {
|
|
12
|
+
return program.stateMap(orderByKey).get(target) || [];
|
|
13
|
+
}
|
|
14
|
+
export function isOrderBy(program, target) {
|
|
15
|
+
return program.stateMap(orderByKey).has(target);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=order-by.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-by.js","sourceRoot":"","sources":["../../../src/decorators/order-by.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAyB,EAAE,MAAiB,EAAE,GAAG,UAAoB;IAC5F,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC/D,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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DecoratorContext, Namespace, Program } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@privatePreviewDefinition` - create a reusable private preview definition.
|
|
4
|
+
*
|
|
5
|
+
* `@privatePreviewDefinition` can only be applied to namespaces.
|
|
6
|
+
*/
|
|
7
|
+
export interface PrivatePreviewDefinitionParameters {
|
|
8
|
+
name: string;
|
|
9
|
+
announcementDate: string;
|
|
10
|
+
removalDate: string;
|
|
11
|
+
owner: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `@privatePreviewDefinition` - Allow us create a reusable private preview definition.
|
|
15
|
+
* `@privatePreviewDefinition` - Applies only to namespaces.
|
|
16
|
+
*/
|
|
17
|
+
export declare function $privatePreviewDefinition(context: DecoratorContext, target: Namespace, name: string, announcementDate: string, removalDate: string, owner: string): void;
|
|
18
|
+
export declare function getPrivatePreviewDefinitions(program: Program, target: Namespace): Map<string, PrivatePreviewDefinitionParameters>;
|
|
19
|
+
//# sourceMappingURL=private-preview-definition.d.ts.map
|
|
@@ -0,0 +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;AAE1E;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IACjD,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,MAAM,EACZ,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,QAMd;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,GAChB,GAAG,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAKjD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const privatePreviewDefinitionKey = Symbol("privatePreviewDefinition");
|
|
2
|
+
/**
|
|
3
|
+
* `@privatePreviewDefinition` - Allow us create a reusable private preview definition.
|
|
4
|
+
* `@privatePreviewDefinition` - Applies only to namespaces.
|
|
5
|
+
*/
|
|
6
|
+
export function $privatePreviewDefinition(context, target, name, announcementDate, removalDate, owner) {
|
|
7
|
+
const definitions = getPrivatePreviewDefinitions(context.program, target);
|
|
8
|
+
definitions.set(name, { name, announcementDate, removalDate, owner });
|
|
9
|
+
context.program.stateMap(privatePreviewDefinitionKey).set(target, definitions);
|
|
10
|
+
}
|
|
11
|
+
export function getPrivatePreviewDefinitions(program, target) {
|
|
12
|
+
return (program.stateMap(privatePreviewDefinitionKey).get(target) ||
|
|
13
|
+
new Map());
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=private-preview-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-preview-definition.js","sourceRoot":"","sources":["../../../src/decorators/private-preview-definition.ts"],"names":[],"mappings":"AAcA,MAAM,2BAA2B,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAyB,EACzB,MAAiB,EACjB,IAAY,EACZ,gBAAwB,EACxB,WAAmB,EACnB,KAAa;IAEb,MAAM,WAAW,GAAG,4BAA4B,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1E,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IAEtE,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,EAA8C,CACtD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DecoratorContext, Enum, EnumMember, Model, ModelProperty, Namespace, Operation, Program, Type } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* `@privatePreview` - Allow us to deprecate a defined element.
|
|
4
|
+
* `@privatePreview` - Applies to models, model properties, enums, enum members, namespaces and operations.
|
|
5
|
+
*/
|
|
6
|
+
export declare function $privatePreview(context: DecoratorContext, target: Model | ModelProperty | EnumMember | Enum | Operation | Namespace, name: string): void;
|
|
7
|
+
export declare function getPrivatePreview(program: Program, target: Type): string;
|
|
8
|
+
export declare function isPrivatePreview(program: Program, target: Type): boolean;
|
|
9
|
+
//# sourceMappingURL=private-preview.d.ts.map
|
|
@@ -0,0 +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,EAEL,MAAM,oBAAoB,CAAC;AAU5B;;;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,MAAM,QAOb;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"}
|