saasufy-components 3.21.1 → 3.22.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 +22 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ You can apply custom CSS/styling to elements that are rendered inside a viewport
|
|
|
56
56
|
|
|
57
57
|
To use a component, you just need to include the relevant `<script>` tag into the `<head>` tag of your `.html` file.
|
|
58
58
|
You can simply copy-paste the script tag provided under the `Import` section of the relevant component's documentation.
|
|
59
|
+
Make sure that you read the documentation carefully; especially the list of available attributes and acceptable values for each component.
|
|
59
60
|
|
|
60
61
|
You should only add the script tags for the components which your page uses to avoid wasting bandwidth and unnecessarily delaying page load for your users.
|
|
61
62
|
You should always include the `socket.js` script and create a top-level `socket-provider` component if you intend to use components which depend on data from Saasufy.
|
|
@@ -86,6 +87,27 @@ The following utility functions can be used anywhere inside template `{{expressi
|
|
|
86
87
|
- Format UNIX timestamp as a human-readable date: `{{date(Product.updatedAt)}}`
|
|
87
88
|
- Given an array of objects, extract the values from the specified field and join them together into a single comma-separated string: `{{joinFields(Product, 'name')}}`
|
|
88
89
|
|
|
90
|
+
### Special fields
|
|
91
|
+
|
|
92
|
+
Saasufy supports a number of special metadata fields which are automatically created and updated on each model record.
|
|
93
|
+
Those fields are hidden by default but may be exposed via the Saasufy control panel and used within your application.
|
|
94
|
+
The fields are:
|
|
95
|
+
|
|
96
|
+
- `id`: String, UUID v4 format; the ID of the resource.
|
|
97
|
+
- `createdBy`: String, UUID v4 format; if the socket was authenticated, this will hold the ID of the account which created the resource.
|
|
98
|
+
- `updatedBy`: String, UUID v4 format; if the socket was authenticated, this will hold the ID of the account which last modified the resource.
|
|
99
|
+
- `createdByIp`: String, IP address format; the IP address of the client which last modified the resource.
|
|
100
|
+
- `createdAt`: Number, UNIX timestamp format; the timestamp for when the resource was created.
|
|
101
|
+
- `updatedAt`: Number, UNIX timestamp format; the timestamp for when the resource was last modified.
|
|
102
|
+
|
|
103
|
+
All of the above fields except for the `id` field are hidden by default and must be exposed via the Saasufy control panel in order to be accessible within your front end application.
|
|
104
|
+
To expose a special field on a specific model, you just need to create a field with the same name under the `fields` section of the relevant model.
|
|
105
|
+
You will need to make sure that the type you specify (`String` or `Number`) matches the type of the special field described above.
|
|
106
|
+
You will need to deploy your Saasufy service from the dashboard for the changes to take effect.
|
|
107
|
+
|
|
108
|
+
The `id` field in Saasufy is extra special; you can optionally specify it when you create a new resource, however, if it is not specified, Saasufy will create one for you.
|
|
109
|
+
Saasufy offers utility functions for creating IDs (random and deterministic). See the previous `Utility functions` section.
|
|
110
|
+
|
|
89
111
|
### File hosting
|
|
90
112
|
|
|
91
113
|
Saasufy provides basic HTTP/HTTPS file hosting functionality with support for client-side caching (with `ETag`).
|