@microsoft/typespec-msgraph 0.0.1-Preview.3 → 0.0.1-Preview.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.
Files changed (204) hide show
  1. package/dist/src/components/alternate-keys-annotation.js +4 -4
  2. package/dist/src/components/alternate-keys-annotation.js.map +1 -1
  3. package/dist/src/components/annotations.d.ts +9 -0
  4. package/dist/src/components/annotations.d.ts.map +1 -0
  5. package/dist/src/components/annotations.js +50 -0
  6. package/dist/src/components/annotations.js.map +1 -0
  7. package/dist/src/components/common-elements.d.ts +17 -4
  8. package/dist/src/components/common-elements.d.ts.map +1 -1
  9. package/dist/src/components/common-elements.js +2 -2
  10. package/dist/src/components/common-elements.js.map +1 -1
  11. package/dist/src/components/computed-annotation.js +1 -1
  12. package/dist/src/components/computed-annotation.js.map +1 -1
  13. package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -1
  14. package/dist/src/components/count-restrictions-annotation.js +3 -8
  15. package/dist/src/components/count-restrictions-annotation.js.map +1 -1
  16. package/dist/src/components/description-annotation.d.ts.map +1 -1
  17. package/dist/src/components/description-annotation.js +1 -0
  18. package/dist/src/components/description-annotation.js.map +1 -1
  19. package/dist/src/components/entity-container-element.d.ts +18 -3
  20. package/dist/src/components/entity-container-element.d.ts.map +1 -1
  21. package/dist/src/components/entity-container-element.js +6 -42
  22. package/dist/src/components/entity-container-element.js.map +1 -1
  23. package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -1
  24. package/dist/src/components/expand-restrictions-annotation.js +7 -13
  25. package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
  26. package/dist/src/components/operation-element.js +3 -3
  27. package/dist/src/components/operation-element.js.map +1 -1
  28. package/dist/src/components/schema-element.d.ts.map +1 -1
  29. package/dist/src/components/schema-element.js +6 -3
  30. package/dist/src/components/schema-element.js.map +1 -1
  31. package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
  32. package/dist/src/components/search-restrictions-annotation.js +3 -8
  33. package/dist/src/components/search-restrictions-annotation.js.map +1 -1
  34. package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
  35. package/dist/src/components/skip-supported-annotation.js +1 -6
  36. package/dist/src/components/skip-supported-annotation.js.map +1 -1
  37. package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
  38. package/dist/src/components/sort-restrictions-annotation.js +7 -13
  39. package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
  40. package/dist/src/components/structured-type-element.d.ts +4 -7
  41. package/dist/src/components/structured-type-element.d.ts.map +1 -1
  42. package/dist/src/components/structured-type-element.js +21 -23
  43. package/dist/src/components/structured-type-element.js.map +1 -1
  44. package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
  45. package/dist/src/components/top-supported-annotation.js +1 -4
  46. package/dist/src/components/top-supported-annotation.js.map +1 -1
  47. package/dist/src/decorators/{handlers/custom/additional-query-parameters.d.ts → additional-query-parameters.d.ts} +4 -3
  48. package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -0
  49. package/dist/src/decorators/additional-query-parameters.js +21 -0
  50. package/dist/src/decorators/additional-query-parameters.js.map +1 -0
  51. package/dist/src/decorators/ags-attribute.d.ts +13 -0
  52. package/dist/src/decorators/ags-attribute.d.ts.map +1 -0
  53. package/dist/src/decorators/ags-attribute.js +68 -0
  54. package/dist/src/decorators/ags-attribute.js.map +1 -0
  55. package/dist/src/decorators/delta-collection.d.ts +8 -0
  56. package/dist/src/decorators/delta-collection.d.ts.map +1 -0
  57. package/dist/src/decorators/delta-collection.js +12 -0
  58. package/dist/src/decorators/delta-collection.js.map +1 -0
  59. package/dist/src/decorators/deprecated-definition.d.ts +3 -4
  60. package/dist/src/decorators/deprecated-definition.d.ts.map +1 -1
  61. package/dist/src/decorators/deprecated-definition.js +1 -7
  62. package/dist/src/decorators/deprecated-definition.js.map +1 -1
  63. package/dist/src/decorators/expand.d.ts +1 -2
  64. package/dist/src/decorators/expand.d.ts.map +1 -1
  65. package/dist/src/decorators/expand.js +1 -1
  66. package/dist/src/decorators/expand.js.map +1 -1
  67. package/dist/src/decorators/function.d.ts +1 -2
  68. package/dist/src/decorators/function.d.ts.map +1 -1
  69. package/dist/src/decorators/function.js +1 -1
  70. package/dist/src/decorators/function.js.map +1 -1
  71. package/dist/src/decorators/graph-route.d.ts +9 -0
  72. package/dist/src/decorators/graph-route.d.ts.map +1 -0
  73. package/dist/src/decorators/graph-route.js +84 -0
  74. package/dist/src/decorators/graph-route.js.map +1 -0
  75. package/dist/src/decorators/has-stream.d.ts +1 -2
  76. package/dist/src/decorators/has-stream.d.ts.map +1 -1
  77. package/dist/src/decorators/has-stream.js +1 -1
  78. package/dist/src/decorators/has-stream.js.map +1 -1
  79. package/dist/src/decorators/index.d.ts +9 -2
  80. package/dist/src/decorators/index.d.ts.map +1 -1
  81. package/dist/src/decorators/index.js +9 -2
  82. package/dist/src/decorators/index.js.map +1 -1
  83. package/dist/src/decorators/is-owner.d.ts +9 -0
  84. package/dist/src/decorators/is-owner.d.ts.map +1 -0
  85. package/dist/src/decorators/is-owner.js +14 -0
  86. package/dist/src/decorators/is-owner.js.map +1 -0
  87. package/dist/src/decorators/order-by.d.ts +1 -2
  88. package/dist/src/decorators/order-by.d.ts.map +1 -1
  89. package/dist/src/decorators/order-by.js +1 -1
  90. package/dist/src/decorators/order-by.js.map +1 -1
  91. package/dist/src/decorators/paged-collection.d.ts +8 -0
  92. package/dist/src/decorators/paged-collection.d.ts.map +1 -0
  93. package/dist/src/decorators/paged-collection.js +12 -0
  94. package/dist/src/decorators/paged-collection.js.map +1 -0
  95. package/dist/src/decorators/private-preview-definition.d.ts +3 -4
  96. package/dist/src/decorators/private-preview-definition.d.ts.map +1 -1
  97. package/dist/src/decorators/private-preview-definition.js +1 -6
  98. package/dist/src/decorators/private-preview-definition.js.map +1 -1
  99. package/dist/src/decorators/private-preview.d.ts +1 -2
  100. package/dist/src/decorators/private-preview.d.ts.map +1 -1
  101. package/dist/src/decorators/private-preview.js +1 -1
  102. package/dist/src/decorators/private-preview.js.map +1 -1
  103. package/dist/src/decorators/privileged.d.ts +9 -0
  104. package/dist/src/decorators/privileged.d.ts.map +1 -0
  105. package/dist/src/decorators/privileged.js +13 -0
  106. package/dist/src/decorators/privileged.js.map +1 -0
  107. package/dist/src/decorators/workload-name-msa.d.ts +9 -0
  108. package/dist/src/decorators/workload-name-msa.d.ts.map +1 -0
  109. package/dist/src/decorators/workload-name-msa.js +13 -0
  110. package/dist/src/decorators/workload-name-msa.js.map +1 -0
  111. package/dist/src/decorators/workload-name.d.ts +9 -0
  112. package/dist/src/decorators/workload-name.d.ts.map +1 -0
  113. package/dist/src/decorators/workload-name.js +13 -0
  114. package/dist/src/decorators/workload-name.js.map +1 -0
  115. package/dist/src/entities/annotations.d.ts +30 -0
  116. package/dist/src/entities/annotations.d.ts.map +1 -0
  117. package/dist/src/entities/annotations.js +97 -0
  118. package/dist/src/entities/annotations.js.map +1 -0
  119. package/dist/src/entities/entity-container.d.ts +3 -24
  120. package/dist/src/entities/entity-container.d.ts.map +1 -1
  121. package/dist/src/entities/entity-container.js +24 -118
  122. package/dist/src/entities/entity-container.js.map +1 -1
  123. package/dist/src/entities/enum.d.ts.map +1 -1
  124. package/dist/src/entities/enum.js +3 -3
  125. package/dist/src/entities/enum.js.map +1 -1
  126. package/dist/src/entities/model.d.ts +12 -22
  127. package/dist/src/entities/model.d.ts.map +1 -1
  128. package/dist/src/entities/model.js +64 -101
  129. package/dist/src/entities/model.js.map +1 -1
  130. package/dist/src/entities/namespace.d.ts +7 -2
  131. package/dist/src/entities/namespace.d.ts.map +1 -1
  132. package/dist/src/entities/namespace.js +20 -13
  133. package/dist/src/entities/namespace.js.map +1 -1
  134. package/dist/src/entities/operation.d.ts +2 -2
  135. package/dist/src/entities/operation.d.ts.map +1 -1
  136. package/dist/src/entities/operation.js +30 -14
  137. package/dist/src/entities/operation.js.map +1 -1
  138. package/dist/src/linter.d.ts.map +1 -1
  139. package/dist/src/linter.js +25 -25
  140. package/dist/src/linter.js.map +1 -1
  141. package/dist/src/rules/count.d.ts.map +1 -1
  142. package/dist/src/rules/count.js +3 -1
  143. package/dist/src/rules/count.js.map +1 -1
  144. package/dist/src/rules/entity.d.ts.map +1 -1
  145. package/dist/src/rules/entity.js +4 -1
  146. package/dist/src/rules/entity.js.map +1 -1
  147. package/dist/src/rules/expand.d.ts.map +1 -1
  148. package/dist/src/rules/expand.js +5 -7
  149. package/dist/src/rules/expand.js.map +1 -1
  150. package/dist/src/rules/index.d.ts.map +1 -1
  151. package/dist/src/rules/index.js +1 -0
  152. package/dist/src/rules/index.js.map +1 -1
  153. package/dist/src/rules/order-by.d.ts +1 -1
  154. package/dist/src/rules/order-by.d.ts.map +1 -1
  155. package/dist/src/rules/order-by.js +11 -10
  156. package/dist/src/rules/order-by.js.map +1 -1
  157. package/dist/src/rules/search.d.ts.map +1 -1
  158. package/dist/src/rules/search.js +3 -1
  159. package/dist/src/rules/search.js.map +1 -1
  160. package/dist/src/rules/skip.d.ts.map +1 -1
  161. package/dist/src/rules/skip.js +3 -1
  162. package/dist/src/rules/skip.js.map +1 -1
  163. package/dist/src/rules/top.d.ts.map +1 -1
  164. package/dist/src/rules/top.js +3 -1
  165. package/dist/src/rules/top.js.map +1 -1
  166. package/dist/src/utils.d.ts +16 -0
  167. package/dist/src/utils.d.ts.map +1 -1
  168. package/dist/src/utils.js +89 -1
  169. package/dist/src/utils.js.map +1 -1
  170. package/lib/decorators.tsp +90 -14
  171. package/lib/deployment.tsp +18 -0
  172. package/lib/lib.tsp +9 -14
  173. package/lib/msgraph.tsp +4 -0
  174. package/lib/porcelain.tsp +135 -0
  175. package/lib/responses.tsp +82 -0
  176. package/lib/shared-models.tsp +74 -0
  177. package/package.json +6 -10
  178. package/dist/src/decorators/attribute-builder.d.ts +0 -2
  179. package/dist/src/decorators/attribute-builder.d.ts.map +0 -1
  180. package/dist/src/decorators/attribute-builder.js +0 -166
  181. package/dist/src/decorators/attribute-builder.js.map +0 -1
  182. package/dist/src/decorators/attributes.d.ts +0 -57
  183. package/dist/src/decorators/attributes.d.ts.map +0 -1
  184. package/dist/src/decorators/attributes.js +0 -50
  185. package/dist/src/decorators/attributes.js.map +0 -1
  186. package/dist/src/decorators/decorator-parameter.d.ts +0 -4
  187. package/dist/src/decorators/decorator-parameter.d.ts.map +0 -1
  188. package/dist/src/decorators/decorator-parameter.js +0 -2
  189. package/dist/src/decorators/decorator-parameter.js.map +0 -1
  190. package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +0 -1
  191. package/dist/src/decorators/handlers/custom/additional-query-parameters.js +0 -38
  192. package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +0 -1
  193. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +0 -8
  194. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +0 -1
  195. package/dist/src/decorators/handlers/custom/ags-attribute.js +0 -36
  196. package/dist/src/decorators/handlers/custom/ags-attribute.js.map +0 -1
  197. package/dist/src/decorators/handlers/custom/index.d.ts +0 -3
  198. package/dist/src/decorators/handlers/custom/index.d.ts.map +0 -1
  199. package/dist/src/decorators/handlers/custom/index.js +0 -3
  200. package/dist/src/decorators/handlers/custom/index.js.map +0 -1
  201. package/dist/src/decorators/handlers/index.d.ts +0 -31
  202. package/dist/src/decorators/handlers/index.d.ts.map +0 -1
  203. package/dist/src/decorators/handlers/index.js +0 -121
  204. package/dist/src/decorators/handlers/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/typespec-msgraph",
3
- "version": "0.0.1-Preview.3",
3
+ "version": "0.0.1-Preview.5",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec for Microsoft Graph provides a description of the Microsoft Graph APIs. It is used for generating API description languages, client and service code, documentation, and other assets.",
6
6
  "homepage": "https://github.com/microsoftgraph/typespec-msgraph",
@@ -38,7 +38,6 @@
38
38
  },
39
39
  "scripts": {
40
40
  "clean": "rimraf ./dist ./temp",
41
- "prebuild": "tsx src/decorators/attribute-builder.ts",
42
41
  "build": "tsc -p .",
43
42
  "watch": "tsc -p . --watch",
44
43
  "test": "mocha",
@@ -52,10 +51,12 @@
52
51
  "dist/**",
53
52
  "!dist/test/**"
54
53
  ],
55
- "peerDependencies": {
56
- "@typespec/compiler": "~0.45.0"
57
- },
58
54
  "dependencies": {
55
+ "@xmldom/xmldom": "~0.8.2",
56
+ "@typespec/compiler": "~0.45.0",
57
+ "@typespec/http": "~0.45.0",
58
+ "@typespec/lint": "~0.45.0",
59
+ "@typespec/rest": "~0.45.0",
59
60
  "prettier": "~2.8.7",
60
61
  "react-dom": "~18.2.0",
61
62
  "react": "~18.2.0",
@@ -67,12 +68,7 @@
67
68
  "@types/prettier": "2.6.0",
68
69
  "@types/react": "~18.0.5",
69
70
  "@types/react-reconciler": "~0.28.0",
70
- "@typespec/compiler": "~0.45.0",
71
71
  "@typespec/eslint-config-typespec": "~0.7.0",
72
- "@typespec/http": "~0.45.0",
73
- "@typespec/lint": "~0.45.0",
74
- "@typespec/rest": "~0.45.0",
75
- "@xmldom/xmldom": "~0.8.2",
76
72
  "c8": "~7.13.0",
77
73
  "eslint": "^8.36.0",
78
74
  "mocha": "~10.2.0",
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=attribute-builder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attribute-builder.d.ts","sourceRoot":"","sources":["../../../src/decorators/attribute-builder.ts"],"names":[],"mappings":""}
@@ -1,166 +0,0 @@
1
- import { writeFileSync } from "fs";
2
- import path, { join } from "path";
3
- import { fileURLToPath } from "url";
4
- import { attributes } from "./attributes.js";
5
- const mapTargetToType = (target) => {
6
- switch (target) {
7
- case "Model":
8
- return "Model";
9
- case "ModelProperty":
10
- return "ModelProperty";
11
- case "Enum":
12
- return "Enum";
13
- case "EnumMember":
14
- return "EnumMember";
15
- case "Operation":
16
- return "Operation";
17
- case "Namespace":
18
- return "Namespace";
19
- default:
20
- throw new Error("Should not reach here");
21
- }
22
- };
23
- const writeDecoratorsFile = () => {
24
- let data = writeHeader();
25
- data += writeImports();
26
- attributes.forEach((attribute) => {
27
- data += writeDecorator(attribute);
28
- });
29
- data += writeDecoratorMappings();
30
- data += writeBuildAttributesFunc();
31
- const __fileName = fileURLToPath(import.meta.url);
32
- const __dirname = path.dirname(__fileName);
33
- writeFileSync(join(__dirname, "handlers", "index.ts"), data, { flag: "w" });
34
- // eslint-disable-next-line no-console
35
- console.log("🚀 Success! 🚀");
36
- };
37
- const writeHeader = () => {
38
- return `
39
- /**
40
- * NOTICE: This is an autogenerated file and should not be edited directly.
41
- */
42
- `;
43
- };
44
- const writeImports = () => {
45
- return `
46
- import {
47
- createDecoratorDefinition,
48
- DecoratorContext,
49
- EnumMember,
50
- Enum,
51
- Interface,
52
- Model,
53
- ModelProperty,
54
- Namespace,
55
- Operation,
56
- Program,
57
- Type,
58
- } from "@typespec/compiler";
59
- import * as customAttribs from "./custom/index.js";
60
- `;
61
- };
62
- let decoratorToMethodMap = [];
63
- const writeDecoratorMappings = () => {
64
- const customAttribs = attributes
65
- .filter((attr) => !!attr.emitter)
66
- .map((attr) => `${[attr.decorator]}: customAttribs.${attr.emitter}`);
67
- decoratorToMethodMap = [...decoratorToMethodMap, ...customAttribs];
68
- return `
69
- const decoratorToMethodMapper: { [key: string]: (p: Program, t: Type) => boolean | string | { [key: string]: string } | undefined } = {
70
- ${decoratorToMethodMap.join(",\n ")}
71
- }
72
-
73
- const decoratorToAgsAttributeMapper: { [key: string]: string } = {
74
- ${attributes
75
- .filter((attr) => !attr.emitter)
76
- .map((attr) => `"${attr.decorator}": "ags:${attr.attribute.name}"`)
77
- .join(",\n ")}
78
- }
79
- `;
80
- };
81
- const addGetMethod = (decorator) => {
82
- const decoratorName = `${decorator[0].toUpperCase()}${decorator.substring(1)}`;
83
- decoratorToMethodMap.push(`${decorator}: get${decoratorName}`);
84
- return `
85
- export function get${decoratorName}(program: Program, target: Type): string | undefined {
86
- return program.stateMap(${decorator}Key).get(target);
87
- }
88
- `;
89
- };
90
- const addBoolMethod = (decorator) => {
91
- const decoratorName = `${decorator[0].toUpperCase()}${decorator.substring(1)}`;
92
- decoratorToMethodMap.push(`${decorator}: is${decoratorName}`);
93
- return `
94
- export function is${decoratorName}(program: Program, target: Type): boolean {
95
- return program.stateSet(${decorator}Key).has(target);
96
- }
97
- `;
98
- };
99
- const writeDecorator = (attribute) => {
100
- var _a, _b;
101
- if (attribute.emitter) {
102
- return "";
103
- }
104
- return `
105
- // -- @${attribute.decorator} decorator
106
-
107
- const ${attribute.decorator}Key = Symbol("${attribute.decorator}");
108
- const ${attribute.decorator}Decorator = createDecoratorDefinition({
109
- name: "@${attribute.decorator}",
110
- target: [${attribute.target.map((item) => `"${item}"`).join(", ")}],
111
- ${attribute.args
112
- ? `args: [ ${attribute.args.map((_) => '{ kind: "String" }').join(", ")} ]`
113
- : `args: []`}
114
- } as const);
115
-
116
- /**
117
- * ${attribute.description ? `\`@${attribute.decorator}\` - ${attribute.description}` : ""}
118
- * \`@${attribute.decorator}\` can be applied to ${attribute.target.join(", ")}.
119
- */
120
- export function $${attribute.decorator}(
121
- context: DecoratorContext,
122
- target: ${attribute.target.map((item) => mapTargetToType(item)).join(" | ")},
123
- ${attribute.args ? `${(_a = attribute.args) === null || _a === void 0 ? void 0 : _a.map((item) => `${item}: string`).join(", ")}` : ""}
124
- ) {
125
- if (!${attribute.decorator}Decorator.validate(context, target, [${((_b = attribute.args) === null || _b === void 0 ? void 0 : _b.join(", ")) || ""}])) {
126
- return;
127
- }
128
-
129
- ${attribute.args
130
- ? `context.program.stateMap(${attribute.decorator}Key).set(target, ${attribute.args[0]});`
131
- : `context.program.stateSet(${attribute.decorator}Key).add(target);`}
132
- }
133
- ${attribute.args ? addGetMethod(attribute.decorator) : addBoolMethod(attribute.decorator)}
134
- `;
135
- };
136
- const writeBuildAttributesFunc = () => {
137
- const decorators = attributes.map((attr) => `"${attr.decorator}"`).join(", ");
138
- // generate a dict of customDecorators which will be used to unpack attribute values
139
- return `
140
- export function buildAttributes(
141
- program: Program,
142
- type: Model | ModelProperty | Namespace | Interface | Operation | Enum | EnumMember
143
- ) {
144
- const declaredDecorators: string[] = [${decorators}];
145
- let attrs = {};
146
- type.decorators
147
- // only handle declared decorators
148
- .filter((d) => declaredDecorators.some((s) => s === d.decorator.name.substring(1)))
149
- .forEach((d) => {
150
- const attrName = d.decorator.name.substring(1); // name prefixed with $
151
- let key = attrName as keyof typeof decoratorToMethodMapper;
152
- const agsAttrParams = decoratorToMethodMapper[key](program, type);
153
- if (typeof agsAttrParams === "object") {
154
- attrs = { ...attrs, ...agsAttrParams };
155
- } else {
156
- key = attrName as keyof typeof decoratorToAgsAttributeMapper;
157
- const agsAttr = decoratorToAgsAttributeMapper[key];
158
- attrs = { ...attrs, ...{ [agsAttr]: agsAttrParams } };
159
- }
160
- });
161
- return attrs;
162
- }
163
- `;
164
- };
165
- writeDecoratorsFile();
166
- //# sourceMappingURL=attribute-builder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attribute-builder.js","sourceRoot":"","sources":["../../../src/decorators/attribute-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,UAAU,EAAiB,MAAM,iBAAiB,CAAC;AAE5D,MAAM,eAAe,GAAG,CAAC,MAAc,EAAU,EAAE;IACjD,QAAQ,MAAM,EAAE;QACd,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,eAAe;YAClB,OAAO,eAAe,CAAC;QACzB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,WA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;QAC1F,CAAC,CAAC,4BAA4B,SAAS,CAAC,SAAS,mBACrD;;EAEA,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC;CACxF,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,GAAG,EAAE;IACpC,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE9E,oFAAoF;IAEpF,OAAO;;;;;0CAKiC,UAAU;;;;;;;;;;;;;;;;;;;GAmBjD,CAAC;AACJ,CAAC,CAAC;AAEF,mBAAmB,EAAE,CAAC"}
@@ -1,57 +0,0 @@
1
- /**
2
- * Defines the structure of an attribute
3
- */
4
- export interface AttributeType {
5
- decorator: string;
6
- target: string[];
7
- attribute: any;
8
- description?: string;
9
- args?: string[];
10
- emitter?: string;
11
- }
12
- /**
13
- *
14
- * NOTE: If you need custom handlers you declare them here and
15
- * create a separate file for it in ./decorators/handlers/custom
16
- */
17
- /**
18
- * `@attributes` - declares supported ags:attributes
19
- */
20
- export declare const attributes: ({
21
- decorator: string;
22
- description: string;
23
- target: string[];
24
- attribute: {
25
- name: string;
26
- };
27
- args?: undefined;
28
- emitter?: undefined;
29
- } | {
30
- decorator: string;
31
- target: string[];
32
- attribute: {
33
- name: string;
34
- };
35
- description?: undefined;
36
- args?: undefined;
37
- emitter?: undefined;
38
- } | {
39
- decorator: string;
40
- args: string[];
41
- target: string[];
42
- attribute: {
43
- name: string;
44
- };
45
- description?: undefined;
46
- emitter?: undefined;
47
- } | {
48
- decorator: string;
49
- args: string[];
50
- target: string[];
51
- emitter: string;
52
- attribute: {
53
- name: string;
54
- };
55
- description?: undefined;
56
- })[];
57
- //# sourceMappingURL=attributes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../src/decorators/attributes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,GAAG,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwCtB,CAAC"}
@@ -1,50 +0,0 @@
1
- /**
2
- *
3
- * NOTE: If you need custom handlers you declare them here and
4
- * create a separate file for it in ./decorators/handlers/custom
5
- */
6
- /**
7
- * `@attributes` - declares supported ags:attributes
8
- */
9
- export const attributes = [
10
- {
11
- decorator: "isOwner",
12
- description: "specify the name of the workload associated with the model",
13
- target: ["Model", "ModelProperty", "Enum", "EnumMember"],
14
- attribute: { name: "IsOwner" },
15
- },
16
- {
17
- decorator: "privileged",
18
- target: ["Model", "ModelProperty", "Enum", "EnumMember", "Operation", "Namespace"],
19
- attribute: { name: "IsHidden" },
20
- },
21
- {
22
- decorator: "workloadName",
23
- args: ["workloadName"],
24
- target: ["Model", "ModelProperty", "Enum", "EnumMember"],
25
- attribute: { name: "WorkloadName" },
26
- },
27
- {
28
- decorator: "workloadNameMsa",
29
- args: ["workloadNameMsa"],
30
- target: ["Model", "ModelProperty", "Enum", "EnumMember"],
31
- attribute: { name: "WorkloadNameMsa" },
32
- },
33
- {
34
- decorator: "additionalQueryParameters",
35
- args: ["name", "value"],
36
- target: ["Namespace"],
37
- emitter: "unpackAdditionalQueryParameters",
38
- attribute: {
39
- name: "AdditionalQueryParameters",
40
- },
41
- },
42
- {
43
- decorator: "agsAttribute",
44
- args: ["name", "value"],
45
- target: ["Model", "ModelProperty", "Enum", "EnumMember", "Interface", "Operation"],
46
- emitter: "unpackAgsAttributes",
47
- attribute: { name: "AgsAttribute" },
48
- },
49
- ];
50
- //# sourceMappingURL=attributes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../src/decorators/attributes.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;QACE,SAAS,EAAE,SAAS;QACpB,WAAW,EAAE,4DAA4D;QACzE,MAAM,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,CAAC;QACxD,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC/B;IACD;QACE,SAAS,EAAE,YAAY;QACvB,MAAM,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,CAAC;QAClF,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;KAChC;IACD;QACE,SAAS,EAAE,cAAc;QACzB,IAAI,EAAE,CAAC,cAAc,CAAC;QACtB,MAAM,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,CAAC;QACxD,SAAS,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;KACpC;IACD;QACE,SAAS,EAAE,iBAAiB;QAC5B,IAAI,EAAE,CAAC,iBAAiB,CAAC;QACzB,MAAM,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,CAAC;QACxD,SAAS,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;KACvC;IACD;QACE,SAAS,EAAE,2BAA2B;QACtC,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QACvB,MAAM,EAAE,CAAC,WAAW,CAAC;QACrB,OAAO,EAAE,iCAAiC;QAC1C,SAAS,EAAE;YACT,IAAI,EAAE,2BAA2B;SAClC;KACF;IACD;QACE,SAAS,EAAE,cAAc;QACzB,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QACvB,MAAM,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,CAAC;QAClF,OAAO,EAAE,qBAAqB;QAC9B,SAAS,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;KACpC;CACF,CAAC"}
@@ -1,4 +0,0 @@
1
- export interface DecoratorParameter {
2
- value: string;
3
- }
4
- //# sourceMappingURL=decorator-parameter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorator-parameter.d.ts","sourceRoot":"","sources":["../../../src/decorators/decorator-parameter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;CACd"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=decorator-parameter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorator-parameter.js","sourceRoot":"","sources":["../../../src/decorators/decorator-parameter.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
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;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,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,SAAS,EAAE,kBAAkB,GAAG,SAAS,EACzC,UAAU,EAAE,kBAAkB,GAAG,SAAS,QAqB3C;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"}
@@ -1,38 +0,0 @@
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, nameParam, valueParam) {
12
- const name = nameParam === undefined ? "" : nameParam.value;
13
- const value = valueParam === undefined ? "" : valueParam.value;
14
- if (!additionalQueryParametersDecorator.validate(context, target, [name, value])) {
15
- return;
16
- }
17
- let queryParameters = context.program
18
- .stateMap(additionalQueryParametersKey)
19
- .get(target);
20
- if (queryParameters === undefined) {
21
- queryParameters = [];
22
- context.program.stateMap(additionalQueryParametersKey).set(target, queryParameters);
23
- }
24
- queryParameters.push({
25
- name,
26
- value,
27
- });
28
- }
29
- export function getAdditionalQueryParameters(program, target) {
30
- return program.stateMap(additionalQueryParametersKey).get(target) || [];
31
- }
32
- export function unpackAdditionalQueryParameters(program, target) {
33
- const additionalQueryParameters = getAdditionalQueryParameters(program, target);
34
- const queryParameters = additionalQueryParameters &&
35
- additionalQueryParameters.map((p) => `${p.name}=${p.value}`).join("&");
36
- return { "ags:AdditionalQueryParameters": queryParameters };
37
- }
38
- //# sourceMappingURL=additional-query-parameters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"additional-query-parameters.js","sourceRoot":"","sources":["../../../../../src/decorators/handlers/custom/additional-query-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,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,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"}
@@ -1,8 +0,0 @@
1
- import { DecoratorContext, Enum, EnumMember, Interface, Model, ModelProperty, Operation, Program, Type } from "@typespec/compiler";
2
- import { DecoratorParameter } from "../../decorator-parameter.js";
3
- export declare function $agsAttribute(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember | Operation | Interface, name: DecoratorParameter, value: DecoratorParameter): void;
4
- export declare function getAgsAttributes(program: Program, target: Model | ModelProperty | Enum | EnumMember | Operation | Interface): Map<string, string> | undefined;
5
- export declare function unpackAgsAttributes(program: Program, target: Type): {
6
- [key: string]: string;
7
- };
8
- //# sourceMappingURL=ags-attribute.d.ts.map
@@ -1 +0,0 @@
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;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAelE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,EACzE,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,kBAAkB,QAiB1B;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"}
@@ -1,36 +0,0 @@
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, value.value])) {
14
- return;
15
- }
16
- let attributeParameters = context.program
17
- .stateMap(agsAttributeKey)
18
- .get(target);
19
- if (attributeParameters) {
20
- attributeParameters.set(name.value, value.value);
21
- }
22
- else {
23
- attributeParameters = new Map([[name.value, value.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
@@ -1 +0,0 @@
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;AAG5B;;;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,IAAwB,EACxB,KAAyB;IAEzB,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;QAC/E,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,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;KAClD;SAAM;QACL,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC5D;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"}
@@ -1,3 +0,0 @@
1
- export * from "./additional-query-parameters.js";
2
- export * from "./ags-attribute.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,3 +0,0 @@
1
- export * from "./additional-query-parameters.js";
2
- export * from "./ags-attribute.js";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/decorators/handlers/custom/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC"}
@@ -1,31 +0,0 @@
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
- import { DecoratorParameter } from "../decorator-parameter.js";
6
- /**
7
- * `@isOwner` - specify the name of the workload associated with the model
8
- * `@isOwner` can be applied to Model, ModelProperty, Enum, EnumMember.
9
- */
10
- export declare function $isOwner(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember): void;
11
- export declare function isIsOwner(program: Program, target: Type): boolean;
12
- /**
13
- *
14
- * `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
15
- */
16
- export declare function $privileged(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace): void;
17
- export declare function isPrivileged(program: Program, target: Type): boolean;
18
- /**
19
- *
20
- * `@workloadName` can be applied to Model, ModelProperty, Enum, EnumMember.
21
- */
22
- export declare function $workloadName(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember, workloadName: DecoratorParameter): void;
23
- export declare function getWorkloadName(program: Program, target: Type): string | undefined;
24
- /**
25
- *
26
- * `@workloadNameMsa` can be applied to Model, ModelProperty, Enum, EnumMember.
27
- */
28
- export declare function $workloadNameMsa(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember, workloadNameMsa: DecoratorParameter): void;
29
- export declare function getWorkloadNameMsa(program: Program, target: Type): string | undefined;
30
- export declare function buildAttributes(program: Program, type: Model | ModelProperty | Namespace | Interface | Operation | Enum | EnumMember): Record<string, string>;
31
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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;AAE5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAW/D;;;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,kBAAkB,QAOjC;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,kBAAkB,QAOpC;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,GAClF,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmBxB"}
@@ -1,121 +0,0 @@
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.value])) {
59
- return;
60
- }
61
- context.program.stateMap(workloadNameKey).set(target, workloadName.value);
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.value])) {
79
- return;
80
- }
81
- context.program.stateMap(workloadNameMsaKey).set(target, workloadNameMsa.value);
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