@nina-protocol/nina-db 0.0.42 → 0.0.43
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
|
+
};
|
package/dist/models/Post.js
CHANGED
|
@@ -13,11 +13,12 @@ class Post extends Model {
|
|
|
13
13
|
static get jsonSchema() {
|
|
14
14
|
return {
|
|
15
15
|
type: 'object',
|
|
16
|
-
required: ['publicKey', 'data', 'datetime'],
|
|
16
|
+
required: ['publicKey', 'data', 'datetime', 'version'],
|
|
17
17
|
properties: {
|
|
18
18
|
publicKey: { type: 'string' },
|
|
19
19
|
data: { type: 'object' },
|
|
20
20
|
datetime: { type: 'string' },
|
|
21
|
+
version: { type: 'string' },
|
|
21
22
|
},
|
|
22
23
|
};
|
|
23
24
|
}
|
package/dist/models/Release.js
CHANGED
|
@@ -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, '') //
|
|
119
|
-
.replace(
|
|
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()}`;
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* @param { import("knex").Knex } knex
|
|
13
|
+
* @returns { Promise<void> }
|
|
14
|
+
*/
|
|
15
|
+
export const down = function(knex) {
|
|
16
|
+
|
|
17
|
+
};
|
package/src/models/Post.js
CHANGED
|
@@ -14,11 +14,12 @@ class Post extends Model {
|
|
|
14
14
|
static get jsonSchema() {
|
|
15
15
|
return {
|
|
16
16
|
type: 'object',
|
|
17
|
-
required: ['publicKey', 'data', 'datetime'],
|
|
17
|
+
required: ['publicKey', 'data', 'datetime', 'version'],
|
|
18
18
|
properties: {
|
|
19
19
|
publicKey: { type: 'string' },
|
|
20
20
|
data: { type: 'object' },
|
|
21
21
|
datetime: { type: 'string' },
|
|
22
|
+
version: { type: 'string' },
|
|
22
23
|
},
|
|
23
24
|
};
|
|
24
25
|
}
|
package/src/models/Release.js
CHANGED
|
@@ -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, '') //
|
|
130
|
-
.replace(
|
|
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) {
|