@typespec/compiler 0.63.0-dev.1 → 0.63.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated-defs/TypeSpec.Prototypes.d.ts +1 -1
- package/dist/generated-defs/TypeSpec.Prototypes.d.ts.map +1 -1
- package/dist/generated-defs/TypeSpec.d.ts +198 -79
- package/dist/generated-defs/TypeSpec.d.ts.map +1 -1
- package/dist/manifest.js +2 -2
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/core/index.js +1 -0
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/core/logger/logger.js +1 -1
- package/dist/src/core/logger/logger.js.map +1 -1
- package/dist/src/core/messages.d.ts +56 -2
- package/dist/src/core/messages.d.ts.map +1 -1
- package/dist/src/core/messages.js +20 -0
- package/dist/src/core/messages.js.map +1 -1
- package/dist/src/core/visibility/core.d.ts +240 -0
- package/dist/src/core/visibility/core.d.ts.map +1 -0
- package/dist/src/core/visibility/core.js +483 -0
- package/dist/src/core/visibility/core.js.map +1 -0
- package/dist/src/core/visibility/index.d.ts +3 -0
- package/dist/src/core/visibility/index.d.ts.map +1 -0
- package/dist/src/core/visibility/index.js +5 -0
- package/dist/src/core/visibility/index.js.map +1 -0
- package/dist/src/core/visibility/lifecycle.d.ts +28 -0
- package/dist/src/core/visibility/lifecycle.d.ts.map +1 -0
- package/dist/src/core/visibility/lifecycle.js +68 -0
- package/dist/src/core/visibility/lifecycle.js.map +1 -0
- package/dist/src/experimental/mutators.d.ts +4 -0
- package/dist/src/experimental/mutators.d.ts.map +1 -1
- package/dist/src/experimental/mutators.js +17 -0
- package/dist/src/experimental/mutators.js.map +1 -1
- package/dist/src/experimental/typekit/define-kit.js +3 -3
- package/dist/src/experimental/typekit/define-kit.js.map +1 -1
- package/dist/src/experimental/typekit/kits/model-property.d.ts +2 -2
- package/dist/src/experimental/typekit/kits/model-property.d.ts.map +1 -1
- package/dist/src/experimental/typekit/kits/model-property.js +4 -3
- package/dist/src/experimental/typekit/kits/model-property.js.map +1 -1
- package/dist/src/lib/decorators.d.ts +5 -28
- package/dist/src/lib/decorators.d.ts.map +1 -1
- package/dist/src/lib/decorators.js +6 -83
- package/dist/src/lib/decorators.js.map +1 -1
- package/dist/src/lib/key.d.ts +6 -0
- package/dist/src/lib/key.d.ts.map +1 -0
- package/dist/src/lib/key.js +7 -0
- package/dist/src/lib/key.js.map +1 -0
- package/dist/src/lib/tsp-index.d.ts.map +1 -1
- package/dist/src/lib/tsp-index.js +10 -4
- package/dist/src/lib/tsp-index.js.map +1 -1
- package/dist/src/lib/utils.d.ts +9 -1
- package/dist/src/lib/utils.d.ts.map +1 -1
- package/dist/src/lib/utils.js +14 -0
- package/dist/src/lib/utils.js.map +1 -1
- package/dist/src/lib/visibility.d.ts +33 -0
- package/dist/src/lib/visibility.d.ts.map +1 -0
- package/dist/src/lib/visibility.js +367 -0
- package/dist/src/lib/visibility.js.map +1 -0
- package/lib/std/decorators.tsp +1 -100
- package/lib/std/main.tsp +1 -0
- package/lib/std/visibility.tsp +400 -0
- package/package.json +1 -1
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
// TypeSpec Visibility System
|
|
4
|
+
// --------------------------
|
|
5
|
+
// This module defines the core visibility system of the TypeSpec language. The
|
|
6
|
+
// visibility system is used to decide when properties of a _conceptual resource_
|
|
7
|
+
// are present. The system is based on the concept of _visibility classes_,
|
|
8
|
+
// represented by TypeSpec enums. Each visibility class has a set of _visibility
|
|
9
|
+
// modifiers_ that can be applied to a model property, each modifier represented
|
|
10
|
+
// by a member of the visibility class enum.
|
|
11
|
+
//
|
|
12
|
+
// Each visibility class has a _default modifier set_ that is used when no
|
|
13
|
+
// modifiers are specified for a property, and each property has an _active
|
|
14
|
+
// modifier set_ that is used when analyzing the visibility of the property.
|
|
15
|
+
//
|
|
16
|
+
// Visibility can be _sealed_ for a program, property, or visibility class
|
|
17
|
+
// within a property. Once visibility is sealed, it cannot be unsealed, and any
|
|
18
|
+
// attempts to modify a sealed visibility will fail.
|
|
19
|
+
import { compilerAssert } from "../diagnostics.js";
|
|
20
|
+
import { reportDiagnostic } from "../messages.js";
|
|
21
|
+
import { getLifecycleVisibilityEnum, normalizeLegacyLifecycleVisibilityString, } from "./lifecycle.js";
|
|
22
|
+
import { useStateMap, useStateSet } from "../../lib/utils.js";
|
|
23
|
+
/**
|
|
24
|
+
* The global visibility store.
|
|
25
|
+
*
|
|
26
|
+
* This store is used to track the visibility modifiers
|
|
27
|
+
*/
|
|
28
|
+
const [getVisibilityStore, setVisibilityStore] = useStateMap("visibilityStore");
|
|
29
|
+
/**
|
|
30
|
+
* Returns the visibility modifiers for a given `property` within a `program`.
|
|
31
|
+
*/
|
|
32
|
+
function getOrInitializeVisibilityModifiers(program, property) {
|
|
33
|
+
let visibilityModifiers = getVisibilityStore(program, property);
|
|
34
|
+
if (!visibilityModifiers) {
|
|
35
|
+
visibilityModifiers = new Map();
|
|
36
|
+
setVisibilityStore(program, property, visibilityModifiers);
|
|
37
|
+
}
|
|
38
|
+
return visibilityModifiers;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns the active visibility modifier set for a given `property` and `visibilityClass`.
|
|
42
|
+
*
|
|
43
|
+
* If no visibility modifiers have been set for the given `property` and `visibilityClass`, the function will use the
|
|
44
|
+
* provided `defaultSet` to initialize the visibility modifiers.
|
|
45
|
+
*
|
|
46
|
+
* @param program - the program in which the property occurs
|
|
47
|
+
* @param property - the property to get visibility modifiers for
|
|
48
|
+
* @param visibilityClass - the visibility class to get visibility modifiers for
|
|
49
|
+
* @param defaultSet - the default set to use if no set has been initialized
|
|
50
|
+
* @returns the active visibility modifier set for the given property and visibility class
|
|
51
|
+
*/
|
|
52
|
+
function getOrInitializeActiveModifierSetForClass(program, property, visibilityClass, defaultSet) {
|
|
53
|
+
const visibilityModifiers = getOrInitializeVisibilityModifiers(program, property);
|
|
54
|
+
let visibilityModifierSet = visibilityModifiers.get(visibilityClass);
|
|
55
|
+
if (!visibilityModifierSet) {
|
|
56
|
+
visibilityModifierSet = defaultSet;
|
|
57
|
+
visibilityModifiers.set(visibilityClass, visibilityModifierSet);
|
|
58
|
+
}
|
|
59
|
+
return visibilityModifierSet;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* If a Program is in this set, visibility is sealed for all properties in that Program.
|
|
63
|
+
*/
|
|
64
|
+
const VISIBILITY_PROGRAM_SEALS = new WeakSet();
|
|
65
|
+
const [isVisibilitySealedForProperty, sealVisibilityForProperty] = useStateSet("propertyVisibilitySealed");
|
|
66
|
+
const [getSealedVisibilityClasses, setSealedVisibilityClasses] = useStateMap("sealedVisibilityClasses");
|
|
67
|
+
/**
|
|
68
|
+
* Seals visibility modifiers for a property in a given visibility class.
|
|
69
|
+
*
|
|
70
|
+
* @param program - the program in which the property occurs
|
|
71
|
+
* @param property - the property to seal visibility modifiers for
|
|
72
|
+
* @param visibilityClass - the visibility class to seal visibility modifiers for
|
|
73
|
+
*/
|
|
74
|
+
function sealVisibilityModifiersForClass(program, property, visibilityClass) {
|
|
75
|
+
let sealedClasses = getSealedVisibilityClasses(program, property);
|
|
76
|
+
if (!sealedClasses) {
|
|
77
|
+
sealedClasses = new Set();
|
|
78
|
+
setSealedVisibilityClasses(program, property, sealedClasses);
|
|
79
|
+
}
|
|
80
|
+
sealedClasses.add(visibilityClass);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Stores the default modifier set for a given visibility class.
|
|
84
|
+
*/
|
|
85
|
+
const [getDefaultModifiers, setDefaultModifiers] = useStateMap("defaultVisibilityModifiers");
|
|
86
|
+
/**
|
|
87
|
+
* Gets the default modifier set for a visibility class. If no default modifier set has been set, this function will
|
|
88
|
+
* initialize the default modifier set to ALL the visibility class's members.
|
|
89
|
+
*
|
|
90
|
+
* @param program - the program in which the visibility class occurs
|
|
91
|
+
* @param visibilityClass - the visibility class to get the default modifier set for
|
|
92
|
+
* @returns the default modifier set for the visibility class
|
|
93
|
+
*/
|
|
94
|
+
function getDefaultModifierSetForClass(program, visibilityClass) {
|
|
95
|
+
const cached = getDefaultModifiers(program, visibilityClass);
|
|
96
|
+
if (cached)
|
|
97
|
+
return cached;
|
|
98
|
+
const defaultModifierSet = new Set(visibilityClass.members.values());
|
|
99
|
+
setDefaultModifiers(program, visibilityClass, defaultModifierSet);
|
|
100
|
+
return defaultModifierSet;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Set the default visibility modifier set for a visibility class.
|
|
104
|
+
*
|
|
105
|
+
* This function may only be called ONCE per visibility class and must be called
|
|
106
|
+
* before the default modifier set is used by any operation.
|
|
107
|
+
*/
|
|
108
|
+
export function setDefaultModifierSetForVisibilityClass(program, visibilityClass, defaultSet) {
|
|
109
|
+
compilerAssert(!getDefaultModifiers(program, visibilityClass), "The default modifier set for a visibility class may only be set once.");
|
|
110
|
+
setDefaultModifiers(program, visibilityClass, defaultSet);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Convert a sequence of visibility modifiers into a map of visibility classes to their respective modifiers in the
|
|
114
|
+
* sequence.
|
|
115
|
+
*
|
|
116
|
+
* @param modifiers - the visibility modifiers to group
|
|
117
|
+
* @returns a map of visibility classes to their respective modifiers in the input list
|
|
118
|
+
*/
|
|
119
|
+
function groupModifiersByVisibilityClass(modifiers) {
|
|
120
|
+
const enumMap = new Map();
|
|
121
|
+
// Prepare new modifier sets for each visibility class
|
|
122
|
+
for (const modifier of modifiers) {
|
|
123
|
+
const visibilityClass = modifier.enum;
|
|
124
|
+
let modifierSet = enumMap.get(visibilityClass);
|
|
125
|
+
if (!modifierSet) {
|
|
126
|
+
modifierSet = new Set();
|
|
127
|
+
enumMap.set(visibilityClass, modifierSet);
|
|
128
|
+
}
|
|
129
|
+
modifierSet.add(modifier);
|
|
130
|
+
}
|
|
131
|
+
return enumMap;
|
|
132
|
+
}
|
|
133
|
+
// #region Legacy Visibility API
|
|
134
|
+
const [getLegacyVisibility, setLegacyVisibilityModifiers, getLegacyVisibilityStateMap] = useStateMap("legacyVisibility");
|
|
135
|
+
export { getLegacyVisibility };
|
|
136
|
+
/**
|
|
137
|
+
* Sets the legacy visibility modifiers for a property.
|
|
138
|
+
*
|
|
139
|
+
* This function will also set the visibility modifiers for the property in the Lifecycle visibility class for any
|
|
140
|
+
* strings in the visibility array that are recognized as lifecycle visibility strings.
|
|
141
|
+
*
|
|
142
|
+
* Calling this function twice on the same property will result in a failed compiler assertion.
|
|
143
|
+
*
|
|
144
|
+
* @param program - the program in which the property occurs
|
|
145
|
+
* @param property - the property to set visibility modifiers for
|
|
146
|
+
* @param visibilities - the legacy visibility strings to set
|
|
147
|
+
*/
|
|
148
|
+
export function setLegacyVisibility(context, property, visibilities) {
|
|
149
|
+
const { program } = context;
|
|
150
|
+
setLegacyVisibilityModifiers(program, property, visibilities);
|
|
151
|
+
const lifecycleClass = getLifecycleVisibilityEnum(program);
|
|
152
|
+
clearVisibilityModifiersForClass(program, property, lifecycleClass, context);
|
|
153
|
+
const isEmpty = visibilities.length === 0 || (visibilities.length === 1 && visibilities[0] === "none");
|
|
154
|
+
if (!isEmpty) {
|
|
155
|
+
const lifecycleVisibilities = visibilities
|
|
156
|
+
.map((v) => normalizeLegacyLifecycleVisibilityString(program, v))
|
|
157
|
+
.filter((v) => !!v);
|
|
158
|
+
addVisibilityModifiers(program, property, lifecycleVisibilities);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Removes legacy visibility modifiers from a property.
|
|
163
|
+
*
|
|
164
|
+
* @param program - the program in which the property occurs
|
|
165
|
+
* @param property - the property to remove visibility modifiers from
|
|
166
|
+
*/
|
|
167
|
+
export function clearLegacyVisibility(program, property) {
|
|
168
|
+
getLegacyVisibilityStateMap(program).delete(property);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Returns the legacy visibility modifiers for a property.
|
|
172
|
+
*
|
|
173
|
+
* For a property using the enum-driven visibility system, the active Lifecycle visibility modifiers will be converted
|
|
174
|
+
* to strings for backwards compatibility as follows:
|
|
175
|
+
*
|
|
176
|
+
* - If Lifecycle visibility is not explicitly set, and no legacy visibility is set, this function will return `undefined`.
|
|
177
|
+
* - If the property has no active Lifecycle visibility modifiers, this function will return `["none"]`.
|
|
178
|
+
* - Otherwise, this function will return an array of lowercase strings representing the active Lifecycle visibility
|
|
179
|
+
* modifiers ("create", "read", "update").
|
|
180
|
+
*
|
|
181
|
+
* @deprecated Use `getVisibilityForClass` instead.
|
|
182
|
+
*
|
|
183
|
+
* @param program - the program in which the property occurs
|
|
184
|
+
* @param property - the property to get legacy visibility modifiers for
|
|
185
|
+
*/
|
|
186
|
+
export function getVisibility(program, property) {
|
|
187
|
+
const legacyModifiers = getLegacyVisibility(program, property);
|
|
188
|
+
if (legacyModifiers)
|
|
189
|
+
return legacyModifiers;
|
|
190
|
+
// Now check for applied lifecycle visibility modifiers and coerce them if necessary.
|
|
191
|
+
const lifecycleModifiers = getVisibilityStore(program, property)?.get(getLifecycleVisibilityEnum(program));
|
|
192
|
+
// Visibility is completely uninitialized, so return undefined to mimic legacy behavior.
|
|
193
|
+
if (!lifecycleModifiers)
|
|
194
|
+
return undefined;
|
|
195
|
+
// Visibility has been cleared explicitly, so return [] to mimic legacy behavior.
|
|
196
|
+
if (lifecycleModifiers.size === 0)
|
|
197
|
+
return [];
|
|
198
|
+
// Otherwise we just convert the modifiers to strings.
|
|
199
|
+
return Array.from(lifecycleModifiers).map((v) => v.name.toLowerCase());
|
|
200
|
+
}
|
|
201
|
+
// #endregion
|
|
202
|
+
// #region Visibility Management API
|
|
203
|
+
/**
|
|
204
|
+
* Check if a property has had its visibility modifiers sealed.
|
|
205
|
+
*
|
|
206
|
+
* If the property has been sealed globally, this function will return true. If the property has been sealed for the
|
|
207
|
+
* given visibility class, this function will return true.
|
|
208
|
+
*
|
|
209
|
+
* Otherwise, this function returns false.
|
|
210
|
+
*
|
|
211
|
+
* @param property - the property to check
|
|
212
|
+
* @param visibilityClass - the optional visibility class to check
|
|
213
|
+
* @returns true if the property is sealed for the given visibility class, false otherwise
|
|
214
|
+
*/
|
|
215
|
+
export function isSealed(program, property, visibilityClass) {
|
|
216
|
+
if (VISIBILITY_PROGRAM_SEALS.has(program))
|
|
217
|
+
return true;
|
|
218
|
+
const classSealed = visibilityClass
|
|
219
|
+
? getSealedVisibilityClasses(program, property)?.has(visibilityClass)
|
|
220
|
+
: false;
|
|
221
|
+
return classSealed || isVisibilitySealedForProperty(program, property);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Seals a property's visibility modifiers.
|
|
225
|
+
*
|
|
226
|
+
* If the `visibilityClass` is provided, the property's visibility modifiers will be sealed for that visibility class
|
|
227
|
+
* only. Otherwise, the property's visibility modifiers will be sealed for all visibility classes (globally).
|
|
228
|
+
*
|
|
229
|
+
* @param property - the property to seal
|
|
230
|
+
* @param visibilityClass - the optional visibility class to seal the property for
|
|
231
|
+
*/
|
|
232
|
+
export function sealVisibilityModifiers(program, property, visibilityClass) {
|
|
233
|
+
if (visibilityClass) {
|
|
234
|
+
sealVisibilityModifiersForClass(program, property, visibilityClass);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
sealVisibilityForProperty(program, property);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Seals a program's visibility modifiers.
|
|
242
|
+
*
|
|
243
|
+
* This affects all properties in the program and prevents any further modifications to visibility modifiers within the
|
|
244
|
+
* program.
|
|
245
|
+
*
|
|
246
|
+
* Once the modifiers for a program are sealed, they cannot be unsealed.
|
|
247
|
+
*
|
|
248
|
+
* @param program - the program to seal
|
|
249
|
+
*/
|
|
250
|
+
export function sealVisibilityModifiersForProgram(program) {
|
|
251
|
+
VISIBILITY_PROGRAM_SEALS.add(program);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Add visibility modifiers to a property.
|
|
255
|
+
*
|
|
256
|
+
* This function will add all the `modifiers` to the active set of visibility modifiers for the given `property`.
|
|
257
|
+
*
|
|
258
|
+
* If no set of active modifiers exists for the given `property`, an empty set will be created for the property.
|
|
259
|
+
*
|
|
260
|
+
* If the visibility modifiers for `property` in the given modifier's visibility class have been sealed, this function
|
|
261
|
+
* will issue a diagnostic and ignore that modifier, but it will still add the rest of the modifiers whose classes have
|
|
262
|
+
* not been sealed.
|
|
263
|
+
*
|
|
264
|
+
* @param program - the program in which the ModelProperty occurs
|
|
265
|
+
* @param property - the property to add visibility modifiers to
|
|
266
|
+
* @param modifiers - the visibility modifiers to add
|
|
267
|
+
* @param context - the optional decorator context to use for displaying diagnostics
|
|
268
|
+
*/
|
|
269
|
+
export function addVisibilityModifiers(program, property, modifiers, context) {
|
|
270
|
+
const modifiersByClass = groupModifiersByVisibilityClass(modifiers);
|
|
271
|
+
for (const [visibilityClass, newModifiers] of modifiersByClass.entries()) {
|
|
272
|
+
const target = context?.decoratorTarget ?? property;
|
|
273
|
+
if (isSealed(program, property, visibilityClass)) {
|
|
274
|
+
reportDiagnostic(program, {
|
|
275
|
+
code: "visibility-sealed",
|
|
276
|
+
format: {
|
|
277
|
+
propName: property.name,
|
|
278
|
+
},
|
|
279
|
+
target,
|
|
280
|
+
});
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
const modifierSet = getOrInitializeActiveModifierSetForClass(program, property, visibilityClass,
|
|
284
|
+
/* defaultSet: */ new Set());
|
|
285
|
+
for (const modifier of newModifiers) {
|
|
286
|
+
modifierSet.add(modifier);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Remove visibility modifiers from a property.
|
|
292
|
+
*
|
|
293
|
+
* This function will remove all the `modifiers` from the active set of visibility modifiers for the given `property`.
|
|
294
|
+
*
|
|
295
|
+
* If no set of active modifiers exists for the given `property`, the default set for the modifier's visibility class
|
|
296
|
+
* will be used.
|
|
297
|
+
*
|
|
298
|
+
* If the visibility modifiers for `property` in the given modifier's visibility class have been sealed, this function
|
|
299
|
+
* will issue a diagnostic and ignore that modifier, but it will still remove the rest of the modifiers whose classes
|
|
300
|
+
* have not been sealed.
|
|
301
|
+
*
|
|
302
|
+
* @param program - the program in which the ModelProperty occurs
|
|
303
|
+
* @param property - the property to remove visibility modifiers from
|
|
304
|
+
* @param modifiers - the visibility modifiers to remove
|
|
305
|
+
* @param context - the optional decorator context to use for displaying diagnostics
|
|
306
|
+
*/
|
|
307
|
+
export function removeVisibilityModifiers(program, property, modifiers, context) {
|
|
308
|
+
const modifiersByClass = groupModifiersByVisibilityClass(modifiers);
|
|
309
|
+
for (const [visibilityClass, newModifiers] of modifiersByClass.entries()) {
|
|
310
|
+
const target = context?.decoratorTarget ?? property;
|
|
311
|
+
if (isSealed(program, property, visibilityClass)) {
|
|
312
|
+
reportDiagnostic(program, {
|
|
313
|
+
code: "visibility-sealed",
|
|
314
|
+
format: {
|
|
315
|
+
propName: property.name,
|
|
316
|
+
},
|
|
317
|
+
target,
|
|
318
|
+
});
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
const modifierSet = getOrInitializeActiveModifierSetForClass(program, property, visibilityClass,
|
|
322
|
+
/* defaultSet: */ getDefaultModifierSetForClass(program, visibilityClass));
|
|
323
|
+
for (const modifier of newModifiers) {
|
|
324
|
+
modifierSet.delete(modifier);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Clears the visibility modifiers for a property in a given visibility class.
|
|
330
|
+
*
|
|
331
|
+
* If the visibility modifiers for the given class are sealed, this function will issue a diagnostic and leave the
|
|
332
|
+
* visibility modifiers unchanged.
|
|
333
|
+
*
|
|
334
|
+
* @param program - the program in which the ModelProperty occurs
|
|
335
|
+
* @param property - the property to clear visibility modifiers for
|
|
336
|
+
* @param visibilityClass - the visibility class to clear visibility modifiers for
|
|
337
|
+
* @param context - the optional decorator context to use for displaying diagnostics
|
|
338
|
+
*/
|
|
339
|
+
export function clearVisibilityModifiersForClass(program, property, visibilityClass, context) {
|
|
340
|
+
const target = context?.decoratorTarget ?? property;
|
|
341
|
+
if (isSealed(program, property, visibilityClass)) {
|
|
342
|
+
reportDiagnostic(program, {
|
|
343
|
+
code: "visibility-sealed",
|
|
344
|
+
format: {
|
|
345
|
+
propName: property.name,
|
|
346
|
+
},
|
|
347
|
+
target,
|
|
348
|
+
});
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
const modifierSet = getOrInitializeActiveModifierSetForClass(program, property, visibilityClass,
|
|
352
|
+
/* defaultSet: */ new Set());
|
|
353
|
+
modifierSet.clear();
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Resets the visibility modifiers for a property in a given visibility class.
|
|
357
|
+
*
|
|
358
|
+
* This does not clear the modifiers. It resets them to the _uninitialized_ state.
|
|
359
|
+
*
|
|
360
|
+
* This is useful when cloning properties and you want to reset the visibility modifiers on the clone.
|
|
361
|
+
*
|
|
362
|
+
* If the visibility modifiers for this property and given visibility class are sealed, this function will issue a
|
|
363
|
+
* diagnostic and leave the visibility modifiers unchanged.
|
|
364
|
+
*
|
|
365
|
+
* @param program - the program in which the property occurs
|
|
366
|
+
* @param property - the property to reset visibility modifiers for
|
|
367
|
+
* @param visibilityClass - the visibility class to reset visibility modifiers for
|
|
368
|
+
* @param context - the optional decorator context to use for displaying diagnostics
|
|
369
|
+
*/
|
|
370
|
+
export function resetVisibilityModifiersForClass(program, property, visibilityClass, context) {
|
|
371
|
+
const target = context?.decoratorTarget ?? property;
|
|
372
|
+
if (isSealed(program, property, visibilityClass)) {
|
|
373
|
+
reportDiagnostic(program, {
|
|
374
|
+
code: "visibility-sealed",
|
|
375
|
+
format: {
|
|
376
|
+
propName: property.name,
|
|
377
|
+
},
|
|
378
|
+
target,
|
|
379
|
+
});
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
getOrInitializeVisibilityModifiers(program, property).delete(visibilityClass);
|
|
383
|
+
}
|
|
384
|
+
// #endregion
|
|
385
|
+
// #region Visibility Analysis API
|
|
386
|
+
/**
|
|
387
|
+
* Returns the active visibility modifiers for a property in a given visibility class.
|
|
388
|
+
*
|
|
389
|
+
* This function is infallible. If the visibility modifiers for the given class have not been set explicitly, it will
|
|
390
|
+
* return the default visibility modifiers for the class.
|
|
391
|
+
*
|
|
392
|
+
* @param program - the program in which the property occurs
|
|
393
|
+
* @param property - the property to get visibility modifiers for
|
|
394
|
+
* @param visibilityClass - the visibility class to get visibility modifiers for
|
|
395
|
+
* @returns the set of active modifiers (enum members) for the property and visibility class
|
|
396
|
+
*/
|
|
397
|
+
export function getVisibilityForClass(program, property, visibilityClass) {
|
|
398
|
+
return getOrInitializeActiveModifierSetForClass(program, property, visibilityClass,
|
|
399
|
+
/* defaultSet: */ getDefaultModifierSetForClass(program, visibilityClass));
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Determines if a property has a specified visibility modifier.
|
|
403
|
+
*
|
|
404
|
+
* If no visibility modifiers have been set for the visibility class of the modifier, the visibility class's default
|
|
405
|
+
* modifier set is used.
|
|
406
|
+
*
|
|
407
|
+
* @param program - the program in which the property occurs
|
|
408
|
+
* @param property - the property to check
|
|
409
|
+
* @param modifier - the visibility modifier to check for
|
|
410
|
+
* @returns true if the property has the visibility modifier, false otherwise
|
|
411
|
+
*/
|
|
412
|
+
export function hasVisibility(program, property, modifier) {
|
|
413
|
+
const activeSet = getOrInitializeActiveModifierSetForClass(program, property, modifier.enum,
|
|
414
|
+
/* defaultSet: */ getDefaultModifierSetForClass(program, modifier.enum));
|
|
415
|
+
return activeSet?.has(modifier) ?? false;
|
|
416
|
+
}
|
|
417
|
+
export const VisibilityFilter = {
|
|
418
|
+
/**
|
|
419
|
+
* Convert a TypeSpec `GeneratedVisibilityFilter` value to a `VisibilityFilter`.
|
|
420
|
+
*
|
|
421
|
+
* @param filter - the decorator argument filter to convert
|
|
422
|
+
* @returns a `VisibilityFilter` object that can be consumed by the visibility APIs
|
|
423
|
+
*/
|
|
424
|
+
fromDecoratorArgument(filter) {
|
|
425
|
+
return {
|
|
426
|
+
all: filter.all && new Set(filter.all.map((v) => v.value)),
|
|
427
|
+
any: filter.any && new Set(filter.any.map((v) => v.value)),
|
|
428
|
+
none: filter.none && new Set(filter.none.map((v) => v.value)),
|
|
429
|
+
};
|
|
430
|
+
},
|
|
431
|
+
/**
|
|
432
|
+
* Extracts the unique visibility classes referred to by the modifiers in a
|
|
433
|
+
* visibility filter.
|
|
434
|
+
*
|
|
435
|
+
* @param filter - the visibility filter to extract visibility classes from
|
|
436
|
+
* @returns a set of visibility classes referred to by the filter
|
|
437
|
+
*/
|
|
438
|
+
getVisibilityClasses(filter) {
|
|
439
|
+
const classes = new Set();
|
|
440
|
+
if (filter.all)
|
|
441
|
+
filter.all.forEach((v) => classes.add(v.enum));
|
|
442
|
+
if (filter.any)
|
|
443
|
+
filter.any.forEach((v) => classes.add(v.enum));
|
|
444
|
+
if (filter.none)
|
|
445
|
+
filter.none.forEach((v) => classes.add(v.enum));
|
|
446
|
+
return classes;
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
export function isVisible(program, property, _filterOrLegacyVisibilities) {
|
|
450
|
+
if (Array.isArray(_filterOrLegacyVisibilities)) {
|
|
451
|
+
return isVisibleLegacy(_filterOrLegacyVisibilities);
|
|
452
|
+
}
|
|
453
|
+
const filter = { ..._filterOrLegacyVisibilities };
|
|
454
|
+
filter.all ??= new Set();
|
|
455
|
+
filter.any ??= new Set();
|
|
456
|
+
filter.none ??= new Set();
|
|
457
|
+
// Validate that property has ALL of the required visibilities of filter.all
|
|
458
|
+
for (const modifier of filter.all) {
|
|
459
|
+
if (!hasVisibility(program, property, modifier))
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
// Validate that property has ANY of the required visibilities of filter.any
|
|
463
|
+
outer: while (filter.any.size > 0) {
|
|
464
|
+
for (const modifier of filter.any) {
|
|
465
|
+
if (hasVisibility(program, property, modifier))
|
|
466
|
+
break outer;
|
|
467
|
+
}
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
// Validate that property has NONE of the excluded visibilities of filter.none
|
|
471
|
+
for (const modifier of filter.none) {
|
|
472
|
+
if (hasVisibility(program, property, modifier))
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
return true;
|
|
476
|
+
function isVisibleLegacy(visibilities) {
|
|
477
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
478
|
+
const propertyVisibilities = getVisibility(program, property);
|
|
479
|
+
return !propertyVisibilities || propertyVisibilities.some((v) => visibilities.includes(v));
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// #endregion
|
|
483
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../src/core/visibility/core.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,kCAAkC;AAElC,6BAA6B;AAC7B,6BAA6B;AAE7B,+EAA+E;AAC/E,iFAAiF;AACjF,2EAA2E;AAC3E,gFAAgF;AAChF,gFAAgF;AAChF,4CAA4C;AAC5C,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,EAAE;AACF,0EAA0E;AAC1E,+EAA+E;AAC/E,oDAAoD;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EACL,0BAA0B,EAC1B,wCAAwC,GACzC,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAS9D;;;;GAIG;AACH,MAAM,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,GAAG,WAAW,CAC1D,iBAA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,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC;AAED,aAAa"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { getLifecycleVisibilityEnum } from "./lifecycle.js";
|
|
2
|
+
export { addVisibilityModifiers, clearVisibilityModifiersForClass, getVisibility, getVisibilityForClass, hasVisibility, isSealed, isVisible, removeVisibilityModifiers, resetVisibilityModifiersForClass, sealVisibilityModifiers, sealVisibilityModifiersForProgram, } from "./core.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/visibility/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EAChC,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,yBAAyB,EACzB,gCAAgC,EAChC,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
export { getLifecycleVisibilityEnum } from "./lifecycle.js";
|
|
4
|
+
export { addVisibilityModifiers, clearVisibilityModifiersForClass, getVisibility, getVisibilityForClass, hasVisibility, isSealed, isVisible, removeVisibilityModifiers, resetVisibilityModifiersForClass, sealVisibilityModifiers, sealVisibilityModifiersForProgram, } from "./core.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/visibility/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,kCAAkC;AAElC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EAChC,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,yBAAyB,EACzB,gCAAgC,EAChC,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Program } from "../program.js";
|
|
2
|
+
import type { Enum, EnumMember } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the instance of `TypeSpec.Visibility.Lifecycle` for the given `program`.
|
|
5
|
+
*
|
|
6
|
+
* @param program - the program to get the lifecycle visibility enum for
|
|
7
|
+
* @returns a reference to the lifecycle visibility enum
|
|
8
|
+
*/
|
|
9
|
+
export declare function getLifecycleVisibilityEnum(program: Program): Enum;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the member of `Lifecycle` that corresponds to the given legacy `visibility` string.
|
|
12
|
+
*
|
|
13
|
+
* @param program - the program to get the lifecycle visibility enum for
|
|
14
|
+
* @param visibility - the visibility string to normalize
|
|
15
|
+
* @returns the corresponding member of `Lifecycle` or `undefined` if the visibility string is not recognized
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeLegacyLifecycleVisibilityString(program: Program, visibility: string): EnumMember | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the legacy visibility string that corresponds to the given `visibility` member of `Lifecycle`.
|
|
20
|
+
*
|
|
21
|
+
* If the given `visibility` member is not a member of `Lifecycle`, the function will return `undefined`.
|
|
22
|
+
*
|
|
23
|
+
* @param program - the program to get the lifecycle visibility enum for
|
|
24
|
+
* @param visibility - the visibility modifier to normalize
|
|
25
|
+
* @returns the corresponding legacy visibility string or `undefined` if the visibility member is not recognized
|
|
26
|
+
*/
|
|
27
|
+
export declare function normalizeVisibilityToLegacyLifecycleString(program: Program, visibility: EnumMember): string | undefined;
|
|
28
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/core/visibility/lifecycle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOpD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiBjE;AAED;;;;;;GAMG;AACH,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,UAAU,GAAG,SAAS,CAYxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,0CAA0C,CACxD,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,GACrB,MAAM,GAAG,SAAS,CAepB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { compilerAssert } from "../diagnostics.js";
|
|
4
|
+
/**
|
|
5
|
+
* A cache for the `TypeSpec.Visibility.Lifecycle` enum per Program instance.
|
|
6
|
+
*/
|
|
7
|
+
const LIFECYCLE_ENUM_CACHE = new WeakMap();
|
|
8
|
+
/**
|
|
9
|
+
* Returns the instance of `TypeSpec.Visibility.Lifecycle` for the given `program`.
|
|
10
|
+
*
|
|
11
|
+
* @param program - the program to get the lifecycle visibility enum for
|
|
12
|
+
* @returns a reference to the lifecycle visibility enum
|
|
13
|
+
*/
|
|
14
|
+
export function getLifecycleVisibilityEnum(program) {
|
|
15
|
+
const cached = LIFECYCLE_ENUM_CACHE.get(program);
|
|
16
|
+
if (cached)
|
|
17
|
+
return cached;
|
|
18
|
+
const [type, diagnostics] = program.resolveTypeReference("TypeSpec.Lifecycle");
|
|
19
|
+
compilerAssert(diagnostics.length === 0, "Encountered diagnostics when resolving the `TypeSpec.Lifecycle` visibility class enum");
|
|
20
|
+
compilerAssert(type.kind === "Enum", "Expected `TypeSpec.Visibility.Lifecycle` to be an enum");
|
|
21
|
+
LIFECYCLE_ENUM_CACHE.set(program, type);
|
|
22
|
+
return type;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the member of `Lifecycle` that corresponds to the given legacy `visibility` string.
|
|
26
|
+
*
|
|
27
|
+
* @param program - the program to get the lifecycle visibility enum for
|
|
28
|
+
* @param visibility - the visibility string to normalize
|
|
29
|
+
* @returns the corresponding member of `Lifecycle` or `undefined` if the visibility string is not recognized
|
|
30
|
+
*/
|
|
31
|
+
export function normalizeLegacyLifecycleVisibilityString(program, visibility) {
|
|
32
|
+
const lifecycle = getLifecycleVisibilityEnum(program);
|
|
33
|
+
switch (visibility) {
|
|
34
|
+
case "create":
|
|
35
|
+
return lifecycle.members.get("Create");
|
|
36
|
+
case "read":
|
|
37
|
+
return lifecycle.members.get("Read");
|
|
38
|
+
case "update":
|
|
39
|
+
return lifecycle.members.get("Update");
|
|
40
|
+
default:
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns the legacy visibility string that corresponds to the given `visibility` member of `Lifecycle`.
|
|
46
|
+
*
|
|
47
|
+
* If the given `visibility` member is not a member of `Lifecycle`, the function will return `undefined`.
|
|
48
|
+
*
|
|
49
|
+
* @param program - the program to get the lifecycle visibility enum for
|
|
50
|
+
* @param visibility - the visibility modifier to normalize
|
|
51
|
+
* @returns the corresponding legacy visibility string or `undefined` if the visibility member is not recognized
|
|
52
|
+
*/
|
|
53
|
+
export function normalizeVisibilityToLegacyLifecycleString(program, visibility) {
|
|
54
|
+
const lifecycle = getLifecycleVisibilityEnum(program);
|
|
55
|
+
if (visibility.enum !== lifecycle)
|
|
56
|
+
return undefined;
|
|
57
|
+
switch (visibility.name) {
|
|
58
|
+
case "Create":
|
|
59
|
+
return "create";
|
|
60
|
+
case "Read":
|
|
61
|
+
return "read";
|
|
62
|
+
case "Update":
|
|
63
|
+
return "update";
|
|
64
|
+
default:
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../../src/core/visibility/lifecycle.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,kCAAkC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD;;GAEG;AACH,MAAM,oBAAoB,GAAG,IAAI,OAAO,EAAiB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACzD,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEjD,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;IAE/E,cAAc,CACZ,WAAW,CAAC,MAAM,KAAK,CAAC,EACxB,uFAAuF,CACxF,CAAC;IAEF,cAAc,CAAC,IAAK,CAAC,IAAI,KAAK,MAAM,EAAE,wDAAwD,CAAC,CAAC;IAEhG,oBAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAExC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wCAAwC,CACtD,OAAgB,EAChB,UAAkB;IAElB,MAAM,SAAS,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;IACtD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;QAC1C,KAAK,MAAM;YACT,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;QACxC,KAAK,QAAQ;YACX,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;QAC1C;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,0CAA0C,CACxD,OAAgB,EAChB,UAAsB;IAEtB,MAAM,SAAS,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAEtD,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAEpD,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;QACxB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -55,6 +55,10 @@ export declare enum MutatorFlow {
|
|
|
55
55
|
}
|
|
56
56
|
/** @experimental */
|
|
57
57
|
export type MutableType = Exclude<Type, TemplateParameter | IntrinsicType | FunctionType | Decorator | FunctionParameter | ObjectType | Projection | Namespace>;
|
|
58
|
+
/**
|
|
59
|
+
* Determines if a type is mutable.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isMutableType(type: Type): type is MutableType;
|
|
58
62
|
/** @experimental */
|
|
59
63
|
export type MutableTypeWithNamespace = MutableType | Namespace;
|
|
60
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutators.d.ts","sourceRoot":"","sources":["../../../src/experimental/mutators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,aAAa,EACb,KAAK,EACL,aAAa,EACb,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB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