tsondb 0.1.3

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 (170) hide show
  1. package/README.md +3 -0
  2. package/lib/ModelContainer.d.ts +17 -0
  3. package/lib/ModelContainer.js +63 -0
  4. package/lib/Schema.d.ts +8 -0
  5. package/lib/Schema.js +72 -0
  6. package/lib/client/api.d.ts +11 -0
  7. package/lib/client/api.js +83 -0
  8. package/lib/client/components/Layout.d.ts +10 -0
  9. package/lib/client/components/Layout.js +4 -0
  10. package/lib/client/components/Select.d.ts +3 -0
  11. package/lib/client/components/Select.js +2 -0
  12. package/lib/client/components/typeInputs/ArrayTypeInput.d.ts +13 -0
  13. package/lib/client/components/typeInputs/ArrayTypeInput.js +10 -0
  14. package/lib/client/components/typeInputs/BooleanTypeInput.d.ts +9 -0
  15. package/lib/client/components/typeInputs/BooleanTypeInput.js +6 -0
  16. package/lib/client/components/typeInputs/DateTypeInput.d.ts +9 -0
  17. package/lib/client/components/typeInputs/DateTypeInput.js +9 -0
  18. package/lib/client/components/typeInputs/FloatTypeInput.d.ts +9 -0
  19. package/lib/client/components/typeInputs/FloatTypeInput.js +15 -0
  20. package/lib/client/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.d.ts +7 -0
  21. package/lib/client/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.js +4 -0
  22. package/lib/client/components/typeInputs/IncludeIdentifierTypeInput.d.ts +13 -0
  23. package/lib/client/components/typeInputs/IncludeIdentifierTypeInput.js +18 -0
  24. package/lib/client/components/typeInputs/IntegerTypeInput.d.ts +9 -0
  25. package/lib/client/components/typeInputs/IntegerTypeInput.js +15 -0
  26. package/lib/client/components/typeInputs/NestedEntityMapTypeInput.d.ts +13 -0
  27. package/lib/client/components/typeInputs/NestedEntityMapTypeInput.js +25 -0
  28. package/lib/client/components/typeInputs/ObjectTypeInput.d.ts +13 -0
  29. package/lib/client/components/typeInputs/ObjectTypeInput.js +20 -0
  30. package/lib/client/components/typeInputs/ReferenceIdentifierTypeInput.d.ts +11 -0
  31. package/lib/client/components/typeInputs/ReferenceIdentifierTypeInput.js +9 -0
  32. package/lib/client/components/typeInputs/StringTypeInput.d.ts +9 -0
  33. package/lib/client/components/typeInputs/StringTypeInput.js +10 -0
  34. package/lib/client/components/typeInputs/TypeInput.d.ts +13 -0
  35. package/lib/client/components/typeInputs/TypeInput.js +87 -0
  36. package/lib/client/components/typeInputs/utils/EnumDeclField.d.ts +13 -0
  37. package/lib/client/components/typeInputs/utils/EnumDeclField.js +38 -0
  38. package/lib/client/components/typeInputs/utils/MismatchingTypeError.d.ts +7 -0
  39. package/lib/client/components/typeInputs/utils/MismatchingTypeError.js +4 -0
  40. package/lib/client/components/typeInputs/utils/ValidationErrors.d.ts +6 -0
  41. package/lib/client/components/typeInputs/utils/ValidationErrors.js +4 -0
  42. package/lib/client/hooks/useEntityFromRoute.d.ts +5 -0
  43. package/lib/client/hooks/useEntityFromRoute.js +20 -0
  44. package/lib/client/hooks/useInstanceNamesByEntity.d.ts +3 -0
  45. package/lib/client/hooks/useInstanceNamesByEntity.js +18 -0
  46. package/lib/client/hooks/useSecondaryDeclarations.d.ts +3 -0
  47. package/lib/client/hooks/useSecondaryDeclarations.js +18 -0
  48. package/lib/client/index.d.ts +1 -0
  49. package/lib/client/index.js +11 -0
  50. package/lib/client/routes/CreateInstance.d.ts +2 -0
  51. package/lib/client/routes/CreateInstance.js +68 -0
  52. package/lib/client/routes/Entity.d.ts +2 -0
  53. package/lib/client/routes/Entity.js +47 -0
  54. package/lib/client/routes/Home.d.ts +2 -0
  55. package/lib/client/routes/Home.js +18 -0
  56. package/lib/client/routes/Instance.d.ts +2 -0
  57. package/lib/client/routes/Instance.js +73 -0
  58. package/lib/client/routes/NotFound.d.ts +2 -0
  59. package/lib/client/routes/NotFound.js +5 -0
  60. package/lib/client/utils/typeSkeleton.d.ts +3 -0
  61. package/lib/client/utils/typeSkeleton.js +51 -0
  62. package/lib/index.d.ts +1 -0
  63. package/lib/index.js +1 -0
  64. package/lib/renderers/Output.d.ts +4 -0
  65. package/lib/renderers/Output.js +1 -0
  66. package/lib/renderers/jsonschema/index.d.ts +6 -0
  67. package/lib/renderers/jsonschema/index.js +12 -0
  68. package/lib/renderers/jsonschema/render.d.ts +5 -0
  69. package/lib/renderers/jsonschema/render.js +156 -0
  70. package/lib/renderers/ts/index.d.ts +6 -0
  71. package/lib/renderers/ts/index.js +11 -0
  72. package/lib/renderers/ts/render.d.ts +5 -0
  73. package/lib/renderers/ts/render.js +109 -0
  74. package/lib/schema/Node.d.ts +37 -0
  75. package/lib/schema/Node.js +79 -0
  76. package/lib/schema/declarations/Declaration.d.ts +44 -0
  77. package/lib/schema/declarations/Declaration.js +98 -0
  78. package/lib/schema/declarations/EntityDecl.d.ts +73 -0
  79. package/lib/schema/declarations/EntityDecl.js +57 -0
  80. package/lib/schema/declarations/EnumDecl.d.ts +33 -0
  81. package/lib/schema/declarations/EnumDecl.js +104 -0
  82. package/lib/schema/declarations/TypeAliasDecl.d.ts +33 -0
  83. package/lib/schema/declarations/TypeAliasDecl.js +49 -0
  84. package/lib/schema/index.d.ts +20 -0
  85. package/lib/schema/index.js +20 -0
  86. package/lib/schema/parameters/TypeParameter.d.ts +14 -0
  87. package/lib/schema/parameters/TypeParameter.js +11 -0
  88. package/lib/schema/types/Type.d.ts +42 -0
  89. package/lib/schema/types/Type.js +177 -0
  90. package/lib/schema/types/generic/ArrayType.d.ts +30 -0
  91. package/lib/schema/types/generic/ArrayType.js +38 -0
  92. package/lib/schema/types/generic/ObjectType.d.ts +47 -0
  93. package/lib/schema/types/generic/ObjectType.js +70 -0
  94. package/lib/schema/types/primitives/BooleanType.d.ts +15 -0
  95. package/lib/schema/types/primitives/BooleanType.js +15 -0
  96. package/lib/schema/types/primitives/DateType.d.ts +16 -0
  97. package/lib/schema/types/primitives/DateType.js +17 -0
  98. package/lib/schema/types/primitives/FloatType.d.ts +26 -0
  99. package/lib/schema/types/primitives/FloatType.js +17 -0
  100. package/lib/schema/types/primitives/IntegerType.d.ts +26 -0
  101. package/lib/schema/types/primitives/IntegerType.js +21 -0
  102. package/lib/schema/types/primitives/NumericType.d.ts +6 -0
  103. package/lib/schema/types/primitives/NumericType.js +2 -0
  104. package/lib/schema/types/primitives/PrimitiveType.d.ts +6 -0
  105. package/lib/schema/types/primitives/PrimitiveType.js +1 -0
  106. package/lib/schema/types/primitives/StringType.d.ts +25 -0
  107. package/lib/schema/types/primitives/StringType.js +20 -0
  108. package/lib/schema/types/references/GenericArgumentIdentifierType.d.ts +21 -0
  109. package/lib/schema/types/references/GenericArgumentIdentifierType.js +18 -0
  110. package/lib/schema/types/references/IncludeIdentifierType.d.ts +28 -0
  111. package/lib/schema/types/references/IncludeIdentifierType.js +25 -0
  112. package/lib/schema/types/references/NestedEntityMapType.d.ts +36 -0
  113. package/lib/schema/types/references/NestedEntityMapType.js +67 -0
  114. package/lib/schema/types/references/ReferenceIdentifierType.d.ts +23 -0
  115. package/lib/schema/types/references/ReferenceIdentifierType.js +21 -0
  116. package/lib/schema/validation/options.d.ts +4 -0
  117. package/lib/schema/validation/options.js +12 -0
  118. package/lib/schema/validation/type.d.ts +4 -0
  119. package/lib/schema/validation/type.js +1 -0
  120. package/lib/server/index.d.ts +8 -0
  121. package/lib/server/index.js +207 -0
  122. package/lib/server/instanceOperations.d.ts +7 -0
  123. package/lib/server/instanceOperations.js +67 -0
  124. package/lib/shared/api.d.ts +42 -0
  125. package/lib/shared/api.js +1 -0
  126. package/lib/shared/enum.d.ts +1 -0
  127. package/lib/shared/enum.js +1 -0
  128. package/lib/shared/utils/compare.d.ts +13 -0
  129. package/lib/shared/utils/compare.js +24 -0
  130. package/lib/shared/utils/displayName.d.ts +2 -0
  131. package/lib/shared/utils/displayName.js +31 -0
  132. package/lib/shared/utils/instances.d.ts +6 -0
  133. package/lib/shared/utils/instances.js +1 -0
  134. package/lib/shared/utils/object.d.ts +2 -0
  135. package/lib/shared/utils/object.js +2 -0
  136. package/lib/shared/utils/string.d.ts +6 -0
  137. package/lib/shared/utils/string.js +52 -0
  138. package/lib/shared/utils/typeSafety.d.ts +1 -0
  139. package/lib/shared/utils/typeSafety.js +3 -0
  140. package/lib/shared/utils/validation.d.ts +3 -0
  141. package/lib/shared/utils/validation.js +14 -0
  142. package/lib/shared/validation/array.d.ts +6 -0
  143. package/lib/shared/validation/array.js +29 -0
  144. package/lib/shared/validation/date.d.ts +4 -0
  145. package/lib/shared/validation/date.js +13 -0
  146. package/lib/shared/validation/identifier.d.ts +1 -0
  147. package/lib/shared/validation/identifier.js +7 -0
  148. package/lib/shared/validation/number.d.ts +12 -0
  149. package/lib/shared/validation/number.js +34 -0
  150. package/lib/shared/validation/object.d.ts +6 -0
  151. package/lib/shared/validation/object.js +13 -0
  152. package/lib/shared/validation/string.d.ts +6 -0
  153. package/lib/shared/validation/string.js +15 -0
  154. package/lib/tsconfig.tsbuildinfo +1 -0
  155. package/lib/utils/enum.d.ts +6 -0
  156. package/lib/utils/enum.js +1 -0
  157. package/lib/utils/error.d.ts +2 -0
  158. package/lib/utils/error.js +18 -0
  159. package/lib/utils/instances.d.ts +4 -0
  160. package/lib/utils/instances.js +12 -0
  161. package/lib/utils/lazy.d.ts +16 -0
  162. package/lib/utils/lazy.js +32 -0
  163. package/lib/utils/object.d.ts +3 -0
  164. package/lib/utils/object.js +1 -0
  165. package/lib/utils/render.d.ts +4 -0
  166. package/lib/utils/render.js +8 -0
  167. package/lib/utils/result.d.ts +57 -0
  168. package/lib/utils/result.js +48 -0
  169. package/package.json +46 -0
  170. package/public/css/styles.css +418 -0
@@ -0,0 +1,418 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ :root {
6
+ --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
7
+ "Segoe UI Symbol", "Noto Color Emoji";
8
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
9
+ "Courier New", monospace;
10
+ --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
11
+ --background: white;
12
+ --color: black;
13
+ --error-color: #9d1212;
14
+ --separator-color: #e9e5eb;
15
+ --secondary-color: #7e7f87;
16
+ --tertiary-color: #bcbdc2;
17
+ --button-background: #c7cad0;
18
+ --button-background-hover: #dedfe4;
19
+ --button-background-primary: black;
20
+ --button-background-primary-hover: #727379;
21
+ --button-background-destructive: #b51616;
22
+ --button-background-destructive-hover: #e63333;
23
+ --button-background-disabled: #a4a5aa;
24
+ --button-color: black;
25
+ --button-color-hover: black;
26
+ --button-color-primary: white;
27
+ --button-color-primary-hover: white;
28
+ --button-color-destructive: white;
29
+ --button-color-destructive-hover: white;
30
+ --button-color-disabled: #cdced2;
31
+ --highlight-color: #a08500;
32
+ --highlight-background: #fdfab9;
33
+ --disabled-color: #cdced2;
34
+ }
35
+
36
+ body {
37
+ font-family: var(--font-sans);
38
+ margin: 0;
39
+ padding: 1.5rem;
40
+ line-height: 1.4;
41
+ background: var(--background);
42
+ }
43
+
44
+ header nav ol {
45
+ list-style-type: " ";
46
+ display: flex;
47
+ gap: 1rem;
48
+ padding: 0;
49
+ margin: 0;
50
+ }
51
+
52
+ h1 {
53
+ margin: 2rem 0 1.5rem;
54
+ font-size: 2.5rem;
55
+ line-height: 1.1;
56
+ }
57
+
58
+ h1.empty-name {
59
+ color: var(--tertiary-color);
60
+ }
61
+
62
+ h1 .id {
63
+ color: var(--tertiary-color);
64
+ font-size: 0.8rem;
65
+ font-family: var(--font-mono);
66
+ display: block;
67
+ margin-top: 0.25rem;
68
+ }
69
+
70
+ a {
71
+ color: var(--color);
72
+ }
73
+
74
+ a.btn,
75
+ button {
76
+ /* --border-width: 2px; */
77
+ display: block;
78
+ /* padding: calc(0.5rem - var(--border-width)) calc(1rem - var(--border-width)); */
79
+ padding: 0.5rem 1rem;
80
+ margin: 0;
81
+ background: var(--button-background);
82
+ color: var(--button-color);
83
+ font-family: var(--font-sans);
84
+ font-size: 1rem;
85
+ line-height: 1.4;
86
+ /* border: var(--border-width) solid var(--button-color); */
87
+ border: none;
88
+ text-decoration: none;
89
+ cursor: pointer;
90
+ }
91
+
92
+ a.btn:hover,
93
+ button:hover {
94
+ background: var(--button-background-hover);
95
+ color: var(--button-color-hover);
96
+ border-color: var(--button-color-hover);
97
+ }
98
+
99
+ a.btn--primary,
100
+ button.primary {
101
+ background: var(--button-background-primary);
102
+ color: var(--button-color-primary);
103
+ padding: 0.5rem 1rem;
104
+ border: none;
105
+ }
106
+
107
+ a.btn--primary:hover,
108
+ button.primary:hover {
109
+ background: var(--button-background-primary-hover);
110
+ color: var(--button-color-primary-hover);
111
+ }
112
+
113
+ a.btn--destructive,
114
+ button.destructive {
115
+ background: var(--button-background-destructive);
116
+ color: var(--button-color-destructive);
117
+ padding: 0.5rem 1rem;
118
+ border: none;
119
+ }
120
+
121
+ a.btn--destructive:hover,
122
+ button.destructive:hover {
123
+ background: var(--button-background-destructive-hover);
124
+ color: var(--button-color-destructive-hover);
125
+ }
126
+
127
+ button:disabled {
128
+ background: var(--button-background-disabled);
129
+ color: var(--button-color-disabled);
130
+ cursor: not-allowed;
131
+ }
132
+
133
+ button.primary:disabled,
134
+ button.destructive:disabled {
135
+ background: var(--button-background-disabled);
136
+ color: var(--button-color-disabled);
137
+ cursor: not-allowed;
138
+ }
139
+
140
+ input, select {
141
+ font-family: var(--font-sans);
142
+ border: 1px solid var(--color);
143
+ padding: 0.5rem;
144
+ display: block;
145
+ width: 100%;
146
+ font-size: 1rem;
147
+ line-height: 1.4;
148
+ border-radius: 0;
149
+ }
150
+
151
+ input[aria-invalid="true"],
152
+ select[aria-invalid="true"] {
153
+ border-color: var(--error-color);
154
+ color: var(--error-color);
155
+ }
156
+
157
+ input[type="checkbox"] {
158
+ height: 1rem;
159
+ width: 1rem;
160
+ margin: 0.25rem 0.5rem 0 0;
161
+ border: 1px solid var(--color);
162
+ flex: none;
163
+ border-radius: 0;
164
+ -webkit-appearance: none;
165
+ appearance: none;
166
+ }
167
+
168
+ input[type="checkbox"]:checked {
169
+ background: var(--color);
170
+ }
171
+
172
+ input[type="checkbox"]:checked::before {
173
+ content: "";
174
+ display: block;
175
+ border-width: 0 0 1px 1px;
176
+ border-style: solid;
177
+ width: 0.6rem;
178
+ height: 0.3rem;
179
+ border-color: var(--background);
180
+ transform: rotate(-45deg);
181
+ margin: calc(-0.2rem - 1px) 0 0 calc(-0.275rem - 1px);
182
+ }
183
+
184
+ .select-wrapper {
185
+ position: relative;
186
+ }
187
+
188
+ .select-wrapper::after {
189
+ content: "";
190
+ position: absolute;
191
+ top: calc(50% - 0.4rem);
192
+ right: 1rem;
193
+ width: 0.5rem;
194
+ height: 0.5rem;
195
+ border-width: 0 1px 1px 0;
196
+ border-style: solid;
197
+ border-color: var(--color);
198
+ transform: rotate(45deg);
199
+ pointer-events: none;
200
+ }
201
+
202
+ .select-wrapper:has(> select:disabled)::after {
203
+ border-color: var(--tertiary-color);
204
+ }
205
+
206
+ select.no-selection {
207
+ color: var(--tertiary-color);
208
+ }
209
+
210
+ select:disabled {
211
+ color: var(--disabled-color);
212
+ border-color: var(--disabled-color);
213
+ }
214
+
215
+ select {
216
+ -webkit-appearance: none;
217
+ appearance: none;
218
+ padding-right: 2.5rem;
219
+ }
220
+
221
+ .header-with-btns {
222
+ display: flex;
223
+ justify-content: space-between;
224
+ align-items: start;
225
+ }
226
+
227
+ .header-with-btns button,
228
+ .header-with-btns .btn {
229
+ margin-top: 2.3rem;
230
+ }
231
+
232
+ .entities,
233
+ .instances {
234
+ list-style-type: " ";
235
+ padding: 0;
236
+ margin: 1.5rem 0 0;
237
+ }
238
+
239
+ .entity-item,
240
+ .instance-item {
241
+ display: flex;
242
+ gap: 1.5rem;
243
+ padding: 0.5rem 0;
244
+ border-top: 1px solid var(--separator-color);
245
+ }
246
+
247
+ .entity-item:first-child,
248
+ .instance-item:first-child {
249
+ border-top: none;
250
+ }
251
+
252
+ .entity-item h2,
253
+ .instance-item h2 {
254
+ font-size: 1rem;
255
+ margin: 0;
256
+ flex: 1 1 auto;
257
+ padding: 0.5rem 0;
258
+ }
259
+
260
+ .entity-item .title {
261
+ flex: 1 1 0;
262
+ }
263
+
264
+ .entity-item .title p {
265
+ color: var(--secondary-color);
266
+ margin: 0;
267
+ padding-bottom: 0.5rem;
268
+ }
269
+
270
+ .entity-item .meta,
271
+ .instance-item .id {
272
+ color: var(--secondary-color);
273
+ margin: 0;
274
+ padding: 0.5rem 0;
275
+ white-space: nowrap;
276
+ }
277
+
278
+ .instance-item .id {
279
+ font-family: var(--font-mono);
280
+ }
281
+
282
+ .instance-item--created {
283
+ color: var(--highlight-color);
284
+ background: var(--highlight-background);
285
+ }
286
+
287
+ .field.field--id {
288
+ margin: 0 0 2rem;
289
+ }
290
+
291
+ .field--id label {
292
+ font-weight: bold;
293
+ }
294
+
295
+ .field--id input {
296
+ margin: 0.75rem 0 0;
297
+ }
298
+
299
+ .btns {
300
+ display: flex;
301
+ gap: 0.5rem;
302
+ flex-wrap: wrap;
303
+ align-items: start;
304
+ }
305
+
306
+ .field {
307
+ margin: 0.75rem 0 0;
308
+ }
309
+
310
+ .field:only-child {
311
+ margin: 0;
312
+ }
313
+
314
+ .validation-errors {
315
+ margin: 0.5rem 0 0;
316
+ color: var(--error-color);
317
+ font-size: 0.8rem;
318
+ }
319
+
320
+ .validation-errors ul {
321
+ padding: 0;
322
+ margin: 0;
323
+ }
324
+
325
+ .validation-errors li:only-child {
326
+ list-style-type: " ";
327
+ }
328
+
329
+ .field--container {
330
+ border: 1px solid var(--separator-color);
331
+ /* border-left-color: var(--color); */
332
+ border-left-width: 4px;
333
+ padding: 0.5rem 0.5rem 0.5rem 1rem;
334
+ }
335
+
336
+ form > .field--container {
337
+ padding: 0;
338
+ border: none;
339
+ }
340
+
341
+ .field--container ul,
342
+ .field--container ol {
343
+ margin: 0;
344
+ padding: 0;
345
+ list-style-type: " ";
346
+ }
347
+
348
+ .field--container ul li,
349
+ .field--container ol li {
350
+ padding-top: 0.5rem;
351
+ padding-bottom: 0.75rem;
352
+ border-top: 1px solid var(--separator-color);
353
+ display: block;
354
+ }
355
+
356
+ .field--container ul li:first-child,
357
+ .field--container ol li:first-child {
358
+ padding-top: 0;
359
+ border-top: none;
360
+ }
361
+
362
+ .field--container ul li:last-child,
363
+ .field--container ol li:last-child {
364
+ padding-bottom: 0;
365
+ }
366
+
367
+ .container-item-header {
368
+ display: flex;
369
+ align-items: center;
370
+ }
371
+
372
+ .container-item-title {
373
+ flex: 1 1 auto;
374
+ min-height: 2.4rem;
375
+ display: flex;
376
+ flex-direction: column;
377
+ justify-content: center;
378
+ }
379
+
380
+ .container-item-title .id {
381
+ color: var(--tertiary-color);
382
+ font-size: 0.8rem;
383
+ font-family: var(--font-mono);
384
+ }
385
+
386
+ .container-item-title .comment {
387
+ margin: 0.125rem 0 0;
388
+ }
389
+
390
+ .add-item-container {
391
+ display: flex;
392
+ margin-top: 1rem;
393
+ gap: 0.5rem;
394
+ }
395
+
396
+ .add-item-container:only-child {
397
+ margin: 0;
398
+ }
399
+
400
+ .associated-type {
401
+ margin-top: 0.5rem;
402
+ }
403
+
404
+ button[type="submit"] {
405
+ margin-top: 1rem;
406
+ justify-content: space-between;
407
+ }
408
+
409
+ .description {
410
+ color: var(--secondary-color);
411
+ margin: 0 0 3rem;
412
+ }
413
+
414
+ .comment {
415
+ font-size: 0.8rem;
416
+ color: var(--secondary-color);
417
+ margin: 0.5rem 0 0;
418
+ }