Skip to content

Commit 1ce27ef

Browse files
authored
Merge pull request #635 from dfinity/kai/fix-svelte-starter
fix: repairs svelte-starter example
2 parents 164c677 + ac30468 commit 1ce27ef

32 files changed

+3262
-2227
lines changed

svelte/svelte-starter/deps/candid/rdmx6-jaaaa-aaaaa-aaadq-cai.did

+520
Large diffs are not rendered by default.

svelte/svelte-starter/deps/init.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"canisters": {
3+
"rdmx6-jaaaa-aaaaa-aaadq-cai": {
4+
"arg_str": "(null)",
5+
"arg_raw": "4449444c0a6e016c069ad9a8dc0402caed93df0403c8d99dab0702dfe1a5de0705f7f5cbfb0702f8d995c60f086e786e046c02007801786e066c04c3f9fca002788beea8c5047881cfaef40a0787eb979d0d7a6d7b6e096c02d5f5c5e909789fedfdc50d78010000"
6+
}
7+
}
8+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"canisters": {
3+
"rdmx6-jaaaa-aaaaa-aaadq-cai": {
4+
"name": "internet-identity",
5+
"wasm_hash": "1ae98d1141204d1aa51a7bf2a01561358b21692dc5c65fc3ab893c41d54763f0",
6+
"init_guide": "Use '(null)' for sensible defaults. See the candid interface for more details.",
7+
"candid_args": "(opt InternetIdentityInit)",
8+
"gzip": true
9+
}
10+
}
11+
}

svelte/svelte-starter/dfx.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{
22
"canisters": {
33
"frontend": {
4-
"frontend": {
5-
"entrypoint": "src/frontend/public/index.html"
6-
},
74
"source": [
8-
"src/frontend/public"
5+
"src/frontend/dist"
96
],
107
"type": "assets"
118
}
@@ -16,6 +13,6 @@
1613
"packtool": ""
1714
}
1815
},
19-
"dfx": "0.12.0",
16+
"output_env_file": "src/frontend/.env",
2017
"version": 1
2118
}
Submodule internet-identity deleted from 58a6336

svelte/svelte-starter/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
],
1212
"scripts": {
1313
"build": "cd src/frontend && npm run build",
14-
"prebuild": "npm run copy:types",
14+
"prebuild": "dfx generate",
1515
"dev": "cd src/frontend && npm run dev",
16-
"prestart": "npm run copy:types",
17-
"copy:types": "rsync -avr .dfx/$(echo ${DFX_NETWORK:-'**'})/canisters/** --exclude='assets' --exclude='idl/' --exclude='*.wasm' --delete src/declarations"
16+
"prestart": "dfx generate"
1817
}
19-
}
18+
}

svelte/svelte-starter/src/declarations/frontend/assetstorage.did

-140
This file was deleted.

svelte/svelte-starter/src/declarations/frontend/frontend.did

+124-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ type Time = int;
66
type CreateAssetArguments = record {
77
key: Key;
88
content_type: text;
9+
max_age: opt nat64;
10+
headers: opt vec HeaderField;
11+
enable_aliasing: opt bool;
12+
allow_raw_access: opt bool;
913
};
1014

1115
// Add or change content for an asset, by content encoding
@@ -34,19 +38,41 @@ type BatchOperationKind = variant {
3438
CreateAsset: CreateAssetArguments;
3539
SetAssetContent: SetAssetContentArguments;
3640

41+
SetAssetProperties: SetAssetPropertiesArguments;
42+
3743
UnsetAssetContent: UnsetAssetContentArguments;
3844
DeleteAsset: DeleteAssetArguments;
3945

4046
Clear: ClearArguments;
4147
};
4248

49+
type CommitBatchArguments = record {
50+
batch_id: BatchId;
51+
operations: vec BatchOperationKind
52+
};
53+
54+
type CommitProposedBatchArguments = record {
55+
batch_id: BatchId;
56+
evidence: blob;
57+
};
58+
59+
type ComputeEvidenceArguments = record {
60+
batch_id: BatchId;
61+
max_iterations: opt nat16
62+
};
63+
64+
type DeleteBatchArguments = record {
65+
batch_id: BatchId;
66+
};
67+
4368
type HeaderField = record { text; text; };
4469

4570
type HttpRequest = record {
4671
method: text;
4772
url: text;
4873
headers: vec HeaderField;
4974
body: blob;
75+
certificate_version: opt nat16;
5076
};
5177

5278
type HttpResponse = record {
@@ -75,7 +101,64 @@ type StreamingStrategy = variant {
75101
};
76102
};
77103

78-
service: {
104+
type SetAssetPropertiesArguments = record {
105+
key: Key;
106+
max_age: opt opt nat64;
107+
headers: opt opt vec HeaderField;
108+
allow_raw_access: opt opt bool;
109+
is_aliased: opt opt bool;
110+
};
111+
112+
type ConfigurationResponse = record {
113+
max_batches: opt nat64;
114+
max_chunks: opt nat64;
115+
max_bytes: opt nat64;
116+
};
117+
118+
type ConfigureArguments = record {
119+
max_batches: opt opt nat64;
120+
max_chunks: opt opt nat64;
121+
max_bytes: opt opt nat64;
122+
};
123+
124+
type Permission = variant {
125+
Commit;
126+
ManagePermissions;
127+
Prepare;
128+
};
129+
130+
type GrantPermission = record {
131+
to_principal: principal;
132+
permission: Permission;
133+
};
134+
type RevokePermission = record {
135+
of_principal: principal;
136+
permission: Permission;
137+
};
138+
type ListPermitted = record { permission: Permission };
139+
140+
type ValidationResult = variant { Ok : text; Err : text };
141+
142+
type AssetCanisterArgs = variant {
143+
Init: InitArgs;
144+
Upgrade: UpgradeArgs;
145+
};
146+
147+
type InitArgs = record {};
148+
149+
type UpgradeArgs = record {
150+
set_permissions: opt SetPermissions;
151+
};
152+
153+
/// Sets the list of principals granted each permission.
154+
type SetPermissions = record {
155+
prepare: vec principal;
156+
commit: vec principal;
157+
manage_permissions: vec principal;
158+
};
159+
160+
service: (asset_canister_args: opt AssetCanisterArgs) -> {
161+
api_version: () -> (nat16) query;
79162

80163
get: (record {
81164
key: Key;
@@ -108,12 +191,29 @@ service: {
108191
};
109192
}) query;
110193

194+
certified_tree : (record {}) -> (record {
195+
certificate: blob;
196+
tree: blob;
197+
}) query;
198+
111199
create_batch : (record {}) -> (record { batch_id: BatchId });
112200

113201
create_chunk: (record { batch_id: BatchId; content: blob }) -> (record { chunk_id: ChunkId });
114202

115203
// Perform all operations successfully, or reject
116-
commit_batch: (record { batch_id: BatchId; operations: vec BatchOperationKind }) -> ();
204+
commit_batch: (CommitBatchArguments) -> ();
205+
206+
// Save the batch operations for later commit
207+
propose_commit_batch: (CommitBatchArguments) -> ();
208+
209+
// Given a batch already proposed, perform all operations successfully, or reject
210+
commit_proposed_batch: (CommitProposedBatchArguments) -> ();
211+
212+
// Compute a hash over the CommitBatchArguments. Call until it returns Some(evidence).
213+
compute_evidence: (ComputeEvidenceArguments) -> (opt blob);
214+
215+
// Delete a batch that has been created, or proposed for commit, but not yet committed
216+
delete_batch: (DeleteBatchArguments) -> ();
117217

118218
create_asset: (CreateAssetArguments) -> ();
119219
set_asset_content: (SetAssetContentArguments) -> ();
@@ -137,4 +237,26 @@ service: {
137237
http_request_streaming_callback: (token: StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query;
138238

139239
authorize: (principal) -> ();
240+
deauthorize: (principal) -> ();
241+
list_authorized: () -> (vec principal);
242+
grant_permission: (GrantPermission) -> ();
243+
revoke_permission: (RevokePermission) -> ();
244+
list_permitted: (ListPermitted) -> (vec principal);
245+
take_ownership: () -> ();
246+
247+
get_asset_properties : (key: Key) -> (record {
248+
max_age: opt nat64;
249+
headers: opt vec HeaderField;
250+
allow_raw_access: opt bool;
251+
is_aliased: opt bool; } ) query;
252+
set_asset_properties: (SetAssetPropertiesArguments) -> ();
253+
254+
get_configuration: () -> (ConfigurationResponse);
255+
configure: (ConfigureArguments) -> ();
256+
257+
validate_grant_permission: (GrantPermission) -> (ValidationResult);
258+
validate_revoke_permission: (RevokePermission) -> (ValidationResult);
259+
validate_take_ownership: () -> (ValidationResult);
260+
validate_commit_proposed_batch: (CommitProposedBatchArguments) -> (ValidationResult);
261+
validate_configure: (ConfigureArguments) -> (ValidationResult);
140262
}

0 commit comments

Comments
 (0)