@azure-tools/typespec-azure-resource-manager 0.31.0-dev.3 → 0.31.0-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-resource-manager",
3
- "version": "0.31.0-dev.3",
3
+ "version": "0.31.0-dev.5",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Resource Manager library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -1,44 +0,0 @@
1
- export declare const namespace = "Azure.ResourceManager.Foundations";
2
- import { DecoratorContext, Interface, Model, ModelProperty, Program, Type } from "@typespec/compiler";
3
- /**
4
- * Using ARM common definition for a Model
5
- * @param {DecoratorContext} context DecoratorContext object
6
- * @param {Type} entity Decorator target type. Must be `Model`
7
- * @param {string?} definitionName Optional definition name
8
- * @param {string?} version Optional version
9
- * @param {string?} referenceFile Optional common file path
10
- * @returns {void}
11
- */
12
- export declare function $armCommonDefinition(context: DecoratorContext, entity: Type, definitionName?: string, version?: string, referenceFile?: string): void;
13
- /**
14
- * Refer an model property to be a common ARM parameter
15
- * @param {DecoratorContext} context DecoratorContext object
16
- * @param {Type} entity Decorator target type. Must be `Model`
17
- * @param {string?} definitionName Optional definition name
18
- * @param {string?} version Optional version
19
- * @param {string?} referenceFile Optional common file path
20
- * @returns void
21
- */
22
- export declare function $armCommonParameter(context: DecoratorContext, entity: Type, parameterName?: string, version?: string, referenceFile?: string): void;
23
- /**
24
- * This decorator dynamically assigns the serviceNamespace from the containing
25
- * namespace to the string literal value of the path parameter to which this
26
- * decorator is applied. Its purpose is to dynamically insert the provider
27
- * namespace (e.g. 'Microsoft.CodeSigning') into the path parameter list.
28
- * @param {DecoratorContext} context DecoratorContext
29
- * @param {Type} target Target of this decorator. Must be a string `ModelProperty`.
30
- * @param {Type} resourceType Must be a `Model`.
31
- */
32
- export declare function $assignProviderNameValue(context: DecoratorContext, target: ModelProperty, resourceType: Model): void;
33
- /**
34
- * Update the ARM provider namespace for a given entity.
35
- * @param {DecoratorContext} context DecoratorContext
36
- * @param {Type} entity Entity to set namespace. Must be a `Operation`.
37
- * @returns
38
- */
39
- export declare function $armUpdateProviderNamespace(context: DecoratorContext, entity: Type): void;
40
- /**
41
- * Check if an interface is extending the Azure.ResourceManager.Operations interface.
42
- */
43
- export declare function isArmOperationsListInterface(program: Program, type: Interface): boolean;
44
- //# sourceMappingURL=internal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,sCAAsC,CAAC;AAG7D,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,aAAa,EAEb,OAAO,EAEP,IAAI,EAEL,MAAM,oBAAoB,CAAC;AAS5B;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,IAAI,EACZ,cAAc,CAAC,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CAqBN;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,IAAI,EACZ,aAAa,CAAC,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CAqBN;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,KAAK,GAClB,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,QA4BlF;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAWvF"}
@@ -1,133 +0,0 @@
1
- export const namespace = "Azure.ResourceManager.Foundations";
2
- import { $useRef } from "@azure-tools/typespec-autorest";
3
- import { validateDecoratorTarget, } from "@typespec/compiler";
4
- import { getSegment } from "@typespec/rest";
5
- import { reportDiagnostic } from "./lib.js";
6
- import { getArmProviderNamespace } from "./namespace.js";
7
- function getArmTypesPath(program) {
8
- return program.getOption("arm-types-path") || "{arm-types-dir}";
9
- }
10
- /**
11
- * Using ARM common definition for a Model
12
- * @param {DecoratorContext} context DecoratorContext object
13
- * @param {Type} entity Decorator target type. Must be `Model`
14
- * @param {string?} definitionName Optional definition name
15
- * @param {string?} version Optional version
16
- * @param {string?} referenceFile Optional common file path
17
- * @returns {void}
18
- */
19
- export function $armCommonDefinition(context, entity, definitionName, version, referenceFile) {
20
- if (!validateDecoratorTarget(context, entity, "@armCommonDefinition", "Model")) {
21
- return;
22
- }
23
- // Use the name of the model type if not specified
24
- if (!definitionName) {
25
- definitionName = entity.name;
26
- }
27
- const basePath = getArmTypesPath(context.program).trim();
28
- // for backward compatibility, skip if we are trying to access a non-default file and emit the type
29
- if ((version || referenceFile) && basePath.endsWith(".json"))
30
- return;
31
- if (!version)
32
- version = "v3";
33
- if (!referenceFile)
34
- referenceFile = "types.json";
35
- const path = basePath.endsWith(".json")
36
- ? `${basePath}#/definitions/${definitionName}`
37
- : `${basePath}/${version}/${referenceFile}#/definitions/${definitionName}`;
38
- context.call($useRef, entity, path);
39
- }
40
- /**
41
- * Refer an model property to be a common ARM parameter
42
- * @param {DecoratorContext} context DecoratorContext object
43
- * @param {Type} entity Decorator target type. Must be `Model`
44
- * @param {string?} definitionName Optional definition name
45
- * @param {string?} version Optional version
46
- * @param {string?} referenceFile Optional common file path
47
- * @returns void
48
- */
49
- export function $armCommonParameter(context, entity, parameterName, version, referenceFile) {
50
- if (!validateDecoratorTarget(context, entity, "@armCommonParameter", "ModelProperty")) {
51
- return;
52
- }
53
- // Use the name of the model type if not specified
54
- if (!parameterName) {
55
- parameterName = entity.name;
56
- }
57
- const basePath = getArmTypesPath(context.program).trim();
58
- // for backward compatibility, skip if we are trying to access a non-default file and emit the type
59
- if ((version || referenceFile) && basePath.endsWith(".json"))
60
- return;
61
- if (!version)
62
- version = "v3";
63
- if (!referenceFile)
64
- referenceFile = "types.json";
65
- const path = basePath.endsWith(".json")
66
- ? `${basePath}#/parameters/${parameterName}`
67
- : `${basePath}/${version}/${referenceFile}#/parameters/${parameterName}`;
68
- context.call($useRef, entity, path);
69
- }
70
- /**
71
- * This decorator dynamically assigns the serviceNamespace from the containing
72
- * namespace to the string literal value of the path parameter to which this
73
- * decorator is applied. Its purpose is to dynamically insert the provider
74
- * namespace (e.g. 'Microsoft.CodeSigning') into the path parameter list.
75
- * @param {DecoratorContext} context DecoratorContext
76
- * @param {Type} target Target of this decorator. Must be a string `ModelProperty`.
77
- * @param {Type} resourceType Must be a `Model`.
78
- */
79
- export function $assignProviderNameValue(context, target, resourceType) {
80
- const { program } = context;
81
- const armProviderNamespace = getArmProviderNamespace(program, resourceType);
82
- if (armProviderNamespace) {
83
- target.type.value = armProviderNamespace;
84
- }
85
- }
86
- /**
87
- * Update the ARM provider namespace for a given entity.
88
- * @param {DecoratorContext} context DecoratorContext
89
- * @param {Type} entity Entity to set namespace. Must be a `Operation`.
90
- * @returns
91
- */
92
- export function $armUpdateProviderNamespace(context, entity) {
93
- const { program } = context;
94
- if (!validateDecoratorTarget(context, entity, "@armUpdateProviderNamespace", "Operation")) {
95
- return;
96
- }
97
- const operation = entity;
98
- const opInterface = operation.interface;
99
- if (opInterface && opInterface.namespace) {
100
- const armProviderNamespace = getArmProviderNamespace(program, opInterface.namespace);
101
- if (armProviderNamespace) {
102
- // Set the namespace constant on the 'provider' parameter
103
- const providerParam = operation.parameters.properties.get("provider");
104
- if (providerParam) {
105
- if (providerParam.type.kind !== "String") {
106
- reportDiagnostic(program, {
107
- code: "decorator-param-wrong-type",
108
- messageId: "armUpdateProviderNamespace",
109
- target: providerParam,
110
- });
111
- return;
112
- }
113
- providerParam.type.value = armProviderNamespace;
114
- }
115
- }
116
- }
117
- }
118
- /**
119
- * Check if an interface is extending the Azure.ResourceManager.Operations interface.
120
- */
121
- export function isArmOperationsListInterface(program, type) {
122
- if (type.name !== "Operations") {
123
- return false;
124
- }
125
- const listOperation = type.operations.get("list");
126
- if (listOperation) {
127
- if (getSegment(program, listOperation) === "operations") {
128
- return true;
129
- }
130
- }
131
- return false;
132
- }
133
- //# sourceMappingURL=internal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,mCAAmC,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EASL,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,SAAS,eAAe,CAAC,OAAgB;IACvC,OAAO,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,iBAAiB,CAAC;AAClE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAyB,EACzB,MAAY,EACZ,cAAuB,EACvB,OAAgB,EAChB,aAAsB;IAEtB,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE;QAC9E,OAAO;KACR;IAED,kDAAkD;IAClD,IAAI,CAAC,cAAc,EAAE;QACnB,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC;KAC9B;IAED,MAAM,QAAQ,GAAW,eAAe,CAAC,OAAO,CAAC,O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