@postxl/schema 0.0.2

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 (75) hide show
  1. package/LICENSE +50 -0
  2. package/README.md +320 -0
  3. package/dist/enum/enum.brands.d.ts +11 -0
  4. package/dist/enum/enum.brands.js +19 -0
  5. package/dist/enum/enum.d.ts +49 -0
  6. package/dist/enum/enum.defaults.d.ts +41 -0
  7. package/dist/enum/enum.defaults.js +105 -0
  8. package/dist/enum/enum.js +6 -0
  9. package/dist/enum/enum.json-decoder.d.ts +61 -0
  10. package/dist/enum/enum.json-decoder.js +51 -0
  11. package/dist/enum/enum.transformer.d.ts +12 -0
  12. package/dist/enum/enum.transformer.js +76 -0
  13. package/dist/enum/enum.types.d.ts +14 -0
  14. package/dist/enum/enum.types.js +2 -0
  15. package/dist/enum/index.d.ts +6 -0
  16. package/dist/enum/index.js +22 -0
  17. package/dist/field/defaults.d.ts +12 -0
  18. package/dist/field/defaults.js +78 -0
  19. package/dist/field/discriminated-union.d.ts +125 -0
  20. package/dist/field/discriminated-union.js +207 -0
  21. package/dist/field/enum.d.ts +65 -0
  22. package/dist/field/enum.js +111 -0
  23. package/dist/field/field.d.ts +483 -0
  24. package/dist/field/field.js +68 -0
  25. package/dist/field/id.d.ts +152 -0
  26. package/dist/field/id.js +104 -0
  27. package/dist/field/index.d.ts +11 -0
  28. package/dist/field/index.js +27 -0
  29. package/dist/field/relation.d.ts +88 -0
  30. package/dist/field/relation.js +138 -0
  31. package/dist/field/scalar.d.ts +179 -0
  32. package/dist/field/scalar.js +197 -0
  33. package/dist/field/shared/brands.d.ts +38 -0
  34. package/dist/field/shared/brands.js +109 -0
  35. package/dist/field/shared/decoders.d.ts +17 -0
  36. package/dist/field/shared/decoders.js +88 -0
  37. package/dist/field/shared/seed.d.ts +32 -0
  38. package/dist/field/shared/seed.js +63 -0
  39. package/dist/field/shared/types.d.ts +73 -0
  40. package/dist/field/shared/types.js +2 -0
  41. package/dist/field/shared/utils.d.ts +26 -0
  42. package/dist/field/shared/utils.js +52 -0
  43. package/dist/index.d.ts +12 -0
  44. package/dist/index.js +25 -0
  45. package/dist/model/index.d.ts +5 -0
  46. package/dist/model/index.js +21 -0
  47. package/dist/model/model.brands.d.ts +7 -0
  48. package/dist/model/model.brands.js +10 -0
  49. package/dist/model/model.defaults.d.ts +28 -0
  50. package/dist/model/model.defaults.js +304 -0
  51. package/dist/model/model.json-decoder.d.ts +94 -0
  52. package/dist/model/model.json-decoder.js +107 -0
  53. package/dist/model/model.transformer.d.ts +93 -0
  54. package/dist/model/model.transformer.js +183 -0
  55. package/dist/model/model.types.d.ts +37 -0
  56. package/dist/model/model.types.js +2 -0
  57. package/dist/project-schema/project-schema.brands.d.ts +10 -0
  58. package/dist/project-schema/project-schema.brands.js +17 -0
  59. package/dist/project-schema/project-schema.defaults.d.ts +16 -0
  60. package/dist/project-schema/project-schema.defaults.js +53 -0
  61. package/dist/project-schema/project-schema.json-decoder.d.ts +285 -0
  62. package/dist/project-schema/project-schema.json-decoder.js +145 -0
  63. package/dist/project-schema/project-schema.transformer.d.ts +284 -0
  64. package/dist/project-schema/project-schema.transformer.js +444 -0
  65. package/dist/project-schema/project-schema.types.d.ts +77 -0
  66. package/dist/project-schema/project-schema.types.js +2 -0
  67. package/dist/samples/la.schema.json +2055 -0
  68. package/dist/samples/mca.schema.json +830 -0
  69. package/dist/samples/ring.schema.json +879 -0
  70. package/dist/samples/sample-schemas.d.ts +1896 -0
  71. package/dist/samples/sample-schemas.js +20 -0
  72. package/dist/samples/simple.schema.json +250 -0
  73. package/dist/samples/subex.schema.json +1188 -0
  74. package/dist/samples/usp-msm.schema.json +2515 -0
  75. package/package.json +57 -0
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sampleSchemas = void 0;
7
+ const la_schema_json_1 = __importDefault(require("./la.schema.json"));
8
+ const mca_schema_json_1 = __importDefault(require("./mca.schema.json"));
9
+ const ring_schema_json_1 = __importDefault(require("./ring.schema.json"));
10
+ const simple_schema_json_1 = __importDefault(require("./simple.schema.json"));
11
+ const subex_schema_json_1 = __importDefault(require("./subex.schema.json"));
12
+ const usp_msm_schema_json_1 = __importDefault(require("./usp-msm.schema.json"));
13
+ exports.sampleSchemas = {
14
+ la: la_schema_json_1.default,
15
+ mca: mca_schema_json_1.default,
16
+ ring: ring_schema_json_1.default,
17
+ simple: simple_schema_json_1.default,
18
+ subex: subex_schema_json_1.default,
19
+ uspmsm: usp_msm_schema_json_1.default,
20
+ };
@@ -0,0 +1,250 @@
1
+ {
2
+ "name": "PXL Template Project",
3
+ "slug": "pxl-template",
4
+ "description": "A template for PostXL projects.",
5
+ "projectType": {
6
+ "kind": "workspace",
7
+ "projectDirectory": "template"
8
+ },
9
+ "version": "0.0.1",
10
+ "schemas": ["PXL", "Data"],
11
+ "defaultSchema": "Data",
12
+ "systemUser": {
13
+ "name": "System",
14
+ "email": "system@postxl.com",
15
+ "sub": null
16
+ },
17
+ "standardModels": ["Action", "ActionOperation", "File", "User"],
18
+ "models": [
19
+ {
20
+ "name": "Country",
21
+ "description": "A lookup table, demonstrating the use of a @@IsDefault. See description of `isDefault` field for details.",
22
+ "schema": "Data",
23
+ "fields": [
24
+ {
25
+ "name": "name",
26
+ "type": "String",
27
+ "label": "Name",
28
+ "description": "The name of the country.",
29
+ "faker": "location.country"
30
+ },
31
+ {
32
+ "name": "countryCode",
33
+ "type": "String",
34
+ "label": "CountryCode",
35
+ "description": "The country's ISO 3166-1 alpha-2 code.",
36
+ "faker": "location.countryCode"
37
+ },
38
+ {
39
+ "name": "isDefault",
40
+ "type": "Boolean",
41
+ "label": "IsDefault",
42
+ "description": "The IsDefault identifies which boolean field to be used to identify the default value.",
43
+ "seed": false
44
+ }
45
+ ],
46
+ "defaultField": "isDefault",
47
+ "seed": [
48
+ {
49
+ "id": "US",
50
+ "name": "US",
51
+ "countryCode": "US",
52
+ "isDefault": true
53
+ },
54
+ {
55
+ "id": "DE",
56
+ "name": "Germany",
57
+ "countryCode": "DE",
58
+ "isDefault": false
59
+ },
60
+ {
61
+ "id": "DK",
62
+ "name": "Denmark",
63
+ "countryCode": "DK",
64
+ "isDefault": false
65
+ }
66
+ ],
67
+ "faker": {
68
+ "items": 10
69
+ }
70
+ },
71
+ {
72
+ "name": "Post",
73
+ "description": "A blog post entry.",
74
+ "schema": "Data",
75
+ "fields": [
76
+ {
77
+ "name": "title",
78
+ "type": "String",
79
+ "label": "Blog Title",
80
+ "faker": "lorem.sentence"
81
+ },
82
+ {
83
+ "name": "body",
84
+ "type": "String",
85
+ "label": "Body",
86
+ "faker": "lorem.paragraph"
87
+ },
88
+ {
89
+ "name": "author",
90
+ "type": "DiscriminatedUnion",
91
+ "label": "Blog Author",
92
+ "commonFields": [
93
+ {
94
+ "name": "email",
95
+ "type": "String",
96
+ "faker": "internet.email"
97
+ }
98
+ ],
99
+ "members": [
100
+ {
101
+ "type": "user",
102
+ "label": "existing user",
103
+ "fields": [
104
+ {
105
+ "name": "userId",
106
+ "type": "User"
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "type": "anonymous",
112
+ "label": "Anonymous user",
113
+ "fields": [
114
+ {
115
+ "name": "name",
116
+ "type": "String?",
117
+ "faker": "person.fullName"
118
+ }
119
+ ]
120
+ },
121
+ {
122
+ "type": "guest",
123
+ "label": "Guest user"
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "name": "nextPostId",
129
+ "type": "Post?",
130
+ "label": "Next post",
131
+ "description": "The post that you should see after reading this one."
132
+ },
133
+ {
134
+ "name": "publicationId",
135
+ "type": "Publication?",
136
+ "label": "Publication",
137
+ "description": "Posts are bundled in publications."
138
+ }
139
+ ],
140
+ "standardFields": ["id", "createdAt", "updatedAt"],
141
+ "labelField": "title",
142
+ "standardActions": ["create", "update", "upsert", "delete", "clone", "cloneMany"],
143
+ "actions": {
144
+ "publish": "Publish a post",
145
+ "unpublish": "Unpublish a post"
146
+ },
147
+ "faker": {
148
+ "items": 10
149
+ }
150
+ },
151
+ {
152
+ "name": "Publication",
153
+ "description": "",
154
+ "schema": "Data",
155
+ "fields": [
156
+ {
157
+ "name": "name",
158
+ "type": "String",
159
+ "label": "Name",
160
+ "faker": "lorem.sentence"
161
+ },
162
+ {
163
+ "name": "featuredPostId",
164
+ "type": "Post?",
165
+ "label": "FeaturedPostId",
166
+ "prismaRelationFieldName": "featuredPost",
167
+ "deepClone": true
168
+ },
169
+ {
170
+ "name": "mostLikedPostId",
171
+ "type": "Post?",
172
+ "label": "MostLikedPostId",
173
+ "prismaRelationFieldName": "mostLikedPost"
174
+ },
175
+ {
176
+ "name": "status",
177
+ "type": "PublicationStatus",
178
+ "label": "Status"
179
+ }
180
+ ],
181
+ "standardActions": [
182
+ "create",
183
+ "createMany",
184
+ "update",
185
+ "updateMany",
186
+ "upsert",
187
+ "upsertMany",
188
+ "delete",
189
+ "deleteMany",
190
+ "clone",
191
+ "cloneMany"
192
+ ],
193
+ "actions": {
194
+ "addPost": "Add a post to a publication",
195
+ "removePost": "Remove a post from a publication",
196
+ "reorderPosts": "Reorder posts in a publication"
197
+ },
198
+ "faker": {
199
+ "items": 3
200
+ }
201
+ },
202
+ {
203
+ "name": "ViewStatistic",
204
+ "description": "An example of an in memory model which is transient. It will store the view stats for a given post.",
205
+ "schema": "Data",
206
+ "isReadonly": true,
207
+ "repository": {
208
+ "type": "InMemory"
209
+ },
210
+ "standardFields": ["id"],
211
+ "fields": [
212
+ {
213
+ "name": "postId",
214
+ "type": "Post",
215
+ "label": "PostId",
216
+ "description": "The post that the view stats belong to."
217
+ },
218
+ {
219
+ "name": "views",
220
+ "type": "Int",
221
+ "label": "Views",
222
+ "description": "The number of views for the post."
223
+ },
224
+ {
225
+ "name": "entryName",
226
+ "type": "String",
227
+ "description": "A field that tests the isUnique constraint.",
228
+ "isUnique": true
229
+ }
230
+ ]
231
+ }
232
+ ],
233
+ "enums": [
234
+ {
235
+ "name": "PublicationStatus",
236
+ "description": "Status a publication can have.",
237
+ "schema": "Data",
238
+ "members": [
239
+ {
240
+ "value": "Draft",
241
+ "description": "The publication is in draft mode."
242
+ },
243
+ {
244
+ "value": "Published",
245
+ "description": "The publication is published."
246
+ }
247
+ ]
248
+ }
249
+ ]
250
+ }