Skip to content

Commit

Permalink
Merge pull request #635 from dfinity/kai/fix-svelte-starter
Browse files Browse the repository at this point in the history
fix: repairs svelte-starter example
  • Loading branch information
krpeacock authored Dec 19, 2023
2 parents 164c677 + ac30468 commit 1ce27ef
Show file tree
Hide file tree
Showing 32 changed files with 3,262 additions and 2,227 deletions.
520 changes: 520 additions & 0 deletions svelte/svelte-starter/deps/candid/rdmx6-jaaaa-aaaaa-aaadq-cai.did

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions svelte/svelte-starter/deps/init.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"canisters": {
"rdmx6-jaaaa-aaaaa-aaadq-cai": {
"arg_str": "(null)",
"arg_raw": "4449444c0a6e016c069ad9a8dc0402caed93df0403c8d99dab0702dfe1a5de0705f7f5cbfb0702f8d995c60f086e786e046c02007801786e066c04c3f9fca002788beea8c5047881cfaef40a0787eb979d0d7a6d7b6e096c02d5f5c5e909789fedfdc50d78010000"
}
}
}
11 changes: 11 additions & 0 deletions svelte/svelte-starter/deps/pulled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"canisters": {
"rdmx6-jaaaa-aaaaa-aaadq-cai": {
"name": "internet-identity",
"wasm_hash": "1ae98d1141204d1aa51a7bf2a01561358b21692dc5c65fc3ab893c41d54763f0",
"init_guide": "Use '(null)' for sensible defaults. See the candid interface for more details.",
"candid_args": "(opt InternetIdentityInit)",
"gzip": true
}
}
}
7 changes: 2 additions & 5 deletions svelte/svelte-starter/dfx.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"canisters": {
"frontend": {
"frontend": {
"entrypoint": "src/frontend/public/index.html"
},
"source": [
"src/frontend/public"
"src/frontend/dist"
],
"type": "assets"
}
Expand All @@ -16,6 +13,6 @@
"packtool": ""
}
},
"dfx": "0.12.0",
"output_env_file": "src/frontend/.env",
"version": 1
}
1 change: 0 additions & 1 deletion svelte/svelte-starter/internet-identity
Submodule internet-identity deleted from 58a633
7 changes: 3 additions & 4 deletions svelte/svelte-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
],
"scripts": {
"build": "cd src/frontend && npm run build",
"prebuild": "npm run copy:types",
"prebuild": "dfx generate",
"dev": "cd src/frontend && npm run dev",
"prestart": "npm run copy:types",
"copy:types": "rsync -avr .dfx/$(echo ${DFX_NETWORK:-'**'})/canisters/** --exclude='assets' --exclude='idl/' --exclude='*.wasm' --delete src/declarations"
"prestart": "dfx generate"
}
}
}
140 changes: 0 additions & 140 deletions svelte/svelte-starter/src/declarations/frontend/assetstorage.did

This file was deleted.

126 changes: 124 additions & 2 deletions svelte/svelte-starter/src/declarations/frontend/frontend.did
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ type Time = int;
type CreateAssetArguments = record {
key: Key;
content_type: text;
max_age: opt nat64;
headers: opt vec HeaderField;
enable_aliasing: opt bool;
allow_raw_access: opt bool;
};

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

SetAssetProperties: SetAssetPropertiesArguments;

UnsetAssetContent: UnsetAssetContentArguments;
DeleteAsset: DeleteAssetArguments;

Clear: ClearArguments;
};

type CommitBatchArguments = record {
batch_id: BatchId;
operations: vec BatchOperationKind
};

type CommitProposedBatchArguments = record {
batch_id: BatchId;
evidence: blob;
};

type ComputeEvidenceArguments = record {
batch_id: BatchId;
max_iterations: opt nat16
};

type DeleteBatchArguments = record {
batch_id: BatchId;
};

type HeaderField = record { text; text; };

type HttpRequest = record {
method: text;
url: text;
headers: vec HeaderField;
body: blob;
certificate_version: opt nat16;
};

type HttpResponse = record {
Expand Down Expand Up @@ -75,7 +101,64 @@ type StreamingStrategy = variant {
};
};

service: {
type SetAssetPropertiesArguments = record {
key: Key;
max_age: opt opt nat64;
headers: opt opt vec HeaderField;
allow_raw_access: opt opt bool;
is_aliased: opt opt bool;
};

type ConfigurationResponse = record {
max_batches: opt nat64;
max_chunks: opt nat64;
max_bytes: opt nat64;
};

type ConfigureArguments = record {
max_batches: opt opt nat64;
max_chunks: opt opt nat64;
max_bytes: opt opt nat64;
};

type Permission = variant {
Commit;
ManagePermissions;
Prepare;
};

type GrantPermission = record {
to_principal: principal;
permission: Permission;
};
type RevokePermission = record {
of_principal: principal;
permission: Permission;
};
type ListPermitted = record { permission: Permission };

type ValidationResult = variant { Ok : text; Err : text };

type AssetCanisterArgs = variant {
Init: InitArgs;
Upgrade: UpgradeArgs;
};

type InitArgs = record {};

type UpgradeArgs = record {
set_permissions: opt SetPermissions;
};

/// Sets the list of principals granted each permission.
type SetPermissions = record {
prepare: vec principal;
commit: vec principal;
manage_permissions: vec principal;
};

service: (asset_canister_args: opt AssetCanisterArgs) -> {
api_version: () -> (nat16) query;

get: (record {
key: Key;
Expand Down Expand Up @@ -108,12 +191,29 @@ service: {
};
}) query;

certified_tree : (record {}) -> (record {
certificate: blob;
tree: blob;
}) query;

create_batch : (record {}) -> (record { batch_id: BatchId });

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

// Perform all operations successfully, or reject
commit_batch: (record { batch_id: BatchId; operations: vec BatchOperationKind }) -> ();
commit_batch: (CommitBatchArguments) -> ();

// Save the batch operations for later commit
propose_commit_batch: (CommitBatchArguments) -> ();

// Given a batch already proposed, perform all operations successfully, or reject
commit_proposed_batch: (CommitProposedBatchArguments) -> ();

// Compute a hash over the CommitBatchArguments. Call until it returns Some(evidence).
compute_evidence: (ComputeEvidenceArguments) -> (opt blob);

// Delete a batch that has been created, or proposed for commit, but not yet committed
delete_batch: (DeleteBatchArguments) -> ();

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

authorize: (principal) -> ();
deauthorize: (principal) -> ();
list_authorized: () -> (vec principal);
grant_permission: (GrantPermission) -> ();
revoke_permission: (RevokePermission) -> ();
list_permitted: (ListPermitted) -> (vec principal);
take_ownership: () -> ();

get_asset_properties : (key: Key) -> (record {
max_age: opt nat64;
headers: opt vec HeaderField;
allow_raw_access: opt bool;
is_aliased: opt bool; } ) query;
set_asset_properties: (SetAssetPropertiesArguments) -> ();

get_configuration: () -> (ConfigurationResponse);
configure: (ConfigureArguments) -> ();

validate_grant_permission: (GrantPermission) -> (ValidationResult);
validate_revoke_permission: (RevokePermission) -> (ValidationResult);
validate_take_ownership: () -> (ValidationResult);
validate_commit_proposed_batch: (CommitProposedBatchArguments) -> (ValidationResult);
validate_configure: (ConfigureArguments) -> (ValidationResult);
}
Loading

0 comments on commit 1ce27ef

Please sign in to comment.