Skip to content

Commit ad0c304

Browse files
feat: integrate boilerplate from cli into repo
1 parent d4afb85 commit ad0c304

File tree

9 files changed

+422
-5
lines changed

9 files changed

+422
-5
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,3 @@ templates/**/package-lock.json
4343
/playwright-report/
4444
/blob-report/
4545
/playwright/.cache/
46-
47-
# We generate this on publish
48-
boilerplate/functions
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {defineAssert, defineHook} from '@junobuild/functions';
2+
3+
// All the available hooks and assertions for your Datastore and Storage are scaffolded by default in this module.
4+
// However, if you don’t have to implement all of them, for example to improve readability or reduce unnecessary logic,
5+
// you can selectively delete the features you do not need.
6+
7+
export const assertSetDoc = defineAssert({
8+
collections: [],
9+
assert: (context) => {}
10+
});
11+
12+
export const onSetDoc = defineHook({
13+
collections: [],
14+
run: async (context) => {}
15+
});

boilerplate/functions/rust/Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[workspace]
2+
members = [
3+
"src/satellite"
4+
]
5+
resolver = "2"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "satellite"
3+
version = "0.0.1"
4+
edition = "2021"
5+
6+
[lib]
7+
crate-type = ["cdylib"]
8+
9+
[dependencies]
10+
candid = "0.10.13"
11+
ic-cdk = "0.17.1"
12+
ic-cdk-macros = "0.17.1"
13+
serde = "1.0.217"
14+
serde_cbor = "0.11.2"
15+
junobuild-satellite = "0.0.22"
16+
junobuild-macros = "0.0.4"
17+
junobuild-utils = "0.0.4"
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
type AssetEncodingNoContent = record {
2+
modified : nat64;
3+
sha256 : blob;
4+
total_length : nat;
5+
};
6+
type AssetKey = record {
7+
token : opt text;
8+
collection : text;
9+
owner : principal;
10+
name : text;
11+
description : opt text;
12+
full_path : text;
13+
};
14+
type AssetNoContent = record {
15+
key : AssetKey;
16+
updated_at : nat64;
17+
encodings : vec record { text; AssetEncodingNoContent };
18+
headers : vec record { text; text };
19+
created_at : nat64;
20+
version : opt nat64;
21+
};
22+
type AuthenticationConfig = record {
23+
internet_identity : opt AuthenticationConfigInternetIdentity;
24+
};
25+
type AuthenticationConfigInternetIdentity = record {
26+
derivation_origin : opt text;
27+
external_alternative_origins : opt vec text;
28+
};
29+
type CollectionType = variant { Db; Storage };
30+
type CommitBatch = record {
31+
batch_id : nat;
32+
headers : vec record { text; text };
33+
chunk_ids : vec nat;
34+
};
35+
type Config = record {
36+
db : opt DbConfig;
37+
authentication : opt AuthenticationConfig;
38+
storage : StorageConfig;
39+
};
40+
type ConfigMaxMemorySize = record { stable : opt nat64; heap : opt nat64 };
41+
type Controller = record {
42+
updated_at : nat64;
43+
metadata : vec record { text; text };
44+
created_at : nat64;
45+
scope : ControllerScope;
46+
expires_at : opt nat64;
47+
};
48+
type ControllerScope = variant { Write; Admin };
49+
type CustomDomain = record {
50+
updated_at : nat64;
51+
created_at : nat64;
52+
version : opt nat64;
53+
bn_id : opt text;
54+
};
55+
type DbConfig = record { max_memory_size : opt ConfigMaxMemorySize };
56+
type DelDoc = record { version : opt nat64 };
57+
type DelRule = record { version : opt nat64 };
58+
type DeleteControllersArgs = record { controllers : vec principal };
59+
type DepositCyclesArgs = record { cycles : nat; destination_id : principal };
60+
type Doc = record {
61+
updated_at : nat64;
62+
owner : principal;
63+
data : blob;
64+
description : opt text;
65+
created_at : nat64;
66+
version : opt nat64;
67+
};
68+
type HttpRequest = record {
69+
url : text;
70+
method : text;
71+
body : blob;
72+
headers : vec record { text; text };
73+
certificate_version : opt nat16;
74+
};
75+
type HttpResponse = record {
76+
body : blob;
77+
headers : vec record { text; text };
78+
streaming_strategy : opt StreamingStrategy;
79+
status_code : nat16;
80+
};
81+
type InitAssetKey = record {
82+
token : opt text;
83+
collection : text;
84+
name : text;
85+
description : opt text;
86+
encoding_type : opt text;
87+
full_path : text;
88+
};
89+
type InitUploadResult = record { batch_id : nat };
90+
type ListMatcher = record {
91+
key : opt text;
92+
updated_at : opt TimestampMatcher;
93+
description : opt text;
94+
created_at : opt TimestampMatcher;
95+
};
96+
type ListOrder = record { field : ListOrderField; desc : bool };
97+
type ListOrderField = variant { UpdatedAt; Keys; CreatedAt };
98+
type ListPaginate = record { start_after : opt text; limit : opt nat64 };
99+
type ListParams = record {
100+
order : opt ListOrder;
101+
owner : opt principal;
102+
matcher : opt ListMatcher;
103+
paginate : opt ListPaginate;
104+
};
105+
type ListResults = record {
106+
matches_pages : opt nat64;
107+
matches_length : nat64;
108+
items_page : opt nat64;
109+
items : vec record { text; AssetNoContent };
110+
items_length : nat64;
111+
};
112+
type ListResults_1 = record {
113+
matches_pages : opt nat64;
114+
matches_length : nat64;
115+
items_page : opt nat64;
116+
items : vec record { text; Doc };
117+
items_length : nat64;
118+
};
119+
type Memory = variant { Heap; Stable };
120+
type MemorySize = record { stable : nat64; heap : nat64 };
121+
type Permission = variant { Controllers; Private; Public; Managed };
122+
type RateConfig = record { max_tokens : nat64; time_per_token_ns : nat64 };
123+
type Rule = record {
124+
max_capacity : opt nat32;
125+
memory : opt Memory;
126+
updated_at : nat64;
127+
max_size : opt nat;
128+
read : Permission;
129+
created_at : nat64;
130+
version : opt nat64;
131+
mutable_permissions : opt bool;
132+
rate_config : opt RateConfig;
133+
write : Permission;
134+
max_changes_per_user : opt nat32;
135+
};
136+
type SetController = record {
137+
metadata : vec record { text; text };
138+
scope : ControllerScope;
139+
expires_at : opt nat64;
140+
};
141+
type SetControllersArgs = record {
142+
controller : SetController;
143+
controllers : vec principal;
144+
};
145+
type SetDoc = record {
146+
data : blob;
147+
description : opt text;
148+
version : opt nat64;
149+
};
150+
type SetRule = record {
151+
max_capacity : opt nat32;
152+
memory : opt Memory;
153+
max_size : opt nat;
154+
read : Permission;
155+
version : opt nat64;
156+
mutable_permissions : opt bool;
157+
rate_config : opt RateConfig;
158+
write : Permission;
159+
max_changes_per_user : opt nat32;
160+
};
161+
type StorageConfig = record {
162+
iframe : opt StorageConfigIFrame;
163+
rewrites : vec record { text; text };
164+
headers : vec record { text; vec record { text; text } };
165+
max_memory_size : opt ConfigMaxMemorySize;
166+
raw_access : opt StorageConfigRawAccess;
167+
redirects : opt vec record { text; StorageConfigRedirect };
168+
};
169+
type StorageConfigIFrame = variant { Deny; AllowAny; SameOrigin };
170+
type StorageConfigRawAccess = variant { Deny; Allow };
171+
type StorageConfigRedirect = record { status_code : nat16; location : text };
172+
type StreamingCallbackHttpResponse = record {
173+
token : opt StreamingCallbackToken;
174+
body : blob;
175+
};
176+
type StreamingCallbackToken = record {
177+
memory : Memory;
178+
token : opt text;
179+
sha256 : opt blob;
180+
headers : vec record { text; text };
181+
index : nat64;
182+
encoding_type : text;
183+
full_path : text;
184+
};
185+
type StreamingStrategy = variant {
186+
Callback : record {
187+
token : StreamingCallbackToken;
188+
callback : func () -> () query;
189+
};
190+
};
191+
type TimestampMatcher = variant {
192+
Equal : nat64;
193+
Between : record { nat64; nat64 };
194+
GreaterThan : nat64;
195+
LessThan : nat64;
196+
};
197+
type UploadChunk = record {
198+
content : blob;
199+
batch_id : nat;
200+
order_id : opt nat;
201+
};
202+
type UploadChunkResult = record { chunk_id : nat };
203+
service : () -> {
204+
commit_asset_upload : (CommitBatch) -> ();
205+
count_assets : (text, ListParams) -> (nat64) query;
206+
count_collection_assets : (text) -> (nat64) query;
207+
count_collection_docs : (text) -> (nat64) query;
208+
count_docs : (text, ListParams) -> (nat64) query;
209+
del_asset : (text, text) -> ();
210+
del_assets : (text) -> ();
211+
del_controllers : (DeleteControllersArgs) -> (
212+
vec record { principal; Controller },
213+
);
214+
del_custom_domain : (text) -> ();
215+
del_doc : (text, text, DelDoc) -> ();
216+
del_docs : (text) -> ();
217+
del_filtered_assets : (text, ListParams) -> ();
218+
del_filtered_docs : (text, ListParams) -> ();
219+
del_many_assets : (vec record { text; text }) -> ();
220+
del_many_docs : (vec record { text; text; DelDoc }) -> ();
221+
del_rule : (CollectionType, text, DelRule) -> ();
222+
deposit_cycles : (DepositCyclesArgs) -> ();
223+
get_asset : (text, text) -> (opt AssetNoContent) query;
224+
get_auth_config : () -> (opt AuthenticationConfig) query;
225+
get_config : () -> (Config);
226+
get_db_config : () -> (opt DbConfig) query;
227+
get_doc : (text, text) -> (opt Doc) query;
228+
get_many_assets : (vec record { text; text }) -> (
229+
vec record { text; opt AssetNoContent },
230+
) query;
231+
get_many_docs : (vec record { text; text }) -> (
232+
vec record { text; opt Doc },
233+
) query;
234+
get_rule : (CollectionType, text) -> (opt Rule) query;
235+
get_storage_config : () -> (StorageConfig) query;
236+
http_request : (HttpRequest) -> (HttpResponse) query;
237+
http_request_streaming_callback : (StreamingCallbackToken) -> (
238+
StreamingCallbackHttpResponse,
239+
) query;
240+
init_asset_upload : (InitAssetKey) -> (InitUploadResult);
241+
list_assets : (text, ListParams) -> (ListResults) query;
242+
list_controllers : () -> (vec record { principal; Controller }) query;
243+
list_custom_domains : () -> (vec record { text; CustomDomain }) query;
244+
list_docs : (text, ListParams) -> (ListResults_1) query;
245+
list_rules : (CollectionType) -> (vec record { text; Rule }) query;
246+
memory_size : () -> (MemorySize) query;
247+
set_auth_config : (AuthenticationConfig) -> ();
248+
set_controllers : (SetControllersArgs) -> (
249+
vec record { principal; Controller },
250+
);
251+
set_custom_domain : (text, opt text) -> ();
252+
set_db_config : (DbConfig) -> ();
253+
set_doc : (text, text, SetDoc) -> (Doc);
254+
set_many_docs : (vec record { text; text; SetDoc }) -> (
255+
vec record { text; Doc },
256+
);
257+
set_rule : (CollectionType, text, SetRule) -> (Rule);
258+
set_storage_config : (StorageConfig) -> ();
259+
upload_asset_chunk : (UploadChunk) -> (UploadChunkResult);
260+
version : () -> (text) query;
261+
}

0 commit comments

Comments
 (0)