diff --git a/tests/data/output.did b/tests/data/output.did index 49d0637..ee0b58a 100644 --- a/tests/data/output.did +++ b/tests/data/output.did @@ -54,6 +54,7 @@ type DbConfig = record { max_memory_size : opt ConfigMaxMemorySize }; type DelDoc = record { version : opt nat64 }; type DelRule = record { version : opt nat64 }; type DeleteControllersArgs = record { controllers : vec principal }; +type DemoArg = record { status : text; message : text }; type DepositCyclesArgs = record { cycles : nat; destination_id : principal }; type Doc = record { updated_at : nat64; @@ -117,6 +118,7 @@ type ListResults_1 = record { type Memory = variant { Heap; Stable }; type MemorySize = record { stable : nat64; heap : nat64 }; type Permission = variant { Controllers; Private; Public; Managed }; +type Result = variant { Ok : text; Err : text }; type Rule = record { max_capacity : opt nat32; memory : opt Memory; @@ -195,7 +197,6 @@ type UploadChunk = record { }; type UploadChunkResult = record { chunk_id : nat }; service : { - build_version : () -> (text) query; commit_asset_upload : (CommitBatch) -> (); count_assets : (text, ListParams) -> (nat64) query; count_collection_assets : (text) -> (nat64) query; @@ -212,6 +213,7 @@ service : { del_many_assets : (vec record { text; text }) -> (); del_many_docs : (vec record { text; text; DelDoc }) -> (); del_rule : (RulesType, text, DelRule) -> (); + demo : (DemoArg) -> (Result) query; deposit_cycles : (DepositCyclesArgs) -> (); get_asset : (text, text) -> (opt AssetNoContent) query; get_auth_config : () -> (opt AuthenticationConfig) query; @@ -236,6 +238,7 @@ service : { list_docs : (text, ListParams) -> (ListResults_1) query; list_rules : (RulesType) -> (vec record { text; Rule }) query; memory_size : () -> (MemorySize) query; + say : () -> () query; set_auth_config : (AuthenticationConfig) -> (); set_controllers : (SetControllersArgs) -> ( vec record { principal; Controller }, diff --git a/tests/data/satellite.js b/tests/data/satellite.js index 152088a..b060583 100644 --- a/tests/data/satellite.js +++ b/tests/data/satellite.js @@ -1,333 +1,336 @@ export const idlFactory = ({ IDL }) => { - const CommitBatch = IDL.Record({ - 'batch_id' : IDL.Nat, - 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'chunk_ids' : IDL.Vec(IDL.Nat), - }); - const ListOrderField = IDL.Variant({ - 'UpdatedAt' : IDL.Null, - 'Keys' : IDL.Null, - 'CreatedAt' : IDL.Null, - }); - const ListOrder = IDL.Record({ 'field' : ListOrderField, 'desc' : IDL.Bool }); - const TimestampMatcher = IDL.Variant({ - 'Equal' : IDL.Nat64, - 'Between' : IDL.Tuple(IDL.Nat64, IDL.Nat64), - 'GreaterThan' : IDL.Nat64, - 'LessThan' : IDL.Nat64, - }); - const ListMatcher = IDL.Record({ - 'key' : IDL.Opt(IDL.Text), - 'updated_at' : IDL.Opt(TimestampMatcher), - 'description' : IDL.Opt(IDL.Text), - 'created_at' : IDL.Opt(TimestampMatcher), - }); - const ListPaginate = IDL.Record({ - 'start_after' : IDL.Opt(IDL.Text), - 'limit' : IDL.Opt(IDL.Nat64), - }); - const ListParams = IDL.Record({ - 'order' : IDL.Opt(ListOrder), - 'owner' : IDL.Opt(IDL.Principal), - 'matcher' : IDL.Opt(ListMatcher), - 'paginate' : IDL.Opt(ListPaginate), - }); - const DeleteControllersArgs = IDL.Record({ - 'controllers' : IDL.Vec(IDL.Principal), - }); - const ControllerScope = IDL.Variant({ - 'Write' : IDL.Null, - 'Admin' : IDL.Null, - }); - const Controller = IDL.Record({ - 'updated_at' : IDL.Nat64, - 'metadata' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'created_at' : IDL.Nat64, - 'scope' : ControllerScope, - 'expires_at' : IDL.Opt(IDL.Nat64), - }); - const DelDoc = IDL.Record({ 'version' : IDL.Opt(IDL.Nat64) }); - const RulesType = IDL.Variant({ 'Db' : IDL.Null, 'Storage' : IDL.Null }); - const DelRule = IDL.Record({ 'version' : IDL.Opt(IDL.Nat64) }); - const DepositCyclesArgs = IDL.Record({ - 'cycles' : IDL.Nat, - 'destination_id' : IDL.Principal, - }); - const AssetKey = IDL.Record({ - 'token' : IDL.Opt(IDL.Text), - 'collection' : IDL.Text, - 'owner' : IDL.Principal, - 'name' : IDL.Text, - 'description' : IDL.Opt(IDL.Text), - 'full_path' : IDL.Text, - }); - const AssetEncodingNoContent = IDL.Record({ - 'modified' : IDL.Nat64, - 'sha256' : IDL.Vec(IDL.Nat8), - 'total_length' : IDL.Nat, - }); - const AssetNoContent = IDL.Record({ - 'key' : AssetKey, - 'updated_at' : IDL.Nat64, - 'encodings' : IDL.Vec(IDL.Tuple(IDL.Text, AssetEncodingNoContent)), - 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'created_at' : IDL.Nat64, - 'version' : IDL.Opt(IDL.Nat64), - }); - const AuthenticationConfigInternetIdentity = IDL.Record({ - 'derivation_origin' : IDL.Opt(IDL.Text), - }); - const AuthenticationConfig = IDL.Record({ - 'internet_identity' : IDL.Opt(AuthenticationConfigInternetIdentity), - }); - const ConfigMaxMemorySize = IDL.Record({ - 'stable' : IDL.Opt(IDL.Nat64), - 'heap' : IDL.Opt(IDL.Nat64), - }); - const DbConfig = IDL.Record({ - 'max_memory_size' : IDL.Opt(ConfigMaxMemorySize), - }); - const StorageConfigIFrame = IDL.Variant({ - 'Deny' : IDL.Null, - 'AllowAny' : IDL.Null, - 'SameOrigin' : IDL.Null, - }); - const StorageConfigRawAccess = IDL.Variant({ - 'Deny' : IDL.Null, - 'Allow' : IDL.Null, - }); - const StorageConfigRedirect = IDL.Record({ - 'status_code' : IDL.Nat16, - 'location' : IDL.Text, - }); - const StorageConfig = IDL.Record({ - 'iframe' : IDL.Opt(StorageConfigIFrame), - 'rewrites' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'headers' : IDL.Vec( - IDL.Tuple(IDL.Text, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))) - ), - 'max_memory_size' : IDL.Opt(ConfigMaxMemorySize), - 'raw_access' : IDL.Opt(StorageConfigRawAccess), - 'redirects' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, StorageConfigRedirect))), - }); - const Config = IDL.Record({ - 'db' : IDL.Opt(DbConfig), - 'authentication' : IDL.Opt(AuthenticationConfig), - 'storage' : StorageConfig, - }); - const Doc = IDL.Record({ - 'updated_at' : IDL.Nat64, - 'owner' : IDL.Principal, - 'data' : IDL.Vec(IDL.Nat8), - 'description' : IDL.Opt(IDL.Text), - 'created_at' : IDL.Nat64, - 'version' : IDL.Opt(IDL.Nat64), - }); - const HttpRequest = IDL.Record({ - 'url' : IDL.Text, - 'method' : IDL.Text, - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'certificate_version' : IDL.Opt(IDL.Nat16), - }); - const Memory = IDL.Variant({ 'Heap' : IDL.Null, 'Stable' : IDL.Null }); - const StreamingCallbackToken = IDL.Record({ - 'memory' : Memory, - 'token' : IDL.Opt(IDL.Text), - 'sha256' : IDL.Opt(IDL.Vec(IDL.Nat8)), - 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'index' : IDL.Nat64, - 'encoding_type' : IDL.Text, - 'full_path' : IDL.Text, - }); - const StreamingStrategy = IDL.Variant({ - 'Callback' : IDL.Record({ - 'token' : StreamingCallbackToken, - 'callback' : IDL.Func([], [], ['query']), - }), - }); - const HttpResponse = IDL.Record({ - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'streaming_strategy' : IDL.Opt(StreamingStrategy), - 'status_code' : IDL.Nat16, - }); - const StreamingCallbackHttpResponse = IDL.Record({ - 'token' : IDL.Opt(StreamingCallbackToken), - 'body' : IDL.Vec(IDL.Nat8), - }); - const InitAssetKey = IDL.Record({ - 'token' : IDL.Opt(IDL.Text), - 'collection' : IDL.Text, - 'name' : IDL.Text, - 'description' : IDL.Opt(IDL.Text), - 'encoding_type' : IDL.Opt(IDL.Text), - 'full_path' : IDL.Text, - }); - const InitUploadResult = IDL.Record({ 'batch_id' : IDL.Nat }); - const ListResults = IDL.Record({ - 'matches_pages' : IDL.Opt(IDL.Nat64), - 'matches_length' : IDL.Nat64, - 'items_page' : IDL.Opt(IDL.Nat64), - 'items' : IDL.Vec(IDL.Tuple(IDL.Text, AssetNoContent)), - 'items_length' : IDL.Nat64, - }); - const CustomDomain = IDL.Record({ - 'updated_at' : IDL.Nat64, - 'created_at' : IDL.Nat64, - 'version' : IDL.Opt(IDL.Nat64), - 'bn_id' : IDL.Opt(IDL.Text), - }); - const ListResults_1 = IDL.Record({ - 'matches_pages' : IDL.Opt(IDL.Nat64), - 'matches_length' : IDL.Nat64, - 'items_page' : IDL.Opt(IDL.Nat64), - 'items' : IDL.Vec(IDL.Tuple(IDL.Text, Doc)), - 'items_length' : IDL.Nat64, - }); - const Permission = IDL.Variant({ - 'Controllers' : IDL.Null, - 'Private' : IDL.Null, - 'Public' : IDL.Null, - 'Managed' : IDL.Null, - }); - const Rule = IDL.Record({ - 'max_capacity' : IDL.Opt(IDL.Nat32), - 'memory' : IDL.Opt(Memory), - 'updated_at' : IDL.Nat64, - 'max_size' : IDL.Opt(IDL.Nat), - 'read' : Permission, - 'created_at' : IDL.Nat64, - 'version' : IDL.Opt(IDL.Nat64), - 'mutable_permissions' : IDL.Opt(IDL.Bool), - 'write' : Permission, - }); - const MemorySize = IDL.Record({ 'stable' : IDL.Nat64, 'heap' : IDL.Nat64 }); - const SetController = IDL.Record({ - 'metadata' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - 'scope' : ControllerScope, - 'expires_at' : IDL.Opt(IDL.Nat64), - }); - const SetControllersArgs = IDL.Record({ - 'controller' : SetController, - 'controllers' : IDL.Vec(IDL.Principal), - }); - const SetDoc = IDL.Record({ - 'data' : IDL.Vec(IDL.Nat8), - 'description' : IDL.Opt(IDL.Text), - 'version' : IDL.Opt(IDL.Nat64), - }); - const SetRule = IDL.Record({ - 'max_capacity' : IDL.Opt(IDL.Nat32), - 'memory' : IDL.Opt(Memory), - 'max_size' : IDL.Opt(IDL.Nat), - 'read' : Permission, - 'version' : IDL.Opt(IDL.Nat64), - 'mutable_permissions' : IDL.Opt(IDL.Bool), - 'write' : Permission, - }); - const UploadChunk = IDL.Record({ - 'content' : IDL.Vec(IDL.Nat8), - 'batch_id' : IDL.Nat, - 'order_id' : IDL.Opt(IDL.Nat), - }); - const UploadChunkResult = IDL.Record({ 'chunk_id' : IDL.Nat }); - return IDL.Service({ - 'build_version' : IDL.Func([], [IDL.Text], ['query']), - 'commit_asset_upload' : IDL.Func([CommitBatch], [], []), - 'count_assets' : IDL.Func([IDL.Text, ListParams], [IDL.Nat64], ['query']), - 'count_collection_assets' : IDL.Func([IDL.Text], [IDL.Nat64], ['query']), - 'count_collection_docs' : IDL.Func([IDL.Text], [IDL.Nat64], ['query']), - 'count_docs' : IDL.Func([IDL.Text, ListParams], [IDL.Nat64], ['query']), - 'del_asset' : IDL.Func([IDL.Text, IDL.Text], [], []), - 'del_assets' : IDL.Func([IDL.Text], [], []), - 'del_controllers' : IDL.Func( - [DeleteControllersArgs], - [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], - [], - ), - 'del_custom_domain' : IDL.Func([IDL.Text], [], []), - 'del_doc' : IDL.Func([IDL.Text, IDL.Text, DelDoc], [], []), - 'del_docs' : IDL.Func([IDL.Text], [], []), - 'del_many_assets' : IDL.Func( - [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], - [], - [], - ), - 'del_many_docs' : IDL.Func( - [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text, DelDoc))], - [], - [], - ), - 'del_rule' : IDL.Func([RulesType, IDL.Text, DelRule], [], []), - 'deposit_cycles' : IDL.Func([DepositCyclesArgs], [], []), - 'get_asset' : IDL.Func( - [IDL.Text, IDL.Text], - [IDL.Opt(AssetNoContent)], - ['query'], - ), - 'get_auth_config' : IDL.Func( - [], - [IDL.Opt(AuthenticationConfig)], - ['query'], - ), - 'get_config' : IDL.Func([], [Config], []), - 'get_db_config' : IDL.Func([], [IDL.Opt(DbConfig)], ['query']), - 'get_doc' : IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']), - 'get_many_assets' : IDL.Func( - [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], - [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Opt(AssetNoContent)))], - ['query'], - ), - 'get_many_docs' : IDL.Func( - [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], - [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Opt(Doc)))], - ['query'], - ), - 'get_storage_config' : IDL.Func([], [StorageConfig], ['query']), - 'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']), - 'http_request_streaming_callback' : IDL.Func( - [StreamingCallbackToken], - [StreamingCallbackHttpResponse], - ['query'], - ), - 'init_asset_upload' : IDL.Func([InitAssetKey], [InitUploadResult], []), - 'list_assets' : IDL.Func([IDL.Text, ListParams], [ListResults], ['query']), - 'list_controllers' : IDL.Func( - [], - [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], - ['query'], - ), - 'list_custom_domains' : IDL.Func( - [], - [IDL.Vec(IDL.Tuple(IDL.Text, CustomDomain))], - ['query'], - ), - 'list_docs' : IDL.Func([IDL.Text, ListParams], [ListResults_1], ['query']), - 'list_rules' : IDL.Func( - [RulesType], - [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], - ['query'], - ), - 'memory_size' : IDL.Func([], [MemorySize], ['query']), - 'set_auth_config' : IDL.Func([AuthenticationConfig], [], []), - 'set_controllers' : IDL.Func( - [SetControllersArgs], - [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], - [], - ), - 'set_custom_domain' : IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []), - 'set_db_config' : IDL.Func([DbConfig], [], []), - 'set_doc' : IDL.Func([IDL.Text, IDL.Text, SetDoc], [Doc], []), - 'set_many_docs' : IDL.Func( - [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text, SetDoc))], - [IDL.Vec(IDL.Tuple(IDL.Text, Doc))], - [], - ), - 'set_rule' : IDL.Func([RulesType, IDL.Text, SetRule], [], []), - 'set_storage_config' : IDL.Func([StorageConfig], [], []), - 'upload_asset_chunk' : IDL.Func([UploadChunk], [UploadChunkResult], []), - 'version' : IDL.Func([], [IDL.Text], ['query']), - }); + const CommitBatch = IDL.Record({ + 'batch_id' : IDL.Nat, + 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + 'chunk_ids' : IDL.Vec(IDL.Nat), + }); + const ListOrderField = IDL.Variant({ + 'UpdatedAt' : IDL.Null, + 'Keys' : IDL.Null, + 'CreatedAt' : IDL.Null, + }); + const ListOrder = IDL.Record({ 'field' : ListOrderField, 'desc' : IDL.Bool }); + const TimestampMatcher = IDL.Variant({ + 'Equal' : IDL.Nat64, + 'Between' : IDL.Tuple(IDL.Nat64, IDL.Nat64), + 'GreaterThan' : IDL.Nat64, + 'LessThan' : IDL.Nat64, + }); + const ListMatcher = IDL.Record({ + 'key' : IDL.Opt(IDL.Text), + 'updated_at' : IDL.Opt(TimestampMatcher), + 'description' : IDL.Opt(IDL.Text), + 'created_at' : IDL.Opt(TimestampMatcher), + }); + const ListPaginate = IDL.Record({ + 'start_after' : IDL.Opt(IDL.Text), + 'limit' : IDL.Opt(IDL.Nat64), + }); + const ListParams = IDL.Record({ + 'order' : IDL.Opt(ListOrder), + 'owner' : IDL.Opt(IDL.Principal), + 'matcher' : IDL.Opt(ListMatcher), + 'paginate' : IDL.Opt(ListPaginate), + }); + const DeleteControllersArgs = IDL.Record({ + 'controllers' : IDL.Vec(IDL.Principal), + }); + const ControllerScope = IDL.Variant({ + 'Write' : IDL.Null, + 'Admin' : IDL.Null, + }); + const Controller = IDL.Record({ + 'updated_at' : IDL.Nat64, + 'metadata' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + 'created_at' : IDL.Nat64, + 'scope' : ControllerScope, + 'expires_at' : IDL.Opt(IDL.Nat64), + }); + const DelDoc = IDL.Record({ 'version' : IDL.Opt(IDL.Nat64) }); + const RulesType = IDL.Variant({ 'Db' : IDL.Null, 'Storage' : IDL.Null }); + const DelRule = IDL.Record({ 'version' : IDL.Opt(IDL.Nat64) }); + const DemoArg = IDL.Record({ 'status' : IDL.Text, 'message' : IDL.Text }); + const Result = IDL.Variant({ 'Ok' : IDL.Text, 'Err' : IDL.Text }); + const DepositCyclesArgs = IDL.Record({ + 'cycles' : IDL.Nat, + 'destination_id' : IDL.Principal, + }); + const AssetKey = IDL.Record({ + 'token' : IDL.Opt(IDL.Text), + 'collection' : IDL.Text, + 'owner' : IDL.Principal, + 'name' : IDL.Text, + 'description' : IDL.Opt(IDL.Text), + 'full_path' : IDL.Text, + }); + const AssetEncodingNoContent = IDL.Record({ + 'modified' : IDL.Nat64, + 'sha256' : IDL.Vec(IDL.Nat8), + 'total_length' : IDL.Nat, + }); + const AssetNoContent = IDL.Record({ + 'key' : AssetKey, + 'updated_at' : IDL.Nat64, + 'encodings' : IDL.Vec(IDL.Tuple(IDL.Text, AssetEncodingNoContent)), + 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + 'created_at' : IDL.Nat64, + 'version' : IDL.Opt(IDL.Nat64), + }); + const AuthenticationConfigInternetIdentity = IDL.Record({ + 'derivation_origin' : IDL.Opt(IDL.Text), + }); + const AuthenticationConfig = IDL.Record({ + 'internet_identity' : IDL.Opt(AuthenticationConfigInternetIdentity), + }); + const ConfigMaxMemorySize = IDL.Record({ + 'stable' : IDL.Opt(IDL.Nat64), + 'heap' : IDL.Opt(IDL.Nat64), + }); + const DbConfig = IDL.Record({ + 'max_memory_size' : IDL.Opt(ConfigMaxMemorySize), + }); + const StorageConfigIFrame = IDL.Variant({ + 'Deny' : IDL.Null, + 'AllowAny' : IDL.Null, + 'SameOrigin' : IDL.Null, + }); + const StorageConfigRawAccess = IDL.Variant({ + 'Deny' : IDL.Null, + 'Allow' : IDL.Null, + }); + const StorageConfigRedirect = IDL.Record({ + 'status_code' : IDL.Nat16, + 'location' : IDL.Text, + }); + const StorageConfig = IDL.Record({ + 'iframe' : IDL.Opt(StorageConfigIFrame), + 'rewrites' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + 'headers' : IDL.Vec( + IDL.Tuple(IDL.Text, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))) + ), + 'max_memory_size' : IDL.Opt(ConfigMaxMemorySize), + 'raw_access' : IDL.Opt(StorageConfigRawAccess), + 'redirects' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, StorageConfigRedirect))), + }); + const Config = IDL.Record({ + 'db' : IDL.Opt(DbConfig), + 'authentication' : IDL.Opt(AuthenticationConfig), + 'storage' : StorageConfig, + }); + const Doc = IDL.Record({ + 'updated_at' : IDL.Nat64, + 'owner' : IDL.Principal, + 'data' : IDL.Vec(IDL.Nat8), + 'description' : IDL.Opt(IDL.Text), + 'created_at' : IDL.Nat64, + 'version' : IDL.Opt(IDL.Nat64), + }); + const HttpRequest = IDL.Record({ + 'url' : IDL.Text, + 'method' : IDL.Text, + 'body' : IDL.Vec(IDL.Nat8), + 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + 'certificate_version' : IDL.Opt(IDL.Nat16), + }); + const Memory = IDL.Variant({ 'Heap' : IDL.Null, 'Stable' : IDL.Null }); + const StreamingCallbackToken = IDL.Record({ + 'memory' : Memory, + 'token' : IDL.Opt(IDL.Text), + 'sha256' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + 'index' : IDL.Nat64, + 'encoding_type' : IDL.Text, + 'full_path' : IDL.Text, + }); + const StreamingStrategy = IDL.Variant({ + 'Callback' : IDL.Record({ + 'token' : StreamingCallbackToken, + 'callback' : IDL.Func([], [], ['query']), + }), + }); + const HttpResponse = IDL.Record({ + 'body' : IDL.Vec(IDL.Nat8), + 'headers' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + 'streaming_strategy' : IDL.Opt(StreamingStrategy), + 'status_code' : IDL.Nat16, + }); + const StreamingCallbackHttpResponse = IDL.Record({ + 'token' : IDL.Opt(StreamingCallbackToken), + 'body' : IDL.Vec(IDL.Nat8), + }); + const InitAssetKey = IDL.Record({ + 'token' : IDL.Opt(IDL.Text), + 'collection' : IDL.Text, + 'name' : IDL.Text, + 'description' : IDL.Opt(IDL.Text), + 'encoding_type' : IDL.Opt(IDL.Text), + 'full_path' : IDL.Text, + }); + const InitUploadResult = IDL.Record({ 'batch_id' : IDL.Nat }); + const ListResults = IDL.Record({ + 'matches_pages' : IDL.Opt(IDL.Nat64), + 'matches_length' : IDL.Nat64, + 'items_page' : IDL.Opt(IDL.Nat64), + 'items' : IDL.Vec(IDL.Tuple(IDL.Text, AssetNoContent)), + 'items_length' : IDL.Nat64, + }); + const CustomDomain = IDL.Record({ + 'updated_at' : IDL.Nat64, + 'created_at' : IDL.Nat64, + 'version' : IDL.Opt(IDL.Nat64), + 'bn_id' : IDL.Opt(IDL.Text), + }); + const ListResults_1 = IDL.Record({ + 'matches_pages' : IDL.Opt(IDL.Nat64), + 'matches_length' : IDL.Nat64, + 'items_page' : IDL.Opt(IDL.Nat64), + 'items' : IDL.Vec(IDL.Tuple(IDL.Text, Doc)), + 'items_length' : IDL.Nat64, + }); + const Permission = IDL.Variant({ + 'Controllers' : IDL.Null, + 'Private' : IDL.Null, + 'Public' : IDL.Null, + 'Managed' : IDL.Null, + }); + const Rule = IDL.Record({ + 'max_capacity' : IDL.Opt(IDL.Nat32), + 'memory' : IDL.Opt(Memory), + 'updated_at' : IDL.Nat64, + 'max_size' : IDL.Opt(IDL.Nat), + 'read' : Permission, + 'created_at' : IDL.Nat64, + 'version' : IDL.Opt(IDL.Nat64), + 'mutable_permissions' : IDL.Opt(IDL.Bool), + 'write' : Permission, + }); + const MemorySize = IDL.Record({ 'stable' : IDL.Nat64, 'heap' : IDL.Nat64 }); + const SetController = IDL.Record({ + 'metadata' : IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + 'scope' : ControllerScope, + 'expires_at' : IDL.Opt(IDL.Nat64), + }); + const SetControllersArgs = IDL.Record({ + 'controller' : SetController, + 'controllers' : IDL.Vec(IDL.Principal), + }); + const SetDoc = IDL.Record({ + 'data' : IDL.Vec(IDL.Nat8), + 'description' : IDL.Opt(IDL.Text), + 'version' : IDL.Opt(IDL.Nat64), + }); + const SetRule = IDL.Record({ + 'max_capacity' : IDL.Opt(IDL.Nat32), + 'memory' : IDL.Opt(Memory), + 'max_size' : IDL.Opt(IDL.Nat), + 'read' : Permission, + 'version' : IDL.Opt(IDL.Nat64), + 'mutable_permissions' : IDL.Opt(IDL.Bool), + 'write' : Permission, + }); + const UploadChunk = IDL.Record({ + 'content' : IDL.Vec(IDL.Nat8), + 'batch_id' : IDL.Nat, + 'order_id' : IDL.Opt(IDL.Nat), + }); + const UploadChunkResult = IDL.Record({ 'chunk_id' : IDL.Nat }); + return IDL.Service({ + 'commit_asset_upload' : IDL.Func([CommitBatch], [], []), + 'count_assets' : IDL.Func([IDL.Text, ListParams], [IDL.Nat64], ['query']), + 'count_collection_assets' : IDL.Func([IDL.Text], [IDL.Nat64], ['query']), + 'count_collection_docs' : IDL.Func([IDL.Text], [IDL.Nat64], ['query']), + 'count_docs' : IDL.Func([IDL.Text, ListParams], [IDL.Nat64], ['query']), + 'del_asset' : IDL.Func([IDL.Text, IDL.Text], [], []), + 'del_assets' : IDL.Func([IDL.Text], [], []), + 'del_controllers' : IDL.Func( + [DeleteControllersArgs], + [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], + [], + ), + 'del_custom_domain' : IDL.Func([IDL.Text], [], []), + 'del_doc' : IDL.Func([IDL.Text, IDL.Text, DelDoc], [], []), + 'del_docs' : IDL.Func([IDL.Text], [], []), + 'del_many_assets' : IDL.Func( + [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], + [], + [], + ), + 'del_many_docs' : IDL.Func( + [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text, DelDoc))], + [], + [], + ), + 'del_rule' : IDL.Func([RulesType, IDL.Text, DelRule], [], []), + 'demo' : IDL.Func([DemoArg], [Result], ['query']), + 'deposit_cycles' : IDL.Func([DepositCyclesArgs], [], []), + 'get_asset' : IDL.Func( + [IDL.Text, IDL.Text], + [IDL.Opt(AssetNoContent)], + ['query'], + ), + 'get_auth_config' : IDL.Func( + [], + [IDL.Opt(AuthenticationConfig)], + ['query'], + ), + 'get_config' : IDL.Func([], [Config], []), + 'get_db_config' : IDL.Func([], [IDL.Opt(DbConfig)], ['query']), + 'get_doc' : IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']), + 'get_many_assets' : IDL.Func( + [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], + [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Opt(AssetNoContent)))], + ['query'], + ), + 'get_many_docs' : IDL.Func( + [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], + [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Opt(Doc)))], + ['query'], + ), + 'get_storage_config' : IDL.Func([], [StorageConfig], ['query']), + 'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']), + 'http_request_streaming_callback' : IDL.Func( + [StreamingCallbackToken], + [StreamingCallbackHttpResponse], + ['query'], + ), + 'init_asset_upload' : IDL.Func([InitAssetKey], [InitUploadResult], []), + 'list_assets' : IDL.Func([IDL.Text, ListParams], [ListResults], ['query']), + 'list_controllers' : IDL.Func( + [], + [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], + ['query'], + ), + 'list_custom_domains' : IDL.Func( + [], + [IDL.Vec(IDL.Tuple(IDL.Text, CustomDomain))], + ['query'], + ), + 'list_docs' : IDL.Func([IDL.Text, ListParams], [ListResults_1], ['query']), + 'list_rules' : IDL.Func( + [RulesType], + [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], + ['query'], + ), + 'memory_size' : IDL.Func([], [MemorySize], ['query']), + 'say' : IDL.Func([], [], ['query']), + 'set_auth_config' : IDL.Func([AuthenticationConfig], [], []), + 'set_controllers' : IDL.Func( + [SetControllersArgs], + [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], + [], + ), + 'set_custom_domain' : IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []), + 'set_db_config' : IDL.Func([DbConfig], [], []), + 'set_doc' : IDL.Func([IDL.Text, IDL.Text, SetDoc], [Doc], []), + 'set_many_docs' : IDL.Func( + [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text, SetDoc))], + [IDL.Vec(IDL.Tuple(IDL.Text, Doc))], + [], + ), + 'set_rule' : IDL.Func([RulesType, IDL.Text, SetRule], [], []), + 'set_storage_config' : IDL.Func([StorageConfig], [], []), + 'upload_asset_chunk' : IDL.Func([UploadChunk], [UploadChunkResult], []), + 'version' : IDL.Func([], [IDL.Text], ['query']), + }); }; export const init = ({ IDL }) => { return []; }; \ No newline at end of file diff --git a/tests/data/satellite.ts b/tests/data/satellite.ts index a95b8b1..8a3fe90 100644 --- a/tests/data/satellite.ts +++ b/tests/data/satellite.ts @@ -3,284 +3,288 @@ import type { ActorMethod } from '@dfinity/agent'; import type { IDL } from '@dfinity/candid'; export interface AssetEncodingNoContent { - 'modified' : bigint, - 'sha256' : Uint8Array | number[], - 'total_length' : bigint, + 'modified' : bigint, + 'sha256' : Uint8Array | number[], + 'total_length' : bigint, } export interface AssetKey { - 'token' : [] | [string], - 'collection' : string, - 'owner' : Principal, - 'name' : string, - 'description' : [] | [string], - 'full_path' : string, + 'token' : [] | [string], + 'collection' : string, + 'owner' : Principal, + 'name' : string, + 'description' : [] | [string], + 'full_path' : string, } export interface AssetNoContent { - 'key' : AssetKey, - 'updated_at' : bigint, - 'encodings' : Array<[string, AssetEncodingNoContent]>, - 'headers' : Array<[string, string]>, - 'created_at' : bigint, - 'version' : [] | [bigint], + 'key' : AssetKey, + 'updated_at' : bigint, + 'encodings' : Array<[string, AssetEncodingNoContent]>, + 'headers' : Array<[string, string]>, + 'created_at' : bigint, + 'version' : [] | [bigint], } export interface AuthenticationConfig { - 'internet_identity' : [] | [AuthenticationConfigInternetIdentity], + 'internet_identity' : [] | [AuthenticationConfigInternetIdentity], } export interface AuthenticationConfigInternetIdentity { - 'derivation_origin' : [] | [string], + 'derivation_origin' : [] | [string], } export interface CommitBatch { - 'batch_id' : bigint, - 'headers' : Array<[string, string]>, - 'chunk_ids' : Array, + 'batch_id' : bigint, + 'headers' : Array<[string, string]>, + 'chunk_ids' : Array, } export interface Config { - 'db' : [] | [DbConfig], - 'authentication' : [] | [AuthenticationConfig], - 'storage' : StorageConfig, + 'db' : [] | [DbConfig], + 'authentication' : [] | [AuthenticationConfig], + 'storage' : StorageConfig, } export interface ConfigMaxMemorySize { - 'stable' : [] | [bigint], - 'heap' : [] | [bigint], + 'stable' : [] | [bigint], + 'heap' : [] | [bigint], } export interface Controller { - 'updated_at' : bigint, - 'metadata' : Array<[string, string]>, - 'created_at' : bigint, - 'scope' : ControllerScope, - 'expires_at' : [] | [bigint], + 'updated_at' : bigint, + 'metadata' : Array<[string, string]>, + 'created_at' : bigint, + 'scope' : ControllerScope, + 'expires_at' : [] | [bigint], } export type ControllerScope = { 'Write' : null } | - { 'Admin' : null }; + { 'Admin' : null }; export interface CustomDomain { - 'updated_at' : bigint, - 'created_at' : bigint, - 'version' : [] | [bigint], - 'bn_id' : [] | [string], + 'updated_at' : bigint, + 'created_at' : bigint, + 'version' : [] | [bigint], + 'bn_id' : [] | [string], } export interface DbConfig { 'max_memory_size' : [] | [ConfigMaxMemorySize] } export interface DelDoc { 'version' : [] | [bigint] } export interface DelRule { 'version' : [] | [bigint] } export interface DeleteControllersArgs { 'controllers' : Array } +export interface DemoArg { 'status' : string, 'message' : string } export interface DepositCyclesArgs { - 'cycles' : bigint, - 'destination_id' : Principal, + 'cycles' : bigint, + 'destination_id' : Principal, } export interface Doc { - 'updated_at' : bigint, - 'owner' : Principal, - 'data' : Uint8Array | number[], - 'description' : [] | [string], - 'created_at' : bigint, - 'version' : [] | [bigint], + 'updated_at' : bigint, + 'owner' : Principal, + 'data' : Uint8Array | number[], + 'description' : [] | [string], + 'created_at' : bigint, + 'version' : [] | [bigint], } export interface HttpRequest { - 'url' : string, - 'method' : string, - 'body' : Uint8Array | number[], - 'headers' : Array<[string, string]>, - 'certificate_version' : [] | [number], + 'url' : string, + 'method' : string, + 'body' : Uint8Array | number[], + 'headers' : Array<[string, string]>, + 'certificate_version' : [] | [number], } export interface HttpResponse { - 'body' : Uint8Array | number[], - 'headers' : Array<[string, string]>, - 'streaming_strategy' : [] | [StreamingStrategy], - 'status_code' : number, + 'body' : Uint8Array | number[], + 'headers' : Array<[string, string]>, + 'streaming_strategy' : [] | [StreamingStrategy], + 'status_code' : number, } export interface InitAssetKey { - 'token' : [] | [string], - 'collection' : string, - 'name' : string, - 'description' : [] | [string], - 'encoding_type' : [] | [string], - 'full_path' : string, + 'token' : [] | [string], + 'collection' : string, + 'name' : string, + 'description' : [] | [string], + 'encoding_type' : [] | [string], + 'full_path' : string, } export interface InitUploadResult { 'batch_id' : bigint } export interface ListMatcher { - 'key' : [] | [string], - 'updated_at' : [] | [TimestampMatcher], - 'description' : [] | [string], - 'created_at' : [] | [TimestampMatcher], + 'key' : [] | [string], + 'updated_at' : [] | [TimestampMatcher], + 'description' : [] | [string], + 'created_at' : [] | [TimestampMatcher], } export interface ListOrder { 'field' : ListOrderField, 'desc' : boolean } export type ListOrderField = { 'UpdatedAt' : null } | - { 'Keys' : null } | - { 'CreatedAt' : null }; + { 'Keys' : null } | + { 'CreatedAt' : null }; export interface ListPaginate { - 'start_after' : [] | [string], - 'limit' : [] | [bigint], + 'start_after' : [] | [string], + 'limit' : [] | [bigint], } export interface ListParams { - 'order' : [] | [ListOrder], - 'owner' : [] | [Principal], - 'matcher' : [] | [ListMatcher], - 'paginate' : [] | [ListPaginate], + 'order' : [] | [ListOrder], + 'owner' : [] | [Principal], + 'matcher' : [] | [ListMatcher], + 'paginate' : [] | [ListPaginate], } export interface ListResults { - 'matches_pages' : [] | [bigint], - 'matches_length' : bigint, - 'items_page' : [] | [bigint], - 'items' : Array<[string, AssetNoContent]>, - 'items_length' : bigint, + 'matches_pages' : [] | [bigint], + 'matches_length' : bigint, + 'items_page' : [] | [bigint], + 'items' : Array<[string, AssetNoContent]>, + 'items_length' : bigint, } export interface ListResults_1 { - 'matches_pages' : [] | [bigint], - 'matches_length' : bigint, - 'items_page' : [] | [bigint], - 'items' : Array<[string, Doc]>, - 'items_length' : bigint, + 'matches_pages' : [] | [bigint], + 'matches_length' : bigint, + 'items_page' : [] | [bigint], + 'items' : Array<[string, Doc]>, + 'items_length' : bigint, } export type Memory = { 'Heap' : null } | - { 'Stable' : null }; + { 'Stable' : null }; export interface MemorySize { 'stable' : bigint, 'heap' : bigint } export type Permission = { 'Controllers' : null } | - { 'Private' : null } | - { 'Public' : null } | - { 'Managed' : null }; + { 'Private' : null } | + { 'Public' : null } | + { 'Managed' : null }; +export type Result = { 'Ok' : string } | + { 'Err' : string }; export interface Rule { - 'max_capacity' : [] | [number], - 'memory' : [] | [Memory], - 'updated_at' : bigint, - 'max_size' : [] | [bigint], - 'read' : Permission, - 'created_at' : bigint, - 'version' : [] | [bigint], - 'mutable_permissions' : [] | [boolean], - 'write' : Permission, + 'max_capacity' : [] | [number], + 'memory' : [] | [Memory], + 'updated_at' : bigint, + 'max_size' : [] | [bigint], + 'read' : Permission, + 'created_at' : bigint, + 'version' : [] | [bigint], + 'mutable_permissions' : [] | [boolean], + 'write' : Permission, } export type RulesType = { 'Db' : null } | - { 'Storage' : null }; + { 'Storage' : null }; export interface SetController { - 'metadata' : Array<[string, string]>, - 'scope' : ControllerScope, - 'expires_at' : [] | [bigint], + 'metadata' : Array<[string, string]>, + 'scope' : ControllerScope, + 'expires_at' : [] | [bigint], } export interface SetControllersArgs { - 'controller' : SetController, - 'controllers' : Array, + 'controller' : SetController, + 'controllers' : Array, } export interface SetDoc { - 'data' : Uint8Array | number[], - 'description' : [] | [string], - 'version' : [] | [bigint], + 'data' : Uint8Array | number[], + 'description' : [] | [string], + 'version' : [] | [bigint], } export interface SetRule { - 'max_capacity' : [] | [number], - 'memory' : [] | [Memory], - 'max_size' : [] | [bigint], - 'read' : Permission, - 'version' : [] | [bigint], - 'mutable_permissions' : [] | [boolean], - 'write' : Permission, + 'max_capacity' : [] | [number], + 'memory' : [] | [Memory], + 'max_size' : [] | [bigint], + 'read' : Permission, + 'version' : [] | [bigint], + 'mutable_permissions' : [] | [boolean], + 'write' : Permission, } export interface StorageConfig { - 'iframe' : [] | [StorageConfigIFrame], - 'rewrites' : Array<[string, string]>, - 'headers' : Array<[string, Array<[string, string]>]>, - 'max_memory_size' : [] | [ConfigMaxMemorySize], - 'raw_access' : [] | [StorageConfigRawAccess], - 'redirects' : [] | [Array<[string, StorageConfigRedirect]>], + 'iframe' : [] | [StorageConfigIFrame], + 'rewrites' : Array<[string, string]>, + 'headers' : Array<[string, Array<[string, string]>]>, + 'max_memory_size' : [] | [ConfigMaxMemorySize], + 'raw_access' : [] | [StorageConfigRawAccess], + 'redirects' : [] | [Array<[string, StorageConfigRedirect]>], } export type StorageConfigIFrame = { 'Deny' : null } | - { 'AllowAny' : null } | - { 'SameOrigin' : null }; + { 'AllowAny' : null } | + { 'SameOrigin' : null }; export type StorageConfigRawAccess = { 'Deny' : null } | - { 'Allow' : null }; + { 'Allow' : null }; export interface StorageConfigRedirect { - 'status_code' : number, - 'location' : string, + 'status_code' : number, + 'location' : string, } export interface StreamingCallbackHttpResponse { - 'token' : [] | [StreamingCallbackToken], - 'body' : Uint8Array | number[], + 'token' : [] | [StreamingCallbackToken], + 'body' : Uint8Array | number[], } export interface StreamingCallbackToken { - 'memory' : Memory, - 'token' : [] | [string], - 'sha256' : [] | [Uint8Array | number[]], - 'headers' : Array<[string, string]>, - 'index' : bigint, - 'encoding_type' : string, - 'full_path' : string, + 'memory' : Memory, + 'token' : [] | [string], + 'sha256' : [] | [Uint8Array | number[]], + 'headers' : Array<[string, string]>, + 'index' : bigint, + 'encoding_type' : string, + 'full_path' : string, } export type StreamingStrategy = { 'Callback' : { - 'token' : StreamingCallbackToken, - 'callback' : [Principal, string], + 'token' : StreamingCallbackToken, + 'callback' : [Principal, string], } -}; + }; export type TimestampMatcher = { 'Equal' : bigint } | - { 'Between' : [bigint, bigint] } | - { 'GreaterThan' : bigint } | - { 'LessThan' : bigint }; + { 'Between' : [bigint, bigint] } | + { 'GreaterThan' : bigint } | + { 'LessThan' : bigint }; export interface UploadChunk { - 'content' : Uint8Array | number[], - 'batch_id' : bigint, - 'order_id' : [] | [bigint], + 'content' : Uint8Array | number[], + 'batch_id' : bigint, + 'order_id' : [] | [bigint], } export interface UploadChunkResult { 'chunk_id' : bigint } export interface _SERVICE { - 'build_version' : ActorMethod<[], string>, - 'commit_asset_upload' : ActorMethod<[CommitBatch], undefined>, - 'count_assets' : ActorMethod<[string, ListParams], bigint>, - 'count_collection_assets' : ActorMethod<[string], bigint>, - 'count_collection_docs' : ActorMethod<[string], bigint>, - 'count_docs' : ActorMethod<[string, ListParams], bigint>, - 'del_asset' : ActorMethod<[string, string], undefined>, - 'del_assets' : ActorMethod<[string], undefined>, - 'del_controllers' : ActorMethod< - [DeleteControllersArgs], - Array<[Principal, Controller]> - >, - 'del_custom_domain' : ActorMethod<[string], undefined>, - 'del_doc' : ActorMethod<[string, string, DelDoc], undefined>, - 'del_docs' : ActorMethod<[string], undefined>, - 'del_many_assets' : ActorMethod<[Array<[string, string]>], undefined>, - 'del_many_docs' : ActorMethod<[Array<[string, string, DelDoc]>], undefined>, - 'del_rule' : ActorMethod<[RulesType, string, DelRule], undefined>, - 'deposit_cycles' : ActorMethod<[DepositCyclesArgs], undefined>, - 'get_asset' : ActorMethod<[string, string], [] | [AssetNoContent]>, - 'get_auth_config' : ActorMethod<[], [] | [AuthenticationConfig]>, - 'get_config' : ActorMethod<[], Config>, - 'get_db_config' : ActorMethod<[], [] | [DbConfig]>, - 'get_doc' : ActorMethod<[string, string], [] | [Doc]>, - 'get_many_assets' : ActorMethod< - [Array<[string, string]>], - Array<[string, [] | [AssetNoContent]]> - >, - 'get_many_docs' : ActorMethod< - [Array<[string, string]>], - Array<[string, [] | [Doc]]> - >, - 'get_storage_config' : ActorMethod<[], StorageConfig>, - 'http_request' : ActorMethod<[HttpRequest], HttpResponse>, - 'http_request_streaming_callback' : ActorMethod< - [StreamingCallbackToken], - StreamingCallbackHttpResponse - >, - 'init_asset_upload' : ActorMethod<[InitAssetKey], InitUploadResult>, - 'list_assets' : ActorMethod<[string, ListParams], ListResults>, - 'list_controllers' : ActorMethod<[], Array<[Principal, Controller]>>, - 'list_custom_domains' : ActorMethod<[], Array<[string, CustomDomain]>>, - 'list_docs' : ActorMethod<[string, ListParams], ListResults_1>, - 'list_rules' : ActorMethod<[RulesType], Array<[string, Rule]>>, - 'memory_size' : ActorMethod<[], MemorySize>, - 'set_auth_config' : ActorMethod<[AuthenticationConfig], undefined>, - 'set_controllers' : ActorMethod< - [SetControllersArgs], - Array<[Principal, Controller]> - >, - 'set_custom_domain' : ActorMethod<[string, [] | [string]], undefined>, - 'set_db_config' : ActorMethod<[DbConfig], undefined>, - 'set_doc' : ActorMethod<[string, string, SetDoc], Doc>, - 'set_many_docs' : ActorMethod< - [Array<[string, string, SetDoc]>], - Array<[string, Doc]> - >, - 'set_rule' : ActorMethod<[RulesType, string, SetRule], undefined>, - 'set_storage_config' : ActorMethod<[StorageConfig], undefined>, - 'upload_asset_chunk' : ActorMethod<[UploadChunk], UploadChunkResult>, - 'version' : ActorMethod<[], string>, + 'commit_asset_upload' : ActorMethod<[CommitBatch], undefined>, + 'count_assets' : ActorMethod<[string, ListParams], bigint>, + 'count_collection_assets' : ActorMethod<[string], bigint>, + 'count_collection_docs' : ActorMethod<[string], bigint>, + 'count_docs' : ActorMethod<[string, ListParams], bigint>, + 'del_asset' : ActorMethod<[string, string], undefined>, + 'del_assets' : ActorMethod<[string], undefined>, + 'del_controllers' : ActorMethod< + [DeleteControllersArgs], + Array<[Principal, Controller]> + >, + 'del_custom_domain' : ActorMethod<[string], undefined>, + 'del_doc' : ActorMethod<[string, string, DelDoc], undefined>, + 'del_docs' : ActorMethod<[string], undefined>, + 'del_many_assets' : ActorMethod<[Array<[string, string]>], undefined>, + 'del_many_docs' : ActorMethod<[Array<[string, string, DelDoc]>], undefined>, + 'del_rule' : ActorMethod<[RulesType, string, DelRule], undefined>, + 'demo' : ActorMethod<[DemoArg], Result>, + 'deposit_cycles' : ActorMethod<[DepositCyclesArgs], undefined>, + 'get_asset' : ActorMethod<[string, string], [] | [AssetNoContent]>, + 'get_auth_config' : ActorMethod<[], [] | [AuthenticationConfig]>, + 'get_config' : ActorMethod<[], Config>, + 'get_db_config' : ActorMethod<[], [] | [DbConfig]>, + 'get_doc' : ActorMethod<[string, string], [] | [Doc]>, + 'get_many_assets' : ActorMethod< + [Array<[string, string]>], + Array<[string, [] | [AssetNoContent]]> + >, + 'get_many_docs' : ActorMethod< + [Array<[string, string]>], + Array<[string, [] | [Doc]]> + >, + 'get_storage_config' : ActorMethod<[], StorageConfig>, + 'http_request' : ActorMethod<[HttpRequest], HttpResponse>, + 'http_request_streaming_callback' : ActorMethod< + [StreamingCallbackToken], + StreamingCallbackHttpResponse + >, + 'init_asset_upload' : ActorMethod<[InitAssetKey], InitUploadResult>, + 'list_assets' : ActorMethod<[string, ListParams], ListResults>, + 'list_controllers' : ActorMethod<[], Array<[Principal, Controller]>>, + 'list_custom_domains' : ActorMethod<[], Array<[string, CustomDomain]>>, + 'list_docs' : ActorMethod<[string, ListParams], ListResults_1>, + 'list_rules' : ActorMethod<[RulesType], Array<[string, Rule]>>, + 'memory_size' : ActorMethod<[], MemorySize>, + 'say' : ActorMethod<[], undefined>, + 'set_auth_config' : ActorMethod<[AuthenticationConfig], undefined>, + 'set_controllers' : ActorMethod< + [SetControllersArgs], + Array<[Principal, Controller]> + >, + 'set_custom_domain' : ActorMethod<[string, [] | [string]], undefined>, + 'set_db_config' : ActorMethod<[DbConfig], undefined>, + 'set_doc' : ActorMethod<[string, string, SetDoc], Doc>, + 'set_many_docs' : ActorMethod< + [Array<[string, string, SetDoc]>], + Array<[string, Doc]> + >, + 'set_rule' : ActorMethod<[RulesType, string, SetRule], undefined>, + 'set_storage_config' : ActorMethod<[StorageConfig], undefined>, + 'upload_asset_chunk' : ActorMethod<[UploadChunk], UploadChunkResult>, + 'version' : ActorMethod<[], string>, } export declare const idlFactory: IDL.InterfaceFactory; export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; \ No newline at end of file diff --git a/tests/data/satellite_extension.did b/tests/data/satellite_extension.did index 0596cd3..8a0d794 100644 --- a/tests/data/satellite_extension.did +++ b/tests/data/satellite_extension.did @@ -1 +1,3 @@ -service : { build_version : () -> (text) query } +type DemoArg = record { status : text; message : text }; +type Result = variant { Ok : text; Err : text }; +service : { demo : (DemoArg) -> (Result) query; say : () -> () query }