@living-architecture/riviere-extract-conventions 0.4.3 → 0.4.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/dist/{interfaces.d.ts → component-contracts.d.ts} +10 -1
- package/dist/component-contracts.d.ts.map +1 -0
- package/dist/decorators.d.ts +4 -0
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +6 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/default-extraction.config.json +14 -0
- package/src/eslint/event-publisher-method-signature.cjs +179 -0
- package/src/eslint/event-publisher-method-signature.d.cts +6 -0
- package/src/eslint/index.cjs +2 -0
- package/src/eslint/require-component-decorator.cjs +2 -1
- package/dist/interfaces.d.ts.map +0 -1
- /package/dist/{interfaces.js → component-contracts.js} +0 -0
|
@@ -64,4 +64,13 @@ export interface UIPageDef {
|
|
|
64
64
|
export interface DomainOpContainerDef {
|
|
65
65
|
readonly __brand?: 'DomainOpContainerDef';
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Marker interface for event publisher classes.
|
|
69
|
+
* Classes implementing this interface publish domain events via typed methods.
|
|
70
|
+
* Each public method should have exactly one parameter whose type implements EventDef.
|
|
71
|
+
* The parameter type name is matched against Event component metadata.eventName.
|
|
72
|
+
*/
|
|
73
|
+
export interface EventPublisherDef {
|
|
74
|
+
readonly __brand?: 'EventPublisherDef';
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=component-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-contracts.d.ts","sourceRoot":"","sources":["../src/component-contracts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEpE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAAE,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;CAAC;AAE/E;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,GAAG,OAAO;IAC7C,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAA;CAAC;AAEjF;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAAC"}
|
package/dist/decorators.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export declare function APIContainer<T>(target: T, _: ClassDecoratorContext): T;
|
|
|
17
17
|
* Marks a class as a container where all public methods are event handlers.
|
|
18
18
|
*/
|
|
19
19
|
export declare function EventHandlerContainer<T>(target: T, _: ClassDecoratorContext): T;
|
|
20
|
+
/**
|
|
21
|
+
* Marks a class as a container where all public methods are event publishers.
|
|
22
|
+
*/
|
|
23
|
+
export declare function EventPublisherContainer<T>(target: T, _: ClassDecoratorContext): T;
|
|
20
24
|
/**
|
|
21
25
|
* Marks a class as a use case component.
|
|
22
26
|
*/
|
package/dist/decorators.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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EG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,qBAAqB,GAAG,CAAC,CAE5D;AAMD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,2BAA2B,GAAG,CAAC,CAEvF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,2BAA2B,GAAG,CAAC,CAE1F;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,2BAA2B,GAAG,CAAC,CAE3F;AASD;;;;;GAKG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,GACX,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAqB,GAAG,2BAA2B,KAAK,CAAC,CAgBnF;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,qBAAqB,GAAG,2BAA2B,GAAG,CAAC,CAE9F;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQjE"}
|
package/dist/decorators.js
CHANGED
|
@@ -25,6 +25,12 @@ export function APIContainer(target, _) {
|
|
|
25
25
|
export function EventHandlerContainer(target, _) {
|
|
26
26
|
return target;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Marks a class as a container where all public methods are event publishers.
|
|
30
|
+
*/
|
|
31
|
+
export function EventPublisherContainer(target, _) {
|
|
32
|
+
return target;
|
|
33
|
+
}
|
|
28
34
|
// ============================================================================
|
|
29
35
|
// Class-as-Component Decorators
|
|
30
36
|
// ============================================================================
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { DomainOpContainer, APIContainer, EventHandlerContainer, UseCase, Event, UI, DomainOp, APIEndpoint, EventHandler, Custom, Ignore, getCustomType, } from './decorators';
|
|
2
|
-
export type { HttpMethod, APIControllerDef, EventDef, EventHandlerDef, IEventHandler, UIPageDef, DomainOpContainerDef, } from './
|
|
1
|
+
export { DomainOpContainer, APIContainer, EventHandlerContainer, EventPublisherContainer, UseCase, Event, UI, DomainOp, APIEndpoint, EventHandler, Custom, Ignore, getCustomType, } from './decorators';
|
|
2
|
+
export type { HttpMethod, APIControllerDef, EventDef, EventHandlerDef, IEventHandler, UIPageDef, DomainOpContainerDef, EventPublisherDef, } from './component-contracts';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EAEvB,OAAO,EACP,KAAK,EACL,EAAE,EAEF,QAAQ,EACR,WAAW,EACX,YAAY,EAEZ,MAAM,EACN,MAAM,EAEN,aAAa,GACd,MAAM,cAAc,CAAA;AAGrB,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,eAAe,EACf,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,uBAAuB,CAAA"}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@living-architecture/riviere-extract-conventions",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"!**/*.tsbuildinfo"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@living-architecture/riviere-extract-config": "0.4.
|
|
35
|
+
"@living-architecture/riviere-extract-config": "0.4.3"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -67,6 +67,20 @@
|
|
|
67
67
|
"subscribedEvents": { "fromGenericArg": { "interface": "IEventHandler", "position": 0 } }
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
+
"eventPublisher": {
|
|
71
|
+
"find": "methods",
|
|
72
|
+
"where": {
|
|
73
|
+
"inClassWith": {
|
|
74
|
+
"hasDecorator": {
|
|
75
|
+
"name": "EventPublisherContainer",
|
|
76
|
+
"from": "@living-architecture/riviere-extract-conventions"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"extract": {
|
|
81
|
+
"publishedEventType": { "fromParameterType": { "position": 0 } }
|
|
82
|
+
}
|
|
83
|
+
},
|
|
70
84
|
"ui": {
|
|
71
85
|
"find": "classes",
|
|
72
86
|
"where": {
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
const { implementsInterface } = require('./interface-ast-predicates.cjs')
|
|
2
|
+
|
|
3
|
+
let getParserServices = null
|
|
4
|
+
try {
|
|
5
|
+
getParserServices = require('@typescript-eslint/utils').ESLintUtils.getParserServices
|
|
6
|
+
/* v8 ignore next -- soft-require: package always present in this repo */
|
|
7
|
+
} catch { /* type checking unavailable */ }
|
|
8
|
+
|
|
9
|
+
function getTypeReferenceName(typeAnnotation) {
|
|
10
|
+
const typeName = typeAnnotation.typeName
|
|
11
|
+
if (typeName.type === 'TSQualifiedName') {
|
|
12
|
+
return typeName.right.name
|
|
13
|
+
}
|
|
14
|
+
return typeName.name
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function checkEventDefShape(checker, services, param, typeAnnotation) {
|
|
18
|
+
if (!checker || !services) return null
|
|
19
|
+
|
|
20
|
+
const tsParam = services.esTreeNodeToTSNodeMap.get(param)
|
|
21
|
+
const paramType = checker.getTypeAtLocation(tsParam)
|
|
22
|
+
const typeProperty = paramType.getProperty('type')
|
|
23
|
+
const referenceName = getTypeReferenceName(typeAnnotation)
|
|
24
|
+
|
|
25
|
+
if (!typeProperty) {
|
|
26
|
+
return referenceName
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const typePropertyType = checker.getTypeOfSymbol(typeProperty)
|
|
30
|
+
const stringType = checker.getStringType()
|
|
31
|
+
if (!checker.isTypeAssignableTo(typePropertyType, stringType)) {
|
|
32
|
+
return referenceName
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function checkMethod(context, member, className, checker, services) {
|
|
39
|
+
const methodName = member.key.name
|
|
40
|
+
|
|
41
|
+
if (member.accessibility === 'private' || member.accessibility === 'protected') {
|
|
42
|
+
context.report({
|
|
43
|
+
node: member.key,
|
|
44
|
+
messageId: 'nonPublicMethod',
|
|
45
|
+
data: {
|
|
46
|
+
methodName,
|
|
47
|
+
className,
|
|
48
|
+
accessibility: member.accessibility,
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const params = member.value.params
|
|
55
|
+
|
|
56
|
+
if (params.length === 0) {
|
|
57
|
+
context.report({
|
|
58
|
+
node: member.key,
|
|
59
|
+
messageId: 'missingParameter',
|
|
60
|
+
data: {
|
|
61
|
+
methodName,
|
|
62
|
+
className,
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (params.length > 1) {
|
|
69
|
+
context.report({
|
|
70
|
+
node: member.key,
|
|
71
|
+
messageId: 'tooManyParameters',
|
|
72
|
+
data: {
|
|
73
|
+
methodName,
|
|
74
|
+
className,
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const param = params[0]
|
|
81
|
+
const typeAnnotation = param.typeAnnotation && param.typeAnnotation.typeAnnotation
|
|
82
|
+
|
|
83
|
+
if (!typeAnnotation) {
|
|
84
|
+
context.report({
|
|
85
|
+
node: member.key,
|
|
86
|
+
messageId: 'missingTypeAnnotation',
|
|
87
|
+
data: {
|
|
88
|
+
methodName,
|
|
89
|
+
className,
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (typeAnnotation.type !== 'TSTypeReference') {
|
|
96
|
+
context.report({
|
|
97
|
+
node: member.key,
|
|
98
|
+
messageId: 'notTypeReference',
|
|
99
|
+
data: {
|
|
100
|
+
methodName,
|
|
101
|
+
className,
|
|
102
|
+
},
|
|
103
|
+
})
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const failedTypeName = checkEventDefShape(checker, services, param, typeAnnotation)
|
|
108
|
+
if (failedTypeName) {
|
|
109
|
+
context.report({
|
|
110
|
+
node: member.key,
|
|
111
|
+
messageId: 'notEventDef',
|
|
112
|
+
data: {
|
|
113
|
+
typeName: failedTypeName,
|
|
114
|
+
methodName,
|
|
115
|
+
className,
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function isMethodToCheck(member) {
|
|
122
|
+
return (
|
|
123
|
+
member.type === 'MethodDefinition' &&
|
|
124
|
+
member.kind !== 'constructor' &&
|
|
125
|
+
member.kind !== 'get' &&
|
|
126
|
+
member.kind !== 'set'
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module.exports = {
|
|
131
|
+
meta: {
|
|
132
|
+
type: 'problem',
|
|
133
|
+
docs: {
|
|
134
|
+
description: 'Require EventPublisherDef methods to have exactly one EventDef-typed parameter',
|
|
135
|
+
requiresTypeChecking: true,
|
|
136
|
+
examples: {
|
|
137
|
+
valid: "class OrderPublisher implements EventPublisherDef { publish(event: OrderPlacedEvent): void {} }",
|
|
138
|
+
invalid: "class OrderPublisher implements EventPublisherDef { publish(): void {} }",
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
schema: [],
|
|
142
|
+
messages: {
|
|
143
|
+
missingParameter: "Method '{{methodName}}' on EventPublisherDef class '{{className}}' must have exactly one parameter",
|
|
144
|
+
tooManyParameters: "Method '{{methodName}}' on EventPublisherDef class '{{className}}' must have exactly one parameter",
|
|
145
|
+
missingTypeAnnotation: "Parameter of method '{{methodName}}' on EventPublisherDef class '{{className}}' must have a type annotation",
|
|
146
|
+
notTypeReference: "Parameter of method '{{methodName}}' on EventPublisherDef class '{{className}}' must have a type reference annotation",
|
|
147
|
+
notEventDef: "Parameter type '{{typeName}}' of method '{{methodName}}' on EventPublisherDef class '{{className}}' does not implement EventDef (missing 'type: string' property)",
|
|
148
|
+
nonPublicMethod: "Method '{{methodName}}' on EventPublisherDef class '{{className}}' must be public, but is {{accessibility}}",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
create(context) {
|
|
152
|
+
let services = null
|
|
153
|
+
let checker = null
|
|
154
|
+
/* v8 ignore start -- graceful degradation: getParserServices always available in this repo */
|
|
155
|
+
if (getParserServices) {
|
|
156
|
+
try {
|
|
157
|
+
services = getParserServices(context, true)
|
|
158
|
+
checker = services.program?.getTypeChecker() ?? null
|
|
159
|
+
} catch { /* no type info */ }
|
|
160
|
+
}
|
|
161
|
+
/* v8 ignore stop */
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
ClassDeclaration(node) {
|
|
165
|
+
/* v8 ignore next -- ClassDeclaration always has id (name) */
|
|
166
|
+
if (!node.id) return
|
|
167
|
+
if (!implementsInterface(node, 'EventPublisherDef')) return
|
|
168
|
+
|
|
169
|
+
const className = node.id.name
|
|
170
|
+
|
|
171
|
+
for (const member of node.body.body) {
|
|
172
|
+
if (isMethodToCheck(member)) {
|
|
173
|
+
checkMethod(context, member, className, checker, services)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils'
|
|
2
|
+
|
|
3
|
+
type MessageIds = 'missingParameter' | 'tooManyParameters' | 'missingTypeAnnotation' | 'notTypeReference' | 'notEventDef' | 'nonPublicMethod'
|
|
4
|
+
|
|
5
|
+
declare const rule: TSESLint.RuleModule<MessageIds>
|
|
6
|
+
export default rule
|
package/src/eslint/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const apiControllerRequiresRouteAndMethod = require('./api-controller-requires-r
|
|
|
3
3
|
const eventRequiresTypeProperty = require('./event-requires-type-property.cjs')
|
|
4
4
|
const eventHandlerRequiresSubscribedEvents = require('./event-handler-requires-subscribed-events.cjs')
|
|
5
5
|
const uiPageRequiresRoute = require('./ui-page-requires-route.cjs')
|
|
6
|
+
const eventPublisherMethodSignature = require('./event-publisher-method-signature.cjs')
|
|
6
7
|
|
|
7
8
|
module.exports = {
|
|
8
9
|
rules: {
|
|
@@ -11,5 +12,6 @@ module.exports = {
|
|
|
11
12
|
'event-requires-type-property': eventRequiresTypeProperty,
|
|
12
13
|
'event-handler-requires-subscribed-events': eventHandlerRequiresSubscribedEvents,
|
|
13
14
|
'ui-page-requires-route': uiPageRequiresRoute,
|
|
15
|
+
'event-publisher-method-signature': eventPublisherMethodSignature,
|
|
14
16
|
},
|
|
15
17
|
}
|
|
@@ -2,6 +2,7 @@ const COMPONENT_DECORATORS = [
|
|
|
2
2
|
'DomainOpContainer',
|
|
3
3
|
'APIContainer',
|
|
4
4
|
'EventHandlerContainer',
|
|
5
|
+
'EventPublisherContainer',
|
|
5
6
|
'UseCase',
|
|
6
7
|
'Event',
|
|
7
8
|
'UI',
|
|
@@ -35,7 +36,7 @@ module.exports = {
|
|
|
35
36
|
schema: [],
|
|
36
37
|
messages: {
|
|
37
38
|
missingDecorator:
|
|
38
|
-
"Class '{{className}}' requires a component decorator. Add one of: @UseCase, @Event, @UI, @DomainOpContainer, @APIContainer, @EventHandlerContainer, @Custom('type'), or @Ignore",
|
|
39
|
+
"Class '{{className}}' requires a component decorator. Add one of: @UseCase, @Event, @UI, @DomainOpContainer, @APIContainer, @EventHandlerContainer, @EventPublisherContainer, @Custom('type'), or @Ignore",
|
|
39
40
|
},
|
|
40
41
|
},
|
|
41
42
|
create(context) {
|
package/dist/interfaces.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEpE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAAE,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;CAAC;AAE/E;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,GAAG,OAAO;IAC7C,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAA;CAAC"}
|
|
File without changes
|