@nina-protocol/nina-db 0.0.36 → 0.0.38

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.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @param { import("knex").Knex } knex
3
+ * @returns { Promise<void> }
4
+ */
5
+ export const up = function (knex) {
6
+ return knex.schema.table('account', table => {
7
+ table.string('image');
8
+ table.string('description');
9
+ table.string('displayName');
10
+ table.string('handle');
11
+ });
12
+ };
13
+ /**
14
+ * @param { import("knex").Knex } knex
15
+ * @returns { Promise<void> }
16
+ */
17
+ export const down = function (knex) {
18
+ };
@@ -12,6 +12,10 @@ export default class Account extends Model {
12
12
  required: ['publicKey'],
13
13
  properties: {
14
14
  publicKey: { type: 'string' },
15
+ image: { type: 'string' },
16
+ description: { type: 'string' },
17
+ displayName: { type: 'string' },
18
+ handle: { type: 'string' },
15
19
  },
16
20
  };
17
21
  static findOrCreate = async (publicKey) => {
@@ -113,9 +113,10 @@ export default class Release extends Model {
113
113
  .normalize('NFKD').replace(/[\u0300-\u036F]/g, '') // remove accents and convert to closest ascii equivalent
114
114
  .toLowerCase() // convert to lowercase
115
115
  .replace('-', '') // remove hyphens
116
- .replace(/ +/g, '-') // remove spaces
116
+ .replace(/ +/g, ' ') // remove spaces
117
117
  .replace(/ /g, '-') // replace spaces with hyphens
118
- .replace(/![^\W_0-9-]/g, ''); // remove non-alphanumeric characters
118
+ .replace(/[^a-zA-Z0-9-]/g, '') // remove non-alphanumeric characters
119
+ .replace(/--+/g, ''); // remove spaces
119
120
  const existingRelease = await Release.query().findOne({ slug });
120
121
  if (existingRelease) {
121
122
  return `${slug}-${randomStringGenerator()}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nina-protocol/nina-db",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "",
5
5
  "source": "src/index.js",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @param { import("knex").Knex } knex
3
+ * @returns { Promise<void> }
4
+ */
5
+ export const up = function(knex) {
6
+ return knex.schema.table('account' , table => {
7
+ table.string('image');
8
+ table.string('description');
9
+ table.string('displayName');
10
+ table.string('handle');
11
+ });
12
+ };
13
+
14
+ /**
15
+ * @param { import("knex").Knex } knex
16
+ * @returns { Promise<void> }
17
+ */
18
+ export const down = function(knex) {
19
+
20
+ };
@@ -15,6 +15,10 @@ export default class Account extends Model {
15
15
  required: ['publicKey'],
16
16
  properties: {
17
17
  publicKey: { type: 'string' },
18
+ image: { type: 'string' },
19
+ description: { type: 'string' },
20
+ displayName: { type: 'string' },
21
+ handle: { type: 'string' },
18
22
  },
19
23
  }
20
24
 
@@ -124,10 +124,10 @@ export default class Release extends Model {
124
124
  .normalize('NFKD').replace(/[\u0300-\u036F]/g, '') // remove accents and convert to closest ascii equivalent
125
125
  .toLowerCase() // convert to lowercase
126
126
  .replace('-', '') // remove hyphens
127
- .replace(/ +/g, '-') // remove spaces
127
+ .replace(/ +/g, ' ') // remove spaces
128
128
  .replace(/ /g, '-') // replace spaces with hyphens
129
- .replace(/![^\W_0-9-]/g, ''); // remove non-alphanumeric characters
130
-
129
+ .replace(/[^a-zA-Z0-9-]/g, '') // remove non-alphanumeric characters
130
+ .replace(/--+/g, '') // remove spaces
131
131
  const existingRelease = await Release.query().findOne({ slug });
132
132
  if (existingRelease) {
133
133
  return `${slug}-${randomStringGenerator()}`;