@hauska-sdk/vda 0.1.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.
@@ -0,0 +1,158 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * Unified VDA SDK - Main entry point
4
+ */
5
+ import { WalletManager } from "@hauska-sdk/wallet";
6
+ import type { VDAStorageAdapter } from "./minting";
7
+ import type { VDA, MintVDAParams } from "./types";
8
+ import type { CreateAccessPassParams } from "./access-pass";
9
+ import type { OwnershipVerificationResult } from "./ownership";
10
+ import type { TransferOwnershipParams } from "./ownership-transfer";
11
+ import type { SearchOptions, SearchResult } from "./minting";
12
+ /**
13
+ * Logging hook function type
14
+ */
15
+ export type LogHook = (level: "info" | "warn" | "error", message: string, data?: any) => void;
16
+ /**
17
+ * VDA SDK Configuration
18
+ */
19
+ export interface VDASDKConfig {
20
+ /**
21
+ * Storage adapter for persisting VDAs
22
+ */
23
+ storageAdapter: VDAStorageAdapter;
24
+ /**
25
+ * Wallet manager (optional, will be created if not provided)
26
+ */
27
+ walletManager?: WalletManager;
28
+ /**
29
+ * Optional logging hook for monitoring and debugging
30
+ */
31
+ logHook?: LogHook;
32
+ }
33
+ /**
34
+ * Unified VDA SDK
35
+ *
36
+ * Main entry point for all VDA operations including:
37
+ * - VDA minting
38
+ * - Access pass creation and revocation
39
+ * - Ownership verification
40
+ * - Ownership transfer
41
+ * - Cross-spoke search
42
+ */
43
+ export declare class VDASDK {
44
+ private config;
45
+ private walletManager;
46
+ private mintingService;
47
+ private accessPassService;
48
+ private ownershipService;
49
+ private transferService;
50
+ private searchService;
51
+ constructor(config: VDASDKConfig);
52
+ /**
53
+ * Initialize SDK components
54
+ */
55
+ private initialize;
56
+ /**
57
+ * Log a message using the configured log hook
58
+ */
59
+ private log;
60
+ /**
61
+ * Mint a new VDA
62
+ *
63
+ * @param params - VDA minting parameters
64
+ * @returns The created VDA
65
+ */
66
+ mint(params: MintVDAParams): Promise<VDA>;
67
+ /**
68
+ * Get a VDA by ID
69
+ *
70
+ * @param vdaId - VDA ID
71
+ * @returns The VDA or null if not found
72
+ */
73
+ getVDA(vdaId: string): Promise<VDA | null>;
74
+ /**
75
+ * List VDAs by owner wallet
76
+ *
77
+ * @param wallet - Owner wallet address
78
+ * @returns Array of VDAs owned by the wallet
79
+ */
80
+ listVDAsByOwner(wallet: string): Promise<VDA[]>;
81
+ /**
82
+ * Create an access pass VDA
83
+ *
84
+ * @param params - Access pass creation parameters
85
+ * @returns The created access pass VDA
86
+ */
87
+ createAccessPass(params: CreateAccessPassParams): Promise<VDA>;
88
+ /**
89
+ * Revoke an access pass
90
+ *
91
+ * @param accessPassId - Access pass VDA ID
92
+ * @param grantorWallet - Grantor wallet address (must match)
93
+ * @returns The revoked access pass VDA
94
+ */
95
+ revokeAccessPass(accessPassId: string, grantorWallet: string): Promise<VDA>;
96
+ /**
97
+ * Get access passes owned by a wallet
98
+ *
99
+ * @param wallet - Wallet address
100
+ * @returns Array of access pass VDAs
101
+ */
102
+ getAccessPassesByOwner(wallet: string): Promise<VDA[]>;
103
+ /**
104
+ * Verify ownership of a VDA
105
+ *
106
+ * @param vdaId - VDA ID
107
+ * @param wallet - Wallet address to verify
108
+ * @param requiredPermissions - Optional permissions to check
109
+ * @returns Ownership verification result
110
+ */
111
+ verifyOwnership(vdaId: string, wallet: string, requiredPermissions?: string[]): Promise<OwnershipVerificationResult>;
112
+ /**
113
+ * Transfer ownership of a VDA
114
+ *
115
+ * @param params - Ownership transfer parameters
116
+ * @returns The updated VDA
117
+ */
118
+ transferOwnership(params: TransferOwnershipParams): Promise<VDA>;
119
+ /**
120
+ * Search VDAs by address (supports partial matching)
121
+ *
122
+ * @param address - Address to search for
123
+ * @param options - Search options (pagination, etc.)
124
+ * @returns Search results with pagination metadata
125
+ */
126
+ searchByAddress(address: string, options?: SearchOptions): Promise<SearchResult>;
127
+ /**
128
+ * Search VDAs by patient ID (exact match)
129
+ *
130
+ * @param patientId - Patient ID to search for
131
+ * @param options - Search options (pagination, etc.)
132
+ * @returns Search results with pagination metadata
133
+ */
134
+ searchByPatientId(patientId: string, options?: SearchOptions): Promise<SearchResult>;
135
+ /**
136
+ * Search VDAs by API14 (exact match)
137
+ *
138
+ * @param api14 - API14 well number to search for
139
+ * @param options - Search options (pagination, etc.)
140
+ * @returns Search results with pagination metadata
141
+ */
142
+ searchByAPI14(api14: string, options?: SearchOptions): Promise<SearchResult>;
143
+ /**
144
+ * Search VDAs across all spokes by any universal metadata key
145
+ *
146
+ * @param query - Search query (address, patientId, or api14)
147
+ * @param options - Search options (pagination, etc.)
148
+ * @returns Search results with pagination metadata
149
+ */
150
+ searchUniversal(query: string, options?: SearchOptions): Promise<SearchResult>;
151
+ /**
152
+ * Get the wallet manager instance
153
+ *
154
+ * @returns The wallet manager
155
+ */
156
+ getWalletManager(): WalletManager;
157
+ }
158
+ //# sourceMappingURL=VDASDK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VDASDK.d.ts","sourceRoot":"","sources":["../src/VDASDK.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD,OAAO,KAAK,EACV,iBAAiB,EAClB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,GAAG,EACH,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,sBAAsB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,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7B,OAAO,CAAC,2BAA2B,CAAC;IAavC;;;;;OAKG;IACG,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC;IAgBtE;;;;;;OAMG;IACG,eAAe,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IASxB;;;;;;OAMG;IACG,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IASxB;;;;;;OAMG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IASxB;;;;;;OAMG;IACG,eAAe,CACnB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IASxB;;;;OAIG;IACH,gBAAgB,IAAI,aAAa;CAGlC"}
package/dist/VDASDK.js ADDED
@@ -0,0 +1,284 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * Unified VDA SDK - Main entry point
4
+ */
5
+ import { WalletManager } from "@hauska-sdk/wallet";
6
+ import { VDAMintingService } from "./minting";
7
+ import { AccessPassService } from "./access-pass";
8
+ import { OwnershipVerificationService } from "./ownership";
9
+ import { OwnershipTransferService } from "./ownership-transfer";
10
+ import { VDASearchService } from "./search";
11
+ /**
12
+ * Unified VDA SDK
13
+ *
14
+ * Main entry point for all VDA operations including:
15
+ * - VDA minting
16
+ * - Access pass creation and revocation
17
+ * - Ownership verification
18
+ * - Ownership transfer
19
+ * - Cross-spoke search
20
+ */
21
+ export class VDASDK {
22
+ config;
23
+ walletManager;
24
+ mintingService;
25
+ accessPassService;
26
+ ownershipService;
27
+ transferService;
28
+ searchService;
29
+ constructor(config) {
30
+ this.config = config;
31
+ this.initialize();
32
+ }
33
+ /**
34
+ * Initialize SDK components
35
+ */
36
+ initialize() {
37
+ // Initialize wallet manager if not provided
38
+ if (!this.config.walletManager) {
39
+ this.walletManager = new WalletManager();
40
+ }
41
+ else {
42
+ this.walletManager = this.config.walletManager;
43
+ }
44
+ // Initialize minting service
45
+ this.mintingService = new VDAMintingService({
46
+ storageAdapter: this.config.storageAdapter,
47
+ walletManager: this.walletManager,
48
+ });
49
+ // Initialize access pass service
50
+ this.accessPassService = new AccessPassService(this.mintingService, this.config.storageAdapter, this.walletManager);
51
+ // Initialize ownership verification service
52
+ this.ownershipService = new OwnershipVerificationService(this.config.storageAdapter);
53
+ // Initialize ownership transfer service
54
+ this.transferService = new OwnershipTransferService(this.config.storageAdapter);
55
+ // Initialize search service
56
+ this.searchService = new VDASearchService({
57
+ storageAdapter: this.config.storageAdapter,
58
+ });
59
+ this.log("info", "VDA SDK initialized");
60
+ }
61
+ /**
62
+ * Log a message using the configured log hook
63
+ */
64
+ log(level, message, data) {
65
+ if (this.config.logHook) {
66
+ this.config.logHook(level, message, data);
67
+ }
68
+ }
69
+ /**
70
+ * Mint a new VDA
71
+ *
72
+ * @param params - VDA minting parameters
73
+ * @returns The created VDA
74
+ */
75
+ async mint(params) {
76
+ try {
77
+ this.log("info", "Minting VDA", { assetType: params.assetType, spoke: params.spoke });
78
+ const vda = await this.mintingService.mint(params);
79
+ this.log("info", "VDA minted successfully", { vdaId: vda.id });
80
+ return vda;
81
+ }
82
+ catch (error) {
83
+ this.log("error", "Failed to mint VDA", { error, params });
84
+ throw error;
85
+ }
86
+ }
87
+ /**
88
+ * Get a VDA by ID
89
+ *
90
+ * @param vdaId - VDA ID
91
+ * @returns The VDA or null if not found
92
+ */
93
+ async getVDA(vdaId) {
94
+ try {
95
+ return await this.mintingService.getVDA(vdaId);
96
+ }
97
+ catch (error) {
98
+ this.log("error", "Failed to get VDA", { error, vdaId });
99
+ throw error;
100
+ }
101
+ }
102
+ /**
103
+ * List VDAs by owner wallet
104
+ *
105
+ * @param wallet - Owner wallet address
106
+ * @returns Array of VDAs owned by the wallet
107
+ */
108
+ async listVDAsByOwner(wallet) {
109
+ try {
110
+ return await this.mintingService.listVDAsByOwner(wallet);
111
+ }
112
+ catch (error) {
113
+ this.log("error", "Failed to list VDAs by owner", { error, wallet });
114
+ throw error;
115
+ }
116
+ }
117
+ /**
118
+ * Create an access pass VDA
119
+ *
120
+ * @param params - Access pass creation parameters
121
+ * @returns The created access pass VDA
122
+ */
123
+ async createAccessPass(params) {
124
+ try {
125
+ this.log("info", "Creating access pass", {
126
+ grantorWallet: params.grantorWallet,
127
+ accessibleVDAs: params.accessibleVDAs.length
128
+ });
129
+ const accessPass = await this.accessPassService.createAccessPass(params);
130
+ this.log("info", "Access pass created successfully", { accessPassId: accessPass.id });
131
+ return accessPass;
132
+ }
133
+ catch (error) {
134
+ this.log("error", "Failed to create access pass", { error, params });
135
+ throw error;
136
+ }
137
+ }
138
+ /**
139
+ * Revoke an access pass
140
+ *
141
+ * @param accessPassId - Access pass VDA ID
142
+ * @param grantorWallet - Grantor wallet address (must match)
143
+ * @returns The revoked access pass VDA
144
+ */
145
+ async revokeAccessPass(accessPassId, grantorWallet) {
146
+ try {
147
+ this.log("info", "Revoking access pass", { accessPassId, grantorWallet });
148
+ const revokedAccessPass = await this.accessPassService.revokeAccessPass(accessPassId, grantorWallet);
149
+ this.log("info", "Access pass revoked successfully", { accessPassId });
150
+ return revokedAccessPass;
151
+ }
152
+ catch (error) {
153
+ this.log("error", "Failed to revoke access pass", { error, accessPassId, grantorWallet });
154
+ throw error;
155
+ }
156
+ }
157
+ /**
158
+ * Get access passes owned by a wallet
159
+ *
160
+ * @param wallet - Wallet address
161
+ * @returns Array of access pass VDAs
162
+ */
163
+ async getAccessPassesByOwner(wallet) {
164
+ try {
165
+ return await this.accessPassService.getAccessPassesByOwner(wallet);
166
+ }
167
+ catch (error) {
168
+ this.log("error", "Failed to get access passes by owner", { error, wallet });
169
+ throw error;
170
+ }
171
+ }
172
+ /**
173
+ * Verify ownership of a VDA
174
+ *
175
+ * @param vdaId - VDA ID
176
+ * @param wallet - Wallet address to verify
177
+ * @param requiredPermissions - Optional permissions to check
178
+ * @returns Ownership verification result
179
+ */
180
+ async verifyOwnership(vdaId, wallet, requiredPermissions) {
181
+ try {
182
+ return await this.ownershipService.verifyOwnership(vdaId, wallet, requiredPermissions);
183
+ }
184
+ catch (error) {
185
+ this.log("error", "Failed to verify ownership", { error, vdaId, wallet });
186
+ throw error;
187
+ }
188
+ }
189
+ /**
190
+ * Transfer ownership of a VDA
191
+ *
192
+ * @param params - Ownership transfer parameters
193
+ * @returns The updated VDA
194
+ */
195
+ async transferOwnership(params) {
196
+ try {
197
+ this.log("info", "Transferring VDA ownership", {
198
+ vdaId: params.vdaId,
199
+ from: params.currentOwner,
200
+ to: params.newOwner
201
+ });
202
+ const updatedVDA = await this.transferService.transferOwnership(params);
203
+ this.log("info", "VDA ownership transferred successfully", { vdaId: params.vdaId });
204
+ return updatedVDA;
205
+ }
206
+ catch (error) {
207
+ this.log("error", "Failed to transfer ownership", { error, params });
208
+ throw error;
209
+ }
210
+ }
211
+ /**
212
+ * Search VDAs by address (supports partial matching)
213
+ *
214
+ * @param address - Address to search for
215
+ * @param options - Search options (pagination, etc.)
216
+ * @returns Search results with pagination metadata
217
+ */
218
+ async searchByAddress(address, options) {
219
+ try {
220
+ return await this.searchService.searchByAddress(address, options);
221
+ }
222
+ catch (error) {
223
+ this.log("error", "Failed to search by address", { error, address });
224
+ throw error;
225
+ }
226
+ }
227
+ /**
228
+ * Search VDAs by patient ID (exact match)
229
+ *
230
+ * @param patientId - Patient ID to search for
231
+ * @param options - Search options (pagination, etc.)
232
+ * @returns Search results with pagination metadata
233
+ */
234
+ async searchByPatientId(patientId, options) {
235
+ try {
236
+ return await this.searchService.searchByPatientId(patientId, options);
237
+ }
238
+ catch (error) {
239
+ this.log("error", "Failed to search by patient ID", { error, patientId });
240
+ throw error;
241
+ }
242
+ }
243
+ /**
244
+ * Search VDAs by API14 (exact match)
245
+ *
246
+ * @param api14 - API14 well number to search for
247
+ * @param options - Search options (pagination, etc.)
248
+ * @returns Search results with pagination metadata
249
+ */
250
+ async searchByAPI14(api14, options) {
251
+ try {
252
+ return await this.searchService.searchByAPI14(api14, options);
253
+ }
254
+ catch (error) {
255
+ this.log("error", "Failed to search by API14", { error, api14 });
256
+ throw error;
257
+ }
258
+ }
259
+ /**
260
+ * Search VDAs across all spokes by any universal metadata key
261
+ *
262
+ * @param query - Search query (address, patientId, or api14)
263
+ * @param options - Search options (pagination, etc.)
264
+ * @returns Search results with pagination metadata
265
+ */
266
+ async searchUniversal(query, options) {
267
+ try {
268
+ return await this.searchService.searchUniversal(query, options);
269
+ }
270
+ catch (error) {
271
+ this.log("error", "Failed to search universal", { error, query });
272
+ throw error;
273
+ }
274
+ }
275
+ /**
276
+ * Get the wallet manager instance
277
+ *
278
+ * @returns The wallet manager
279
+ */
280
+ getWalletManager() {
281
+ return this.walletManager;
282
+ }
283
+ }
284
+ //# sourceMappingURL=VDASDK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VDASDK.js","sourceRoot":"","sources":["../src/VDASDK.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AA+C5C;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAM;IACT,MAAM,CAAe;IACrB,aAAa,CAAiB;IAC9B,cAAc,CAAqB;IACnC,iBAAiB,CAAqB;IACtC,gBAAgB,CAAgC;IAChD,eAAe,CAA4B;IAC3C,aAAa,CAAoB;IAEzC,YAAY,MAAoB;QAC9B,IA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AAG,CAAC,OAAO,EAAE,2BAA2B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACjE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CACnB,KAAa,EACb,OAAuB;QAEvB,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,4BAA4B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YAClE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * Access Pass Creation Implementation
4
+ */
5
+ import type { WalletManager } from "@hauska-sdk/wallet";
6
+ import type { VDA, SpokeType } from "./types";
7
+ import type { VDAStorageAdapter } from "./minting";
8
+ import { VDAMintingService } from "./minting";
9
+ import type { PermissionType } from "./types";
10
+ /**
11
+ * Options for creating an access pass
12
+ */
13
+ export interface CreateAccessPassParams {
14
+ /**
15
+ * Grantor wallet address (must own all accessible VDAs)
16
+ */
17
+ grantorWallet: string;
18
+ /**
19
+ * Recipient wallet address (optional, will be auto-created if not provided)
20
+ */
21
+ recipientWallet?: string;
22
+ /**
23
+ * User ID for automatic wallet creation (if recipientWallet not provided)
24
+ */
25
+ userId?: string;
26
+ password?: string;
27
+ /**
28
+ * Array of VDA IDs this access pass grants access to
29
+ */
30
+ accessibleVDAs: string[];
31
+ /**
32
+ * Permissions granted by this access pass
33
+ */
34
+ permissions: PermissionType[];
35
+ /**
36
+ * Expiry timestamp (must be in the future)
37
+ */
38
+ expiry: number;
39
+ /**
40
+ * Spoke
41
+ */
42
+ spoke: SpokeType;
43
+ /**
44
+ * Universal metadata (at least one required)
45
+ */
46
+ address?: string;
47
+ legalDesc?: string;
48
+ patientId?: string;
49
+ api14?: string;
50
+ /**
51
+ * Additional metadata
52
+ */
53
+ metadata?: Record<string, any>;
54
+ }
55
+ /**
56
+ * Access Pass Creation Service
57
+ */
58
+ export declare class AccessPassService {
59
+ private mintingService;
60
+ private storageAdapter;
61
+ private walletManager;
62
+ constructor(mintingService: VDAMintingService, storageAdapter: VDAStorageAdapter, walletManager: WalletManager);
63
+ /**
64
+ * Create an access pass VDA
65
+ *
66
+ * @param params - Access pass creation parameters
67
+ * @returns The created access pass VDA
68
+ * @throws Error if validation fails or grantor doesn't own accessible VDAs
69
+ */
70
+ createAccessPass(params: CreateAccessPassParams): Promise<VDA>;
71
+ /**
72
+ * Verify that grantor owns all accessible VDAs
73
+ *
74
+ * @param grantorWallet - Grantor wallet address
75
+ * @param accessibleVDAs - Array of VDA IDs to verify
76
+ * @throws Error if grantor doesn't own any of the VDAs
77
+ */
78
+ private verifyGrantorOwnership;
79
+ /**
80
+ * Revoke an access pass
81
+ *
82
+ * @param accessPassId - Access pass VDA ID
83
+ * @param grantorWallet - Grantor wallet address (must match)
84
+ * @returns The revoked access pass VDA
85
+ * @throws Error if grantor doesn't match or access pass not found
86
+ */
87
+ revokeAccessPass(accessPassId: string, grantorWallet: string): Promise<VDA>;
88
+ /**
89
+ * Get access passes owned by a wallet
90
+ *
91
+ * @param wallet - Wallet address
92
+ * @returns Array of access pass VDAs
93
+ */
94
+ getAccessPassesByOwner(wallet: string): Promise<VDA[]>;
95
+ }
96
+ //# sourceMappingURL=access-pass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-pass.d.ts","sourceRoot":"","sources":["../src/access-pass.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,GAAG,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