okai 0.0.38 → 0.0.40
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/dist/icons.js +4 -1
- package/dist/index.js +13 -8
- package/dist/ts-once.js +15 -11
- package/dist/ts-parser.js +34 -6
- package/package.json +1 -1
package/dist/icons.js
CHANGED
@@ -154,6 +154,7 @@ export const IconMap = {
|
|
154
154
|
Refund: S(`0 0 20 20`, `<path fill='currentColor' fill-rule='evenodd' d='M5 2a2 2 0 0 0-2 2v14l3.5-2l3.5 2l3.5-2l3.5 2V4a2 2 0 0 0-2-2zm4.707 3.707a1 1 0 0 0-1.414-1.414l-3 3a1 1 0 0 0 0 1.414l3 3a1 1 0 0 0 1.414-1.414L8.414 9H10a3 3 0 0 1 3 3v1a1 1 0 1 0 2 0v-1a5 5 0 0 0-5-5H8.414z' clip-rule='evenodd'/>`),
|
155
155
|
Play: S(`0 0 24 24`, `<path fill='currentColor' d='M8 5.14v14l11-7z'/>`),
|
156
156
|
Result: S(`0 0 2048 2048`, `<path fill='currentColor' d='M2048 640v640h-768v512H128v128H0V0h128v128h1408v512zM128 256v384h1280V256zm1024 1408v-384H128v384zm768-512V768H128v384z'/>`),
|
157
|
+
Auction: S(`0 0 24 24`, `<path fill="currentColor" d="M14.005 20.003v2h-12v-2zM14.59.689l7.778 7.778l-1.414 1.414l-1.061-.353l-2.475 2.475l5.657 5.657l-1.414 1.414l-5.657-5.657l-2.404 2.404l.283 1.132l-1.415 1.414l-7.778-7.778l1.414-1.415l1.132.283l6.293-6.293l-.353-1.06zm.707 3.536l-7.071 7.07l3.535 3.536l7.071-7.07z"/>`),
|
157
158
|
/** CMS */
|
158
159
|
Page: S('0 0 24 24', `<g fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5'><path d='M4 21.4V2.6a.6.6 0 0 1 .6-.6h11.652a.6.6 0 0 1 .424.176l3.148 3.148A.6.6 0 0 1 20 5.75V21.4a.6.6 0 0 1-.6.6H4.6a.6.6 0 0 1-.6-.6M8 10h8m-8 8h8m-8-4h4'/><path d='M16 2v3.4a.6.6 0 0 0 .6.6H20'/></g>`),
|
159
160
|
Tag: S('0 0 24 24', `<g fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'><path d='M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0-2 0'/><path d='M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592-5.592a2.41 2.41 0 0 0 0-3.408l-7.71-7.71A2 2 0 0 0 11.172 3H6a3 3 0 0 0-3 3'/></g>`),
|
@@ -183,6 +184,7 @@ export const IconMap = {
|
|
183
184
|
Alert: S(`0 0 24 24`, `<path fill='currentColor' d='M12 2L1 21h22M12 6l7.53 13H4.47M11 10v4h2v-4m-2 6v2h2v-2'/>`),
|
184
185
|
Data: S(`0 0 24 24`, `<path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M18 12v5c0 1.657-2.686 3-6 3s-6-1.343-6-3v-5m12 0V7m0 5c0 1.657-2.686 3-6 3s-6-1.343-6-3m12-5c0-1.657-2.686-3-6-3S6 5.343 6 7m12 0c0 1.657-2.686 3-6 3S6 8.657 6 7m0 5V7'/>`),
|
185
186
|
Tool: S(`0 0 24 24`, `<path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 10h3V7L6.5 3.5a6 6 0 0 1 8 8l6 6a2 2 0 0 1-3 3l-6-6a6 6 0 0 1-8-8z'/>`),
|
187
|
+
Chip: S('0 0 512 512', `<rect width="352" height="352" x="80" y="80" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32" rx="48" ry="48"/><rect width="224" height="224" x="144" y="144" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32" rx="16" ry="16"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M256 80V48m80 32V48M176 80V48m80 416v-32m80 32v-32m-160 32v-32m256-176h32m-32 80h32m-32-160h32M48 256h32m-32 80h32M48 176h32"/>`),
|
186
188
|
/** Actions */
|
187
189
|
Completed: S(`0 0 2048 2048`, `<path fill='currentColor' d='M1024 0q141 0 272 36t244 104t207 160t161 207t103 245t37 272q0 141-36 272t-104 244t-160 207t-207 161t-245 103t-272 37q-141 0-272-36t-244-104t-207-160t-161-207t-103-245t-37-272q0-141 36-272t104-244t160-207t207-161T752 37t272-37m603 685l-136-136l-659 659l-275-275l-136 136l411 411z'/>`),
|
188
190
|
Failed: S(`0 0 2048 2048`, `<path fill='currentColor' d='M1024 0q141 0 272 36t244 104t207 160t161 207t103 245t37 272q0 141-36 272t-104 244t-160 207t-207 161t-245 103t-272 37q-141 0-272-36t-244-104t-207-160t-161-207t-103-245t-37-272q0-141 36-272t104-244t160-207t207-161T752 37t272-37m113 1024l342-342l-113-113l-342 342l-342-342l-113 113l342 342l-342 342l113 113l342-342l342 342l113-113z'/>`),
|
@@ -233,7 +235,7 @@ export const IconGroups = {
|
|
233
235
|
Post: ['Posting'],
|
234
236
|
Content: ['Website', 'Blog', 'Template', 'LandingPage', 'Portal', 'Workspace'],
|
235
237
|
Menu: ['Nav', 'Form', 'MenuList'],
|
236
|
-
Skill: ['Qualification', 'Certification', 'Experience', 'Training', 'Requirement'],
|
238
|
+
Skill: ['Qualification', 'Certification', 'Experience', 'Training', 'Requirement', 'Bid'],
|
237
239
|
Analytics: ['Level', 'Metric', 'Kpi', 'Goal', 'Objective'],
|
238
240
|
Review: ['Audit', 'Status'],
|
239
241
|
Comment: ['Feedback'],
|
@@ -250,6 +252,7 @@ export const IconGroups = {
|
|
250
252
|
Channel: ['Stream', 'Broadcast', 'Feed', 'Session'],
|
251
253
|
Search: ['Filter', 'Lookup', 'Query', 'Match'],
|
252
254
|
Save: ['Saved', 'Archive', 'Backup', 'Download', 'Export'],
|
255
|
+
Chip: ['Hardware'],
|
253
256
|
};
|
254
257
|
export const Icons = withAliases(IconMap, IconGroups);
|
255
258
|
const IconKeys = Object.keys(Icons).sort((a, b) => b.length - a.length);
|
package/dist/index.js
CHANGED
@@ -162,7 +162,7 @@ export async function cli(cmdArgs) {
|
|
162
162
|
uiMjsDir: "/path/to/MyApp/wwwroot/admin/sections",
|
163
163
|
};
|
164
164
|
fs.writeFileSync('okai.json', JSON.stringify(info, undefined, 2));
|
165
|
-
console.log(`
|
165
|
+
console.log(`Saved: okai.json`);
|
166
166
|
process.exit(0);
|
167
167
|
return;
|
168
168
|
}
|
@@ -272,7 +272,7 @@ Options:
|
|
272
272
|
if (command.type == "init" && command.info) {
|
273
273
|
const toApiFile = path.join(info.serviceModelDir, 'api.d.ts');
|
274
274
|
fs.copyFileSync(path.join(import.meta.dirname, 'api.d.ts'), toApiFile);
|
275
|
-
console.log(`
|
275
|
+
console.log(`Saved: ${toApiFile}`);
|
276
276
|
let model = toPascalCase(leftPart(command.init, '.'));
|
277
277
|
let groupName = plural(model);
|
278
278
|
if (model == groupName) {
|
@@ -300,7 +300,6 @@ Options:
|
|
300
300
|
tsdAst,
|
301
301
|
uiFileName,
|
302
302
|
});
|
303
|
-
command.type = "update"; // let update handle the rest
|
304
303
|
command.tsdFile = groupName + '.d.ts';
|
305
304
|
fs.writeFileSync(path.join(info.serviceModelDir, command.tsdFile), tsdContent, { encoding: 'utf-8' });
|
306
305
|
}
|
@@ -313,7 +312,7 @@ Options:
|
|
313
312
|
}
|
314
313
|
const toFile = path.join(info.serviceModelDir, 'api.d.ts');
|
315
314
|
fs.copyFileSync(apiFile, toFile);
|
316
|
-
console.log(`
|
315
|
+
console.log(`Saved: ${toFile}`);
|
317
316
|
process.exit(0);
|
318
317
|
}
|
319
318
|
else {
|
@@ -341,7 +340,7 @@ Options:
|
|
341
340
|
? path.join(info.slnDir, trimStart(filePath, '~/'))
|
342
341
|
: path.join(process.cwd(), filePath);
|
343
342
|
}
|
344
|
-
if (command.type === "update") {
|
343
|
+
if (command.type === "update" || (command.type == "init" && command.info)) {
|
345
344
|
let tsdPath = assertTsdPath(command.tsdFile);
|
346
345
|
if (command.verbose)
|
347
346
|
console.log(`Updating: ${tsdPath}...`);
|
@@ -415,9 +414,15 @@ Options:
|
|
415
414
|
return;
|
416
415
|
}
|
417
416
|
else {
|
418
|
-
regenerate(header, tsdContent, '
|
419
|
-
|
420
|
-
|
417
|
+
regenerate(header, tsdContent, 'Saved: ');
|
418
|
+
if (command.type == "init") {
|
419
|
+
console.log(`\nRun 'npm run migrate' to apply the new migration and create the new tables or:`);
|
420
|
+
console.log(`$ dotnet run --AppTasks=migrate`);
|
421
|
+
}
|
422
|
+
else {
|
423
|
+
console.log(`\nLast migration can be rerun with 'npm run rerun:last' or:`);
|
424
|
+
console.log(`$ dotnet run --AppTasks=migrate.rerun:last`);
|
425
|
+
}
|
421
426
|
process.exit(0);
|
422
427
|
}
|
423
428
|
}
|
package/dist/ts-once.js
CHANGED
@@ -45,23 +45,27 @@ export function transformUserRefs(tsAst, info) {
|
|
45
45
|
prop.type = info.userType;
|
46
46
|
if (!prop.annotations)
|
47
47
|
prop.annotations = [];
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
if (!prop.annotations.find(x => x.name === 'reference')) {
|
49
|
+
const attr = {
|
50
|
+
name: 'reference',
|
51
|
+
args: {
|
52
|
+
selfId: 'createdBy',
|
53
|
+
refId: 'userName',
|
54
|
+
}
|
55
|
+
};
|
56
|
+
if (info.userLabel)
|
57
|
+
attr.args.refLabel = info.userLabel;
|
58
|
+
prop.annotations.push(attr);
|
59
|
+
}
|
58
60
|
}
|
59
61
|
if (prop.type === 'User[]') {
|
60
62
|
if (info.userType) {
|
61
63
|
prop.type = info.userType + '[]';
|
62
64
|
if (!prop.annotations)
|
63
65
|
prop.annotations = [];
|
64
|
-
prop.annotations.
|
66
|
+
if (!prop.annotations.find(x => x.name === 'reference')) {
|
67
|
+
prop.annotations.push({ name: 'reference' });
|
68
|
+
}
|
65
69
|
const idPropType = cls.properties.find(x => x.name.toLowerCase() === 'id')?.type ?? 'number';
|
66
70
|
// Add Many to Many User Table
|
67
71
|
addClasses.push({
|
package/dist/ts-parser.js
CHANGED
@@ -340,12 +340,14 @@ export class TypeScriptParser {
|
|
340
340
|
this.classes = [];
|
341
341
|
this.interfaces = [];
|
342
342
|
this.enums = [];
|
343
|
-
|
344
|
-
|
345
|
-
this.
|
346
|
-
this.
|
347
|
-
this.
|
348
|
-
this.
|
343
|
+
const src = removeMultilineComments(sourceCode);
|
344
|
+
// const src = sourceCode
|
345
|
+
this.parseConfigType(src);
|
346
|
+
this.parseDefaultExport(src);
|
347
|
+
this.parseReferences(src);
|
348
|
+
this.parseInterfaces(src);
|
349
|
+
this.parseClasses(src);
|
350
|
+
this.parseEnums(src);
|
349
351
|
return {
|
350
352
|
config: this.config,
|
351
353
|
defaultExport: this.defaultExport,
|
@@ -523,3 +525,29 @@ function parseGenericType(typeStr) {
|
|
523
525
|
function isNullableType(type) {
|
524
526
|
return type === 'null' || type === 'undefined';
|
525
527
|
}
|
528
|
+
// Removes /*: Merge with User DTO... */ comments from the source code
|
529
|
+
export function removeMultilineComments(src) {
|
530
|
+
let result = '';
|
531
|
+
let inComment = false;
|
532
|
+
let i = 0;
|
533
|
+
while (i < src.length) {
|
534
|
+
// Check for comment start
|
535
|
+
if (src[i] === '/' && src[i + 1] === '*' && src[i + 2] === ':') {
|
536
|
+
inComment = true;
|
537
|
+
i += 2;
|
538
|
+
continue;
|
539
|
+
}
|
540
|
+
// Check for comment end
|
541
|
+
if (inComment && (src[i] === '*' && src[i + 1] === '/')) {
|
542
|
+
inComment = false;
|
543
|
+
i += 2;
|
544
|
+
continue;
|
545
|
+
}
|
546
|
+
// Only append characters when not in a comment
|
547
|
+
if (!inComment) {
|
548
|
+
result += src[i];
|
549
|
+
}
|
550
|
+
i++;
|
551
|
+
}
|
552
|
+
return result;
|
553
|
+
}
|