mushroom-cli 1.1.0-alpha.16 → 1.1.0-alpha.17

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.
@@ -12,7 +12,7 @@ function processGenDocs(aliasProject, entities, source, html, args, projectName,
12
12
  const roles = aliasProject.allowRoles.includes("*") ? source.roles : source.roles?.filter(r => aliasProject.allowRoles.includes(r.name));
13
13
 
14
14
  html = html.replace(/^\uFEFF/, '');
15
- html = html.replace(/<script src="([^"]+)" data-mt-cond='\{"lazy-load": 1\}'><\/script>/g, (scriptTag, src) => `<script data-mt-cond='{"x": 1}'>${fs.readFileSync("./docs/" + src).toString()}</script>`);
15
+ html = html.replace(/<script src="([^"]+)" data-mt-cond='\{"lazy-load": 1\}'><\/script>/g, (scriptTag, src) => `<script data-mt-cond='{"x": 1}'>${fs.readFileSync(__dirname + "/../docs/" + src).toString()}</script>`);
16
16
  html = html.replace("</body>", `<script data-mt-cond='{"x": 1}'>
17
17
  window.data.name = ${JSON.stringify(source.name)};
18
18
  window.data.description = ${JSON.stringify(source.description)};
@@ -118,7 +118,7 @@ async function genDocs(args, projectName, project, alias, source) {
118
118
  }
119
119
 
120
120
  //const html = await fetch('https://api.siten.vn/gen/docs.html').then(res => res.text());
121
- const html = fs.readFileSync("./docs/docs.html").toString();
121
+ const html = fs.readFileSync(__dirname + "/../docs/docs.html").toString();
122
122
  await processGenDocs(aliasProject, entities, source, html, args, projectName, alias);
123
123
  }
124
124
 
package/gen/gen-csharp.js CHANGED
@@ -302,7 +302,7 @@ function genCSharpMongoDbClasses(args, projectName, project, alias, source) {
302
302
 
303
303
  const className = toCSharpName(entityName);
304
304
  collectionNames += ` public static string ${className}CollectionName => "${entities[entityName].storageName}";
305
- public static MongoDB.Driver.IMongoCollection<Resources.${className}> ${className}Collection => GetDatabase().GetCollection<Resources.${className}>(${className}CollectionName);
305
+ public static IMongoCollection<Resources.${className}> ${className}Collection => GetDatabase().GetCollection<Resources.${className}>(${className}CollectionName);
306
306
  `;
307
307
  resourceNames += ` public static string ${className} => "${entityName}";${newLine}`;
308
308
  strClasses += generateCSharpClassMongoDb(source, className, entities[entityName].fields, true, entities[entityName].description, out);
@@ -455,17 +455,17 @@ namespace ${namespace}
455
455
  ${collectionNames}
456
456
  public static IMongoDatabase GetDatabase() => Mushroom.MushroomDaoFactory.GetDbAdapter() as IMongoDatabase;
457
457
 
458
- public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this MongoDB.Driver.IMongoCollection<T> collection, TId id) where T : Mushroom.Models.IResource<TId>
458
+ public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this IMongoCollection<T> collection, TId id) where T : Mushroom.Models.IResource<TId>
459
459
  {
460
460
  return await (await collection.FindAsync(Builders<T>.Filter.Eq(doc => doc.Id, id))).FirstOrDefaultAsync();
461
461
  }
462
462
 
463
- public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this MongoDB.Driver.IMongoCollection<T> collection, TId id, FindOptions<T> findOptions) where T : Mushroom.Models.IResource<TId>
463
+ public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this IMongoCollection<T> collection, TId id, FindOptions<T> findOptions) where T : Mushroom.Models.IResource<TId>
464
464
  {
465
465
  return await (await collection.FindAsync(Builders<T>.Filter.Eq(doc => doc.Id, id), findOptions)).FirstOrDefaultAsync();
466
466
  }
467
467
 
468
- public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this MongoDB.Driver.IMongoCollection<T> collection, TId id, ProjectionDefinition<T> projection) where T : Mushroom.Models.IResource<TId>
468
+ public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this IMongoCollection<T> collection, TId id, ProjectionDefinition<T> projection) where T : Mushroom.Models.IResource<TId>
469
469
  {
470
470
  return await (await collection.FindAsync(Builders<T>.Filter.Eq(doc => doc.Id, id), new FindOptions<T> { Projection = projection })).FirstOrDefaultAsync();
471
471
  }
@@ -685,7 +685,7 @@ function genCSharpMongoDbClassesToFolder(projectName, alias, source, aliasProjec
685
685
 
686
686
  const className = toCSharpName(entityName);
687
687
  collectionNames += ` public static string ${className}CollectionName => "${entities[entityName].storageName}";
688
- public static MongoDB.Driver.IMongoCollection<Resources.${className}> ${className}Collection => GetDatabase().GetCollection<Resources.${className}>(${className}CollectionName);
688
+ public static IMongoCollection<Resources.${className}> ${className}Collection => GetDatabase().GetCollection<Resources.${className}>(${className}CollectionName);
689
689
  `;
690
690
  resourceNames += ` public static string ${className} => "${entityName}";
691
691
  `;
@@ -825,17 +825,17 @@ namespace ${namespace}
825
825
  ${collectionNames}
826
826
  public static IMongoDatabase GetDatabase() => Mushroom.MushroomDaoFactory.GetDbAdapter() as IMongoDatabase;
827
827
 
828
- public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this MongoDB.Driver.IMongoCollection<T> collection, TId id) where T : Mushroom.Models.IResource<TId>
828
+ public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this IMongoCollection<T> collection, TId id) where T : Mushroom.Models.IResource<TId>
829
829
  {
830
830
  return await (await collection.FindAsync(Builders<T>.Filter.Eq(doc => doc.Id, id))).FirstOrDefaultAsync();
831
831
  }
832
832
 
833
- public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this MongoDB.Driver.IMongoCollection<T> collection, TId id, FindOptions<T> findOptions) where T : Mushroom.Models.IResource<TId>
833
+ public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this IMongoCollection<T> collection, TId id, FindOptions<T> findOptions) where T : Mushroom.Models.IResource<TId>
834
834
  {
835
835
  return await (await collection.FindAsync(Builders<T>.Filter.Eq(doc => doc.Id, id), findOptions)).FirstOrDefaultAsync();
836
836
  }
837
837
 
838
- public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this MongoDB.Driver.IMongoCollection<T> collection, TId id, ProjectionDefinition<T> projection) where T : Mushroom.Models.IResource<TId>
838
+ public static async System.Threading.Tasks.Task<T> FindByIdAsync<T, TId>(this IMongoCollection<T> collection, TId id, ProjectionDefinition<T> projection) where T : Mushroom.Models.IResource<TId>
839
839
  {
840
840
  return await (await collection.FindAsync(Builders<T>.Filter.Eq(doc => doc.Id, id), new FindOptions<T> { Projection = projection })).FirstOrDefaultAsync();
841
841
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mushroom-cli",
3
- "version": "1.1.0-alpha.16",
3
+ "version": "1.1.0-alpha.17",
4
4
  "description": "Mushroom CLI",
5
5
  "main": "mr.js",
6
6
  "scripts": {