@gearbox-protocol/cli-utils 9.2.0 → 9.2.2

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/schema.js CHANGED
@@ -1,23 +1,62 @@
1
- import {
2
- addressArrayLike,
3
- addressLike,
4
- boolLike,
5
- clientWhitelistItemSchema,
6
- optionalAddressArrayLike,
7
- optionalStringArrayLike,
8
- stringArrayLike,
9
- whitelistItemSchema,
10
- whitelistItemsSchema
11
- } from "./chunk-GGX3YGGH.js";
12
- export {
13
- addressArrayLike,
14
- addressLike,
15
- boolLike,
16
- clientWhitelistItemSchema,
17
- optionalAddressArrayLike,
18
- optionalStringArrayLike,
19
- stringArrayLike,
20
- whitelistItemSchema,
21
- whitelistItemsSchema
22
- };
1
+ import { NetworkType } from "@gearbox-protocol/sdk";
2
+ import { z } from "zod/v4";
3
+ import { getAddress, isAddress } from "viem";
4
+ //#region src/schemas/schema-primitives.ts
5
+ const boolLike = () => z.any().transform((v) => {
6
+ if (typeof v === "string") return ["true", "1"].includes(v.toLowerCase());
7
+ return Boolean(v);
8
+ });
9
+ const stringArrayLike = () => z.union([z.array(z.string()), z.string().transform((val) => val.split(","))]);
10
+ const optionalStringArrayLike = () => stringArrayLike().optional().transform((v) => v?.length ? v : void 0);
11
+ /**
12
+ * Like Address from abitype/zod, but converts an address into an address that is checksum encoded.
13
+ */
14
+ const addressLike = () => z.string().transform((val, ctx) => {
15
+ if (!isAddress(val)) ctx.issues.push({
16
+ code: "custom",
17
+ message: `invalid address ${val}`,
18
+ input: ctx.value
19
+ });
20
+ return getAddress(val);
21
+ });
22
+ const addressArrayLike = () => stringArrayLike().pipe(z.array(addressLike()));
23
+ const optionalAddressArrayLike = () => stringArrayLike().pipe(z.array(addressLike())).optional().transform((v) => v?.length ? v : void 0);
24
+ //#endregion
25
+ //#region src/schemas/whitelist-schema.ts
26
+ /**
27
+ * Schema for editing whitelist items.
28
+ * We can input multiple addresses at once.
29
+ */
30
+ const whitelistItemsSchema = z.object({
31
+ network: NetworkType,
32
+ addresses: z.array(addressLike()).min(1),
33
+ reason: z.string().default(""),
34
+ issue: z.string().optional(),
35
+ expiresAt: z.number().optional()
36
+ });
37
+ /**
38
+ * Schema for a single whitelist item as returned by the API
39
+ */
40
+ const whitelistItemSchema = z.object({
41
+ network: NetworkType,
42
+ category: z.string(),
43
+ address: addressLike(),
44
+ reason: z.string().default(""),
45
+ issue: z.string().optional(),
46
+ contractType: z.string().optional(),
47
+ createdAt: z.number(),
48
+ expiresAt: z.number().optional()
49
+ });
50
+ /**
51
+ * Subset of {@link WhitelistItemSchema} actually consumed by client apps.
52
+ */
53
+ const clientWhitelistItemSchema = whitelistItemSchema.pick({
54
+ address: true,
55
+ reason: true,
56
+ expiresAt: true,
57
+ contractType: true
58
+ });
59
+ //#endregion
60
+ export { addressArrayLike, addressLike, boolLike, clientWhitelistItemSchema, optionalAddressArrayLike, optionalStringArrayLike, stringArrayLike, whitelistItemSchema, whitelistItemsSchema };
61
+
23
62
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../src/schemas/schema-primitives.ts","../src/schemas/whitelist-schema.ts"],"sourcesContent":["import { getAddress, isAddress } from \"viem\";\nimport { z } from \"zod/v4\";\n\nexport const boolLike = () =>\n z.any().transform(v => {\n if (typeof v === \"string\") {\n return [\"true\", \"1\"].includes(v.toLowerCase());\n }\n return Boolean(v);\n });\n\nexport const stringArrayLike = () =>\n z.union([z.array(z.string()), z.string().transform(val => val.split(\",\"))]);\n\nexport const optionalStringArrayLike = () =>\n stringArrayLike()\n .optional()\n .transform(v => (v?.length ? v : undefined));\n\n/**\n * Like Address from abitype/zod, but converts an address into an address that is checksum encoded.\n */\nexport const addressLike = () =>\n z.string().transform((val, ctx) => {\n if (!isAddress(val)) {\n ctx.issues.push({\n code: \"custom\",\n message: `invalid address ${val}`,\n input: ctx.value,\n });\n }\n\n return getAddress(val);\n });\n\nexport const addressArrayLike = () =>\n stringArrayLike().pipe(z.array(addressLike()));\n\nexport const optionalAddressArrayLike = () =>\n stringArrayLike()\n .pipe(z.array(addressLike()))\n .optional()\n .transform(v => (v?.length ? v : undefined));\n","// Mirror of packages/shared/src/whitelist-schema.ts; keep in sync.\nimport { NetworkType } from \"@gearbox-protocol/sdk\";\nimport { z } from \"zod/v4\";\nimport { addressLike } from \"./schema-primitives.js\";\n\n/**\n * Schema for editing whitelist items.\n * We can input multiple addresses at once.\n */\nexport const whitelistItemsSchema = z.object({\n network: NetworkType,\n addresses: z.array(addressLike()).min(1),\n reason: z.string().default(\"\"),\n issue: z.string().optional(),\n expiresAt: z.number().optional(),\n});\n\nexport type WhitelistItems = z.infer<typeof whitelistItemsSchema>;\n\n/**\n * Schema for a single whitelist item as returned by the API\n */\nexport const whitelistItemSchema = z.object({\n network: NetworkType,\n category: z.string(),\n address: addressLike(),\n reason: z.string().default(\"\"),\n issue: z.string().optional(),\n contractType: z.string().optional(),\n createdAt: z.number(),\n expiresAt: z.number().optional(),\n});\n\nexport type WhitelistItem = z.infer<typeof whitelistItemSchema>;\n\n/**\n * Subset of {@link WhitelistItemSchema} actually consumed by client apps.\n */\nexport const clientWhitelistItemSchema = whitelistItemSchema.pick({\n address: true,\n reason: true,\n expiresAt: true,\n contractType: true,\n});\n\nexport type ClientWhitelistItem = z.infer<typeof clientWhitelistItemSchema>;\n"],"mappings":";;;;AAGA,MAAa,iBACX,EAAE,IAAI,CAAC,CAAC,WAAU,MAAK;CACrB,IAAI,OAAO,MAAM,UACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,SAAS,EAAE,YAAY,CAAC;CAE/C,OAAO,QAAQ,CAAC;AAClB,CAAC;AAEH,MAAa,wBACX,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,WAAU,QAAO,IAAI,MAAM,GAAG,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ED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/cli-utils",
3
- "version": "9.2.0",
3
+ "version": "9.2.2",
4
4
  "description": "Utils for creating cli apps",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
@@ -32,34 +32,30 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@aws-sdk/client-s3": "^3.1033.0",
36
- "@aws-sdk/client-secrets-manager": "^3.1033.0",
37
- "@aws-sdk/client-ssm": "^3.1033.0",
38
- "@commander-js/extra-typings": "^14.0.0",
35
+ "@aws-sdk/client-s3": "^3.1088.0",
36
+ "@aws-sdk/client-secrets-manager": "^3.1088.0",
37
+ "@aws-sdk/client-ssm": "^3.1088.0",
38
+ "@commander-js/extra-typings": "^15.0.0",
39
+ "@gearbox-protocol/sdk": "^14.11.10",
39
40
  "@vlad-yakovlev/telegram-md": "^2.1.0",
40
- "abitype": "^1.2.4",
41
- "commander": "^14.0.3",
41
+ "abitype": "^1.3.0",
42
+ "commander": "^15.0.0",
42
43
  "lodash-es": "^4.18.1",
43
- "lru-cache": "^11.3.5",
44
- "p-queue": "^9.1.2",
44
+ "lru-cache": "^11.5.2",
45
+ "p-queue": "^9.3.1",
46
+ "viem": "^2.55.2",
45
47
  "yaml": "^2.8.3",
46
48
  "zod": "^4.3.6"
47
49
  },
48
- "peerDependencies": {
49
- "@gearbox-protocol/sdk": ">=14.10.1",
50
- "viem": "2.52.2"
51
- },
52
50
  "devDependencies": {
53
- "@gearbox-protocol/sdk": "14.10.2",
54
51
  "@types/lodash-es": "^4.17.12",
55
- "@types/node": "^25.9.3",
56
- "tsup": "^8.5.1",
57
- "typescript": "^6.0.3",
58
- "viem": "2.52.2",
59
- "vitest": "^4.1.9"
52
+ "@types/node": "^26.1.1",
53
+ "tsdown": "^0.22.9",
54
+ "typescript": "^7.0.2",
55
+ "vitest": "^4.1.10"
60
56
  },
61
57
  "scripts": {
62
- "build": "tsup",
58
+ "build": "tsdown",
63
59
  "typecheck:ci": "tsc --noEmit",
64
60
  "test": "vitest run"
65
61
  }
@@ -1,63 +0,0 @@
1
- // src/schemas/schema-primitives.ts
2
- import { getAddress, isAddress } from "viem";
3
- import { z } from "zod/v4";
4
- var boolLike = () => z.any().transform((v) => {
5
- if (typeof v === "string") {
6
- return ["true", "1"].includes(v.toLowerCase());
7
- }
8
- return Boolean(v);
9
- });
10
- var stringArrayLike = () => z.union([z.array(z.string()), z.string().transform((val) => val.split(","))]);
11
- var optionalStringArrayLike = () => stringArrayLike().optional().transform((v) => v?.length ? v : void 0);
12
- var addressLike = () => z.string().transform((val, ctx) => {
13
- if (!isAddress(val)) {
14
- ctx.issues.push({
15
- code: "custom",
16
- message: `invalid address ${val}`,
17
- input: ctx.value
18
- });
19
- }
20
- return getAddress(val);
21
- });
22
- var addressArrayLike = () => stringArrayLike().pipe(z.array(addressLike()));
23
- var optionalAddressArrayLike = () => stringArrayLike().pipe(z.array(addressLike())).optional().transform((v) => v?.length ? v : void 0);
24
-
25
- // src/schemas/whitelist-schema.ts
26
- import { NetworkType } from "@gearbox-protocol/sdk";
27
- import { z as z2 } from "zod/v4";
28
- var whitelistItemsSchema = z2.object({
29
- network: NetworkType,
30
- addresses: z2.array(addressLike()).min(1),
31
- reason: z2.string().default(""),
32
- issue: z2.string().optional(),
33
- expiresAt: z2.number().optional()
34
- });
35
- var whitelistItemSchema = z2.object({
36
- network: NetworkType,
37
- category: z2.string(),
38
- address: addressLike(),
39
- reason: z2.string().default(""),
40
- issue: z2.string().optional(),
41
- contractType: z2.string().optional(),
42
- createdAt: z2.number(),
43
- expiresAt: z2.number().optional()
44
- });
45
- var clientWhitelistItemSchema = whitelistItemSchema.pick({
46
- address: true,
47
- reason: true,
48
- expiresAt: true,
49
- contractType: true
50
- });
51
-
52
- export {
53
- boolLike,
54
- stringArrayLike,
55
- optionalStringArrayLike,
56
- addressLike,
57
- addressArrayLike,
58
- optionalAddressArrayLike,
59
- whitelistItemsSchema,
60
- whitelistItemSchema,
61
- clientWhitelistItemSchema
62
- };
63
- //# sourceMappingURL=chunk-GGX3YGGH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/schemas/schema-primitives.ts","../src/schemas/whitelist-schema.ts"],"sourcesContent":["import { getAddress, isAddress } from \"viem\";\nimport { z } from \"zod/v4\";\n\nexport const boolLike = () =>\n z.any().transform(v => {\n if (typeof v === \"string\") {\n return [\"true\", \"1\"].includes(v.toLowerCase());\n }\n return Boolean(v);\n });\n\nexport const stringArrayLike = () =>\n z.union([z.array(z.string()), z.string().transform(val => val.split(\",\"))]);\n\nexport const optionalStringArrayLike = () =>\n stringArrayLike()\n .optional()\n .transform(v => (v?.length ? v : undefined));\n\n/**\n * Like Address from abitype/zod, but converts an address into an address that is checksum encoded.\n */\nexport const addressLike = () =>\n z.string().transform((val, ctx) => {\n if (!isAddress(val)) {\n ctx.issues.push({\n code: \"custom\",\n message: `invalid address ${val}`,\n input: ctx.value,\n });\n }\n\n return getAddress(val);\n });\n\nexport const addressArrayLike = () =>\n stringArrayLike().pipe(z.array(addressLike()));\n\nexport const optionalAddressArrayLike = () =>\n stringArrayLike()\n .pipe(z.array(addressLike()))\n .optional()\n .transform(v => (v?.length ? v : undefined));\n","// Mirror of packages/shared/src/whitelist-schema.ts; keep in sync.\nimport { NetworkType } from \"@gearbox-protocol/sdk\";\nimport { z } from \"zod/v4\";\nimport { addressLike } from \"./schema-primitives.js\";\n\n/**\n * Schema for editing whitelist items.\n * We can input multiple addresses at once.\n */\nexport const whitelistItemsSchema = z.object({\n network: NetworkType,\n addresses: z.array(addressLike()).min(1),\n reason: z.string().default(\"\"),\n issue: z.string().optional(),\n expiresAt: z.number().optional(),\n});\n\nexport type WhitelistItems = z.infer<typeof whitelistItemsSchema>;\n\n/**\n * Schema for a single whitelist item as returned by the API\n */\nexport const whitelistItemSchema = z.object({\n network: NetworkType,\n category: z.string(),\n address: addressLike(),\n reason: z.string().default(\"\"),\n issue: z.string().optional(),\n contractType: z.string().optional(),\n createdAt: z.number(),\n expiresAt: z.number().optional(),\n});\n\nexport type WhitelistItem = z.infer<typeof whitelistItemSchema>;\n\n/**\n * Subset of {@link WhitelistItemSchema} actually consumed by client apps.\n */\nexport const clientWhitelistItemSchema = whitelistItemSchema.pick({\n address: true,\n reason: true,\n expiresAt: true,\n contractType: true,\n});\n\nexport type ClientWhitelistItem = z.infer<typeof clientWhitelistItemSchema>;\n"],"mappings":";AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAS,SAAS;AAEX,IAAM,WAAW,MACtB,EAAE,IAAI,EAAE,UAAU,OAAK;AACrB,MAAI,OAAO,MAAM,UAAU;AACzB,WAAO,CAAC,QAAQ,GAAG,EAAE,SAAS,EAAE,YAAY,CAAC;AAAA,EAC/C;AACA,SAAO,QAAQ,CAAC;AAClB,CAAC;AAEI,IAAM,kBAAkB,MAC7B,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,SAAO,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;AAErE,IAAM,0BAA0B,MACrC,gBAAgB,EACb,SAAS,EACT,UAAU,OAAM,GAAG,SAAS,IAAI,MAAU;AAKxC,IAAM,cAAc,MACzB,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,QAAQ;AACjC,MAAI,CAAC,UAAU,GAAG,GAAG;AACnB,QAAI,OAAO,KAAK;AAAA,MACd,MAAM;AAAA,MACN,SAAS,mBAAmB,GAAG;AAAA,MAC/B,OAAO,IAAI;AAAA,IACb,CAAC;AAAA,EACH;AAEA,SAAO,WAAW,GAAG;AACvB,CAAC;AAEI,IAAM,mBAAmB,MAC9B,gBAAgB,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC,CAAC;AAExC,IAAM,2BAA2B,MACtC,gBAAgB,EACb,KAAK,EAAE,MAAM,YAAY,CAAC,CAAC,EAC3B,SAAS,EACT,UAAU,OAAM,GAAG,SAAS,IAAI,MAAU;;;ACzC/C,SAA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