@postxl/generator 0.74.0 → 0.74.1
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.
|
@@ -116,7 +116,7 @@ export class ${meta.data.dataService.class} {
|
|
|
116
116
|
repo: ${meta.data.repository.typeName}<T, ID>
|
|
117
117
|
execution: ${meta.actions.execution.interface}
|
|
118
118
|
}): Promise<void> {
|
|
119
|
-
if (!data) {
|
|
119
|
+
if (!data || data.length === 0) {
|
|
120
120
|
return
|
|
121
121
|
}
|
|
122
122
|
if (!DEBUG) {
|
|
@@ -148,7 +148,7 @@ export class ${meta.data.dataService.class} {
|
|
|
148
148
|
repo: ${meta.data.repository.typeName}<T, ID>
|
|
149
149
|
execution: ${meta.actions.execution.interface}
|
|
150
150
|
}): Promise<void> {
|
|
151
|
-
if (!data) {
|
|
151
|
+
if (!data || data.length === 0) {
|
|
152
152
|
return
|
|
153
153
|
}
|
|
154
154
|
if (!DEBUG) {
|
|
@@ -180,7 +180,7 @@ export class ${meta.data.dataService.class} {
|
|
|
180
180
|
repo: ${meta.data.repository.typeName}<T, ID>
|
|
181
181
|
execution: ${meta.actions.execution.interface}
|
|
182
182
|
}): Promise<void> {
|
|
183
|
-
if (!data) {
|
|
183
|
+
if (!data || data.length === 0) {
|
|
184
184
|
return
|
|
185
185
|
}
|
|
186
186
|
if (!DEBUG) {
|
|
@@ -212,7 +212,7 @@ export class ${meta.data.dataService.class} {
|
|
|
212
212
|
repo: ${meta.data.repository.typeName}<T, ID>
|
|
213
213
|
execution: ${meta.actions.execution.interface}
|
|
214
214
|
}): Promise<void> {
|
|
215
|
-
if (!data) {
|
|
215
|
+
if (!data || data.length === 0) {
|
|
216
216
|
return
|
|
217
217
|
}
|
|
218
218
|
if (!DEBUG) {
|
package/dist/lib/utils/string.js
CHANGED
|
@@ -41,35 +41,73 @@ const toPascalCase = (str) => {
|
|
|
41
41
|
};
|
|
42
42
|
exports.toPascalCase = toPascalCase;
|
|
43
43
|
const IRREGULAR_PLURALS = Object.entries({
|
|
44
|
+
abyss: 'abysses',
|
|
45
|
+
aegis: 'aegises',
|
|
46
|
+
alias: 'aliases',
|
|
44
47
|
alumnus: 'alumni',
|
|
48
|
+
amends: 'amends',
|
|
45
49
|
analysis: 'analyses',
|
|
50
|
+
apparatus: 'apparatuses',
|
|
46
51
|
appendix: 'appendices',
|
|
52
|
+
asbestos: 'asbestoses',
|
|
53
|
+
atlas: 'atlases',
|
|
47
54
|
axis: 'axes',
|
|
48
55
|
basis: 'bases',
|
|
56
|
+
biceps: 'bicepses',
|
|
57
|
+
bus: 'buses',
|
|
58
|
+
caress: 'caresses',
|
|
49
59
|
child: 'children',
|
|
50
60
|
children: 'children',
|
|
61
|
+
circus: 'circuses',
|
|
62
|
+
citrus: 'citruses',
|
|
63
|
+
compass: 'compasses',
|
|
51
64
|
crisis: 'crises',
|
|
52
65
|
criterion: 'criteria',
|
|
66
|
+
crocus: 'crocuses',
|
|
53
67
|
data: 'data',
|
|
54
68
|
datum: 'data',
|
|
69
|
+
diabetes: 'diabetes',
|
|
55
70
|
diagnosis: 'diagnoses',
|
|
71
|
+
dross: 'drosses',
|
|
72
|
+
egress: 'egresses',
|
|
73
|
+
elvis: 'elvises',
|
|
74
|
+
emboss: 'embosses',
|
|
75
|
+
fiss: 'fisses',
|
|
56
76
|
focus: 'foci',
|
|
77
|
+
glass: 'glasses',
|
|
78
|
+
hippocampus: 'hippocampi',
|
|
57
79
|
// While `histories` is the plural of `history`, in a model context, `history` makes more sense:
|
|
58
80
|
// If you have a model called `UserHistory`, calling the table `UserHistories` would be confusing.
|
|
59
81
|
history: 'history',
|
|
60
82
|
hypothesis: 'hypotheses',
|
|
83
|
+
ignis: 'ignises',
|
|
61
84
|
index: 'indices',
|
|
85
|
+
iris: 'irises',
|
|
86
|
+
jesus: 'jesuses',
|
|
87
|
+
kudos: 'kudos',
|
|
88
|
+
lens: 'lenses',
|
|
89
|
+
man: 'men',
|
|
62
90
|
matrix: 'matrices',
|
|
63
91
|
medium: 'media',
|
|
92
|
+
news: 'news',
|
|
93
|
+
oasis: 'oases',
|
|
64
94
|
parenthesis: 'parentheses',
|
|
95
|
+
pass: 'passes',
|
|
65
96
|
phenomenon: 'phenomena',
|
|
66
97
|
prognosis: 'prognoses',
|
|
67
98
|
radius: 'radii',
|
|
99
|
+
ras: 'rasses',
|
|
100
|
+
sepsis: 'sepses',
|
|
101
|
+
species: 'species',
|
|
68
102
|
status: 'statuses',
|
|
69
103
|
suffix: 'suffixes',
|
|
70
104
|
syllabus: 'syllabi',
|
|
71
105
|
synopsis: 'synopses',
|
|
72
106
|
thesis: 'theses',
|
|
107
|
+
tress: 'tresses',
|
|
108
|
+
virus: 'viruses',
|
|
109
|
+
vortex: 'vortices',
|
|
110
|
+
woman: 'women',
|
|
73
111
|
});
|
|
74
112
|
/**
|
|
75
113
|
* Returns a pluralized version of the given string based on the count.
|
|
@@ -91,6 +129,17 @@ const pluralize = (s, count = 2) => {
|
|
|
91
129
|
if (lower.endsWith('ss')) {
|
|
92
130
|
return s.slice(0, -2) + 'sses';
|
|
93
131
|
}
|
|
132
|
+
if (
|
|
133
|
+
// e.g. index
|
|
134
|
+
lower.endsWith('x') ||
|
|
135
|
+
// e.g. buzz
|
|
136
|
+
lower.endsWith('z') ||
|
|
137
|
+
// e.g. wish
|
|
138
|
+
lower.endsWith('sh') ||
|
|
139
|
+
// e.g. match
|
|
140
|
+
lower.endsWith('ch')) {
|
|
141
|
+
return s + 'es';
|
|
142
|
+
}
|
|
94
143
|
if (s.endsWith('y') &&
|
|
95
144
|
!s.endsWith('ay') &&
|
|
96
145
|
!s.endsWith('ey') &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postxl/generator",
|
|
3
|
-
"version": "0.74.
|
|
3
|
+
"version": "0.74.1",
|
|
4
4
|
"main": "./dist/generator.js",
|
|
5
5
|
"typings": "./dist/generator.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"zod": "3.22.2",
|
|
23
23
|
"@postxl/lock": "1.5.0",
|
|
24
24
|
"@postxl/prettier": "0.1.0",
|
|
25
|
-
"@postxl/runtime": "0.1.
|
|
25
|
+
"@postxl/runtime": "0.1.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@jest/globals": "29.7.0",
|