Skip to content

Commit

Permalink
fix: generate types for last version of the satellites
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed May 10, 2024
1 parent 1460d1a commit 73065b8
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 15 deletions.
24 changes: 20 additions & 4 deletions cli/src/declarations/satellite.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ export interface AssetNoContent {
encodings: Array<[string, AssetEncodingNoContent]>;
headers: Array<[string, string]>;
created_at: bigint;
version: [] | [bigint];
}
export interface AuthenticationConfig {
internet_identity: [] | [AuthenticationConfigInternetIdentity];
}
export interface AuthenticationConfigInternetIdentity {
derivation_origin: [] | [string];
}
export interface CommitBatch {
batch_id: bigint;
Expand All @@ -41,10 +48,11 @@ export type ControllerScope = {Write: null} | {Admin: null};
export interface CustomDomain {
updated_at: bigint;
created_at: bigint;
version: [] | [bigint];
bn_id: [] | [string];
}
export interface DelDoc {
updated_at: [] | [bigint];
version: [] | [bigint];
}
export interface DeleteControllersArgs {
controllers: Array<Principal>;
Expand All @@ -59,6 +67,7 @@ export interface Doc {
data: Uint8Array | number[];
description: [] | [string];
created_at: bigint;
version: [] | [bigint];
}
export interface HttpRequest {
url: string;
Expand Down Expand Up @@ -124,11 +133,13 @@ export interface MemorySize {
}
export type Permission = {Controllers: null} | {Private: null} | {Public: null} | {Managed: null};
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;
}
Expand All @@ -143,25 +154,28 @@ export interface SetControllersArgs {
controllers: Array<Principal>;
}
export interface SetDoc {
updated_at: [] | [bigint];
data: Uint8Array | number[];
description: [] | [string];
version: [] | [bigint];
}
export interface SetRule {
max_capacity: [] | [number];
memory: [] | [Memory];
updated_at: [] | [bigint];
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]>]>;
raw_access: [] | [StorageConfigRawAccess];
redirects: [] | [Array<[string, StorageConfigRedirect]>];
}
export type StorageConfigIFrame = {Deny: null} | {AllowAny: null} | {SameOrigin: null};
export type StorageConfigRawAccess = {Deny: null} | {Allow: null};
export interface StorageConfigRedirect {
status_code: number;
location: string;
Expand Down Expand Up @@ -209,6 +223,7 @@ export interface _SERVICE {
del_rule: ActorMethod<[RulesType, string, DelDoc], undefined>;
deposit_cycles: ActorMethod<[DepositCyclesArgs], undefined>;
get_asset: ActorMethod<[string, string], [] | [AssetNoContent]>;
get_auth_config: ActorMethod<[], [] | [AuthenticationConfig]>;
get_config: ActorMethod<[], Config>;
get_doc: ActorMethod<[string, string], [] | [Doc]>;
get_many_assets: ActorMethod<[Array<[string, string]>], Array<[string, [] | [AssetNoContent]]>>;
Expand All @@ -225,6 +240,7 @@ export interface _SERVICE {
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_config: ActorMethod<[Config], undefined>;
set_controllers: ActorMethod<[SetControllersArgs], Array<[Principal, Controller]>>;
set_custom_domain: ActorMethod<[string, [] | [string]], undefined>;
Expand All @@ -235,4 +251,4 @@ export interface _SERVICE {
version: ActorMethod<[], string>;
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({IDL}: {IDL: IDL}) => IDL.Type[];
export declare const init: (args: {IDL: typeof IDL}) => IDL.Type[];
25 changes: 21 additions & 4 deletions cli/src/declarations/satellite.did
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import service "satellite_extension.did";

type AssetEncodingNoContent = record {
modified : nat64;
sha256 : vec nat8;
Expand All @@ -17,6 +19,13 @@ type AssetNoContent = record {
encodings : vec record { text; AssetEncodingNoContent };
headers : vec record { text; text };
created_at : nat64;
version : opt nat64;
};
type AuthenticationConfig = record {
internet_identity : opt AuthenticationConfigInternetIdentity;
};
type AuthenticationConfigInternetIdentity = record {
derivation_origin : opt text;
};
type CommitBatch = record {
batch_id : nat;
Expand All @@ -35,9 +44,10 @@ type ControllerScope = variant { Write; Admin };
type CustomDomain = record {
updated_at : nat64;
created_at : nat64;
version : opt nat64;
bn_id : opt text;
};
type DelDoc = record { updated_at : opt nat64 };
type DelDoc = record { version : opt nat64 };
type DeleteControllersArgs = record { controllers : vec principal };
type DepositCyclesArgs = record { cycles : nat; destination_id : principal };
type Doc = record {
Expand All @@ -46,6 +56,7 @@ type Doc = record {
data : vec nat8;
description : opt text;
created_at : nat64;
version : opt nat64;
};
type HttpRequest = record {
url : text;
Expand Down Expand Up @@ -97,11 +108,13 @@ type Memory = variant { Heap; Stable };
type MemorySize = record { stable : nat64; heap : nat64 };
type Permission = variant { Controllers; Private; Public; Managed };
type Rule = record {
max_capacity : opt nat32;
memory : opt Memory;
updated_at : nat64;
max_size : opt nat;
read : Permission;
created_at : nat64;
version : opt nat64;
mutable_permissions : opt bool;
write : Permission;
};
Expand All @@ -116,25 +129,28 @@ type SetControllersArgs = record {
controllers : vec principal;
};
type SetDoc = record {
updated_at : opt nat64;
data : vec nat8;
description : opt text;
version : opt nat64;
};
type SetRule = record {
max_capacity : opt nat32;
memory : opt Memory;
updated_at : opt nat64;
max_size : opt nat;
read : Permission;
version : opt nat64;
mutable_permissions : opt bool;
write : Permission;
};
type StorageConfig = record {
iframe : opt StorageConfigIFrame;
rewrites : vec record { text; text };
headers : vec record { text; vec record { text; text } };
raw_access : opt StorageConfigRawAccess;
redirects : opt vec record { text; StorageConfigRedirect };
};
type StorageConfigIFrame = variant { Deny; AllowAny; SameOrigin };
type StorageConfigRawAccess = variant { Deny; Allow };
type StorageConfigRedirect = record { status_code : nat16; location : text };
type StreamingCallbackHttpResponse = record {
token : opt StreamingCallbackToken;
Expand Down Expand Up @@ -178,6 +194,7 @@ service : () -> {
del_rule : (RulesType, text, DelDoc) -> ();
deposit_cycles : (DepositCyclesArgs) -> ();
get_asset : (text, text) -> (opt AssetNoContent) query;
get_auth_config : () -> (opt AuthenticationConfig) query;
get_config : () -> (Config);
get_doc : (text, text) -> (opt Doc) query;
get_many_assets : (vec record { text; text }) -> (
Expand All @@ -197,6 +214,7 @@ service : () -> {
list_docs : (text, ListParams) -> (ListResults_1) query;
list_rules : (RulesType) -> (vec record { text; Rule }) query;
memory_size : () -> (MemorySize) query;
set_auth_config : (AuthenticationConfig) -> ();
set_config : (Config) -> ();
set_controllers : (SetControllersArgs) -> (
vec record { principal; Controller },
Expand All @@ -209,5 +227,4 @@ service : () -> {
set_rule : (RulesType, text, SetRule) -> ();
upload_asset_chunk : (UploadChunk) -> (UploadChunkResult);
version : () -> (text) query;
build_version : () -> (text) query
}
31 changes: 25 additions & 6 deletions cli/src/declarations/satellite.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const idlFactory = ({IDL}) => {
scope: ControllerScope,
expires_at: IDL.Opt(IDL.Nat64)
});
const DelDoc = IDL.Record({updated_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 DepositCyclesArgs = IDL.Record({
cycles: IDL.Nat,
Expand All @@ -42,13 +42,24 @@ export const idlFactory = ({IDL}) => {
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
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 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
Expand All @@ -57,6 +68,7 @@ export const idlFactory = ({IDL}) => {
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)))),
raw_access: IDL.Opt(StorageConfigRawAccess),
redirects: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, StorageConfigRedirect)))
});
const Config = IDL.Record({storage: StorageConfig});
Expand All @@ -65,7 +77,8 @@ export const idlFactory = ({IDL}) => {
owner: IDL.Principal,
data: IDL.Vec(IDL.Nat8),
description: IDL.Opt(IDL.Text),
created_at: IDL.Nat64
created_at: IDL.Nat64,
version: IDL.Opt(IDL.Nat64)
});
const HttpRequest = IDL.Record({
url: IDL.Text,
Expand Down Expand Up @@ -139,6 +152,7 @@ export const idlFactory = ({IDL}) => {
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({
Expand All @@ -155,11 +169,13 @@ export const idlFactory = ({IDL}) => {
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
});
Expand All @@ -174,15 +190,16 @@ export const idlFactory = ({IDL}) => {
controllers: IDL.Vec(IDL.Principal)
});
const SetDoc = IDL.Record({
updated_at: IDL.Opt(IDL.Nat64),
data: IDL.Vec(IDL.Nat8),
description: IDL.Opt(IDL.Text)
description: IDL.Opt(IDL.Text),
version: IDL.Opt(IDL.Nat64)
});
const SetRule = IDL.Record({
max_capacity: IDL.Opt(IDL.Nat32),
memory: IDL.Opt(Memory),
updated_at: IDL.Opt(IDL.Nat64),
max_size: IDL.Opt(IDL.Nat),
read: Permission,
version: IDL.Opt(IDL.Nat64),
mutable_permissions: IDL.Opt(IDL.Bool),
write: Permission
});
Expand Down Expand Up @@ -212,6 +229,7 @@ export const idlFactory = ({IDL}) => {
del_rule: IDL.Func([RulesType, IDL.Text, DelDoc], [], []),
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_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
get_many_assets: IDL.Func(
Expand All @@ -237,6 +255,7 @@ export const idlFactory = ({IDL}) => {
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_config: IDL.Func([Config], [], []),
set_controllers: IDL.Func(
[SetControllersArgs],
Expand Down
1 change: 1 addition & 0 deletions cli/src/declarations/satellite_extension.did
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service : { build_version : () -> (text) query }
3 changes: 2 additions & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"repo": "https://github.com/junobuild/juno",
"url": "https://cdn.juno.build/releases/satellite-v0.0.17.wasm.gz",
"candid": [
"https://github.com/junobuild/juno/releases/download/v0.0.30/satellite.did"
"https://github.com/junobuild/juno/releases/download/v0.0.30/satellite.did",
"https://raw.githubusercontent.com/junobuild/juno/main/src/satellite/satellite_extension.did"
]
},
"icp_ledger": {
Expand Down

0 comments on commit 73065b8

Please sign in to comment.