@nucypher/taco 0.6.0-alpha.2 → 0.6.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.
- package/dist/cjs/conditions/base/index.d.ts +1 -0
- package/dist/cjs/conditions/base/index.js +19 -8
- package/dist/cjs/conditions/base/index.js.map +1 -1
- package/dist/cjs/conditions/base/jwt.d.ts +7 -0
- package/dist/cjs/conditions/base/jwt.js +19 -0
- package/dist/cjs/conditions/base/jwt.js.map +1 -0
- package/dist/cjs/conditions/condition-expr.js +5 -5
- package/dist/cjs/conditions/condition-expr.js.map +1 -1
- package/dist/cjs/conditions/condition-factory.js +3 -0
- package/dist/cjs/conditions/condition-factory.js.map +1 -1
- package/dist/cjs/conditions/condition.js +2 -1
- package/dist/cjs/conditions/condition.js.map +1 -1
- package/dist/cjs/conditions/const.js +0 -1
- package/dist/cjs/conditions/const.js.map +1 -1
- package/dist/cjs/conditions/context/context.d.ts +1 -1
- package/dist/cjs/conditions/context/context.js +11 -10
- package/dist/cjs/conditions/context/context.js.map +1 -1
- package/dist/cjs/conditions/index.js +17 -7
- package/dist/cjs/conditions/index.js.map +1 -1
- package/dist/cjs/conditions/predefined/index.js +17 -7
- package/dist/cjs/conditions/predefined/index.js.map +1 -1
- package/dist/cjs/conditions/schemas/common.d.ts +1 -1
- package/dist/cjs/conditions/schemas/common.js +10 -7
- package/dist/cjs/conditions/schemas/common.js.map +1 -1
- package/dist/cjs/conditions/schemas/context.d.ts +1 -0
- package/dist/cjs/conditions/schemas/context.js +24 -3
- package/dist/cjs/conditions/schemas/context.js.map +1 -1
- package/dist/cjs/conditions/schemas/contract.d.ts +44 -25
- package/dist/cjs/conditions/schemas/contract.js +7 -7
- package/dist/cjs/conditions/schemas/contract.js.map +1 -1
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.d.ts +18 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js +37 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js.map +1 -0
- package/dist/cjs/conditions/schemas/json-api.d.ts +13 -10
- package/dist/cjs/conditions/schemas/json-rpc.d.ts +14 -11
- package/dist/cjs/conditions/schemas/jwt.d.ts +22 -0
- package/dist/cjs/conditions/schemas/jwt.js +19 -0
- package/dist/cjs/conditions/schemas/jwt.js.map +1 -0
- package/dist/cjs/conditions/schemas/return-value-test.d.ts +18 -2
- package/dist/cjs/conditions/schemas/return-value-test.js +7 -2
- package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/cjs/conditions/schemas/rpc.d.ts +16 -13
- package/dist/cjs/conditions/schemas/rpc.js +17 -11
- package/dist/cjs/conditions/schemas/rpc.js.map +1 -1
- package/dist/cjs/conditions/schemas/time.d.ts +9 -8
- package/dist/cjs/conditions/schemas/utils.js +2 -0
- package/dist/cjs/conditions/schemas/utils.js.map +1 -1
- package/dist/cjs/conditions/shared.d.ts +1 -1
- package/dist/cjs/conditions/shared.js +2 -1
- package/dist/cjs/conditions/shared.js.map +1 -1
- package/dist/cjs/index.js +17 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils.d.ts +2 -0
- package/dist/cjs/utils.js +48 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/es/conditions/base/index.d.ts +1 -0
- package/dist/es/conditions/base/index.js +1 -0
- package/dist/es/conditions/base/index.js.map +1 -1
- package/dist/es/conditions/base/jwt.d.ts +7 -0
- package/dist/es/conditions/base/jwt.js +12 -0
- package/dist/es/conditions/base/jwt.js.map +1 -0
- package/dist/es/conditions/condition-expr.js +3 -3
- package/dist/es/conditions/condition-expr.js.map +1 -1
- package/dist/es/conditions/condition-factory.js +3 -0
- package/dist/es/conditions/condition-factory.js.map +1 -1
- package/dist/es/conditions/condition.js +2 -1
- package/dist/es/conditions/condition.js.map +1 -1
- package/dist/es/conditions/const.js +1 -2
- package/dist/es/conditions/const.js.map +1 -1
- package/dist/es/conditions/context/context.d.ts +1 -1
- package/dist/es/conditions/context/context.js +10 -9
- package/dist/es/conditions/context/context.js.map +1 -1
- package/dist/es/conditions/schemas/common.d.ts +1 -1
- package/dist/es/conditions/schemas/common.js +11 -8
- package/dist/es/conditions/schemas/common.js.map +1 -1
- package/dist/es/conditions/schemas/context.d.ts +1 -0
- package/dist/es/conditions/schemas/context.js +23 -2
- package/dist/es/conditions/schemas/context.js.map +1 -1
- package/dist/es/conditions/schemas/contract.d.ts +44 -25
- package/dist/es/conditions/schemas/contract.js +4 -4
- package/dist/es/conditions/schemas/contract.js.map +1 -1
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.d.ts +18 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js +21 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js.map +1 -0
- package/dist/es/conditions/schemas/json-api.d.ts +13 -10
- package/dist/es/conditions/schemas/json-rpc.d.ts +14 -11
- package/dist/es/conditions/schemas/jwt.d.ts +22 -0
- package/dist/es/conditions/schemas/jwt.js +16 -0
- package/dist/es/conditions/schemas/jwt.js.map +1 -0
- package/dist/es/conditions/schemas/return-value-test.d.ts +18 -2
- package/dist/es/conditions/schemas/return-value-test.js +7 -2
- package/dist/es/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/es/conditions/schemas/rpc.d.ts +16 -13
- package/dist/es/conditions/schemas/rpc.js +18 -12
- package/dist/es/conditions/schemas/rpc.js.map +1 -1
- package/dist/es/conditions/schemas/time.d.ts +9 -8
- package/dist/es/conditions/schemas/utils.js +2 -0
- package/dist/es/conditions/schemas/utils.js.map +1 -1
- package/dist/es/conditions/shared.d.ts +1 -1
- package/dist/es/conditions/shared.js +1 -1
- package/dist/es/conditions/shared.js.map +1 -1
- package/dist/es/utils.d.ts +2 -0
- package/dist/es/utils.js +43 -0
- package/dist/es/utils.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +13 -8
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
declare const
|
|
2
|
+
export declare const functionAbiVariableSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
type: z.ZodEnum<[string, ...string[]]>;
|
|
5
|
+
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
type: string;
|
|
8
|
+
name: string;
|
|
9
|
+
internalType: string;
|
|
10
|
+
}, {
|
|
11
|
+
type: string;
|
|
12
|
+
name: string;
|
|
13
|
+
internalType: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const functionAbiSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
3
16
|
name: z.ZodString;
|
|
4
17
|
type: z.ZodLiteral<"function">;
|
|
5
18
|
inputs: z.ZodArray<z.ZodObject<{
|
|
@@ -140,21 +153,28 @@ declare const functionAbiSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
140
153
|
}>;
|
|
141
154
|
export type FunctionAbiProps = z.infer<typeof functionAbiSchema>;
|
|
142
155
|
export declare const ContractConditionType = "contract";
|
|
143
|
-
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
144
|
-
|
|
156
|
+
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
157
|
+
conditionType: z.ZodString;
|
|
158
|
+
}, {
|
|
159
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
160
|
+
chain: z.ZodNumber;
|
|
161
|
+
method: z.ZodEnum<["eth_getBalance"]>;
|
|
162
|
+
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>, z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodEnum<["earliest", "finalized", "safe", "latest", "pending"]>]>, z.ZodString]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>], null>]>;
|
|
163
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
145
164
|
index: z.ZodOptional<z.ZodNumber>;
|
|
146
165
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
166
|
+
}, {
|
|
147
167
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
148
|
-
}
|
|
168
|
+
}>, "strip", z.ZodTypeAny, {
|
|
149
169
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
150
|
-
index?: number | undefined;
|
|
151
170
|
value?: any;
|
|
171
|
+
index?: number | undefined;
|
|
152
172
|
}, {
|
|
153
173
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
154
|
-
index?: number | undefined;
|
|
155
174
|
value?: any;
|
|
175
|
+
index?: number | undefined;
|
|
156
176
|
}>;
|
|
157
|
-
|
|
177
|
+
}>, {
|
|
158
178
|
conditionType: z.ZodDefault<z.ZodLiteral<"contract">>;
|
|
159
179
|
contractAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
160
180
|
standardContractType: z.ZodOptional<z.ZodEnum<["ERC20", "ERC721"]>>;
|
|
@@ -299,18 +319,17 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
299
319
|
stateMutability: "view" | "pure";
|
|
300
320
|
}>>;
|
|
301
321
|
parameters: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
302
|
-
}
|
|
322
|
+
}>, "strip", z.ZodTypeAny, {
|
|
303
323
|
conditionType: "contract";
|
|
324
|
+
chain: number;
|
|
304
325
|
method: string;
|
|
326
|
+
parameters: any[];
|
|
305
327
|
returnValueTest: {
|
|
306
328
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
307
|
-
index?: number | undefined;
|
|
308
329
|
value?: any;
|
|
330
|
+
index?: number | undefined;
|
|
309
331
|
};
|
|
310
|
-
parameters: any[];
|
|
311
|
-
chain: number;
|
|
312
332
|
contractAddress: string;
|
|
313
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
314
333
|
functionAbi?: {
|
|
315
334
|
type: "function";
|
|
316
335
|
name: string;
|
|
@@ -330,18 +349,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
330
349
|
}[]];
|
|
331
350
|
stateMutability: "view" | "pure";
|
|
332
351
|
} | undefined;
|
|
352
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
333
353
|
}, {
|
|
354
|
+
chain: number;
|
|
334
355
|
method: string;
|
|
356
|
+
parameters: any[];
|
|
335
357
|
returnValueTest: {
|
|
336
358
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
337
|
-
index?: number | undefined;
|
|
338
359
|
value?: any;
|
|
360
|
+
index?: number | undefined;
|
|
339
361
|
};
|
|
340
|
-
parameters: any[];
|
|
341
|
-
chain: number;
|
|
342
362
|
contractAddress: string;
|
|
343
363
|
conditionType?: "contract" | undefined;
|
|
344
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
345
364
|
functionAbi?: {
|
|
346
365
|
type: "function";
|
|
347
366
|
name: string;
|
|
@@ -361,18 +380,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
361
380
|
}[]];
|
|
362
381
|
stateMutability: "view" | "pure";
|
|
363
382
|
} | undefined;
|
|
383
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
364
384
|
}>, {
|
|
365
385
|
conditionType: "contract";
|
|
386
|
+
chain: number;
|
|
366
387
|
method: string;
|
|
388
|
+
parameters: any[];
|
|
367
389
|
returnValueTest: {
|
|
368
390
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
369
|
-
index?: number | undefined;
|
|
370
391
|
value?: any;
|
|
392
|
+
index?: number | undefined;
|
|
371
393
|
};
|
|
372
|
-
parameters: any[];
|
|
373
|
-
chain: number;
|
|
374
394
|
contractAddress: string;
|
|
375
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
376
395
|
functionAbi?: {
|
|
377
396
|
type: "function";
|
|
378
397
|
name: string;
|
|
@@ -392,18 +411,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
392
411
|
}[]];
|
|
393
412
|
stateMutability: "view" | "pure";
|
|
394
413
|
} | undefined;
|
|
414
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
395
415
|
}, {
|
|
416
|
+
chain: number;
|
|
396
417
|
method: string;
|
|
418
|
+
parameters: any[];
|
|
397
419
|
returnValueTest: {
|
|
398
420
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
399
|
-
index?: number | undefined;
|
|
400
421
|
value?: any;
|
|
422
|
+
index?: number | undefined;
|
|
401
423
|
};
|
|
402
|
-
parameters: any[];
|
|
403
|
-
chain: number;
|
|
404
424
|
contractAddress: string;
|
|
405
425
|
conditionType?: "contract" | undefined;
|
|
406
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
407
426
|
functionAbi?: {
|
|
408
427
|
type: "function";
|
|
409
428
|
name: string;
|
|
@@ -423,6 +442,6 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
423
442
|
}[]];
|
|
424
443
|
stateMutability: "view" | "pure";
|
|
425
444
|
} | undefined;
|
|
445
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
426
446
|
}>;
|
|
427
447
|
export type ContractConditionProps = z.infer<typeof contractConditionSchema>;
|
|
428
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.contractConditionSchema = exports.ContractConditionType = void 0;
|
|
3
|
+
exports.contractConditionSchema = exports.ContractConditionType = exports.functionAbiSchema = exports.functionAbiVariableSchema = void 0;
|
|
4
4
|
const shared_1 = require("@nucypher/shared");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
6
|
const zod_1 = require("zod");
|
|
@@ -19,19 +19,19 @@ const EthBaseTypes = [
|
|
|
19
19
|
...Array.from({ length: 32 }, (_v, i) => `uint${8 * (i + 1)}`), // uint8 through uint256
|
|
20
20
|
...Array.from({ length: 32 }, (_v, i) => `int${8 * (i + 1)}`), // int8 through int256
|
|
21
21
|
];
|
|
22
|
-
|
|
22
|
+
exports.functionAbiVariableSchema = zod_1.z
|
|
23
23
|
.object({
|
|
24
24
|
name: zod_1.z.string(),
|
|
25
25
|
type: zod_1.z.enum(EthBaseTypes),
|
|
26
26
|
internalType: zod_1.z.enum(EthBaseTypes), // TODO: Do we need to validate this?
|
|
27
27
|
})
|
|
28
28
|
.strict();
|
|
29
|
-
|
|
29
|
+
exports.functionAbiSchema = zod_1.z
|
|
30
30
|
.object({
|
|
31
31
|
name: zod_1.z.string(),
|
|
32
32
|
type: zod_1.z.literal('function'),
|
|
33
|
-
inputs: zod_1.z.array(functionAbiVariableSchema).min(0),
|
|
34
|
-
outputs: zod_1.z.array(functionAbiVariableSchema).nonempty(),
|
|
33
|
+
inputs: zod_1.z.array(exports.functionAbiVariableSchema).min(0),
|
|
34
|
+
outputs: zod_1.z.array(exports.functionAbiVariableSchema).nonempty(),
|
|
35
35
|
stateMutability: zod_1.z.union([zod_1.z.literal('view'), zod_1.z.literal('pure')]),
|
|
36
36
|
})
|
|
37
37
|
.strict()
|
|
@@ -67,8 +67,8 @@ exports.contractConditionSchema = rpc_1.rpcConditionSchema
|
|
|
67
67
|
contractAddress: shared_1.EthAddressSchema,
|
|
68
68
|
standardContractType: zod_1.z.enum(['ERC20', 'ERC721']).optional(),
|
|
69
69
|
method: zod_1.z.string(),
|
|
70
|
-
functionAbi: functionAbiSchema.optional(),
|
|
71
|
-
parameters: zod_1.z.array(context_1.
|
|
70
|
+
functionAbi: exports.functionAbiSchema.optional(),
|
|
71
|
+
parameters: zod_1.z.array(context_1.blockchainParamOrContextParamSchema),
|
|
72
72
|
})
|
|
73
73
|
// Adding this custom logic causes the return type to be ZodEffects instead of ZodObject
|
|
74
74
|
// https://github.com/colinhacks/zod/issues/2474
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/contract.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AACpD,mCAAgC;AAChC,6BAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/contract.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is used by zod2md to generate markdown documentation for the Zod schemas.
|
|
3
|
+
*
|
|
4
|
+
* NOTE: The order of the exported Zod objects in this file dictates the order of the generated markdown.
|
|
5
|
+
*/
|
|
6
|
+
export * from './utils';
|
|
7
|
+
export * from './common';
|
|
8
|
+
export * from './context';
|
|
9
|
+
export * from './compound';
|
|
10
|
+
export * from './contract';
|
|
11
|
+
export * from './if-then-else';
|
|
12
|
+
export * from './json-api';
|
|
13
|
+
export * from './json-rpc';
|
|
14
|
+
export * from './jwt';
|
|
15
|
+
export * from './return-value-test';
|
|
16
|
+
export * from './rpc';
|
|
17
|
+
export * from './sequential';
|
|
18
|
+
export * from './time';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file is used by zod2md to generate markdown documentation for the Zod schemas.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: The order of the exported Zod objects in this file dictates the order of the generated markdown.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
__exportStar(require("./utils"), exports);
|
|
23
|
+
// ts-unused-exports:disable-next-line - this comment line is added to prevent lint from changing or objecting the export order.
|
|
24
|
+
__exportStar(require("./common"), exports);
|
|
25
|
+
__exportStar(require("./context"), exports);
|
|
26
|
+
// ts-unused-exports:disable-next-line - this comment line is added to prevent lint from changing or objecting the export order.
|
|
27
|
+
__exportStar(require("./compound"), exports);
|
|
28
|
+
__exportStar(require("./contract"), exports);
|
|
29
|
+
__exportStar(require("./if-then-else"), exports);
|
|
30
|
+
__exportStar(require("./json-api"), exports);
|
|
31
|
+
__exportStar(require("./json-rpc"), exports);
|
|
32
|
+
__exportStar(require("./jwt"), exports);
|
|
33
|
+
__exportStar(require("./return-value-test"), exports);
|
|
34
|
+
__exportStar(require("./rpc"), exports);
|
|
35
|
+
__exportStar(require("./sequential"), exports);
|
|
36
|
+
__exportStar(require("./time"), exports);
|
|
37
|
+
//# sourceMappingURL=export-for-zod-doc-gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-for-zod-doc-gen.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/export-for-zod-doc-gen.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,gIAAgI;AAChI,2CAAyB;AACzB,4CAA0B;AAC1B,gIAAgI;AAChI,6CAA2B;AAC3B,6CAA2B;AAC3B,iDAA+B;AAC/B,6CAA2B;AAC3B,6CAA2B;AAC3B,wCAAsB;AACtB,sDAAoC;AACpC,wCAAsB;AACtB,+CAA6B;AAC7B,yCAAuB"}
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const JsonApiConditionType = "json-api";
|
|
3
|
-
export declare const jsonApiConditionSchema: z.ZodObject<{
|
|
3
|
+
export declare const jsonApiConditionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
4
|
+
conditionType: z.ZodString;
|
|
5
|
+
}, {
|
|
4
6
|
conditionType: z.ZodDefault<z.ZodLiteral<"json-api">>;
|
|
5
7
|
endpoint: z.ZodEffects<z.ZodString, string, string>;
|
|
6
8
|
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7
9
|
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
8
10
|
authorizationToken: z.ZodOptional<z.ZodString>;
|
|
9
|
-
returnValueTest: z.ZodObject<{
|
|
11
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
10
12
|
index: z.ZodOptional<z.ZodNumber>;
|
|
11
13
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
14
|
+
}, {
|
|
12
15
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
13
|
-
}
|
|
16
|
+
}>, "strip", z.ZodTypeAny, {
|
|
14
17
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
15
|
-
index?: number | undefined;
|
|
16
18
|
value?: any;
|
|
19
|
+
index?: number | undefined;
|
|
17
20
|
}, {
|
|
18
21
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
19
|
-
index?: number | undefined;
|
|
20
22
|
value?: any;
|
|
23
|
+
index?: number | undefined;
|
|
21
24
|
}>;
|
|
22
|
-
}
|
|
25
|
+
}>, "strip", z.ZodTypeAny, {
|
|
23
26
|
conditionType: "json-api";
|
|
24
|
-
endpoint: string;
|
|
25
27
|
returnValueTest: {
|
|
26
28
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
27
|
-
index?: number | undefined;
|
|
28
29
|
value?: any;
|
|
30
|
+
index?: number | undefined;
|
|
29
31
|
};
|
|
32
|
+
endpoint: string;
|
|
30
33
|
parameters?: Record<string, unknown> | undefined;
|
|
31
34
|
query?: string | undefined;
|
|
32
35
|
authorizationToken?: string | undefined;
|
|
33
36
|
}, {
|
|
34
|
-
endpoint: string;
|
|
35
37
|
returnValueTest: {
|
|
36
38
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
37
|
-
index?: number | undefined;
|
|
38
39
|
value?: any;
|
|
40
|
+
index?: number | undefined;
|
|
39
41
|
};
|
|
42
|
+
endpoint: string;
|
|
40
43
|
conditionType?: "json-api" | undefined;
|
|
41
44
|
parameters?: Record<string, unknown> | undefined;
|
|
42
45
|
query?: string | undefined;
|
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const JsonRpcConditionType = "json-rpc";
|
|
3
|
-
export declare const jsonRpcConditionSchema: z.ZodObject<{
|
|
3
|
+
export declare const jsonRpcConditionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
4
|
+
conditionType: z.ZodString;
|
|
5
|
+
}, {
|
|
4
6
|
conditionType: z.ZodDefault<z.ZodLiteral<"json-rpc">>;
|
|
5
7
|
endpoint: z.ZodEffects<z.ZodString, string, string>;
|
|
6
8
|
method: z.ZodString;
|
|
7
9
|
params: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
8
10
|
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
9
11
|
authorizationToken: z.ZodOptional<z.ZodString>;
|
|
10
|
-
returnValueTest: z.ZodObject<{
|
|
12
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
11
13
|
index: z.ZodOptional<z.ZodNumber>;
|
|
12
14
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
15
|
+
}, {
|
|
13
16
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
14
|
-
}
|
|
17
|
+
}>, "strip", z.ZodTypeAny, {
|
|
15
18
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
16
|
-
index?: number | undefined;
|
|
17
19
|
value?: any;
|
|
20
|
+
index?: number | undefined;
|
|
18
21
|
}, {
|
|
19
22
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
20
|
-
index?: number | undefined;
|
|
21
23
|
value?: any;
|
|
24
|
+
index?: number | undefined;
|
|
22
25
|
}>;
|
|
23
|
-
}
|
|
26
|
+
}>, "strip", z.ZodTypeAny, {
|
|
24
27
|
conditionType: "json-rpc";
|
|
25
|
-
endpoint: string;
|
|
26
28
|
method: string;
|
|
27
29
|
returnValueTest: {
|
|
28
30
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
29
|
-
index?: number | undefined;
|
|
30
31
|
value?: any;
|
|
32
|
+
index?: number | undefined;
|
|
31
33
|
};
|
|
34
|
+
endpoint: string;
|
|
32
35
|
params?: unknown[] | Record<string, unknown> | undefined;
|
|
33
36
|
query?: string | undefined;
|
|
34
37
|
authorizationToken?: string | undefined;
|
|
35
38
|
}, {
|
|
36
|
-
endpoint: string;
|
|
37
39
|
method: string;
|
|
38
40
|
returnValueTest: {
|
|
39
41
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
40
|
-
index?: number | undefined;
|
|
41
42
|
value?: any;
|
|
43
|
+
index?: number | undefined;
|
|
42
44
|
};
|
|
43
|
-
|
|
45
|
+
endpoint: string;
|
|
44
46
|
params?: unknown[] | Record<string, unknown> | undefined;
|
|
47
|
+
conditionType?: "json-rpc" | undefined;
|
|
45
48
|
query?: string | undefined;
|
|
46
49
|
authorizationToken?: string | undefined;
|
|
47
50
|
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const JWT_PARAM_DEFAULT = ":jwtToken";
|
|
3
|
+
export declare const JWTConditionType = "jwt";
|
|
4
|
+
export declare const jwtConditionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
5
|
+
conditionType: z.ZodString;
|
|
6
|
+
}, {
|
|
7
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"jwt">>;
|
|
8
|
+
publicKey: z.ZodString;
|
|
9
|
+
expectedIssuer: z.ZodOptional<z.ZodString>;
|
|
10
|
+
jwtToken: z.ZodDefault<z.ZodString>;
|
|
11
|
+
}>, "strip", z.ZodTypeAny, {
|
|
12
|
+
conditionType: "jwt";
|
|
13
|
+
publicKey: string;
|
|
14
|
+
jwtToken: string;
|
|
15
|
+
expectedIssuer?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
publicKey: string;
|
|
18
|
+
conditionType?: "jwt" | undefined;
|
|
19
|
+
expectedIssuer?: string | undefined;
|
|
20
|
+
jwtToken?: string | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export type JWTConditionProps = z.infer<typeof jwtConditionSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jwtConditionSchema = exports.JWTConditionType = exports.JWT_PARAM_DEFAULT = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
const context_1 = require("./context");
|
|
7
|
+
exports.JWT_PARAM_DEFAULT = ':jwtToken';
|
|
8
|
+
exports.JWTConditionType = 'jwt';
|
|
9
|
+
exports.jwtConditionSchema = common_1.baseConditionSchema.extend({
|
|
10
|
+
conditionType: zod_1.z.literal(exports.JWTConditionType).default(exports.JWTConditionType),
|
|
11
|
+
publicKey: zod_1.z.string(),
|
|
12
|
+
expectedIssuer: zod_1.z.string().optional(),
|
|
13
|
+
// TODO see https://github.com/nucypher/taco-web/pull/604#discussion_r1901746814
|
|
14
|
+
// subject: contextParamSchema.optional(),
|
|
15
|
+
// expirationWindow: z.number().int().nonnegative().optional(),
|
|
16
|
+
// issuedWindow: z.number().int().nonnegative().optional(),
|
|
17
|
+
jwtToken: context_1.contextParamSchema.default(exports.JWT_PARAM_DEFAULT),
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=jwt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/jwt.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,qCAA+C;AAC/C,uCAA+C;AAElC,QAAA,iBAAiB,GAAG,WAAW,CAAC;AAEhC,QAAA,gBAAgB,GAAG,KAAK,CAAC;AAEzB,QAAA,kBAAkB,GAAG,4BAAmB,CAAC,MAAM,CAAC;IAC3D,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAgB,CAAC,CAAC,OAAO,CAAC,wBAAgB,CAAC;IACpE,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,gFAAgF;IAChF,0CAA0C;IAC1C,+DAA+D;IAC/D,2DAA2D;IAC3D,QAAQ,EAAE,4BAAkB,CAAC,OAAO,CAAC,yBAAiB,CAAC;CACxD,CAAC,CAAC"}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const returnValueTestSchema: z.ZodObject<{
|
|
2
|
+
export declare const returnValueTestSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
3
|
index: z.ZodOptional<z.ZodNumber>;
|
|
4
4
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
5
|
+
}, {
|
|
5
6
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
6
|
-
}
|
|
7
|
+
}>, "strip", z.ZodTypeAny, {
|
|
7
8
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
9
|
+
value?: any;
|
|
8
10
|
index?: number | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
9
13
|
value?: any;
|
|
14
|
+
index?: number | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const blockchainReturnValueTestSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
17
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
10
19
|
}, {
|
|
20
|
+
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
21
|
+
}>, "strip", z.ZodTypeAny, {
|
|
11
22
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
23
|
+
value?: any;
|
|
12
24
|
index?: number | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
13
27
|
value?: any;
|
|
28
|
+
index?: number | undefined;
|
|
14
29
|
}>;
|
|
15
30
|
export type ReturnValueTestProps = z.infer<typeof returnValueTestSchema>;
|
|
31
|
+
export type BlockchainReturnValueTestProps = z.infer<typeof blockchainReturnValueTestSchema>;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.returnValueTestSchema = void 0;
|
|
3
|
+
exports.blockchainReturnValueTestSchema = exports.returnValueTestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const context_1 = require("./context");
|
|
6
|
-
|
|
6
|
+
const returnValueTestBaseSchema = zod_1.z.object({
|
|
7
7
|
index: zod_1.z.number().int().nonnegative().optional(),
|
|
8
8
|
comparator: zod_1.z.enum(['==', '>', '<', '>=', '<=', '!=']),
|
|
9
|
+
});
|
|
10
|
+
exports.returnValueTestSchema = returnValueTestBaseSchema.extend({
|
|
9
11
|
value: context_1.paramOrContextParamSchema,
|
|
10
12
|
});
|
|
13
|
+
exports.blockchainReturnValueTestSchema = returnValueTestBaseSchema.extend({
|
|
14
|
+
value: context_1.blockchainParamOrContextParamSchema,
|
|
15
|
+
});
|
|
11
16
|
//# sourceMappingURL=return-value-test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"return-value-test.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/return-value-test.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"return-value-test.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/return-value-test.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,uCAGmB;AAEnB,MAAM,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAChD,UAAU,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;CACvD,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,yBAAyB,CAAC,MAAM,CAAC;IACpE,KAAK,EAAE,mCAAyB;CACjC,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,yBAAyB,CAAC,MAAM,CAC7E;IACE,KAAK,EAAE,6CAAmC;CAC3C,CACF,CAAC"}
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const RpcConditionType = "rpc";
|
|
3
|
-
export declare const rpcConditionSchema: z.ZodObject<{
|
|
3
|
+
export declare const rpcConditionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
4
|
+
conditionType: z.ZodString;
|
|
5
|
+
}, {
|
|
4
6
|
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
5
7
|
chain: z.ZodNumber;
|
|
6
8
|
method: z.ZodEnum<["eth_getBalance"]>;
|
|
7
|
-
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.
|
|
8
|
-
returnValueTest: z.ZodObject<{
|
|
9
|
+
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>, z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodEnum<["earliest", "finalized", "safe", "latest", "pending"]>]>, z.ZodString]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>], null>]>;
|
|
10
|
+
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
9
11
|
index: z.ZodOptional<z.ZodNumber>;
|
|
10
12
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
13
|
+
}, {
|
|
11
14
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
12
|
-
}
|
|
15
|
+
}>, "strip", z.ZodTypeAny, {
|
|
13
16
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
14
|
-
index?: number | undefined;
|
|
15
17
|
value?: any;
|
|
18
|
+
index?: number | undefined;
|
|
16
19
|
}, {
|
|
17
20
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
18
|
-
index?: number | undefined;
|
|
19
21
|
value?: any;
|
|
22
|
+
index?: number | undefined;
|
|
20
23
|
}>;
|
|
21
|
-
}
|
|
24
|
+
}>, "strip", z.ZodTypeAny, {
|
|
22
25
|
conditionType: "rpc";
|
|
26
|
+
chain: number;
|
|
23
27
|
method: "eth_getBalance";
|
|
28
|
+
parameters: [string, string | number] | [string];
|
|
24
29
|
returnValueTest: {
|
|
25
30
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
26
|
-
index?: number | undefined;
|
|
27
31
|
value?: any;
|
|
32
|
+
index?: number | undefined;
|
|
28
33
|
};
|
|
29
|
-
parameters: [string] | [string, string | number];
|
|
30
|
-
chain: number;
|
|
31
34
|
}, {
|
|
35
|
+
chain: number;
|
|
32
36
|
method: "eth_getBalance";
|
|
37
|
+
parameters: [string, string | number] | [string];
|
|
33
38
|
returnValueTest: {
|
|
34
39
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
35
|
-
index?: number | undefined;
|
|
36
40
|
value?: any;
|
|
41
|
+
index?: number | undefined;
|
|
37
42
|
};
|
|
38
|
-
parameters: [string] | [string, string | number];
|
|
39
|
-
chain: number;
|
|
40
43
|
conditionType?: "rpc" | undefined;
|
|
41
44
|
}>;
|
|
42
45
|
export type RpcConditionProps = z.infer<typeof rpcConditionSchema>;
|
|
@@ -12,23 +12,29 @@ const EthAddressOrContextVariableSchema = zod_1.z.union([
|
|
|
12
12
|
common_1.UserAddressSchema,
|
|
13
13
|
context_1.contextParamSchema,
|
|
14
14
|
]);
|
|
15
|
-
const BlockOrContextParamSchema = zod_1.z
|
|
16
|
-
shared_1.BlockIdentifierSchema,
|
|
17
|
-
|
|
18
|
-
]);
|
|
15
|
+
const BlockOrContextParamSchema = zod_1.z
|
|
16
|
+
.union([shared_1.BlockIdentifierSchema, context_1.contextParamSchema])
|
|
17
|
+
.describe('A block identifier or a context variable that will be replaced with a block identifier at execution time.');
|
|
19
18
|
// eth_getBalance schema specification
|
|
20
19
|
// - Ethereum spec: https://ethereum.github.io/execution-apis/api-documentation/
|
|
21
20
|
// - web3py: https://web3py.readthedocs.io/en/stable/web3.eth.html#web3.eth.Eth.get_balance
|
|
22
|
-
exports.rpcConditionSchema = common_1.baseConditionSchema
|
|
21
|
+
exports.rpcConditionSchema = common_1.baseConditionSchema
|
|
22
|
+
.extend({
|
|
23
23
|
conditionType: zod_1.z.literal(exports.RpcConditionType).default(exports.RpcConditionType),
|
|
24
24
|
chain: zod_1.z.number().int().nonnegative(),
|
|
25
|
-
method: zod_1.z
|
|
25
|
+
method: zod_1.z
|
|
26
|
+
.enum(['eth_getBalance'])
|
|
27
|
+
.describe("Only 'eth_getBalance' method is supported"),
|
|
26
28
|
parameters: zod_1.z.union([
|
|
27
29
|
// Spec requires 2 parameters: an address and a block identifier
|
|
28
|
-
zod_1.z
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
zod_1.z
|
|
31
|
+
.tuple([EthAddressOrContextVariableSchema, BlockOrContextParamSchema])
|
|
32
|
+
.describe('Spec requires 2 parameters - an address and a block identifier'),
|
|
33
|
+
zod_1.z
|
|
34
|
+
.tuple([EthAddressOrContextVariableSchema])
|
|
35
|
+
.describe("Block identifier, which defaults to 'latest' if not specified"),
|
|
31
36
|
]),
|
|
32
|
-
returnValueTest: return_value_test_1.
|
|
33
|
-
})
|
|
37
|
+
returnValueTest: return_value_test_1.blockchainReturnValueTestSchema, // Update to allow multiple return values after expanding supported methods
|
|
38
|
+
})
|
|
39
|
+
.describe('RPC Condition for calling [Ethereum JSON RPC APIs](https://ethereum.github.io/execution-apis/api-documentation/)');
|
|
34
40
|
//# sourceMappingURL=rpc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/rpc.ts"],"names":[],"mappings":";;;AAAA,6CAA2E;AAC3E,6BAAwB;AAExB,qCAAkE;AAClE,uCAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/rpc.ts"],"names":[],"mappings":";;;AAAA,6CAA2E;AAC3E,6BAAwB;AAExB,qCAAkE;AAClE,uCAA+C;AAC/C,2DAAsE;AAEzD,QAAA,gBAAgB,GAAG,KAAK,CAAC;AAEtC,MAAM,iCAAiC,GAAG,OAAC,CAAC,KAAK,CAAC;IAChD,yBAAgB;IAChB,0BAAiB;IACjB,4BAAkB;CACnB,CAAC,CAAC;AACH,MAAM,yBAAyB,GAAG,OAAC;KAChC,KAAK,CAAC,CAAC,8BAAqB,EAAE,4BAAkB,CAAC,CAAC;KAClD,QAAQ,CACP,2GAA2G,CAC5G,CAAC;AAEJ,sCAAsC;AACtC,gFAAgF;AAChF,2FAA2F;AAC9E,QAAA,kBAAkB,GAAG,4BAAmB;KAClD,MAAM,CAAC;IACN,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAgB,CAAC,CAAC,OAAO,CAAC,wBAAgB,CAAC;IACpE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,MAAM,EAAE,OAAC;SACN,IAAI,CAAC,CAAC,gBAAgB,CAAC,CAAC;SACxB,QAAQ,CAAC,2CAA2C,CAAC;IACxD,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC;QAClB,gEAAgE;QAChE,OAAC;aACE,KAAK,CAAC,CAAC,iCAAiC,EAAE,yBAAyB,CAAC,CAAC;aACrE,QAAQ,CACP,gEAAgE,CACjE;QACH,OAAC;aACE,KAAK,CAAC,CAAC,iCAAiC,CAAC,CAAC;aAC1C,QAAQ,CACP,+DAA+D,CAChE;KACJ,CAAC;IACF,eAAe,EAAE,mDAA+B,EAAE,2EAA2E;CAC9H,CAAC;KACD,QAAQ,CACP,kHAAkH,CACnH,CAAC"}
|