@nina-protocol/nina-db 0.0.42 → 0.0.44

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,15 @@
1
+ /**
2
+ * @param { import("knex").Knex } knex
3
+ * @returns { Promise<void> }
4
+ */
5
+ export const up = function (knex) {
6
+ return knex.schema.table('posts', table => {
7
+ table.string('version').notNullable().defaultTo('0.0.0');
8
+ });
9
+ };
10
+ /**
11
+ * @param { import("knex").Knex } knex
12
+ * @returns { Promise<void> }
13
+ */
14
+ export const down = function (knex) {
15
+ };
@@ -115,9 +115,9 @@ export default class Release extends Model {
115
115
  .replace('-', '') // remove hyphens
116
116
  .replace(/ +/g, ' ') // remove spaces
117
117
  .replace(/ /g, '-') // replace spaces with hyphens
118
- .replace(/[^a-zA-Z0-9-]/g, '') // remove non-alphanumeric characters
119
- .replace(/--+/g, '') // remove spaces
120
- .replace(/-$/, '');
118
+ .replace(/[^a-zA-Z0-9-]/g, '-') // replace non-alphanumeric characters with hyphens
119
+ .replace(/-+/g, '-') // replace multiple hyphens with single hyphen
120
+ .replace(/-$/, ''); // remove trailing hyphens
121
121
  const existingRelease = await Release.query().findOne({ slug });
122
122
  if (existingRelease) {
123
123
  return `${slug}-${randomStringGenerator()}`;
@@ -25,7 +25,7 @@ export const tweetNewRelease = async (metadata, publisherId) => {
25
25
  accessToken: process.env.TWITTER_ACCESS_TOKEN,
26
26
  accessSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
27
27
  });
28
- let text = (`${metadata.properties.artist} - "${metadata.properties.title}"`).substr(0, 250);
28
+ let text = (`${metadata.properties.artist ? `${metadata.properties.artist} - ` : ''}${metadata.properties.title}`).substr(0, 250);
29
29
  const publisher = await Account.query().findById(publisherId);
30
30
  if (publisher) {
31
31
  const twitterVerification = (await publisher.$relatedQuery('verifications').where('type', 'twitter').andWhere('active', true))[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nina-protocol/nina-db",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "description": "",
5
5
  "source": "src/index.js",
6
6
  "main": "dist/index.js",
@@ -126,9 +126,9 @@ export default class Release extends Model {
126
126
  .replace('-', '') // remove hyphens
127
127
  .replace(/ +/g, ' ') // remove spaces
128
128
  .replace(/ /g, '-') // replace spaces with hyphens
129
- .replace(/[^a-zA-Z0-9-]/g, '') // remove non-alphanumeric characters
130
- .replace(/--+/g, '') // remove spaces
131
- .replace(/-$/, '')
129
+ .replace(/[^a-zA-Z0-9-]/g, '-') // replace non-alphanumeric characters with hyphens
130
+ .replace(/-+/g,'-') // replace multiple hyphens with single hyphen
131
+ .replace(/-$/, '') // remove trailing hyphens
132
132
 
133
133
  const existingRelease = await Release.query().findOne({ slug });
134
134
  if (existingRelease) {
@@ -29,7 +29,7 @@ export const tweetNewRelease = async (metadata, publisherId) => {
29
29
  accessToken: process.env.TWITTER_ACCESS_TOKEN,
30
30
  accessSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
31
31
  });
32
- let text = (`${metadata.properties.artist} - "${metadata.properties.title}"`).substr(0, 250)
32
+ let text = (`${metadata.properties.artist ? `${metadata.properties.artist} - ` : ''}${metadata.properties.title}`).substr(0, 250)
33
33
  const publisher = await Account.query().findById(publisherId);
34
34
  if (publisher) {
35
35
  const twitterVerification = (await publisher.$relatedQuery('verifications').where('type', 'twitter').andWhere('active', true))[0]