@seljs/types 1.3.0-beta.11 → 1.3.0-beta.13

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,18 @@
1
+ //#region src/context.ts
2
+ /**
3
+ * All primitive CEL type strings as a runtime array.
4
+ */
5
+ const primitiveCelTypes = [
6
+ "sol_int",
7
+ "sol_address",
8
+ "bool",
9
+ "string",
10
+ "bytes"
11
+ ];
12
+ /**
13
+ * All CEL type strings (primitives + list variants) as a runtime array.
14
+ */
15
+ const contextCelTypes = [...primitiveCelTypes, ...primitiveCelTypes.map((t) => `list<${t}>`)];
16
+ //#endregion
17
+ exports.contextCelTypes = contextCelTypes;
18
+ exports.primitiveCelTypes = primitiveCelTypes;
@@ -10,15 +10,23 @@ type InferCelType<T extends ContextCelType> = T extends `list<${infer E extends
10
10
  type ResolveCelType<T extends ContextFieldDefinition> = T extends ContextCelType ? T : T extends {
11
11
  type: infer U extends ContextCelType;
12
12
  } ? U : never;
13
+ /**
14
+ * All primitive CEL type strings as a runtime array.
15
+ */
16
+ declare const primitiveCelTypes: readonly ["sol_int", "sol_address", "bool", "string", "bytes"];
13
17
  /**
14
18
  * Primitive CEL types valid for user-defined context variables.
15
19
  */
16
- type PrimitiveCelType = "sol_int" | "sol_address" | "bool" | "string" | "bytes";
20
+ type PrimitiveCelType = (typeof primitiveCelTypes)[number];
21
+ /**
22
+ * All CEL type strings (primitives + list variants) as a runtime array.
23
+ */
24
+ declare const contextCelTypes: readonly ["sol_int", "sol_address", "bool", "string", "bytes", ...("list<string>" | "list<sol_int>" | "list<sol_address>" | "list<bool>" | "list<bytes>")[]];
17
25
  /**
18
26
  * All CEL types valid for user-defined context variables.
19
27
  * Includes primitives and list<primitive>.
20
28
  */
21
- type ContextCelType = PrimitiveCelType | `list<${PrimitiveCelType}>`;
29
+ type ContextCelType = (typeof contextCelTypes)[number];
22
30
  /**
23
31
  * Maps primitive CEL type names to their TypeScript representation.
24
32
  */
@@ -54,4 +62,4 @@ type ContextDefinition = Record<string, ContextFieldDefinition>;
54
62
  */
55
63
  type InferContext<T extends ContextDefinition> = { [K in keyof T]: InferCelType<ResolveCelType<T[K]>> };
56
64
  //#endregion
57
- export { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType };
65
+ export { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType, contextCelTypes, primitiveCelTypes };
@@ -10,15 +10,23 @@ type InferCelType<T extends ContextCelType> = T extends `list<${infer E extends
10
10
  type ResolveCelType<T extends ContextFieldDefinition> = T extends ContextCelType ? T : T extends {
11
11
  type: infer U extends ContextCelType;
12
12
  } ? U : never;
13
+ /**
14
+ * All primitive CEL type strings as a runtime array.
15
+ */
16
+ declare const primitiveCelTypes: readonly ["sol_int", "sol_address", "bool", "string", "bytes"];
13
17
  /**
14
18
  * Primitive CEL types valid for user-defined context variables.
15
19
  */
16
- type PrimitiveCelType = "sol_int" | "sol_address" | "bool" | "string" | "bytes";
20
+ type PrimitiveCelType = (typeof primitiveCelTypes)[number];
21
+ /**
22
+ * All CEL type strings (primitives + list variants) as a runtime array.
23
+ */
24
+ declare const contextCelTypes: readonly ["sol_int", "sol_address", "bool", "string", "bytes", ...("list<string>" | "list<sol_int>" | "list<sol_address>" | "list<bool>" | "list<bytes>")[]];
17
25
  /**
18
26
  * All CEL types valid for user-defined context variables.
19
27
  * Includes primitives and list<primitive>.
20
28
  */
21
- type ContextCelType = PrimitiveCelType | `list<${PrimitiveCelType}>`;
29
+ type ContextCelType = (typeof contextCelTypes)[number];
22
30
  /**
23
31
  * Maps primitive CEL type names to their TypeScript representation.
24
32
  */
@@ -54,4 +62,4 @@ type ContextDefinition = Record<string, ContextFieldDefinition>;
54
62
  */
55
63
  type InferContext<T extends ContextDefinition> = { [K in keyof T]: InferCelType<ResolveCelType<T[K]>> };
56
64
  //#endregion
57
- export { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType };
65
+ export { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType, contextCelTypes, primitiveCelTypes };
@@ -0,0 +1,17 @@
1
+ //#region src/context.ts
2
+ /**
3
+ * All primitive CEL type strings as a runtime array.
4
+ */
5
+ const primitiveCelTypes = [
6
+ "sol_int",
7
+ "sol_address",
8
+ "bool",
9
+ "string",
10
+ "bytes"
11
+ ];
12
+ /**
13
+ * All CEL type strings (primitives + list variants) as a runtime array.
14
+ */
15
+ const contextCelTypes = [...primitiveCelTypes, ...primitiveCelTypes.map((t) => `list<${t}>`)];
16
+ //#endregion
17
+ export { contextCelTypes, primitiveCelTypes };
package/dist/index.cjs CHANGED
@@ -4,12 +4,15 @@ const require_solidity_int_type_wrapper = require("./custom-types/solidity-int-t
4
4
  const require_registry = require("./registry.cjs");
5
5
  const require_conversion = require("./conversion.cjs");
6
6
  const require_units = require("./units.cjs");
7
+ const require_context = require("./context.cjs");
7
8
  exports.SOLIDITY_TYPES = require_registry.SOLIDITY_TYPES;
8
9
  exports.SolidityAddressTypeWrapper = require_solidity_address_type_wrapper.SolidityAddressTypeWrapper;
9
10
  exports.SolidityIntTypeWrapper = require_solidity_int_type_wrapper.SolidityIntTypeWrapper;
11
+ exports.contextCelTypes = require_context.contextCelTypes;
10
12
  exports.formatUnitsValue = require_units.formatUnitsValue;
11
13
  exports.isSolidityTypeList = require_conversion.isSolidityTypeList;
12
14
  exports.mapSolidityTypeToCEL = require_conversion.mapSolidityTypeToCEL;
13
15
  exports.parseUnitsValue = require_units.parseUnitsValue;
16
+ exports.primitiveCelTypes = require_context.primitiveCelTypes;
14
17
  exports.toAddress = require_solidity_address_type_wrapper.toAddress;
15
18
  exports.toBigInt = require_solidity_int_type_wrapper.toBigInt;
package/dist/index.d.cts CHANGED
@@ -4,5 +4,5 @@ import { SolidityIntTypeWrapper, toBigInt } from "./custom-types/solidity-int-ty
4
4
  import { SOLIDITY_TYPES } from "./registry.cjs";
5
5
  import { isSolidityTypeList, mapSolidityTypeToCEL } from "./conversion.cjs";
6
6
  import { formatUnitsValue, parseUnitsValue } from "./units.cjs";
7
- import { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType } from "./context.cjs";
8
- export { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType, SOLIDITY_TYPES, SolidityAddressTypeWrapper, SolidityIntTypeWrapper, TypeWrapper, formatUnitsValue, isSolidityTypeList, mapSolidityTypeToCEL, parseUnitsValue, toAddress, toBigInt };
7
+ import { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType, contextCelTypes, primitiveCelTypes } from "./context.cjs";
8
+ export { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType, SOLIDITY_TYPES, SolidityAddressTypeWrapper, SolidityIntTypeWrapper, TypeWrapper, contextCelTypes, formatUnitsValue, isSolidityTypeList, mapSolidityTypeToCEL, parseUnitsValue, primitiveCelTypes, toAddress, toBigInt };
package/dist/index.d.mts CHANGED
@@ -4,5 +4,5 @@ import { SolidityIntTypeWrapper, toBigInt } from "./custom-types/solidity-int-ty
4
4
  import { SOLIDITY_TYPES } from "./registry.mjs";
5
5
  import { isSolidityTypeList, mapSolidityTypeToCEL } from "./conversion.mjs";
6
6
  import { formatUnitsValue, parseUnitsValue } from "./units.mjs";
7
- import { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType } from "./context.mjs";
8
- export { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType, SOLIDITY_TYPES, SolidityAddressTypeWrapper, SolidityIntTypeWrapper, TypeWrapper, formatUnitsValue, isSolidityTypeList, mapSolidityTypeToCEL, parseUnitsValue, toAddress, toBigInt };
7
+ import { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType, contextCelTypes, primitiveCelTypes } from "./context.mjs";
8
+ export { CelTypeToTs, ContextCelType, ContextDefinition, ContextFieldDefinition, InferContext, PrimitiveCelType, SOLIDITY_TYPES, SolidityAddressTypeWrapper, SolidityIntTypeWrapper, TypeWrapper, contextCelTypes, formatUnitsValue, isSolidityTypeList, mapSolidityTypeToCEL, parseUnitsValue, primitiveCelTypes, toAddress, toBigInt };
package/dist/index.mjs CHANGED
@@ -3,4 +3,5 @@ import { SolidityIntTypeWrapper, toBigInt } from "./custom-types/solidity-int-ty
3
3
  import { SOLIDITY_TYPES } from "./registry.mjs";
4
4
  import { isSolidityTypeList, mapSolidityTypeToCEL } from "./conversion.mjs";
5
5
  import { formatUnitsValue, parseUnitsValue } from "./units.mjs";
6
- export { SOLIDITY_TYPES, SolidityAddressTypeWrapper, SolidityIntTypeWrapper, formatUnitsValue, isSolidityTypeList, mapSolidityTypeToCEL, parseUnitsValue, toAddress, toBigInt };
6
+ import { contextCelTypes, primitiveCelTypes } from "./context.mjs";
7
+ export { SOLIDITY_TYPES, SolidityAddressTypeWrapper, SolidityIntTypeWrapper, contextCelTypes, formatUnitsValue, isSolidityTypeList, mapSolidityTypeToCEL, parseUnitsValue, primitiveCelTypes, toAddress, toBigInt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seljs/types",
3
- "version": "1.3.0-beta.11",
3
+ "version": "1.3.0-beta.13",
4
4
  "repository": {
5
5
  "url": "https://github.com/abinnovision/seljs"
6
6
  },
@@ -48,7 +48,7 @@
48
48
  ]
49
49
  },
50
50
  "dependencies": {
51
- "@seljs/common": "1.3.0-beta.11"
51
+ "@seljs/common": "1.3.0-beta.13"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@abinnovision/eslint-config-base": "^3.2.2",