junobuild_collections/
constants.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use crate::types::interface::SetRule;
use crate::types::rules::Memory;
use crate::types::rules::Permission::{Controllers, Managed};
use junobuild_shared::rate::constants::DEFAULT_RATE_CONFIG;

pub const SYS_COLLECTION_PREFIX: char = '#';

pub const LOG_COLLECTION_KEY: &str = "#log";

pub const DEFAULT_DB_LOG_RULE: SetRule = SetRule {
    read: Controllers,
    write: Controllers,
    memory: Some(Memory::Stable),
    mutable_permissions: Some(false),
    max_size: None,
    max_capacity: Some(100),
    version: None,
    rate_config: None,
};

pub const DEFAULT_DB_COLLECTIONS: [(&str, SetRule); 2] = [
    (
        "#user",
        SetRule {
            read: Managed,
            write: Managed,
            memory: Some(Memory::Stable),
            mutable_permissions: Some(false),
            max_size: None,
            max_capacity: None,
            version: None,
            rate_config: Some(DEFAULT_RATE_CONFIG),
        },
    ),
    (LOG_COLLECTION_KEY, DEFAULT_DB_LOG_RULE),
];

pub const ASSET_COLLECTION_KEY: &str = "#dapp";

pub const DEFAULT_ASSETS_COLLECTIONS: [(&str, SetRule); 1] = [(
    ASSET_COLLECTION_KEY,
    SetRule {
        read: Controllers,
        write: Controllers,
        memory: Some(Memory::Heap),
        mutable_permissions: Some(false),
        max_size: None,
        max_capacity: None,
        version: None,
        rate_config: None,
    },
)];