@elek-io/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -0
- package/dist/index.cjs +2177 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +816 -0
- package/dist/index.d.ts +816 -0
- package/dist/index.js +2250 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @elek-io/core
|
|
2
|
+
|
|
3
|
+
[](https://codecov.io/gh/elek-io/core)
|
|
4
|
+
|
|
5
|
+
Handles core functionality of elek.io Projects like file IO and version control.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
|-- src
|
|
9
|
+
| |-- error
|
|
10
|
+
| | Different classes extending Error.
|
|
11
|
+
| |-- service
|
|
12
|
+
| | Contains CRUD logic that does file-io as well as utility functions.
|
|
13
|
+
| | The methods are mostly used as endpoints
|
|
14
|
+
| | so their input is validated against a zod schema.
|
|
15
|
+
| |-- test
|
|
16
|
+
| | Additional files only used for testing.
|
|
17
|
+
| |-- upgrade
|
|
18
|
+
| | Files containing logic to upgrade each Project to support a higher Core version.
|
|
19
|
+
| | This may include iterating over all Assets to add a new key / value
|
|
20
|
+
| | because the new Core version uses it to store additional information.
|
|
21
|
+
| |-- util
|
|
22
|
+
| | Utility functions like path generation.
|
|
23
|
+
| |-- index.ts
|
|
24
|
+
| | Exports ElekIoCore main class which makes the services endpoints accessible.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## The concept behind Projects, Collections, Entries, Values and Assets
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
|-- Project (e.g. Website)
|
|
31
|
+
| |-- Collection (e.g. Blog)
|
|
32
|
+
| | |-- Entry (e.g Post)
|
|
33
|
+
| | | |-- Value (e.g for a post's title: "Quarterly results 7% higher than expected")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Projects
|
|
37
|
+
|
|
38
|
+
Are a container for Collections, Entries, Values and Assets. Think of a folder containing all the relevant files. Projects are version controlled with git, so you can roll back to previous versions of files at any time.
|
|
39
|
+
|
|
40
|
+
### Collections
|
|
41
|
+
|
|
42
|
+
Contains ValueDefinitions (a schema) for possible Values each Entry can or has to have.
|
|
43
|
+
e.g. for a Blog, it could have the following definition for each post / Entry:
|
|
44
|
+
|
|
45
|
+
- an image that is displayed on top of the post
|
|
46
|
+
- a title to catch users attention
|
|
47
|
+
- content that contains multiple headlines and paragraphs
|
|
48
|
+
- an author that wrote the post
|
|
49
|
+
|
|
50
|
+
Each definition like the title, contains additional information for the input field, that is used to modify it's Value.
|
|
51
|
+
e.g. the title would be a simple one line input field, that has a maximum lenght of 150 characters and is required for each post. But the content is a markdown editor to easily add formatting. The image let's the user select a jpeg or png from disk. And the author is a reference to another Collection's Entry, so the user is able to choose one of them.
|
|
52
|
+
|
|
53
|
+
### Entries
|
|
54
|
+
|
|
55
|
+
Contains references to Values that follow the Collection's ValueDefinitions. Why references and not the Values itself? To make Values reusable for different Entries and even Collections - so when you update a Value, it updates everywhere you've referenced it.
|
|
56
|
+
|
|
57
|
+
### Values
|
|
58
|
+
|
|
59
|
+
Represent a single piece of data like the string "How to be successfull in 3 easy steps", a number or a boolean.
|
|
60
|
+
|
|
61
|
+
### Assets
|
|
62
|
+
|
|
63
|
+
Are files / blobs like images (png, jpeg etc.), documents (excel sheets etc.), music or a compressed folder.
|
|
64
|
+
Assets have two files inside the Project's repository - the actual file and additionally a file containing meta information like the size.
|