@memberjunction/core 5.13.0 → 5.15.0

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 (40) hide show
  1. package/dist/generic/QueryCacheManager.d.ts +12 -2
  2. package/dist/generic/QueryCacheManager.d.ts.map +1 -1
  3. package/dist/generic/QueryCacheManager.js +17 -3
  4. package/dist/generic/QueryCacheManager.js.map +1 -1
  5. package/dist/generic/databaseProviderBase.d.ts +7 -1
  6. package/dist/generic/databaseProviderBase.d.ts.map +1 -1
  7. package/dist/generic/databaseProviderBase.js.map +1 -1
  8. package/dist/generic/entityInfo.d.ts +110 -0
  9. package/dist/generic/entityInfo.d.ts.map +1 -1
  10. package/dist/generic/entityInfo.js +225 -0
  11. package/dist/generic/entityInfo.js.map +1 -1
  12. package/dist/generic/interfaces.d.ts +10 -0
  13. package/dist/generic/interfaces.d.ts.map +1 -1
  14. package/dist/generic/interfaces.js.map +1 -1
  15. package/dist/generic/providerBase.d.ts +16 -19
  16. package/dist/generic/providerBase.d.ts.map +1 -1
  17. package/dist/generic/providerBase.js +28 -32
  18. package/dist/generic/providerBase.js.map +1 -1
  19. package/dist/generic/queryExecutionSpec.d.ts +68 -0
  20. package/dist/generic/queryExecutionSpec.d.ts.map +1 -0
  21. package/dist/generic/queryExecutionSpec.js +45 -0
  22. package/dist/generic/queryExecutionSpec.js.map +1 -0
  23. package/dist/generic/runQuery.d.ts +10 -0
  24. package/dist/generic/runQuery.d.ts.map +1 -1
  25. package/dist/generic/runQuery.js +11 -0
  26. package/dist/generic/runQuery.js.map +1 -1
  27. package/dist/index.d.ts +1 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -2
  30. package/dist/index.js.map +1 -1
  31. package/package.json +2 -2
  32. package/readme.md +23 -0
  33. package/dist/generic/queryCompositionEngine.d.ts +0 -165
  34. package/dist/generic/queryCompositionEngine.d.ts.map +0 -1
  35. package/dist/generic/queryCompositionEngine.js +0 -464
  36. package/dist/generic/queryCompositionEngine.js.map +0 -1
  37. package/dist/generic/queryPagingEngine.d.ts +0 -110
  38. package/dist/generic/queryPagingEngine.d.ts.map +0 -1
  39. package/dist/generic/queryPagingEngine.js +0 -335
  40. package/dist/generic/queryPagingEngine.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import { IRunQueryProvider, RunQueryResult } from './interfaces.js';
2
2
  import { UserInfo } from './securityInfo.js';
3
+ import { QueryExecutionSpec } from './queryExecutionSpec.js';
3
4
  /**
4
5
  * Parameters for running a query, must provide either QueryID or QueryName. If both are provided QueryName is ignored.
5
6
  * QueryName and CategoryPath together uniquely identify a Query, just as QueryID does.
@@ -122,6 +123,15 @@ export declare class RunQuery {
122
123
  * @returns Array of query results in the same order as the input params
123
124
  */
124
125
  RunQueries(params: RunQueryParams[], contextUser?: UserInfo): Promise<RunQueryResult[]>;
126
+ /**
127
+ * Executes a query from a `QueryExecutionSpec` — the lower-layer interface-based entry point.
128
+ * Runs the full pipeline: composition resolution → Nunjucks template processing → SQL execution.
129
+ * Supports both saved queries (via QueryExecutionSpec.FromQueryInfo) and transient test queries.
130
+ * @param spec - The execution spec describing the query, parameters, and inline dependencies
131
+ * @param contextUser - Optional user context for permissions (mainly used server-side)
132
+ * @returns Query results including data rows and execution metadata
133
+ */
134
+ ExecuteFromSpec(spec: QueryExecutionSpec, contextUser?: UserInfo): Promise<RunQueryResult>;
125
135
  private static _globalProviderKey;
126
136
  /**
127
137
  * Gets the static query provider instance.
@@ -1 +1 @@
1
- {"version":3,"file":"runQuery.d.ts","sourceRoot":"","sources":["../../src/generic/runQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;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AAM,EAAE,cAAc,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC;IAK9F;;;;;;;OAOG;IACU,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAKpG;;;;;;;OAOG;IACU,eAAe,CAAC,IAAI,EAAE,kBAAkB,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC;IAIvG,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAiC;IAClE;;;;;OAKG;IACH,WAAkB,QAAQ,IAAI,iBAAiB,CAM9C;IACD;;;;;OAKG;IACH,WAAkB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,EAMlD;CAEJ"}
@@ -44,6 +44,17 @@ export class RunQuery {
44
44
  // Simple proxy to the provider - telemetry is handled by ProviderBase Pre/Post hooks
45
45
  return this.ProviderToUse.RunQueries(params, contextUser);
46
46
  }
47
+ /**
48
+ * Executes a query from a `QueryExecutionSpec` — the lower-layer interface-based entry point.
49
+ * Runs the full pipeline: composition resolution → Nunjucks template processing → SQL execution.
50
+ * Supports both saved queries (via QueryExecutionSpec.FromQueryInfo) and transient test queries.
51
+ * @param spec - The execution spec describing the query, parameters, and inline dependencies
52
+ * @param contextUser - Optional user context for permissions (mainly used server-side)
53
+ * @returns Query results including data rows and execution metadata
54
+ */
55
+ async ExecuteFromSpec(spec, contextUser) {
56
+ return this.ProviderToUse.ExecuteQueryFromSpec(spec, contextUser);
57
+ }
47
58
  static { this._globalProviderKey = 'MJ_RunQueryProvider'; }
48
59
  /**
49
60
  * Gets the static query provider instance.
@@ -1 +1 @@
1
- {"version":3,"file":"runQuery.js","sourceRoot":"","sources":["../../src/generic/runQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AA8FlD;;;;GAIG;AACH,MAAM,OAAO,QAAQ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AC,GAAG,KAAK,CAAC;;YAEvC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IACtF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -15,8 +15,7 @@ export * from "./generic/util.js";
15
15
  export * from "./generic/logging.js";
16
16
  export * from "./generic/queryInfo.js";
17
17
  export * from "./generic/queryInfoInterfaces.js";
18
- export * from "./generic/queryCompositionEngine.js";
19
- export * from "./generic/queryPagingEngine.js";
18
+ export * from "./generic/queryExecutionSpec.js";
20
19
  export * from "./generic/querySQLFilters.js";
21
20
  export * from "./generic/runQuerySQLFilterImplementations.js";
22
21
  export * from "./generic/libraryInfo.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,C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AAc,4BAA4B,CAAC;AAE3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,qBAAqB,CAAC;AAEpC,wBAAgB,WAAW,CAAC,QAAQ,KAAA,QAMnC"}
package/dist/index.js CHANGED
@@ -20,8 +20,7 @@ export * from "./generic/util.js";
20
20
  export * from "./generic/logging.js";
21
21
  export * from "./generic/queryInfo.js";
22
22
  export * from "./generic/queryInfoInterfaces.js";
23
- export * from "./generic/queryCompositionEngine.js";
24
- export * from "./generic/queryPagingEngine.js";
23
+ export * from "./generic/queryExecutionSpec.js";
25
24
  export * from "./generic/querySQLFilters.js";
26
25
  export * from "./generic/runQuerySQLFilterImplementations.js";
27
26
  export * from "./generic/libraryInfo.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAA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AAc,qBAAqB,CAAC;AAEpC,MAAM,UAAU,WAAW,CAAC,QAAQ;IAChC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC5B,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC9B,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/core",
3
3
  "type": "module",
4
- "version": "5.13.0",
4
+ "version": "5.15.0",
5
5
  "description": "MemberJunction: Core Library including Metadata, Application, Entity Retrieval and Manipulation, and Utilities",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "vitest": "^3.1.1"
27
27
  },
28
28
  "dependencies": {
29
- "@memberjunction/global": "5.13.0",
29
+ "@memberjunction/global": "5.15.0",
30
30
  "rxjs": "^7.8.2",
31
31
  "zod": "~3.24.4",
32
32
  "debug": "^4.4.3"
package/readme.md CHANGED
@@ -1399,12 +1399,35 @@ When saving through one branch of an overlapping hierarchy, Record Change entrie
1399
1399
 
1400
1400
  > **Full Guide**: See [IS-A Relationships Guide](./docs/isa-relationships.md) for the complete data model, runtime object model, save/delete orchestration sequences, overlapping subtypes, Record Change propagation, provider implementations, CodeGen integration, and troubleshooting.
1401
1401
 
1402
+ ## Organic Keys (Cross-System Matching)
1403
+
1404
+ MemberJunction supports **Organic Keys** for establishing relationships between entities based on shared business data (email addresses, phone numbers, domains, etc.) rather than foreign key constraints. This is essential for cross-system integrations where external platforms (Mailchimp, QuickBooks, HubSpot, etc.) share data values but not primary keys.
1405
+
1406
+ Key capabilities:
1407
+ - **Direct matching**: Field-to-field comparison with configurable normalization (LowerCaseTrim, Trim, ExactMatch, Custom)
1408
+ - **Compound keys**: Match on multiple fields simultaneously (FirstName + LastName + DOB)
1409
+ - **Transitive matching**: Bridge through intermediate tables via SQL views for multi-hop relationships
1410
+ - **Bidirectional**: Configure on both sides for complete cross-system navigation
1411
+ - **CodeGen integration**: Declare organic keys in `additionalSchemaInfo.json` — CodeGen creates bridge views, inserts metadata, and generates form panels automatically
1412
+
1413
+ ```typescript
1414
+ // Access organic keys at runtime
1415
+ const organicKeys = entity.OrganicKeys; // EntityOrganicKeyInfo[]
1416
+
1417
+ // Build query params for matching
1418
+ const params = EntityInfo.BuildOrganicKeyViewParams(record, relatedEntity, organicKey);
1419
+ // params.ExtraFilter = "LOWER(LTRIM(RTRIM([EmailAddress]))) = LOWER(LTRIM(RTRIM('john@acme.com')))"
1420
+ ```
1421
+
1422
+ > **Full Guide**: See [Organic Keys Guide](./docs/organic-keys.md) for the complete schema, all 4 query patterns, normalization strategies, CodeGen configuration, Angular UI integration, and an end-to-end setup walkthrough.
1423
+
1402
1424
  ## Documentation
1403
1425
 
1404
1426
  For detailed guides on specific topics, see the [docs/](./docs/) folder:
1405
1427
 
1406
1428
  - [Virtual Entities](./docs/virtual-entities.md) — Config-driven creation, LLM decoration, read-only enforcement
1407
1429
  - [IS-A Relationships](./docs/isa-relationships.md) — Type inheritance, save/delete orchestration, provider integration
1430
+ - [Organic Keys](./docs/organic-keys.md) — Cross-system matching by shared business data (email, phone, domain), CodeGen integration, transitive views
1408
1431
  - [RunQuery Pagination](./docs/runquery-pagination.md) — Parameterized queries with pagination support
1409
1432
 
1410
1433
  ## Support
@@ -1,165 +0,0 @@
1
- import { DatabasePlatform } from "./platformSQL.js";
2
- import { UserInfo } from "./securityInfo.js";
3
- /**
4
- * Metadata about a single CTE generated during composition resolution.
5
- */
6
- export interface CompositionCTEInfo {
7
- /** ID of the referenced query */
8
- QueryID: string;
9
- /** Name of the referenced query */
10
- QueryName: string;
11
- /** Category path as written in the reference */
12
- CategoryPath: string;
13
- /** Generated CTE alias name */
14
- CTEName: string;
15
- /** Original SQL of the referenced query before parameter resolution */
16
- OriginalSQL: string;
17
- /** SQL after parameter values have been substituted */
18
- ResolvedSQL: string;
19
- /** Parameter values applied (key → resolved value) */
20
- Parameters: Record<string, string>;
21
- }
22
- /**
23
- * Result returned by the composition engine after resolving all {{query:"..."}} tokens.
24
- */
25
- export interface CompositionResult {
26
- /** The fully resolved SQL with CTEs prepended */
27
- ResolvedSQL: string;
28
- /** Metadata about each CTE generated */
29
- CTEs: CompositionCTEInfo[];
30
- /** Directed dependency graph: queryId → [dependsOnQueryIds] */
31
- DependencyGraph: Map<string, string[]>;
32
- /** Whether any composition tokens were found and resolved */
33
- HasCompositions: boolean;
34
- }
35
- /**
36
- * Parsed representation of a single {{query:"..."}} token found in SQL.
37
- */
38
- interface ParsedCompositionToken {
39
- /** The full original token text including {{ and }} */
40
- FullToken: string;
41
- /** Category path segments (everything before the query name) */
42
- CategorySegments: string[];
43
- /** The query name (last path segment) */
44
- QueryName: string;
45
- /** Full path as written (CategorySegments joined with /) */
46
- FullPath: string;
47
- /** Parsed parameter mappings */
48
- Parameters: ParsedParameter[];
49
- }
50
- /**
51
- * A single parameter from a composition reference.
52
- */
53
- interface ParsedParameter {
54
- /** Parameter name */
55
- Name: string;
56
- /** If quoted literal: the static value. Otherwise null. */
57
- StaticValue: string | null;
58
- /** If bare name: the pass-through parameter name from the outer query. Otherwise null. */
59
- PassThroughName: string | null;
60
- }
61
- /**
62
- * QueryCompositionEngine resolves {{query:"CategoryPath/QueryName(params)"}} tokens
63
- * in query SQL into Common Table Expressions (CTEs). It handles:
64
- *
65
- * - Recursive resolution of nested compositions
66
- * - Cycle detection via an in-progress set
67
- * - Parameter modes: static literals and pass-through from outer query
68
- * - Deduplication of identical query+params references
69
- * - Platform-aware SQL resolution via QueryInfo.GetPlatformSQL()
70
- *
71
- * This engine runs BEFORE Nunjucks template processing, so regular {{param}}
72
- * tokens are preserved for later substitution.
73
- */
74
- export declare class QueryCompositionEngine {
75
- /**
76
- * Checks whether SQL contains any {{query:"..."}} composition tokens.
77
- * Use this as a fast guard before calling ResolveComposition().
78
- * Only considers tokens outside of SQL comments.
79
- */
80
- HasCompositionTokens(sql: string): boolean;
81
- /**
82
- * Parses all {{query:"..."}} tokens from SQL without resolving them.
83
- * Useful for dependency extraction during the save pipeline.
84
- * Only considers tokens outside of SQL comments.
85
- *
86
- * @param sql - The SQL text to parse
87
- * @returns Array of parsed token metadata
88
- */
89
- ParseCompositionTokens(sql: string): ParsedCompositionToken[];
90
- /**
91
- * Resolves all {{query:"..."}} composition tokens in the given SQL into CTEs.
92
- *
93
- * @param sql - The SQL containing composition tokens
94
- * @param platform - Target database platform for SQL resolution
95
- * @param contextUser - User context for permission checks on referenced queries
96
- * @param outerParams - Parameter values from the outer/parent query (for pass-through resolution)
97
- * @returns CompositionResult with fully resolved SQL and provenance metadata
98
- * @throws Error if a referenced query is not found, not composable, or creates a cycle
99
- */
100
- ResolveComposition(sql: string, platform: DatabasePlatform, contextUser: UserInfo, outerParams?: Record<string, string>): CompositionResult;
101
- /**
102
- * Recursively resolves composition tokens in SQL, building up CTE entries.
103
- */
104
- private resolveTokensRecursive;
105
- /**
106
- * Parses the content inside a {{query:"..."}} token.
107
- */
108
- private parseTokenContent;
109
- /**
110
- * Splits parameter string by commas, respecting quoted values.
111
- */
112
- private splitParams;
113
- /**
114
- * Looks up a query by category path + name in the metadata provider.
115
- */
116
- private lookupQuery;
117
- /**
118
- * Validates that a referenced query is eligible for composition.
119
- */
120
- private validateQueryComposable;
121
- /**
122
- * Resolves parameter values for a composition reference.
123
- * Static values are used directly; pass-through values are looked up from outer params.
124
- */
125
- private resolveParameters;
126
- /**
127
- * Substitutes resolved parameter values into a query's SQL.
128
- * - Static values: replaces {{paramName}} with 'value'
129
- * - Pass-through values: renames {{paramName}} to {{outerParamName}} so
130
- * the downstream Nunjucks processor can resolve it from the outer query's parameters.
131
- */
132
- private substituteStaticParams;
133
- /**
134
- * Builds a deduplication key for a CTE based on query ID and sorted parameter values.
135
- */
136
- private buildDeduplicationKey;
137
- /**
138
- * Generates a SQL-safe CTE name from the query name + short hash for uniqueness.
139
- */
140
- private generateCTEName;
141
- /**
142
- * Simple string hash for generating short, deterministic suffixes.
143
- */
144
- private simpleHash;
145
- /**
146
- * Assembles CTE entries into a WITH clause prepended to the main SQL.
147
- */
148
- private assembleCTEs;
149
- /**
150
- * Strips a trailing ORDER BY clause from SQL that will be wrapped in a CTE.
151
- * SQL Server (and the SQL standard) disallows ORDER BY inside CTEs unless
152
- * TOP, OFFSET, or FOR XML is also present. Since reusable queries often
153
- * include ORDER BY for standalone use, we must remove it when composing.
154
- */
155
- private stripTrailingOrderBy;
156
- /**
157
- * Strips SQL comments from the input string so that composition tokens
158
- * inside comments are not treated as real references.
159
- * Handles both single-line (-- ...) and multi-line block comments.
160
- * Preserves string literals (single-quoted) to avoid stripping inside them.
161
- */
162
- private stripSQLComments;
163
- }
164
- export {};
165
- //# sourceMappingURL=queryCompositionEngine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryCompositionEngine.d.ts","sourceRoot":"","sources":["../../src/generic/queryCompositionEngine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA0B1C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,iDAAiD;I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