@chill-sharp/ui-core 1.1.12

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.
Files changed (204) hide show
  1. package/.agents/skills/chillsharp-current-user-preferences/SKILL.md +70 -0
  2. package/.agents/skills/chillsharp-ui-template/SKILL.md +18 -0
  3. package/README.md +103 -0
  4. package/chill-sharp-ui-core.d.ts.map +1 -0
  5. package/doc/AIAssistedDevelopment/README.md +185 -0
  6. package/doc/AttachmentModel/README.md +173 -0
  7. package/doc/AuthenticationModel/README.md +213 -0
  8. package/doc/AuthenticationModel/how-to-integreate-auth-minimal-api.md +293 -0
  9. package/doc/ChillSharpClient.md +464 -0
  10. package/doc/ClientGeneration/README.md +172 -0
  11. package/doc/ComplianceGuide/README.md +178 -0
  12. package/doc/Configuration/README.md +94 -0
  13. package/doc/CurrentUserPreferences.md +114 -0
  14. package/doc/DateTimePolicy/README.md +154 -0
  15. package/doc/DateTimeSerialization.md +423 -0
  16. package/doc/Endpoints.md +260 -0
  17. package/doc/HowTo/01-simple-blog-sqlite.md +153 -0
  18. package/doc/HowTo/02-blog-schema-labels.md +140 -0
  19. package/doc/HowTo/03-authentication.md +218 -0
  20. package/doc/HowTo/04-blog-posts-one-to-many.md +194 -0
  21. package/doc/HowTo/05-docker-env-variables.md +274 -0
  22. package/doc/HowTo/06-chunk-transactions-autocomplete.md +196 -0
  23. package/doc/Mcp/ChatGPT.md +291 -0
  24. package/doc/Mcp/README.md +799 -0
  25. package/doc/MenuGuide/README.md +49 -0
  26. package/doc/ModelPreparation.md +255 -0
  27. package/doc/PermissionModel/README.md +277 -0
  28. package/doc/README.md +228 -0
  29. package/doc/ReferenceExistence.md +130 -0
  30. package/doc/RegisterContext.md +217 -0
  31. package/doc/UiCore/CRUD.md +170 -0
  32. package/doc/UiCore/README.md +13 -0
  33. package/doc/ValidationModel/README.md +117 -0
  34. package/doc/it/AIAssistedDevelopment/README.md +185 -0
  35. package/doc/it/AttachmentModel/README.md +173 -0
  36. package/doc/it/AuthenticationModel/README.md +171 -0
  37. package/doc/it/AuthenticationModel/how-to-integreate-auth-minimal-api.md +292 -0
  38. package/doc/it/ChillSharpClient.md +464 -0
  39. package/doc/it/ClientGeneration/README.md +152 -0
  40. package/doc/it/ComplianceGuide/README.md +178 -0
  41. package/doc/it/Configuration/README.md +94 -0
  42. package/doc/it/CurrentUserPreferences.md +114 -0
  43. package/doc/it/DateTimePolicy/README.md +154 -0
  44. package/doc/it/DateTimeSerialization.md +423 -0
  45. package/doc/it/Endpoints.md +260 -0
  46. package/doc/it/HowTo/01-simple-blog-sqlite.md +152 -0
  47. package/doc/it/HowTo/02-blog-schema-labels.md +139 -0
  48. package/doc/it/HowTo/03-authentication.md +221 -0
  49. package/doc/it/HowTo/04-blog-posts-one-to-many.md +193 -0
  50. package/doc/it/HowTo/05-docker-env-variables.md +268 -0
  51. package/doc/it/HowTo/06-chunk-transactions-autocomplete.md +196 -0
  52. package/doc/it/Mcp/ChatGPT.md +291 -0
  53. package/doc/it/Mcp/README.md +799 -0
  54. package/doc/it/MenuGuide/README.md +49 -0
  55. package/doc/it/ModelPreparation.md +254 -0
  56. package/doc/it/PermissionModel/README.md +190 -0
  57. package/doc/it/README.md +172 -0
  58. package/doc/it/ReferenceExistence.md +130 -0
  59. package/doc/it/RegisterContext.md +218 -0
  60. package/doc/it/UiCore/CRUD.md +170 -0
  61. package/doc/it/UiCore/README.md +13 -0
  62. package/doc/it/ValidationModel/README.md +117 -0
  63. package/fesm2022/chill-sharp-ui-core.mjs +16725 -0
  64. package/fesm2022/chill-sharp-ui-core.mjs.map +1 -0
  65. package/index.d.ts +6 -0
  66. package/lib/chill-sharp-ui-root.component.d.ts +6 -0
  67. package/lib/chill-sharp-ui-root.component.d.ts.map +1 -0
  68. package/lib/chill-sharp-ui.routes.d.ts +3 -0
  69. package/lib/chill-sharp-ui.routes.d.ts.map +1 -0
  70. package/lib/chill.config.d.ts +5 -0
  71. package/lib/chill.config.d.ts.map +1 -0
  72. package/lib/layouts/auth-shell.component.d.ts +8 -0
  73. package/lib/layouts/auth-shell.component.d.ts.map +1 -0
  74. package/lib/layouts/workspace-page.component.d.ts +49 -0
  75. package/lib/layouts/workspace-page.component.d.ts.map +1 -0
  76. package/lib/lib/chill-form.component.d.ts +151 -0
  77. package/lib/lib/chill-form.component.d.ts.map +1 -0
  78. package/lib/lib/chill-i18n-button-label.component.d.ts +27 -0
  79. package/lib/lib/chill-i18n-button-label.component.d.ts.map +1 -0
  80. package/lib/lib/chill-i18n-label.component.d.ts +30 -0
  81. package/lib/lib/chill-i18n-label.component.d.ts.map +1 -0
  82. package/lib/lib/chill-json-input.component.d.ts +31 -0
  83. package/lib/lib/chill-json-input.component.d.ts.map +1 -0
  84. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-boolean-control.component.d.ts +12 -0
  85. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-boolean-control.component.d.ts.map +1 -0
  86. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-editor-control.component.d.ts +17 -0
  87. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-editor-control.component.d.ts.map +1 -0
  88. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-lookup-control.component.d.ts +45 -0
  89. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-lookup-control.component.d.ts.map +1 -0
  90. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-scalar-control.component.d.ts +19 -0
  91. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-scalar-control.component.d.ts.map +1 -0
  92. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-select-control.component.d.ts +12 -0
  93. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-select-control.component.d.ts.map +1 -0
  94. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-textarea-control.component.d.ts +13 -0
  95. package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-textarea-control.component.d.ts.map +1 -0
  96. package/lib/lib/chill-polymorphic-input.component.d.ts +452 -0
  97. package/lib/lib/chill-polymorphic-input.component.d.ts.map +1 -0
  98. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-boolean-control.component.d.ts +7 -0
  99. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-boolean-control.component.d.ts.map +1 -0
  100. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-lookup-control.component.d.ts +7 -0
  101. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-lookup-control.component.d.ts.map +1 -0
  102. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-number-control.component.d.ts +7 -0
  103. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-number-control.component.d.ts.map +1 -0
  104. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-temporal-control.component.d.ts +8 -0
  105. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-temporal-control.component.d.ts.map +1 -0
  106. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-value-control.component.d.ts +7 -0
  107. package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-value-control.component.d.ts.map +1 -0
  108. package/lib/lib/chill-polymorphic-output.component.d.ts +75 -0
  109. package/lib/lib/chill-polymorphic-output.component.d.ts.map +1 -0
  110. package/lib/lib/chill-table.component.d.ts +434 -0
  111. package/lib/lib/chill-table.component.d.ts.map +1 -0
  112. package/lib/lib/chill-text-editor-dialog.component.d.ts +14 -0
  113. package/lib/lib/chill-text-editor-dialog.component.d.ts.map +1 -0
  114. package/lib/lib/crud-configuration.utils.d.ts +4 -0
  115. package/lib/lib/crud-configuration.utils.d.ts.map +1 -0
  116. package/lib/lib/culture-name-options.d.ts +3 -0
  117. package/lib/lib/culture-name-options.d.ts.map +1 -0
  118. package/lib/lib/date-format-options.d.ts +3 -0
  119. package/lib/lib/date-format-options.d.ts.map +1 -0
  120. package/lib/lib/iana-time-zone-options.d.ts +3 -0
  121. package/lib/lib/iana-time-zone-options.d.ts.map +1 -0
  122. package/lib/lib/notice-transition.directive.d.ts +17 -0
  123. package/lib/lib/notice-transition.directive.d.ts.map +1 -0
  124. package/lib/lib/schema-property-dialog.component.d.ts +74 -0
  125. package/lib/lib/schema-property-dialog.component.d.ts.map +1 -0
  126. package/lib/models/chill-auth.models.d.ts +176 -0
  127. package/lib/models/chill-auth.models.d.ts.map +1 -0
  128. package/lib/models/chill-menu.models.d.ts +12 -0
  129. package/lib/models/chill-menu.models.d.ts.map +1 -0
  130. package/lib/models/chill-schema.models.d.ts +141 -0
  131. package/lib/models/chill-schema.models.d.ts.map +1 -0
  132. package/lib/models/workspace-dialog.models.d.ts +16 -0
  133. package/lib/models/workspace-dialog.models.d.ts.map +1 -0
  134. package/lib/models/workspace-task.models.d.ts +36 -0
  135. package/lib/models/workspace-task.models.d.ts.map +1 -0
  136. package/lib/pages/confirm-reset-page.component.d.ts +21 -0
  137. package/lib/pages/confirm-reset-page.component.d.ts.map +1 -0
  138. package/lib/pages/crud/attachment-upload-dialog.component.d.ts +24 -0
  139. package/lib/pages/crud/attachment-upload-dialog.component.d.ts.map +1 -0
  140. package/lib/pages/crud/crud-page.component.d.ts +244 -0
  141. package/lib/pages/crud/crud-page.component.d.ts.map +1 -0
  142. package/lib/pages/login-page.component.d.ts +21 -0
  143. package/lib/pages/login-page.component.d.ts.map +1 -0
  144. package/lib/pages/permissions/auth-role-dialog.component.d.ts +29 -0
  145. package/lib/pages/permissions/auth-role-dialog.component.d.ts.map +1 -0
  146. package/lib/pages/permissions/auth-search-select.component.d.ts +28 -0
  147. package/lib/pages/permissions/auth-search-select.component.d.ts.map +1 -0
  148. package/lib/pages/permissions/auth-user-dialog.component.d.ts +35 -0
  149. package/lib/pages/permissions/auth-user-dialog.component.d.ts.map +1 -0
  150. package/lib/pages/permissions/permission-editor.component.d.ts +55 -0
  151. package/lib/pages/permissions/permission-editor.component.d.ts.map +1 -0
  152. package/lib/pages/permissions/permissions-page.component.d.ts +38 -0
  153. package/lib/pages/permissions/permissions-page.component.d.ts.map +1 -0
  154. package/lib/pages/permissions/role-permission.component.d.ts +43 -0
  155. package/lib/pages/permissions/role-permission.component.d.ts.map +1 -0
  156. package/lib/pages/permissions/user-permission.component.d.ts +43 -0
  157. package/lib/pages/permissions/user-permission.component.d.ts.map +1 -0
  158. package/lib/pages/register-page.component.d.ts +24 -0
  159. package/lib/pages/register-page.component.d.ts.map +1 -0
  160. package/lib/pages/reset-password-page.component.d.ts +18 -0
  161. package/lib/pages/reset-password-page.component.d.ts.map +1 -0
  162. package/lib/provide-chill-sharp-ui-core.d.ts +8 -0
  163. package/lib/provide-chill-sharp-ui-core.d.ts.map +1 -0
  164. package/lib/services/chill.service.d.ts +249 -0
  165. package/lib/services/chill.service.d.ts.map +1 -0
  166. package/lib/services/workspace-dialog.service.d.ts +22 -0
  167. package/lib/services/workspace-dialog.service.d.ts.map +1 -0
  168. package/lib/services/workspace-layout.service.d.ts +13 -0
  169. package/lib/services/workspace-layout.service.d.ts.map +1 -0
  170. package/lib/services/workspace-task-registry.service.d.ts +35 -0
  171. package/lib/services/workspace-task-registry.service.d.ts.map +1 -0
  172. package/lib/services/workspace-toolbar.service.d.ts +23 -0
  173. package/lib/services/workspace-toolbar.service.d.ts.map +1 -0
  174. package/lib/services/workspace.service.d.ts +114 -0
  175. package/lib/services/workspace.service.d.ts.map +1 -0
  176. package/lib/storage-keys.d.ts +5 -0
  177. package/lib/storage-keys.d.ts.map +1 -0
  178. package/lib/tasks/crud-task/crud-task.component.d.ts +33 -0
  179. package/lib/tasks/crud-task/crud-task.component.d.ts.map +1 -0
  180. package/lib/tasks/goto-url-task/goto-url-task.component.d.ts +31 -0
  181. package/lib/tasks/goto-url-task/goto-url-task.component.d.ts.map +1 -0
  182. package/lib/workspace/confirm-message-dialog.component.d.ts +16 -0
  183. package/lib/workspace/confirm-message-dialog.component.d.ts.map +1 -0
  184. package/lib/workspace/entity-options-dialog.component.d.ts +29 -0
  185. package/lib/workspace/entity-options-dialog.component.d.ts.map +1 -0
  186. package/lib/workspace/external-task-api.d.ts +2 -0
  187. package/lib/workspace/external-task-api.d.ts.map +1 -0
  188. package/lib/workspace/user-profile-dialog.component.d.ts +30 -0
  189. package/lib/workspace/user-profile-dialog.component.d.ts.map +1 -0
  190. package/lib/workspace/workspace-dialog-host.component.d.ts +26 -0
  191. package/lib/workspace/workspace-dialog-host.component.d.ts.map +1 -0
  192. package/lib/workspace/workspace-menu-item-dialog.component.d.ts +61 -0
  193. package/lib/workspace/workspace-menu-item-dialog.component.d.ts.map +1 -0
  194. package/lib/workspace/workspace-menu.component.d.ts +104 -0
  195. package/lib/workspace/workspace-menu.component.d.ts.map +1 -0
  196. package/lib/workspace/workspace-taskbar.component.d.ts +14 -0
  197. package/lib/workspace/workspace-taskbar.component.d.ts.map +1 -0
  198. package/package.json +54 -0
  199. package/public-api.d.ts +56 -0
  200. package/public-api.d.ts.map +1 -0
  201. package/service-worker/chill-sharp-service-worker.js +166 -0
  202. package/styles/core-theme.scss +1268 -0
  203. package/template-customization/upgrade.ps1.template +342 -0
  204. package/template-customization/upgrade.sh.template +271 -0
@@ -0,0 +1,178 @@
1
+ # Security And Compliance Guide
2
+
3
+ Versione italiana: [Italiano](../it/ComplianceGuide/README.md)
4
+
5
+
6
+ This document explains how ChillSharp can support security and compliance programs such as NIS2, ISO 27001, SOC 2, or internal secure-development policies.
7
+
8
+ It is intentionally generic: compliance frameworks differ by jurisdiction and sector, but many of the underlying engineering controls are the same.
9
+
10
+ Important: ChillSharp can help you implement and enforce several technical controls automatically, but using ChillSharp does not by itself make an application compliant. Compliance still depends on your hosting environment, operating procedures, monitoring, incident response, backup strategy, and legal scope.
11
+
12
+ ## Where ChillSharp Helps
13
+
14
+ ChillSharp is useful when you want your API layer to apply the same validation, authorization, metadata, and audit conventions consistently across the whole model instead of re-implementing them controller by controller.
15
+
16
+ That consistency matters in compliance work because many findings come from gaps between endpoints, forgotten checks in one update path, or UI and API behavior drifting apart over time.
17
+
18
+ ## Control Areas Supported By ChillSharp
19
+
20
+ ### 1. Input validation and data integrity
21
+
22
+ ChillSharp helps reduce invalid or unsafe data entering the system by centralizing validation around the entity and query model.
23
+
24
+ - standard DataAnnotations such as `[Required]`, `[StringLength]`, `[Range]`, and `[EmailAddress]` can be applied on `[ChillProperty]` members
25
+ - the validation pipeline runs during explicit `VALIDATE()` flows
26
+ - the same validation also runs automatically when the client goes directly to create or update
27
+ - custom business validation can be added through `OnValidation()`
28
+
29
+ This supports control objectives typically described as:
30
+
31
+ - input validation
32
+ - data quality enforcement
33
+ - secure-by-default server-side validation
34
+ - reduction of inconsistent validation across endpoints
35
+
36
+ Reference:
37
+ - [../ValidationModel/README.md](../ValidationModel/README.md)
38
+
39
+ ### 2. Authentication and controlled access
40
+
41
+ With `ChillSharp.Auth`, the host can expose Identity-backed account flows for:
42
+
43
+ - registration
44
+ - login
45
+ - refresh-token handling
46
+ - password change
47
+ - password reset
48
+
49
+ This helps standardize the access layer and avoid ad-hoc authentication endpoints with inconsistent behavior.
50
+
51
+ Reference:
52
+ - [../AuthenticationModel/README.md](../AuthenticationModel/README.md)
53
+
54
+ ### 3. Authorization and least privilege
55
+
56
+ ChillSharp provides a default-deny permission model with:
57
+
58
+ - user permissions
59
+ - role permissions
60
+ - module, entity, and property scopes
61
+ - allow/deny rules
62
+ - explicit precedence rules
63
+
64
+ This is useful for compliance programs that expect least-privilege access, separation of duties, and clear server-side enforcement of who can see or modify data.
65
+
66
+ Because property-level permissions are part of the model, ChillSharp can help reduce a common risk: users having access to the right entity but too much access to sensitive fields.
67
+
68
+ Reference:
69
+ - [../PermissionModel/README.md](../PermissionModel/README.md)
70
+
71
+ ### 4. Audit trail fields on data changes
72
+
73
+ `ChillEntity` automatically maintains:
74
+
75
+ - `LastUpdate`
76
+ - `LastUpdateUser`
77
+ - `LastUpdateUtcOffset`
78
+ - `Checksum`
79
+
80
+ These values are updated as part of the runtime path used by ChillSharp during updates, which helps enforce a consistent minimum audit trail without depending on every derived entity to remember to do it manually.
81
+
82
+ This supports common control objectives such as:
83
+
84
+ - traceability of changes
85
+ - accountability of user actions
86
+ - basic integrity checking
87
+ - evidence that records were modified, when, and by whom
88
+
89
+ The checksum is especially useful as a lightweight integrity signal for synchronization, comparisons, and tamper detection scenarios inside the application model.
90
+
91
+ Reference:
92
+ - [../README.md](../README.md#audit-fields)
93
+
94
+ ### 5. Consistent schema metadata and safer client generation
95
+
96
+ ChillSharp can expose schema metadata and generate clients from the API description.
97
+
98
+ This does not replace a security control by itself, but it can reduce implementation drift between:
99
+
100
+ - backend validation and frontend forms
101
+ - backend authorization and frontend capabilities
102
+ - actual API contracts and hand-written clients
103
+
104
+ Reducing drift matters in audits because inconsistent clients and duplicated API glue often create hidden exceptions to the intended control model.
105
+
106
+ Reference:
107
+ - [../ClientGeneration/README.md](../ClientGeneration/README.md)
108
+
109
+ ## Why This Matters For NIS2 And Similar Frameworks
110
+
111
+ Frameworks such as NIS2 usually do not certify a library. They expect organizations to implement risk-based technical and organizational measures.
112
+
113
+ In that context, ChillSharp is best understood as a control-enforcement component that can help with:
114
+
115
+ - identity and access control
116
+ - least privilege
117
+ - traceability of updates
118
+ - consistent validation of incoming data
119
+ - reduction of manual security plumbing
120
+
121
+ This can lower the probability of common implementation defects and make the application easier to review during internal audits or external assessments.
122
+
123
+ ## What ChillSharp Does Not Solve On Its Own
124
+
125
+ You still need to design and operate the broader security system around the library. In particular, ChillSharp does not by itself provide:
126
+
127
+ - a full SIEM or centralized security logging strategy
128
+ - incident detection and response procedures
129
+ - vulnerability management and patch governance
130
+ - infrastructure hardening
131
+ - network segmentation
132
+ - transport security configuration
133
+ - encryption key management
134
+ - secrets management
135
+ - backup and disaster recovery processes
136
+ - MFA policy and corporate identity governance
137
+ - supplier risk management
138
+ - legal interpretation of NIS2 or any other regulation
139
+
140
+ Those controls belong partly to your application, but mostly to your platform and organizational processes.
141
+
142
+ ## Recommended Positioning In Audit Documentation
143
+
144
+ When documenting ChillSharp in a security review, describe it as:
145
+
146
+ - a framework that centralizes API validation
147
+ - a framework that enforces role- and property-based authorization
148
+ - a framework that maintains basic audit metadata on entity updates
149
+ - a framework that reduces inconsistent custom CRUD code
150
+
151
+ Avoid stronger claims such as:
152
+
153
+ - "the application is NIS2 compliant because it uses ChillSharp"
154
+ - "ChillSharp guarantees regulatory compliance"
155
+
156
+ The stronger and more defensible statement is:
157
+
158
+ "ChillSharp helps implement and automate several technical controls that are commonly required by security and compliance frameworks, while final compliance depends on the full system design and operating model."
159
+
160
+ ## Practical Checklist
161
+
162
+ If you want to use ChillSharp as part of a compliance-oriented architecture, the baseline is:
163
+
164
+ 1. use `ChillEntity` and annotate exposed properties with `[ChillProperty]`
165
+ 2. add DataAnnotations and custom `OnValidation()` rules for business constraints
166
+ 3. enable `ChillSharp.Auth` for authenticated systems
167
+ 4. configure roles and permission rules with default-deny posture
168
+ 5. verify that `GetCurrentUserName()` is correctly implemented in your `IChillContext`
169
+ 6. preserve and monitor `LastUpdate`, `LastUpdateUtcOffset`, `LastUpdateUser`, and `Checksum`
170
+ 7. secure the host with HTTPS, logging, backups, patching, and operational controls outside ChillSharp
171
+
172
+ ## Related Documents
173
+
174
+ - [../ValidationModel/README.md](../ValidationModel/README.md)
175
+ - [../AuthenticationModel/README.md](../AuthenticationModel/README.md)
176
+ - [../PermissionModel/README.md](../PermissionModel/README.md)
177
+ - [../ClientGeneration/README.md](../ClientGeneration/README.md)
178
+ - [../RegisterContext.md](../RegisterContext.md)
@@ -0,0 +1,94 @@
1
+ # ChillSharp Configuration Reference
2
+
3
+ Versione italiana: [Italiano](../it/Configuration/README.md)
4
+
5
+
6
+ This document lists the environment variables currently used by ChillSharp and by the example ChillSharp host in `ChillSharp.Examples/BloggingApiService`.
7
+
8
+ Use it as a quick reference when configuring Docker, `docker compose`, or another deployment target.
9
+
10
+ At startup, `AddChillApi<TContext>()` writes all `CHILLSHARP_` and `CHILL_SHARP_` process environment variables to the console. Variable names containing `PASSWORD` are masked as `********`.
11
+
12
+ ## Hosting
13
+
14
+ | Option | ENV variable | Description | Default |
15
+ | --- | --- | --- | --- |
16
+ | ASP.NET Core listen URLs | `ASPNETCORE_URLS` | URLs bound by the ASP.NET Core host. | `http://+:8080` |
17
+ | ASP.NET Core environment | `ASPNETCORE_ENVIRONMENT` | Standard ASP.NET Core environment name. | `Development` in the example `.env` |
18
+
19
+ ## Core API
20
+
21
+ | Option | ENV variable | Description | Default |
22
+ | --- | --- | --- | --- |
23
+ | SQLite database path | `CHILLSHARP_DB_PATH` | File path used by the example `BloggingContext` SQLite database. | `/data/blogging.db` |
24
+ | Primary culture | `CHILLSHARP_PRIMARY_CULTURE` | Value returned by `IChillContext.GetPrimaryCultureName()`. | `en-GB` |
25
+ | Secondary culture | `CHILLSHARP_SECONDARY_CULTURE` | Value returned by `IChillContext.GetSecondaryCultureName()`. | `it-IT` |
26
+ | Protected core API | `CHILLSHARP_API_PROTECTED` | Requires authentication for the core ChillSharp API when `true`. | `true` when auth is enabled |
27
+ | DTO system time zone | `CHILLSHARP_SYSTEM_TIMEZONE` | IANA time-zone id used by ChillSharp DTO `DateTime` and `DateTimeOffset` parsing and serialization helpers. | `Europe/Rome` |
28
+
29
+ ## Module Toggles
30
+
31
+ | Option | ENV variable | Description | Default |
32
+ | --- | --- | --- | --- |
33
+ | Enable schema module | `CHILLSHARP_ENABLE_SCHEMA` | Registers `ChillSharp.Schema` services. | `true` |
34
+ | Enable auth module | `CHILLSHARP_ENABLE_AUTH` | Registers `ChillSharp.Auth` account and auth-management services. | `true` |
35
+ | Enable i18n module | `CHILLSHARP_ENABLE_I18N` | Registers `ChillSharp.I18n` services. | `true` |
36
+ | Enable MCP module | `CHILLSHARP_ENABLE_MCP` | Registers `ChillSharp.Mcp` services and maps the MCP endpoint when the host context supports schema metadata. | `true` |
37
+ | Enable attachment module | `CHILLSHARP_ENABLE_ATTACHMENT` | Registers `ChillSharp.Attachment` services and endpoints when the host context supports attachments. | `false` in the example host, set `true` when the context implements attachments |
38
+
39
+ ## Attachment Storage
40
+
41
+ | Option | ENV variable | Description | Default |
42
+ | --- | --- | --- | --- |
43
+ | Attachment archive root | `CHILLSHARP_ATTACHMENT_ARCHIVE_ROOT` | Root folder used by `ChillSharp.Attachment` to read and store archived files. | `attachments` under the host base directory |
44
+
45
+ ## Auth Tokens And Password Flows
46
+
47
+ | Option | ENV variable | Description | Default |
48
+ | --- | --- | --- | --- |
49
+ | Access-token lifetime | `CHILLSHARP_AUTH_ACCESS_TOKEN_MINUTES` | Minutes before a ChillSharp bearer access token expires. Read directly by `ChillAuthIdentityApiOptions` and `ChillIdentityApiOptions` unless the host overrides `AccessTokenLifetime` in code. | `20` |
50
+ | Refresh-token lifetime | `CHILLSHARP_AUTH_REFRESH_TOKEN_DAYS` | Days before a refresh token expires. Read directly by `ChillAuthIdentityApiOptions` and `ChillIdentityApiOptions` unless the host overrides `RefreshTokenLifetime` in code. | `14` |
51
+ | Return reset token in API response | `CHILLSHARP_AUTH_RETURN_PASSWORD_RESET_TOKENS` | Includes `userId` and `resetToken` in `/api/chill-auth/account/request-password-reset` response when `true`. | `false` in the example host |
52
+ | Send password-reset emails | `CHILLSHARP_AUTH_SEND_PASSWORD_RESET_EMAILS` | Sends a password-reset email through SMTP when `true`. | `false` in code, `true` in the example `.env` |
53
+ | Password-reset email subject | `CHILLSHARP_AUTH_PASSWORD_RESET_SUBJECT` | Subject used for password-reset emails. | `Reset your password` |
54
+ | Password-reset URL | `CHILLSHARP_AUTH_PASSWORD_RESET_URL` | Optional frontend URL used to build a clickable password-reset link with `userId` and `resetToken`. | unset |
55
+
56
+ ## SMTP Password-Reset Delivery
57
+
58
+ | Option | ENV variable | Description | Default |
59
+ | --- | --- | --- | --- |
60
+ | SMTP host | `CHILLSHARP_SMTP_HOST` | SMTP server host name used for no-reply password-reset delivery. | unset |
61
+ | SMTP port | `CHILLSHARP_SMTP_PORT` | SMTP server port. | `587` |
62
+ | SMTP SSL/TLS | `CHILLSHARP_SMTP_ENABLE_SSL` | Enables SSL/TLS on the SMTP client when `true`. | `true` |
63
+ | SMTP user name | `CHILLSHARP_SMTP_USERNAME` | SMTP authentication user name. | unset |
64
+ | SMTP password | `CHILLSHARP_SMTP_PASSWORD` | SMTP authentication password. | unset |
65
+ | No-reply sender email | `CHILLSHARP_SMTP_FROM_EMAIL` | Sender email address used for password-reset emails. | unset |
66
+ | No-reply sender display name | `CHILLSHARP_SMTP_FROM_DISPLAY_NAME` | Sender display name used for password-reset emails. | unset |
67
+
68
+ When `CHILLSHARP_AUTH_SEND_PASSWORD_RESET_EMAILS=true`, the SMTP host and sender email must be configured or the reset flow will fail.
69
+
70
+ ## Root User Bootstrap
71
+
72
+ These variables are read by `ChillAuthRootUserInitializer<TUser>` during startup when root-user initialization is enabled.
73
+
74
+ | Option | ENV variable | Description | Default |
75
+ | --- | --- | --- | --- |
76
+ | Initialize root user | `CHILLSHARP_AUTH_INITIALIZE_ROOT_USER` | Creates the root Identity user at startup when credentials are available. | `true` |
77
+ | Create linked ChillSharp auth user | `CHILLSHARP_AUTH_CREATE_ROOT_AUTH_USER` | Also creates the linked ChillSharp `AuthUser` with permission-management access. | `true` |
78
+ | Root user name | `CHILLSHARP_AUTH_ROOT_USERNAME` | Login name for the bootstrap administrator. | unset |
79
+ | Root password | `CHILLSHARP_AUTH_ROOT_PASSWORD` | Password for the bootstrap administrator. | unset |
80
+ | Root email | `CHILLSHARP_AUTH_ROOT_EMAIL` | Optional email for the bootstrap administrator. | unset |
81
+ | Root display name | `CHILLSHARP_AUTH_ROOT_DISPLAY_NAME` | Display name copied into the linked ChillSharp `AuthUser`. | `Root` in code |
82
+
83
+ ## Notes
84
+
85
+ - Most variables listed here use the example host's `CHILLSHARP_*` prefix. `CHILLSHARP_SYSTEM_TIMEZONE` is a core ChillSharp runtime variable used directly by DTO date/time mapping.
86
+ - Startup console output includes both `CHILLSHARP_*` and `CHILL_SHARP_*` variables. `PASSWORD` values are masked, but other values are printed as-is.
87
+ - `CHILLSHARP_AUTH_ACCESS_TOKEN_MINUTES` and `CHILLSHARP_AUTH_REFRESH_TOKEN_DAYS` are built-in ChillSharp auth defaults. Positive integer values are accepted; invalid, zero, or negative values fall back to the code defaults.
88
+ - `CHILLSHARP_ATTACHMENT_ARCHIVE_ROOT` is read by `ChillSharp.Attachment` directly and should point at a persistent volume in Docker.
89
+ - `CHILLSHARP_SYSTEM_TIMEZONE` expects an IANA time-zone id such as `Europe/Rome` or `America/New_York`.
90
+ - `CHILLSHARP_SYSTEM_TIMEZONE` affects `DateTime` and some `DateTimeOffset` normalization paths. `DateOnly` and `TimeOnly` keep standard .NET string output.
91
+ - The `CHILLSHARP_*` variables listed here are consumed either by ChillSharp itself or by the example host startup code.
92
+ - If you build your own host application, you can keep these names or map configuration differently in your own startup code.
93
+ - For deployment examples, also see [doc/HowTo/05-docker-env-variables.md](../HowTo/05-docker-env-variables.md).
94
+ - For the full date/time serialization reference and examples, see [doc/DateTimeSerialization.md](../DateTimeSerialization.md).
@@ -0,0 +1,114 @@
1
+ # Current User Preferences
2
+
3
+ Versione italiana: [Italiano](./it/CurrentUserPreferences.md)
4
+
5
+ `ChillSharp.Auth` can make the authenticated user's display preferences available to entity lifecycle hooks without querying `AuthUser` during every save.
6
+
7
+ The immutable `ChillUserPreferences` snapshot contains:
8
+
9
+ - `DisplayCultureName`
10
+ - `DisplayTimeZone`
11
+ - `DisplayDateFormat`
12
+ - `DisplayNumberFormat`
13
+ - `PreferredTheme`
14
+
15
+ ## Registration And Cache Lifecycle
16
+
17
+ `AddChillAuthApi<TContext>()` registers a singleton `IChillAuthUserPreferencesCache` and scoped `IChillAuthUserPreferencesAccessor`.
18
+
19
+ When the user logs in or refreshes a token, ChillSharp loads the matching `AuthUser` once and warms a snapshot keyed by its `ExternalId`. The accessor only reads that in-memory snapshot during requests; it does not query the user table.
20
+
21
+ `ChillAuthService` refreshes the cached snapshot after creating or updating an `AuthUser`. It invalidates a deleted user's snapshot and both the previous and new keys when `ExternalId` changes.
22
+
23
+ The cache stores scalar preference values, never a tracked EF Core `AuthUser` instance.
24
+
25
+ ## Current User Preferences API
26
+
27
+ Authenticated clients can retrieve the same snapshot used by server-side code with:
28
+
29
+ ```http
30
+ GET /api/chill-auth/current-user-preferences
31
+ Authorization: Bearer <access token>
32
+ ```
33
+
34
+ The response is a `ChillUserPreferences` JSON object:
35
+
36
+ ```json
37
+ {
38
+ "displayCultureName": "it-IT",
39
+ "displayTimeZone": "Europe/Rome",
40
+ "displayDateFormat": "dd/MM/yyyy",
41
+ "displayNumberFormat": "N2",
42
+ "preferredTheme": "cini"
43
+ }
44
+ ```
45
+
46
+ Use this endpoint after login and when restoring an authenticated UI session. It is the source of truth for the language/culture, time zone, date format, and number format used by the API client and UI; do not derive those values from the browser, operating system, token claims, or an auth-management endpoint.
47
+
48
+ The C# client exposes `GetCurrentUserPreferences()`. The Python client exposes `get_current_user_preferences()`, while the TypeScript client and Angular wrapper expose `getCurrentUserPreferences()`. The Vue and React packages additionally provide `useCurrentUserPreferences()`.
49
+
50
+ In the Angular UI Core package, inject `ChillService` and consume its `userPreferences` signal or the individual `displayCultureName`, `displayTimeZone`, `displayDateFormat`, `displayNumberFormat`, and `preferredTheme` projections. Use them for UI text culture, date and number format/parse operations, UTC-to-local time conversion, and the selected theme.
51
+
52
+ `PreferredTheme` is an opaque string: the backend stores and returns it without knowing which themes a client provides. UI Core uses the browser's `prefers-color-scheme` choice (`bright` or `dark`) when there is no authenticated preference. Client applications can declare additional selectable themes when they register UI Core:
53
+
54
+ ```ts
55
+ provideChillSharpUiCore({ additionalThemes: ['cini'] })
56
+ ```
57
+
58
+ The built-in choices are `bright`, `dark`, and `soft`. If an authenticated user's stored value is not available in that client, UI Core falls back to the browser light/dark preference.
59
+
60
+ ## Host DbContext
61
+
62
+ `IChillContext.GetCurrentUserPreferences()` returns `ChillUserPreferences.Empty` by default. In an auth-enabled custom host context, inject `IChillAuthUserPreferencesAccessor` and delegate to it:
63
+
64
+ ```csharp
65
+ using ChillSharp;
66
+ using ChillSharp.Auth.Services;
67
+
68
+ public class AppDbContext : DbContext, IChillContext, IChillAuthDbContext
69
+ {
70
+ private readonly IChillAuthUserPreferencesAccessor? _userPreferencesAccessor;
71
+
72
+ public AppDbContext(
73
+ DbContextOptions<AppDbContext> options,
74
+ IChillAuthUserPreferencesAccessor? userPreferencesAccessor = null)
75
+ : base(options)
76
+ {
77
+ _userPreferencesAccessor = userPreferencesAccessor;
78
+ }
79
+
80
+ public ChillUserPreferences GetCurrentUserPreferences() =>
81
+ _userPreferencesAccessor?.Current ?? ChillUserPreferences.Empty;
82
+
83
+ public string GetDefaultUserCultureName()
84
+ {
85
+ var cultureName = GetCurrentUserPreferences().DisplayCultureName;
86
+ return string.IsNullOrWhiteSpace(cultureName)
87
+ ? GetPrimaryCultureName()
88
+ : cultureName;
89
+ }
90
+ }
91
+ ```
92
+
93
+ The optional constructor parameter keeps design-time creation and tests that construct the context directly compatible. A normal dependency-injection-created context receives the accessor.
94
+
95
+ `ChillAuthDbContext` already implements this pattern.
96
+
97
+ ## Entity Lifecycle Hooks
98
+
99
+ Use the snapshot directly from the supplied `IChillContext`. No database access is required in the hook.
100
+
101
+ ```csharp
102
+ public override void OnUpdate(IChillContext context)
103
+ {
104
+ var preferences = context.GetCurrentUserPreferences();
105
+ var timeZone = preferences.DisplayTimeZone;
106
+
107
+ if (!string.IsNullOrWhiteSpace(timeZone))
108
+ {
109
+ // Apply application-specific time-zone behavior.
110
+ }
111
+ }
112
+ ```
113
+
114
+ All values can be empty for background jobs, unauthenticated calls, or a user without a matching `AuthUser`. Treat them as optional and choose an application fallback. Validate `DisplayTimeZone` before using it as a time-zone identifier.
@@ -0,0 +1,154 @@
1
+ # ChillSharp DateTime Policy
2
+
3
+ Versione italiana: [Italiano](../it/DateTimePolicy/README.md)
4
+
5
+
6
+ This document defines the ChillSharp DTO policy for `DateTime` and `DateTimeOffset` values.
7
+
8
+ The policy applies when ChillSharp reads or writes values through DTO property bags, such as `ChillDtoEntity.Properties` and `ChillDtoQuery.Properties`.
9
+
10
+ ## System Time Zone
11
+
12
+ ChillSharp uses a configured system time zone when a DTO value does not carry an explicit offset.
13
+
14
+ Environment variable:
15
+
16
+ ```text
17
+ CHILLSHARP_SYSTEM_TIMEZONE
18
+ ```
19
+
20
+ Default:
21
+
22
+ ```text
23
+ Europe/Rome
24
+ ```
25
+
26
+ Use an IANA time-zone id, for example:
27
+
28
+ ```text
29
+ Europe/Rome
30
+ America/New_York
31
+ UTC
32
+ ```
33
+
34
+ This configured time zone is not the same thing as `DateTimeKind.Local`. `DateTimeKind.Local` means the operating system local time zone. ChillSharp uses its own configured time zone explicitly.
35
+
36
+ ## Incoming DTO Values
37
+
38
+ Incoming values are values received from a client and applied to CLR properties.
39
+
40
+ ### DateTimeOffset
41
+
42
+ `DateTimeOffset` preserves an explicit offset when the client sends one.
43
+
44
+ Examples:
45
+
46
+ ```text
47
+ 2026-04-11T14:30:00.0000000+02:00
48
+ 2026-04-11T12:30:00.0000000Z
49
+ ```
50
+
51
+ Policy:
52
+
53
+ - if the incoming value has `Z`, preserve it as a UTC `DateTimeOffset`
54
+ - if the incoming value has an explicit offset, preserve that offset
55
+ - if the incoming value has no offset, interpret it as local time in `CHILLSHARP_SYSTEM_TIMEZONE`
56
+ - store the resulting value as a `DateTimeOffset` with the resolved offset
57
+
58
+ Example with `CHILLSHARP_SYSTEM_TIMEZONE=Europe/Rome`:
59
+
60
+ ```text
61
+ Incoming: 2026-04-11T14:30:00
62
+ Stored: 2026-04-11T14:30:00+02:00
63
+ ```
64
+
65
+ ### DateTime
66
+
67
+ `DateTime` represents an instant and is normalized to UTC when read from DTO input.
68
+
69
+ Policy:
70
+
71
+ - if the incoming value has `Z`, parse it as UTC
72
+ - if the incoming value has an explicit offset, parse it as that instant
73
+ - if the incoming value has no offset, interpret it as local time in `CHILLSHARP_SYSTEM_TIMEZONE`
74
+ - store the resulting value as a UTC `DateTime`
75
+ - set `DateTime.Kind` to `DateTimeKind.Utc`
76
+
77
+ Example with `CHILLSHARP_SYSTEM_TIMEZONE=Europe/Rome`:
78
+
79
+ ```text
80
+ Incoming: 2026-04-11T14:30:00
81
+ Stored: 2026-04-11T12:30:00Z
82
+ Kind: Utc
83
+ ```
84
+
85
+ Example with an explicit offset:
86
+
87
+ ```text
88
+ Incoming: 2026-04-11T14:30:00+02:00
89
+ Stored: 2026-04-11T12:30:00Z
90
+ Kind: Utc
91
+ ```
92
+
93
+ ## Outgoing DTO Values
94
+
95
+ Outgoing values are CLR values serialized into DTO property bags before returning data to a client.
96
+
97
+ ### DateTimeOffset
98
+
99
+ ChillSharp serializes `DateTimeOffset` as an ISO 8601 string with its offset.
100
+
101
+ ```text
102
+ 2026-04-11T14:30:00.0000000+02:00
103
+ ```
104
+
105
+ ### DateTime
106
+
107
+ ChillSharp serializes `DateTime` as an ISO 8601 string with an explicit offset.
108
+
109
+ Policy:
110
+
111
+ - if the source value is UTC, convert it to `CHILLSHARP_SYSTEM_TIMEZONE` for DTO output
112
+ - if the source value is unspecified, interpret it as local time in `CHILLSHARP_SYSTEM_TIMEZONE`
113
+ - emit an ISO 8601 string with the resolved offset
114
+
115
+ Example with `CHILLSHARP_SYSTEM_TIMEZONE=Europe/Rome`:
116
+
117
+ ```text
118
+ CLR: 2026-04-11T12:30:00Z
119
+ DTO: 2026-04-11T14:30:00.0000000+02:00
120
+ ```
121
+
122
+ Depending on the JSON serializer, the `+` character may appear as `\u002B` on the wire:
123
+
124
+ ```json
125
+ "2026-04-11T14:30:00.0000000\u002B02:00"
126
+ ```
127
+
128
+ That is valid JSON and clients read it back as `+02:00`.
129
+
130
+ ## Database Guidance
131
+
132
+ This policy is designed to work cleanly with providers such as PostgreSQL/Npgsql.
133
+
134
+ Recommended mapping:
135
+
136
+ - use `DateTime` for instant values that should be persisted as UTC
137
+ - use `DateTimeOffset` when preserving the incoming offset matters
138
+ - use `DateOnly` and `TimeOnly` for calendar dates or times of day that are not instants
139
+
140
+ For PostgreSQL:
141
+
142
+ - `DateTime` values produced by DTO parsing are UTC and are suitable for `timestamp with time zone`
143
+ - local wall-clock values should not be modeled as `DateTime` unless converting them to UTC is intended
144
+
145
+ ## Server-Managed Audit Fields
146
+
147
+ ChillSharp server-managed audit fields are ignored when applying incoming entity DTO values:
148
+
149
+ - `Checksum`
150
+ - `LastUpdateUser`
151
+ - `LastUpdate`
152
+ - `LastUpdateUtcOffset`
153
+
154
+ Clients may receive these values from DTO output, but sending them back does not overwrite the server-managed entity state.