@nina-protocol/nina-db 0.0.33 → 0.0.35

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.
@@ -105,7 +105,11 @@ export default class Release extends Model {
105
105
  }
106
106
  };
107
107
  static generateSlug = async (metadata) => {
108
- const slug = metadata.name.toLowerCase().replace(/ /g, '-').replace(/[^a-z0-9-]/g, '');
108
+ let string = metadata.name;
109
+ if (string.length > 200) {
110
+ string = string.substring(0, 200);
111
+ }
112
+ const slug = string.toLowerCase().replace('-', '').replace(/ +/g, ' ').replace(/ /g, '-').replace(/[^a-z0-9-]/g, '');
109
113
  const existingRelease = await Release.query().findOne({ slug });
110
114
  if (existingRelease) {
111
115
  return `${slug}-${randomStringGenerator()}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nina-protocol/nina-db",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "",
5
5
  "source": "src/index.js",
6
6
  "main": "dist/index.js",
@@ -26,6 +26,7 @@
26
26
  "@project-serum/anchor": "^0.25.0",
27
27
  "axios": "^0.27.2",
28
28
  "knex": "^2.2.0",
29
+ "nanoid": "^4.0.2",
29
30
  "objection": "2.2.15",
30
31
  "pg": "^8.7.3",
31
32
  "striptags": "^3.2.0",
@@ -116,7 +116,11 @@ export default class Release extends Model {
116
116
  }
117
117
 
118
118
  static generateSlug = async (metadata) => {
119
- const slug = metadata.name.toLowerCase().replace(/ /g, '-').replace(/[^a-z0-9-]/g, '');
119
+ let string = metadata.name
120
+ if (string.length > 200) {
121
+ string = string.substring(0, 200);
122
+ }
123
+ const slug = string.toLowerCase().replace('-', '').replace(/ +/g, ' ').replace(/ /g, '-').replace(/[^a-z0-9-]/g, '');
120
124
  const existingRelease = await Release.query().findOne({ slug });
121
125
  if (existingRelease) {
122
126
  return `${slug}-${randomStringGenerator()}`;