@kontor/kontor-sdk 1.0.0-alpha.39 → 1.0.0-alpha.40
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/README.md +1 -1
- package/dist/cjs/sdk/actions/kontor/public/call-view.js.map +1 -1
- package/dist/cjs/sdk/chains/definitions/signet.js +2 -2
- package/dist/cjs/sdk/test/e2e.test-deprecated.js +2 -0
- package/dist/cjs/sdk/test/e2e.test-deprecated.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/codecs/bool.js +9 -21
- package/dist/cjs/sdk/utils/wit/codecs/bool.js.map +1 -1
- package/dist/cjs/sdk/utils/wit/codecs/contract-address.js +92 -0
- package/dist/cjs/sdk/utils/wit/codecs/contract-address.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/codecs/index.js +29 -0
- package/dist/cjs/sdk/utils/wit/codecs/index.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/codecs/list.js +21 -95
- package/dist/cjs/sdk/utils/wit/codecs/list.js.map +1 -1
- package/dist/cjs/sdk/utils/wit/codecs/numerics.js +228 -0
- package/dist/cjs/sdk/utils/wit/codecs/numerics.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/codecs/option.js +21 -72
- package/dist/cjs/sdk/utils/wit/codecs/option.js.map +1 -1
- package/dist/cjs/sdk/utils/wit/codecs/result.js +32 -0
- package/dist/cjs/sdk/utils/wit/codecs/result.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/codecs/string.js +16 -21
- package/dist/cjs/sdk/utils/wit/codecs/string.js.map +1 -1
- package/dist/cjs/sdk/utils/wit/codecs/unit.js +11 -19
- package/dist/cjs/sdk/utils/wit/codecs/unit.js.map +1 -1
- package/dist/cjs/sdk/utils/wit/codecs/util.js +185 -0
- package/dist/cjs/sdk/utils/wit/codecs/util.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/decode-wit-parameter.js +297 -163
- package/dist/cjs/sdk/utils/wit/decode-wit-parameter.js.map +1 -1
- package/dist/cjs/sdk/utils/wit/encode-wit-parameters.js +214 -221
- package/dist/cjs/sdk/utils/wit/encode-wit-parameters.js.map +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/cjs/wit/built-ins.js +19 -0
- package/dist/cjs/wit/built-ins.js.map +1 -0
- package/dist/cjs/wit/regex.js +1 -1
- package/dist/cjs/wit/regex.js.map +1 -1
- package/dist/cjs/wit/wit-parser/core/errors/signature.js +17 -2
- package/dist/cjs/wit/wit-parser/core/errors/signature.js.map +1 -1
- package/dist/cjs/wit/wit-parser/core/signatures.js +18 -0
- package/dist/cjs/wit/wit-parser/core/signatures.js.map +1 -1
- package/dist/cjs/wit/wit-parser/core/types/{records.js → user-defined.js} +1 -1
- package/dist/cjs/wit/wit-parser/core/types/user-defined.js.map +1 -0
- package/dist/cjs/wit/wit-parser/core/user-defined.js +271 -0
- package/dist/cjs/wit/wit-parser/core/user-defined.js.map +1 -0
- package/dist/cjs/wit/wit-parser/core/utils.js +29 -7
- package/dist/cjs/wit/wit-parser/core/utils.js.map +1 -1
- package/dist/cjs/wit/wit-parser/parse-wit-parameter.js +9 -3
- package/dist/cjs/wit/wit-parser/parse-wit-parameter.js.map +1 -1
- package/dist/cjs/wit/wit-parser/parse-wit.js +7 -3
- package/dist/cjs/wit/wit-parser/parse-wit.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/call-view.js.map +1 -1
- package/dist/esm/sdk/chains/definitions/signet.js +2 -2
- package/dist/esm/sdk/test/e2e.test-deprecated.js +197 -0
- package/dist/esm/sdk/test/e2e.test-deprecated.js.map +1 -0
- package/dist/esm/sdk/utils/wit/codecs/bool.js +9 -21
- package/dist/esm/sdk/utils/wit/codecs/bool.js.map +1 -1
- package/dist/esm/sdk/utils/wit/codecs/contract-address.js +92 -0
- package/dist/esm/sdk/utils/wit/codecs/contract-address.js.map +1 -0
- package/dist/esm/sdk/utils/wit/codecs/index.js +9 -0
- package/dist/esm/sdk/utils/wit/codecs/index.js.map +1 -0
- package/dist/esm/sdk/utils/wit/codecs/list.js +20 -114
- package/dist/esm/sdk/utils/wit/codecs/list.js.map +1 -1
- package/dist/esm/sdk/utils/wit/codecs/numerics.js +234 -0
- package/dist/esm/sdk/utils/wit/codecs/numerics.js.map +1 -0
- package/dist/esm/sdk/utils/wit/codecs/option.js +21 -88
- package/dist/esm/sdk/utils/wit/codecs/option.js.map +1 -1
- package/dist/esm/sdk/utils/wit/codecs/result.js +29 -0
- package/dist/esm/sdk/utils/wit/codecs/result.js.map +1 -0
- package/dist/esm/sdk/utils/wit/codecs/string.js +22 -22
- package/dist/esm/sdk/utils/wit/codecs/string.js.map +1 -1
- package/dist/esm/sdk/utils/wit/codecs/unit.js +12 -21
- package/dist/esm/sdk/utils/wit/codecs/unit.js.map +1 -1
- package/dist/esm/sdk/utils/wit/codecs/util.js +181 -0
- package/dist/esm/sdk/utils/wit/codecs/util.js.map +1 -0
- package/dist/esm/sdk/utils/wit/decode-wit-parameter.js +322 -188
- package/dist/esm/sdk/utils/wit/decode-wit-parameter.js.map +1 -1
- package/dist/esm/sdk/utils/wit/encode-wit-parameters.js +230 -233
- package/dist/esm/sdk/utils/wit/encode-wit-parameters.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/wit/built-ins.js +16 -0
- package/dist/esm/wit/built-ins.js.map +1 -0
- package/dist/esm/wit/regex.js +1 -1
- package/dist/esm/wit/regex.js.map +1 -1
- package/dist/esm/wit/wit-parser/core/errors/signature.js +15 -1
- package/dist/esm/wit/wit-parser/core/errors/signature.js.map +1 -1
- package/dist/esm/wit/wit-parser/core/signatures.js +14 -0
- package/dist/esm/wit/wit-parser/core/signatures.js.map +1 -1
- package/dist/esm/wit/wit-parser/core/types/signatures.js.map +1 -1
- package/dist/esm/wit/wit-parser/core/types/user-defined.js +2 -0
- package/dist/esm/wit/wit-parser/core/types/user-defined.js.map +1 -0
- package/dist/esm/wit/wit-parser/core/types/utils.js +25 -0
- package/dist/esm/wit/wit-parser/core/types/utils.js.map +1 -1
- package/dist/esm/wit/wit-parser/core/user-defined.js +280 -0
- package/dist/esm/wit/wit-parser/core/user-defined.js.map +1 -0
- package/dist/esm/wit/wit-parser/core/utils.js +33 -36
- package/dist/esm/wit/wit-parser/core/utils.js.map +1 -1
- package/dist/esm/wit/wit-parser/parse-wit-parameter.js +10 -4
- package/dist/esm/wit/wit-parser/parse-wit-parameter.js.map +1 -1
- package/dist/esm/wit/wit-parser/parse-wit.js +8 -4
- package/dist/esm/wit/wit-parser/parse-wit.js.map +1 -1
- package/dist/types/sdk/actions/kontor/public/call-view.d.ts +2 -1
- package/dist/types/sdk/actions/kontor/public/call-view.d.ts.map +1 -1
- package/dist/types/sdk/chains/definitions/signet.d.ts +2 -2
- package/dist/types/sdk/test/e2e.test-deprecated.d.ts +2 -0
- package/dist/types/sdk/test/e2e.test-deprecated.d.ts.map +1 -0
- package/dist/types/sdk/types/contract.d.ts +5 -5
- package/dist/types/sdk/types/contract.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/codecs/bool.d.ts +2 -2
- package/dist/types/sdk/utils/wit/codecs/bool.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/codecs/contract-address.d.ts +5 -0
- package/dist/types/sdk/utils/wit/codecs/contract-address.d.ts.map +1 -0
- package/dist/types/sdk/utils/wit/codecs/index.d.ts +9 -0
- package/dist/types/sdk/utils/wit/codecs/index.d.ts.map +1 -0
- package/dist/types/sdk/utils/wit/codecs/list.d.ts +2 -16
- package/dist/types/sdk/utils/wit/codecs/list.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/codecs/numerics.d.ts +14 -0
- package/dist/types/sdk/utils/wit/codecs/numerics.d.ts.map +1 -0
- package/dist/types/sdk/utils/wit/codecs/option.d.ts +3 -23
- package/dist/types/sdk/utils/wit/codecs/option.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/codecs/result.d.ts +4 -0
- package/dist/types/sdk/utils/wit/codecs/result.d.ts.map +1 -0
- package/dist/types/sdk/utils/wit/codecs/string.d.ts +6 -2
- package/dist/types/sdk/utils/wit/codecs/string.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/codecs/types.d.ts +4 -0
- package/dist/types/sdk/utils/wit/codecs/types.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/codecs/unit.d.ts +2 -11
- package/dist/types/sdk/utils/wit/codecs/unit.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/codecs/util.d.ts +12 -0
- package/dist/types/sdk/utils/wit/codecs/util.d.ts.map +1 -0
- package/dist/types/sdk/utils/wit/decode-wit-parameter.d.ts +9 -31
- package/dist/types/sdk/utils/wit/decode-wit-parameter.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/encode-wit-parameters.d.ts +9 -1
- package/dist/types/sdk/utils/wit/encode-wit-parameters.d.ts.map +1 -1
- package/dist/types/wit/built-ins.d.ts +6 -0
- package/dist/types/wit/built-ins.d.ts.map +1 -0
- package/dist/types/wit/regex.d.ts.map +1 -1
- package/dist/types/wit/utils.d.ts +53 -33
- package/dist/types/wit/utils.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/core/errors/signature.d.ts +7 -1
- package/dist/types/wit/wit-parser/core/errors/signature.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/core/signatures.d.ts +10 -0
- package/dist/types/wit/wit-parser/core/signatures.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/core/types/signatures.d.ts +6 -2
- package/dist/types/wit/wit-parser/core/types/signatures.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/core/types/user-defined.d.ts +134 -0
- package/dist/types/wit/wit-parser/core/types/user-defined.d.ts.map +1 -0
- package/dist/types/wit/wit-parser/core/types/utils.d.ts +86 -11
- package/dist/types/wit/wit-parser/core/types/utils.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/core/user-defined.d.ts +19 -0
- package/dist/types/wit/wit-parser/core/user-defined.d.ts.map +1 -0
- package/dist/types/wit/wit-parser/core/utils.d.ts +8 -4
- package/dist/types/wit/wit-parser/core/utils.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/parse-wit-parameter.d.ts +11 -5
- package/dist/types/wit/wit-parser/parse-wit-parameter.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/parse-wit.d.ts +7 -3
- package/dist/types/wit/wit-parser/parse-wit.d.ts.map +1 -1
- package/dist/types/wit/wit.d.ts +20 -12
- package/dist/types/wit/wit.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/sdk/actions/get-contract.test-d.ts +430 -50
- package/src/sdk/actions/get-contract.test.ts +324 -24
- package/src/sdk/actions/kontor/public/call-view.ts +2 -1
- package/src/sdk/actions/kontor/public/proc-contract.test-d.ts +107 -0
- package/src/sdk/actions/kontor/public/proc-contract.test.ts +234 -21
- package/src/sdk/actions/kontor/public/view-contract.test-d.ts +240 -0
- package/src/sdk/actions/kontor/public/view-contract.test.ts +613 -18
- package/src/sdk/chains/definitions/signet.ts +2 -2
- package/src/sdk/clients/base/create-rpc-client.test.ts +2 -2
- package/src/sdk/clients/create-public-client.test.ts +2 -2
- package/src/sdk/clients/kontor/create-public-client.test.ts +2 -2
- package/src/sdk/clients/transports/http-rpc.test.ts +0 -24
- package/src/sdk/test/e2e.test-deprecated.ts +195 -0
- package/src/sdk/types/contract.test-d.ts +489 -55
- package/src/sdk/types/contract.ts +6 -7
- package/src/sdk/utils/wit/codecs/bool.test.ts +29 -0
- package/src/sdk/utils/wit/codecs/bool.ts +10 -25
- package/src/sdk/utils/wit/codecs/contract-address.test.ts +37 -0
- package/src/sdk/utils/wit/codecs/contract-address.ts +114 -0
- package/src/sdk/utils/wit/codecs/index.ts +20 -0
- package/src/sdk/utils/wit/codecs/list.test-d.ts +13 -0
- package/src/sdk/utils/wit/codecs/list.test.ts +55 -0
- package/src/sdk/utils/wit/codecs/list.ts +21 -150
- package/src/sdk/utils/wit/codecs/numerics.test.ts +399 -0
- package/src/sdk/utils/wit/codecs/numerics.ts +304 -0
- package/src/sdk/utils/wit/codecs/option.test.ts +71 -0
- package/src/sdk/utils/wit/codecs/option.ts +21 -120
- package/src/sdk/utils/wit/codecs/result.test.ts +82 -0
- package/src/sdk/utils/wit/codecs/result.ts +37 -0
- package/src/sdk/utils/wit/codecs/string.test.ts +62 -0
- package/src/sdk/utils/wit/codecs/string.ts +23 -25
- package/src/sdk/utils/wit/codecs/types.ts +5 -0
- package/src/sdk/utils/wit/codecs/unit.test.ts +27 -0
- package/src/sdk/utils/wit/codecs/unit.ts +14 -38
- package/src/sdk/utils/wit/codecs/util.test.ts +221 -0
- package/src/sdk/utils/wit/codecs/util.ts +193 -0
- package/src/sdk/utils/wit/decode-wit-parameter.test.ts +1264 -32
- package/src/sdk/utils/wit/decode-wit-parameter.ts +508 -211
- package/src/sdk/utils/wit/encode-wit-parameters.test.ts +955 -91
- package/src/sdk/utils/wit/encode-wit-parameters.ts +277 -274
- package/src/sdk/utils/wit/get-wit-item.test.ts +1 -1
- package/src/wit/built-ins.ts +23 -0
- package/src/wit/regex.ts +1 -1
- package/src/wit/utils.ts +120 -74
- package/src/wit/wit-parser/core/errors/signature.ts +13 -2
- package/src/wit/wit-parser/core/signatures.ts +28 -0
- package/src/wit/wit-parser/core/types/signatures.test-d.ts +21 -0
- package/src/wit/wit-parser/core/types/signatures.ts +19 -2
- package/src/wit/wit-parser/core/types/user-defined.test-d.ts +1308 -0
- package/src/wit/wit-parser/core/types/user-defined.ts +412 -0
- package/src/wit/wit-parser/core/types/utils.test-d.ts +43 -2
- package/src/wit/wit-parser/core/types/utils.ts +143 -14
- package/src/wit/wit-parser/core/user-defined.test.ts +609 -0
- package/src/wit/wit-parser/core/user-defined.ts +392 -0
- package/src/wit/wit-parser/core/utils.test.ts +334 -115
- package/src/wit/wit-parser/core/utils.ts +54 -38
- package/src/wit/wit-parser/parse-wit-parameter.test.ts +282 -4
- package/src/wit/wit-parser/parse-wit-parameter.ts +37 -11
- package/src/wit/wit-parser/parse-wit.test.ts +738 -12
- package/src/wit/wit-parser/parse-wit.ts +25 -10
- package/src/wit/wit.ts +37 -16
- package/vitest.config.ts +5 -0
- package/dist/cjs/sdk/utils/wit/codecs/decimal.js +0 -148
- package/dist/cjs/sdk/utils/wit/codecs/decimal.js.map +0 -1
- package/dist/cjs/sdk/utils/wit/codecs/enum.js +0 -94
- package/dist/cjs/sdk/utils/wit/codecs/enum.js.map +0 -1
- package/dist/cjs/sdk/utils/wit/codecs/integer.js +0 -125
- package/dist/cjs/sdk/utils/wit/codecs/integer.js.map +0 -1
- package/dist/cjs/sdk/utils/wit/codecs/s64.js +0 -57
- package/dist/cjs/sdk/utils/wit/codecs/s64.js.map +0 -1
- package/dist/cjs/sdk/utils/wit/codecs/u64.js +0 -56
- package/dist/cjs/sdk/utils/wit/codecs/u64.js.map +0 -1
- package/dist/cjs/wit/wit-parser/core/records.js +0 -70
- package/dist/cjs/wit/wit-parser/core/records.js.map +0 -1
- package/dist/cjs/wit/wit-parser/core/types/records.js.map +0 -1
- package/dist/esm/sdk/utils/wit/codecs/decimal.js +0 -165
- package/dist/esm/sdk/utils/wit/codecs/decimal.js.map +0 -1
- package/dist/esm/sdk/utils/wit/codecs/enum.js +0 -104
- package/dist/esm/sdk/utils/wit/codecs/enum.js.map +0 -1
- package/dist/esm/sdk/utils/wit/codecs/integer.js +0 -167
- package/dist/esm/sdk/utils/wit/codecs/integer.js.map +0 -1
- package/dist/esm/sdk/utils/wit/codecs/s64.js +0 -65
- package/dist/esm/sdk/utils/wit/codecs/s64.js.map +0 -1
- package/dist/esm/sdk/utils/wit/codecs/u64.js +0 -63
- package/dist/esm/sdk/utils/wit/codecs/u64.js.map +0 -1
- package/dist/esm/wit/wit-parser/core/records.js +0 -73
- package/dist/esm/wit/wit-parser/core/records.js.map +0 -1
- package/dist/esm/wit/wit-parser/core/types/records.js +0 -2
- package/dist/esm/wit/wit-parser/core/types/records.js.map +0 -1
- package/dist/types/sdk/utils/wit/codecs/decimal.d.ts +0 -42
- package/dist/types/sdk/utils/wit/codecs/decimal.d.ts.map +0 -1
- package/dist/types/sdk/utils/wit/codecs/enum.d.ts +0 -49
- package/dist/types/sdk/utils/wit/codecs/enum.d.ts.map +0 -1
- package/dist/types/sdk/utils/wit/codecs/integer.d.ts +0 -36
- package/dist/types/sdk/utils/wit/codecs/integer.d.ts.map +0 -1
- package/dist/types/sdk/utils/wit/codecs/s64.d.ts +0 -23
- package/dist/types/sdk/utils/wit/codecs/s64.d.ts.map +0 -1
- package/dist/types/sdk/utils/wit/codecs/u64.d.ts +0 -23
- package/dist/types/sdk/utils/wit/codecs/u64.d.ts.map +0 -1
- package/dist/types/wit/wit-parser/core/records.d.ts +0 -4
- package/dist/types/wit/wit-parser/core/records.d.ts.map +0 -1
- package/dist/types/wit/wit-parser/core/types/records.d.ts +0 -51
- package/dist/types/wit/wit-parser/core/types/records.d.ts.map +0 -1
- package/src/sdk/test/e2e.test.ts +0 -194
- package/src/sdk/utils/wit/codecs/decimal.ts +0 -215
- package/src/sdk/utils/wit/codecs/enum.ts +0 -114
- package/src/sdk/utils/wit/codecs/integer.ts +0 -193
- package/src/sdk/utils/wit/codecs/s64.ts +0 -76
- package/src/sdk/utils/wit/codecs/u64.ts +0 -73
- package/src/wit/wit-parser/core/records.test.ts +0 -69
- package/src/wit/wit-parser/core/records.ts +0 -101
- package/src/wit/wit-parser/core/types/records.test-d.ts +0 -331
- package/src/wit/wit-parser/core/types/records.ts +0 -91
|
@@ -19,7 +19,7 @@ expectTypeOf<ParseWit<typeof nativeToken.raw>>().toEqualTypeOf<
|
|
|
19
19
|
];
|
|
20
20
|
readonly outputs: readonly [
|
|
21
21
|
{
|
|
22
|
-
readonly type: "result<
|
|
22
|
+
readonly type: "result<record, error>";
|
|
23
23
|
readonly internalType: "result<mint, error>";
|
|
24
24
|
|
|
25
25
|
readonly components: readonly [
|
|
@@ -50,7 +50,7 @@ expectTypeOf<ParseWit<typeof nativeToken.raw>>().toEqualTypeOf<
|
|
|
50
50
|
];
|
|
51
51
|
readonly outputs: readonly [
|
|
52
52
|
{
|
|
53
|
-
readonly type: "result<
|
|
53
|
+
readonly type: "result<record, error>";
|
|
54
54
|
readonly internalType: "result<burn, error>";
|
|
55
55
|
|
|
56
56
|
readonly components: readonly [
|
|
@@ -86,7 +86,7 @@ expectTypeOf<ParseWit<typeof nativeToken.raw>>().toEqualTypeOf<
|
|
|
86
86
|
];
|
|
87
87
|
readonly outputs: readonly [
|
|
88
88
|
{
|
|
89
|
-
readonly type: "result<
|
|
89
|
+
readonly type: "result<record, error>";
|
|
90
90
|
readonly internalType: "result<transfer, error>";
|
|
91
91
|
|
|
92
92
|
readonly components: readonly [
|
|
@@ -135,7 +135,7 @@ expectTypeOf<ParseWit<typeof nativeToken.raw>>().toEqualTypeOf<
|
|
|
135
135
|
readonly inputs: readonly [];
|
|
136
136
|
readonly outputs: readonly [
|
|
137
137
|
{
|
|
138
|
-
readonly type: "list<
|
|
138
|
+
readonly type: "list<record>";
|
|
139
139
|
readonly internalType: "list<balance>";
|
|
140
140
|
readonly components: readonly [
|
|
141
141
|
{
|
|
@@ -183,7 +183,7 @@ expectTypeOf<ParseWit<typeof nativeToken.raw>>().toEqualTypeOf<
|
|
|
183
183
|
];
|
|
184
184
|
readonly outputs: readonly [
|
|
185
185
|
{
|
|
186
|
-
readonly type: "result<
|
|
186
|
+
readonly type: "result<record, error>";
|
|
187
187
|
readonly internalType: "result<transfer, error>";
|
|
188
188
|
readonly components: readonly [
|
|
189
189
|
{
|
|
@@ -212,7 +212,7 @@ expectTypeOf<ParseWit<typeof nativeToken.raw>>().toEqualTypeOf<
|
|
|
212
212
|
readonly inputs: readonly [];
|
|
213
213
|
readonly outputs: readonly [
|
|
214
214
|
{
|
|
215
|
-
readonly type: "result<
|
|
215
|
+
readonly type: "result<record, error>";
|
|
216
216
|
readonly internalType: "result<transfer, error>";
|
|
217
217
|
readonly components: readonly [
|
|
218
218
|
{
|
|
@@ -255,7 +255,7 @@ describe("parseWit (runtime)", () => {
|
|
|
255
255
|
],
|
|
256
256
|
outputs: [
|
|
257
257
|
{
|
|
258
|
-
type: "result<
|
|
258
|
+
type: "result<record, error>",
|
|
259
259
|
internalType: "result<mint, error>",
|
|
260
260
|
components: [
|
|
261
261
|
{
|
|
@@ -285,7 +285,7 @@ describe("parseWit (runtime)", () => {
|
|
|
285
285
|
],
|
|
286
286
|
outputs: [
|
|
287
287
|
{
|
|
288
|
-
type: "result<
|
|
288
|
+
type: "result<record, error>",
|
|
289
289
|
internalType: "result<burn, error>",
|
|
290
290
|
components: [
|
|
291
291
|
{
|
|
@@ -320,7 +320,7 @@ describe("parseWit (runtime)", () => {
|
|
|
320
320
|
],
|
|
321
321
|
outputs: [
|
|
322
322
|
{
|
|
323
|
-
type: "result<
|
|
323
|
+
type: "result<record, error>",
|
|
324
324
|
internalType: "result<transfer, error>",
|
|
325
325
|
components: [
|
|
326
326
|
{
|
|
@@ -367,7 +367,7 @@ describe("parseWit (runtime)", () => {
|
|
|
367
367
|
inputs: [],
|
|
368
368
|
outputs: [
|
|
369
369
|
{
|
|
370
|
-
type: "list<
|
|
370
|
+
type: "list<record>",
|
|
371
371
|
internalType: "list<balance>",
|
|
372
372
|
components: [
|
|
373
373
|
{
|
|
@@ -414,7 +414,7 @@ describe("parseWit (runtime)", () => {
|
|
|
414
414
|
],
|
|
415
415
|
outputs: [
|
|
416
416
|
{
|
|
417
|
-
type: "result<
|
|
417
|
+
type: "result<record, error>",
|
|
418
418
|
internalType: "result<transfer, error>",
|
|
419
419
|
components: [
|
|
420
420
|
{
|
|
@@ -443,7 +443,7 @@ describe("parseWit (runtime)", () => {
|
|
|
443
443
|
inputs: [],
|
|
444
444
|
outputs: [
|
|
445
445
|
{
|
|
446
|
-
type: "result<
|
|
446
|
+
type: "result<record, error>",
|
|
447
447
|
internalType: "result<transfer, error>",
|
|
448
448
|
components: [
|
|
449
449
|
{
|
|
@@ -468,3 +468,729 @@ describe("parseWit (runtime)", () => {
|
|
|
468
468
|
]);
|
|
469
469
|
});
|
|
470
470
|
});
|
|
471
|
+
|
|
472
|
+
const taskManagerWit = [
|
|
473
|
+
// Enums
|
|
474
|
+
"enum priority { low, medium, high, urgent }",
|
|
475
|
+
"enum status { pending, active, completed, cancelled }",
|
|
476
|
+
|
|
477
|
+
// Records
|
|
478
|
+
"record task-id { id: u64 }",
|
|
479
|
+
"record timestamp { unix-ms: u64 }",
|
|
480
|
+
"record user { name: string, email: string }",
|
|
481
|
+
"record task-metadata { created-at: timestamp, updated-at: timestamp, owner: user }",
|
|
482
|
+
"record task { id: task-id, title: string, description: string, priority: priority, status: status, metadata: task-metadata }",
|
|
483
|
+
|
|
484
|
+
// Variants
|
|
485
|
+
"variant task-event { created(task), updated(task), deleted(task-id), status-changed(status) }",
|
|
486
|
+
"variant filter { by-status(status), by-priority(priority), by-user(user), all }",
|
|
487
|
+
|
|
488
|
+
// Functions
|
|
489
|
+
"export create-task: func(ctx: borrow<proc-context>, title: string, description: string, priority: priority) -> result<task, error>;",
|
|
490
|
+
"export update-status: func(ctx: borrow<proc-context>, id: task-id, new-status: status) -> result<task, error>;",
|
|
491
|
+
"export get-task: func(ctx: borrow<view-context>, id: task-id) -> option<task>;",
|
|
492
|
+
"export list-tasks: func(ctx: borrow<view-context>, filter: filter) -> list<task>;",
|
|
493
|
+
"export get-events: func(ctx: borrow<view-context>) -> list<task-event>;",
|
|
494
|
+
"export delete-task: func(ctx: borrow<proc-context>, id: task-id) -> result<task-id, error>;",
|
|
495
|
+
] as const;
|
|
496
|
+
|
|
497
|
+
type TaskManagerWit = ParseWit<typeof taskManagerWit>;
|
|
498
|
+
|
|
499
|
+
test("ParseWit - create-task function", () => {
|
|
500
|
+
expectTypeOf<TaskManagerWit[0]>().toEqualTypeOf<{
|
|
501
|
+
readonly name: "create-task";
|
|
502
|
+
readonly type: "function";
|
|
503
|
+
readonly context: "proc";
|
|
504
|
+
readonly inputs: readonly [
|
|
505
|
+
{
|
|
506
|
+
readonly name: "title";
|
|
507
|
+
readonly type: "string";
|
|
508
|
+
readonly internalType: "string";
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
readonly name: "description";
|
|
512
|
+
readonly type: "string";
|
|
513
|
+
readonly internalType: "string";
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
readonly name: "priority";
|
|
517
|
+
readonly type: "enum";
|
|
518
|
+
readonly internalType: "priority";
|
|
519
|
+
readonly components: readonly [
|
|
520
|
+
{
|
|
521
|
+
readonly name: "low";
|
|
522
|
+
readonly type: "_";
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
readonly name: "medium";
|
|
526
|
+
readonly type: "_";
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
readonly name: "high";
|
|
530
|
+
readonly type: "_";
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
readonly name: "urgent";
|
|
534
|
+
readonly type: "_";
|
|
535
|
+
},
|
|
536
|
+
];
|
|
537
|
+
},
|
|
538
|
+
];
|
|
539
|
+
readonly outputs: readonly [
|
|
540
|
+
{
|
|
541
|
+
readonly type: "result<record, error>";
|
|
542
|
+
readonly internalType: "result<task, error>";
|
|
543
|
+
readonly components: readonly [
|
|
544
|
+
{
|
|
545
|
+
readonly name: "id";
|
|
546
|
+
readonly type: "record";
|
|
547
|
+
readonly internalType: "task-id";
|
|
548
|
+
readonly components: readonly [
|
|
549
|
+
{
|
|
550
|
+
readonly name: "id";
|
|
551
|
+
readonly type: "u64";
|
|
552
|
+
readonly internalType: "u64";
|
|
553
|
+
},
|
|
554
|
+
];
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
readonly name: "title";
|
|
558
|
+
readonly type: "string";
|
|
559
|
+
readonly internalType: "string";
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
readonly name: "description";
|
|
563
|
+
readonly type: "string";
|
|
564
|
+
readonly internalType: "string";
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
readonly name: "priority";
|
|
568
|
+
readonly type: "enum";
|
|
569
|
+
readonly internalType: "priority";
|
|
570
|
+
readonly components: readonly [
|
|
571
|
+
{
|
|
572
|
+
readonly name: "low";
|
|
573
|
+
readonly type: "_";
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
readonly name: "medium";
|
|
577
|
+
readonly type: "_";
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
readonly name: "high";
|
|
581
|
+
readonly type: "_";
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
readonly name: "urgent";
|
|
585
|
+
readonly type: "_";
|
|
586
|
+
},
|
|
587
|
+
];
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
readonly name: "status";
|
|
591
|
+
readonly type: "enum";
|
|
592
|
+
readonly internalType: "status";
|
|
593
|
+
readonly components: readonly [
|
|
594
|
+
{
|
|
595
|
+
readonly name: "pending";
|
|
596
|
+
readonly type: "_";
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
readonly name: "active";
|
|
600
|
+
readonly type: "_";
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
readonly name: "completed";
|
|
604
|
+
readonly type: "_";
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
readonly name: "cancelled";
|
|
608
|
+
readonly type: "_";
|
|
609
|
+
},
|
|
610
|
+
];
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
readonly name: "metadata";
|
|
614
|
+
readonly type: "record";
|
|
615
|
+
readonly internalType: "task-metadata";
|
|
616
|
+
readonly components: readonly [
|
|
617
|
+
{
|
|
618
|
+
readonly name: "created-at";
|
|
619
|
+
readonly type: "record";
|
|
620
|
+
readonly internalType: "timestamp";
|
|
621
|
+
readonly components: readonly [
|
|
622
|
+
{
|
|
623
|
+
readonly name: "unix-ms";
|
|
624
|
+
readonly type: "u64";
|
|
625
|
+
readonly internalType: "u64";
|
|
626
|
+
},
|
|
627
|
+
];
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
readonly name: "updated-at";
|
|
631
|
+
readonly type: "record";
|
|
632
|
+
readonly internalType: "timestamp";
|
|
633
|
+
readonly components: readonly [
|
|
634
|
+
{
|
|
635
|
+
readonly name: "unix-ms";
|
|
636
|
+
readonly type: "u64";
|
|
637
|
+
readonly internalType: "u64";
|
|
638
|
+
},
|
|
639
|
+
];
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
readonly name: "owner";
|
|
643
|
+
readonly type: "record";
|
|
644
|
+
readonly internalType: "user";
|
|
645
|
+
readonly components: readonly [
|
|
646
|
+
{
|
|
647
|
+
readonly name: "name";
|
|
648
|
+
readonly type: "string";
|
|
649
|
+
readonly internalType: "string";
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
readonly name: "email";
|
|
653
|
+
readonly type: "string";
|
|
654
|
+
readonly internalType: "string";
|
|
655
|
+
},
|
|
656
|
+
];
|
|
657
|
+
},
|
|
658
|
+
];
|
|
659
|
+
},
|
|
660
|
+
];
|
|
661
|
+
},
|
|
662
|
+
];
|
|
663
|
+
}>();
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
test("ParseWit - update-status function", () => {
|
|
667
|
+
expectTypeOf<TaskManagerWit[1]>().toEqualTypeOf<{
|
|
668
|
+
readonly name: "update-status";
|
|
669
|
+
readonly type: "function";
|
|
670
|
+
readonly context: "proc";
|
|
671
|
+
readonly inputs: readonly [
|
|
672
|
+
{
|
|
673
|
+
readonly name: "id";
|
|
674
|
+
readonly type: "record";
|
|
675
|
+
readonly internalType: "task-id";
|
|
676
|
+
readonly components: readonly [
|
|
677
|
+
{
|
|
678
|
+
readonly name: "id";
|
|
679
|
+
readonly type: "u64";
|
|
680
|
+
readonly internalType: "u64";
|
|
681
|
+
},
|
|
682
|
+
];
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
readonly name: "new-status";
|
|
686
|
+
readonly type: "enum";
|
|
687
|
+
readonly internalType: "status";
|
|
688
|
+
readonly components: readonly [
|
|
689
|
+
{
|
|
690
|
+
readonly name: "pending";
|
|
691
|
+
readonly type: "_";
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
readonly name: "active";
|
|
695
|
+
readonly type: "_";
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
readonly name: "completed";
|
|
699
|
+
readonly type: "_";
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
readonly name: "cancelled";
|
|
703
|
+
readonly type: "_";
|
|
704
|
+
},
|
|
705
|
+
];
|
|
706
|
+
},
|
|
707
|
+
];
|
|
708
|
+
readonly outputs: readonly [
|
|
709
|
+
{
|
|
710
|
+
readonly type: "result<record, error>";
|
|
711
|
+
readonly internalType: "result<task, error>";
|
|
712
|
+
readonly components: readonly [
|
|
713
|
+
{
|
|
714
|
+
readonly name: "id";
|
|
715
|
+
readonly type: "record";
|
|
716
|
+
readonly internalType: "task-id";
|
|
717
|
+
readonly components: readonly [
|
|
718
|
+
{
|
|
719
|
+
readonly name: "id";
|
|
720
|
+
readonly type: "u64";
|
|
721
|
+
readonly internalType: "u64";
|
|
722
|
+
},
|
|
723
|
+
];
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
readonly name: "title";
|
|
727
|
+
readonly type: "string";
|
|
728
|
+
readonly internalType: "string";
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
readonly name: "description";
|
|
732
|
+
readonly type: "string";
|
|
733
|
+
readonly internalType: "string";
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
readonly name: "priority";
|
|
737
|
+
readonly type: "enum";
|
|
738
|
+
readonly internalType: "priority";
|
|
739
|
+
readonly components: readonly [
|
|
740
|
+
{
|
|
741
|
+
readonly name: "low";
|
|
742
|
+
readonly type: "_";
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
readonly name: "medium";
|
|
746
|
+
readonly type: "_";
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
readonly name: "high";
|
|
750
|
+
readonly type: "_";
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
readonly name: "urgent";
|
|
754
|
+
readonly type: "_";
|
|
755
|
+
},
|
|
756
|
+
];
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
readonly name: "status";
|
|
760
|
+
readonly type: "enum";
|
|
761
|
+
readonly internalType: "status";
|
|
762
|
+
readonly components: readonly [
|
|
763
|
+
{
|
|
764
|
+
readonly name: "pending";
|
|
765
|
+
readonly type: "_";
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
readonly name: "active";
|
|
769
|
+
readonly type: "_";
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
readonly name: "completed";
|
|
773
|
+
readonly type: "_";
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
readonly name: "cancelled";
|
|
777
|
+
readonly type: "_";
|
|
778
|
+
},
|
|
779
|
+
];
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
readonly name: "metadata";
|
|
783
|
+
readonly type: "record";
|
|
784
|
+
readonly internalType: "task-metadata";
|
|
785
|
+
readonly components: readonly [
|
|
786
|
+
{
|
|
787
|
+
readonly name: "created-at";
|
|
788
|
+
readonly type: "record";
|
|
789
|
+
readonly internalType: "timestamp";
|
|
790
|
+
readonly components: readonly [
|
|
791
|
+
{
|
|
792
|
+
readonly name: "unix-ms";
|
|
793
|
+
readonly type: "u64";
|
|
794
|
+
readonly internalType: "u64";
|
|
795
|
+
},
|
|
796
|
+
];
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
readonly name: "updated-at";
|
|
800
|
+
readonly type: "record";
|
|
801
|
+
readonly internalType: "timestamp";
|
|
802
|
+
readonly components: readonly [
|
|
803
|
+
{
|
|
804
|
+
readonly name: "unix-ms";
|
|
805
|
+
readonly type: "u64";
|
|
806
|
+
readonly internalType: "u64";
|
|
807
|
+
},
|
|
808
|
+
];
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
readonly name: "owner";
|
|
812
|
+
readonly type: "record";
|
|
813
|
+
readonly internalType: "user";
|
|
814
|
+
readonly components: readonly [
|
|
815
|
+
{
|
|
816
|
+
readonly name: "name";
|
|
817
|
+
readonly type: "string";
|
|
818
|
+
readonly internalType: "string";
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
readonly name: "email";
|
|
822
|
+
readonly type: "string";
|
|
823
|
+
readonly internalType: "string";
|
|
824
|
+
},
|
|
825
|
+
];
|
|
826
|
+
},
|
|
827
|
+
];
|
|
828
|
+
},
|
|
829
|
+
];
|
|
830
|
+
},
|
|
831
|
+
];
|
|
832
|
+
}>();
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
test("ParseWit - get-task function", () => {
|
|
836
|
+
expectTypeOf<TaskManagerWit[2]>().toEqualTypeOf<{
|
|
837
|
+
readonly name: "get-task";
|
|
838
|
+
readonly type: "function";
|
|
839
|
+
readonly context: "view";
|
|
840
|
+
readonly inputs: readonly [
|
|
841
|
+
{
|
|
842
|
+
readonly name: "id";
|
|
843
|
+
readonly type: "record";
|
|
844
|
+
readonly internalType: "task-id";
|
|
845
|
+
readonly components: readonly [
|
|
846
|
+
{
|
|
847
|
+
readonly name: "id";
|
|
848
|
+
readonly type: "u64";
|
|
849
|
+
readonly internalType: "u64";
|
|
850
|
+
},
|
|
851
|
+
];
|
|
852
|
+
},
|
|
853
|
+
];
|
|
854
|
+
readonly outputs: readonly [
|
|
855
|
+
{
|
|
856
|
+
readonly type: "option<record>";
|
|
857
|
+
readonly internalType: "option<task>";
|
|
858
|
+
readonly components: readonly [
|
|
859
|
+
{
|
|
860
|
+
readonly name: "id";
|
|
861
|
+
readonly type: "record";
|
|
862
|
+
readonly internalType: "task-id";
|
|
863
|
+
readonly components: readonly [
|
|
864
|
+
{
|
|
865
|
+
readonly name: "id";
|
|
866
|
+
readonly type: "u64";
|
|
867
|
+
readonly internalType: "u64";
|
|
868
|
+
},
|
|
869
|
+
];
|
|
870
|
+
},
|
|
871
|
+
{
|
|
872
|
+
readonly name: "title";
|
|
873
|
+
readonly type: "string";
|
|
874
|
+
readonly internalType: "string";
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
readonly name: "description";
|
|
878
|
+
readonly type: "string";
|
|
879
|
+
readonly internalType: "string";
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
readonly name: "priority";
|
|
883
|
+
readonly type: "enum";
|
|
884
|
+
readonly internalType: "priority";
|
|
885
|
+
readonly components: readonly [
|
|
886
|
+
{
|
|
887
|
+
readonly name: "low";
|
|
888
|
+
readonly type: "_";
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
readonly name: "medium";
|
|
892
|
+
readonly type: "_";
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
readonly name: "high";
|
|
896
|
+
readonly type: "_";
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
readonly name: "urgent";
|
|
900
|
+
readonly type: "_";
|
|
901
|
+
},
|
|
902
|
+
];
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
readonly name: "status";
|
|
906
|
+
readonly type: "enum";
|
|
907
|
+
readonly internalType: "status";
|
|
908
|
+
readonly components: readonly [
|
|
909
|
+
{
|
|
910
|
+
readonly name: "pending";
|
|
911
|
+
readonly type: "_";
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
readonly name: "active";
|
|
915
|
+
readonly type: "_";
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
readonly name: "completed";
|
|
919
|
+
readonly type: "_";
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
readonly name: "cancelled";
|
|
923
|
+
readonly type: "_";
|
|
924
|
+
},
|
|
925
|
+
];
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
readonly name: "metadata";
|
|
929
|
+
readonly type: "record";
|
|
930
|
+
readonly internalType: "task-metadata";
|
|
931
|
+
readonly components: readonly [
|
|
932
|
+
{
|
|
933
|
+
readonly name: "created-at";
|
|
934
|
+
readonly type: "record";
|
|
935
|
+
readonly internalType: "timestamp";
|
|
936
|
+
readonly components: readonly [
|
|
937
|
+
{
|
|
938
|
+
readonly name: "unix-ms";
|
|
939
|
+
readonly type: "u64";
|
|
940
|
+
readonly internalType: "u64";
|
|
941
|
+
},
|
|
942
|
+
];
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
readonly name: "updated-at";
|
|
946
|
+
readonly type: "record";
|
|
947
|
+
readonly internalType: "timestamp";
|
|
948
|
+
readonly components: readonly [
|
|
949
|
+
{
|
|
950
|
+
readonly name: "unix-ms";
|
|
951
|
+
readonly type: "u64";
|
|
952
|
+
readonly internalType: "u64";
|
|
953
|
+
},
|
|
954
|
+
];
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
readonly name: "owner";
|
|
958
|
+
readonly type: "record";
|
|
959
|
+
readonly internalType: "user";
|
|
960
|
+
readonly components: readonly [
|
|
961
|
+
{
|
|
962
|
+
readonly name: "name";
|
|
963
|
+
readonly type: "string";
|
|
964
|
+
readonly internalType: "string";
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
readonly name: "email";
|
|
968
|
+
readonly type: "string";
|
|
969
|
+
readonly internalType: "string";
|
|
970
|
+
},
|
|
971
|
+
];
|
|
972
|
+
},
|
|
973
|
+
];
|
|
974
|
+
},
|
|
975
|
+
];
|
|
976
|
+
},
|
|
977
|
+
];
|
|
978
|
+
}>();
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
test("ParseWit - list-tasks function - debug", () => {
|
|
982
|
+
type ListTasks = TaskManagerWit[3];
|
|
983
|
+
|
|
984
|
+
// Check basic properties
|
|
985
|
+
expectTypeOf<ListTasks["name"]>().toEqualTypeOf<"list-tasks">();
|
|
986
|
+
expectTypeOf<ListTasks["type"]>().toEqualTypeOf<"function">();
|
|
987
|
+
expectTypeOf<ListTasks["context"]>().toEqualTypeOf<"view">();
|
|
988
|
+
|
|
989
|
+
// Check inputs
|
|
990
|
+
type Inputs = ListTasks["inputs"];
|
|
991
|
+
expectTypeOf<Inputs["length"]>().toEqualTypeOf<1>();
|
|
992
|
+
|
|
993
|
+
type FilterInput = Inputs[0];
|
|
994
|
+
expectTypeOf<FilterInput["name"]>().toEqualTypeOf<"filter">();
|
|
995
|
+
expectTypeOf<FilterInput["type"]>().toEqualTypeOf<"variant">();
|
|
996
|
+
expectTypeOf<FilterInput["internalType"]>().toEqualTypeOf<"filter">();
|
|
997
|
+
|
|
998
|
+
// Check variant components
|
|
999
|
+
type FilterComponents = FilterInput["components"];
|
|
1000
|
+
expectTypeOf<FilterComponents["length"]>().toEqualTypeOf<4>();
|
|
1001
|
+
|
|
1002
|
+
expectTypeOf<FilterComponents[0]>().toEqualTypeOf<{
|
|
1003
|
+
readonly name: "by-status";
|
|
1004
|
+
readonly type: "enum";
|
|
1005
|
+
readonly internalType: "status";
|
|
1006
|
+
readonly components: readonly [
|
|
1007
|
+
{
|
|
1008
|
+
readonly name: "pending";
|
|
1009
|
+
readonly type: "_";
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
readonly name: "active";
|
|
1013
|
+
readonly type: "_";
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
readonly name: "completed";
|
|
1017
|
+
readonly type: "_";
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
readonly name: "cancelled";
|
|
1021
|
+
readonly type: "_";
|
|
1022
|
+
},
|
|
1023
|
+
];
|
|
1024
|
+
}>();
|
|
1025
|
+
|
|
1026
|
+
expectTypeOf<FilterComponents[1]>().toEqualTypeOf<{
|
|
1027
|
+
readonly name: "by-priority";
|
|
1028
|
+
readonly type: "enum";
|
|
1029
|
+
readonly internalType: "priority";
|
|
1030
|
+
readonly components: readonly [
|
|
1031
|
+
{
|
|
1032
|
+
readonly name: "low";
|
|
1033
|
+
readonly type: "_";
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
readonly name: "medium";
|
|
1037
|
+
readonly type: "_";
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
readonly name: "high";
|
|
1041
|
+
readonly type: "_";
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
readonly name: "urgent";
|
|
1045
|
+
readonly type: "_";
|
|
1046
|
+
},
|
|
1047
|
+
];
|
|
1048
|
+
}>();
|
|
1049
|
+
expectTypeOf<FilterComponents[2]>().toEqualTypeOf<{
|
|
1050
|
+
readonly name: "by-user";
|
|
1051
|
+
readonly type: "record";
|
|
1052
|
+
readonly internalType: "user";
|
|
1053
|
+
readonly components: readonly [
|
|
1054
|
+
{
|
|
1055
|
+
readonly name: "name";
|
|
1056
|
+
readonly type: "string";
|
|
1057
|
+
readonly internalType: "string";
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
readonly name: "email";
|
|
1061
|
+
readonly type: "string";
|
|
1062
|
+
readonly internalType: "string";
|
|
1063
|
+
},
|
|
1064
|
+
];
|
|
1065
|
+
}>();
|
|
1066
|
+
//
|
|
1067
|
+
expectTypeOf<FilterComponents[3]>().toEqualTypeOf<{
|
|
1068
|
+
readonly name: "all";
|
|
1069
|
+
readonly internalType: "_";
|
|
1070
|
+
readonly type: "_";
|
|
1071
|
+
}>();
|
|
1072
|
+
|
|
1073
|
+
// Now check the outputs
|
|
1074
|
+
type Outputs = ListTasks["outputs"];
|
|
1075
|
+
expectTypeOf<Outputs["length"]>().toEqualTypeOf<1>();
|
|
1076
|
+
|
|
1077
|
+
type FirstOutput = Outputs[0];
|
|
1078
|
+
expectTypeOf<FirstOutput["type"]>().toEqualTypeOf<"list<record>">();
|
|
1079
|
+
expectTypeOf<FirstOutput["internalType"]>().toEqualTypeOf<"list<task>">();
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
test("ParseWit - get-events function", () => {
|
|
1083
|
+
type GetEventsFunction = TaskManagerWit[4];
|
|
1084
|
+
|
|
1085
|
+
// Test basic function properties
|
|
1086
|
+
expectTypeOf<GetEventsFunction["name"]>().toEqualTypeOf<"get-events">();
|
|
1087
|
+
expectTypeOf<GetEventsFunction["type"]>().toEqualTypeOf<"function">();
|
|
1088
|
+
expectTypeOf<GetEventsFunction["context"]>().toEqualTypeOf<"view">();
|
|
1089
|
+
expectTypeOf<GetEventsFunction["inputs"]>().toEqualTypeOf<readonly []>();
|
|
1090
|
+
|
|
1091
|
+
// Test outputs structure
|
|
1092
|
+
type Outputs = GetEventsFunction["outputs"];
|
|
1093
|
+
type OutputType = Outputs[0];
|
|
1094
|
+
expectTypeOf<OutputType["type"]>().toEqualTypeOf<"list<variant>">();
|
|
1095
|
+
expectTypeOf<
|
|
1096
|
+
OutputType["internalType"]
|
|
1097
|
+
>().toEqualTypeOf<"list<task-event>">();
|
|
1098
|
+
|
|
1099
|
+
// Test components (the 4 variant cases)
|
|
1100
|
+
type Components = OutputType["components"];
|
|
1101
|
+
expectTypeOf<Components["length"]>().toEqualTypeOf<4>();
|
|
1102
|
+
|
|
1103
|
+
// Test "created" variant
|
|
1104
|
+
type CreatedVariant = Components[0];
|
|
1105
|
+
expectTypeOf<CreatedVariant["name"]>().toEqualTypeOf<"created">();
|
|
1106
|
+
expectTypeOf<CreatedVariant["type"]>().toEqualTypeOf<"record">();
|
|
1107
|
+
expectTypeOf<CreatedVariant["internalType"]>().toEqualTypeOf<"task">();
|
|
1108
|
+
|
|
1109
|
+
// Test created task structure (spot check a few fields)
|
|
1110
|
+
type CreatedComponents = CreatedVariant["components"];
|
|
1111
|
+
expectTypeOf<CreatedComponents[0]["name"]>().toEqualTypeOf<"id">();
|
|
1112
|
+
expectTypeOf<CreatedComponents[1]["name"]>().toEqualTypeOf<"title">();
|
|
1113
|
+
expectTypeOf<CreatedComponents[2]["name"]>().toEqualTypeOf<"description">();
|
|
1114
|
+
|
|
1115
|
+
// Test "updated" variant (should be same structure as created)
|
|
1116
|
+
type UpdatedVariant = Components[1];
|
|
1117
|
+
expectTypeOf<UpdatedVariant["name"]>().toEqualTypeOf<"updated">();
|
|
1118
|
+
expectTypeOf<UpdatedVariant["type"]>().toEqualTypeOf<"record">();
|
|
1119
|
+
expectTypeOf<UpdatedVariant["internalType"]>().toEqualTypeOf<"task">();
|
|
1120
|
+
|
|
1121
|
+
// Test "deleted" variant
|
|
1122
|
+
type DeletedVariant = Components[2];
|
|
1123
|
+
expectTypeOf<DeletedVariant["name"]>().toEqualTypeOf<"deleted">();
|
|
1124
|
+
expectTypeOf<DeletedVariant["type"]>().toEqualTypeOf<"record">();
|
|
1125
|
+
expectTypeOf<DeletedVariant["internalType"]>().toEqualTypeOf<"task-id">();
|
|
1126
|
+
expectTypeOf<DeletedVariant["components"][0]["name"]>().toEqualTypeOf<"id">();
|
|
1127
|
+
expectTypeOf<
|
|
1128
|
+
DeletedVariant["components"][0]["type"]
|
|
1129
|
+
>().toEqualTypeOf<"u64">();
|
|
1130
|
+
|
|
1131
|
+
// Test "status-changed" variant - THIS IS THE TRICKY ONE
|
|
1132
|
+
type StatusChangedVariant = Components[3];
|
|
1133
|
+
expectTypeOf<StatusChangedVariant>().toEqualTypeOf<{
|
|
1134
|
+
readonly name: "status-changed";
|
|
1135
|
+
readonly type: "enum";
|
|
1136
|
+
readonly internalType: "status";
|
|
1137
|
+
readonly components: readonly [
|
|
1138
|
+
{
|
|
1139
|
+
readonly name: "pending";
|
|
1140
|
+
readonly type: "_";
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
readonly name: "active";
|
|
1144
|
+
readonly type: "_";
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
readonly name: "completed";
|
|
1148
|
+
readonly type: "_";
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
readonly name: "cancelled";
|
|
1152
|
+
readonly type: "_";
|
|
1153
|
+
},
|
|
1154
|
+
];
|
|
1155
|
+
}>();
|
|
1156
|
+
});
|
|
1157
|
+
|
|
1158
|
+
test("ParseWit - delete-task function", () => {
|
|
1159
|
+
type DeleteTaskFunction = TaskManagerWit[5];
|
|
1160
|
+
|
|
1161
|
+
// Test basic function properties
|
|
1162
|
+
expectTypeOf<DeleteTaskFunction["name"]>().toEqualTypeOf<"delete-task">();
|
|
1163
|
+
expectTypeOf<DeleteTaskFunction["type"]>().toEqualTypeOf<"function">();
|
|
1164
|
+
expectTypeOf<DeleteTaskFunction["context"]>().toEqualTypeOf<"proc">();
|
|
1165
|
+
|
|
1166
|
+
// Test inputs
|
|
1167
|
+
type Inputs = DeleteTaskFunction["inputs"];
|
|
1168
|
+
expectTypeOf<Inputs["length"]>().toEqualTypeOf<1>();
|
|
1169
|
+
|
|
1170
|
+
type IdInput = Inputs[0];
|
|
1171
|
+
expectTypeOf<IdInput["name"]>().toEqualTypeOf<"id">();
|
|
1172
|
+
expectTypeOf<IdInput["type"]>().toEqualTypeOf<"record">();
|
|
1173
|
+
expectTypeOf<IdInput["internalType"]>().toEqualTypeOf<"task-id">();
|
|
1174
|
+
expectTypeOf<IdInput["components"][0]["name"]>().toEqualTypeOf<"id">();
|
|
1175
|
+
expectTypeOf<IdInput["components"][0]["type"]>().toEqualTypeOf<"u64">();
|
|
1176
|
+
expectTypeOf<
|
|
1177
|
+
IdInput["components"][0]["internalType"]
|
|
1178
|
+
>().toEqualTypeOf<"u64">();
|
|
1179
|
+
|
|
1180
|
+
// Test outputs
|
|
1181
|
+
type Outputs = DeleteTaskFunction["outputs"];
|
|
1182
|
+
expectTypeOf<Outputs["length"]>().toEqualTypeOf<1>();
|
|
1183
|
+
|
|
1184
|
+
type OutputType = Outputs[0];
|
|
1185
|
+
expectTypeOf<OutputType["type"]>().toEqualTypeOf<"result<record, error>">();
|
|
1186
|
+
expectTypeOf<
|
|
1187
|
+
OutputType["internalType"]
|
|
1188
|
+
>().toEqualTypeOf<"result<task-id, error>">();
|
|
1189
|
+
|
|
1190
|
+
// Test result components (task-id structure)
|
|
1191
|
+
type OutputComponents = OutputType["components"];
|
|
1192
|
+
expectTypeOf<OutputComponents["length"]>().toEqualTypeOf<1>();
|
|
1193
|
+
expectTypeOf<OutputComponents[0]["name"]>().toEqualTypeOf<"id">();
|
|
1194
|
+
expectTypeOf<OutputComponents[0]["type"]>().toEqualTypeOf<"u64">();
|
|
1195
|
+
expectTypeOf<OutputComponents[0]["internalType"]>().toEqualTypeOf<"u64">();
|
|
1196
|
+
});
|