payment-kit 1.13.40 → 1.13.42
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.
package/api/src/store/migrate.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
2
|
+
import type { QueryInterface } from 'sequelize';
|
|
1
3
|
import { SequelizeStorage, Umzug } from 'umzug';
|
|
2
4
|
|
|
3
5
|
import { sequelize } from './sequelize';
|
|
@@ -13,4 +15,19 @@ export default function migrate() {
|
|
|
13
15
|
return umzug.up();
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
type ColumnChanges = Record<string, { name: string; field: any }[]>;
|
|
19
|
+
export async function safeApplyColumnChanges(context: QueryInterface, changes: ColumnChanges) {
|
|
20
|
+
for (const [table, columns] of Object.entries(changes)) {
|
|
21
|
+
const schema = await context.describeTable(table);
|
|
22
|
+
for (const { name, field } of columns) {
|
|
23
|
+
if (!schema[name]) {
|
|
24
|
+
await context.addColumn(table, name, field);
|
|
25
|
+
if (field.defaultValue) {
|
|
26
|
+
await context.bulkUpdate(table, { [name]: field.defaultValue }, {});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
export type Migration = typeof umzug._types.migration;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
1
2
|
import { DataTypes } from 'sequelize';
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
+
import { Migration, safeApplyColumnChanges } from '../migrate';
|
|
4
5
|
|
|
5
6
|
export const up: Migration = async ({ context }) => {
|
|
6
|
-
await context
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
await safeApplyColumnChanges(context, {
|
|
8
|
+
payment_links: [{ name: 'nft_mint_settings', field: { type: DataTypes.JSON, allowNull: true } }],
|
|
9
|
+
checkout_sessions: [
|
|
10
|
+
{ name: 'nft_mint_settings', field: { type: DataTypes.JSON, allowNull: true } },
|
|
11
|
+
{ name: 'payment_intent_data', field: { type: DataTypes.JSON, allowNull: true } },
|
|
12
|
+
{ name: 'nft_mint_settings', field: { type: DataTypes.JSON, allowNull: true } },
|
|
13
|
+
{ name: 'nft_mint_details', field: { type: DataTypes.JSON, allowNull: true } },
|
|
14
|
+
{
|
|
15
|
+
name: 'nft_mint_status',
|
|
16
|
+
field: {
|
|
17
|
+
type: DataTypes.ENUM('disabled', 'pending', 'minted', 'sent', 'error'),
|
|
18
|
+
defaultValue: 'disabled',
|
|
19
|
+
allowNull: false,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
14
23
|
});
|
|
15
24
|
};
|
|
16
25
|
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
1
2
|
import { DataTypes } from 'sequelize';
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
+
import { Migration, safeApplyColumnChanges } from '../migrate';
|
|
4
5
|
|
|
5
6
|
export const up: Migration = async ({ context }) => {
|
|
6
|
-
await context
|
|
7
|
+
await safeApplyColumnChanges(context, {
|
|
8
|
+
prices: [{ name: 'upsell', field: { type: DataTypes.JSON, allowNull: true } }],
|
|
9
|
+
});
|
|
7
10
|
};
|
|
8
11
|
|
|
9
12
|
export const down: Migration = async ({ context }) => {
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
1
2
|
import { DataTypes } from 'sequelize';
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
+
import { Migration, safeApplyColumnChanges } from '../migrate';
|
|
4
5
|
|
|
5
6
|
export const up: Migration = async ({ context }) => {
|
|
6
|
-
await context
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
await safeApplyColumnChanges(context, {
|
|
8
|
+
products: [{ name: 'cross_sell', field: { type: DataTypes.JSON, allowNull: true } }],
|
|
9
|
+
checkout_sessions: [
|
|
10
|
+
{ name: 'cross_sell_behavior', field: { type: DataTypes.ENUM('auto', 'required'), defaultValue: 'auto' } },
|
|
11
|
+
],
|
|
12
|
+
payment_links: [
|
|
13
|
+
{ name: 'cross_sell_behavior', field: { type: DataTypes.ENUM('auto', 'required'), defaultValue: 'auto' } },
|
|
14
|
+
],
|
|
10
15
|
});
|
|
11
|
-
await context.addColumn('payment_links', 'cross_sell_behavior', {
|
|
12
|
-
type: DataTypes.ENUM('auto', 'required'),
|
|
13
|
-
defaultValue: 'auto',
|
|
14
|
-
});
|
|
15
|
-
await context.bulkUpdate('checkout_sessions', { cross_sell_behavior: 'auto' }, {});
|
|
16
|
-
await context.bulkUpdate('payment_links', { cross_sell_behavior: 'auto' }, {});
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
export const down: Migration = async ({ context }) => {
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.42",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"@abtnode/types": "1.16.17",
|
|
104
104
|
"@arcblock/eslint-config": "^0.2.4",
|
|
105
105
|
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
106
|
-
"@did-pay/types": "1.13.
|
|
106
|
+
"@did-pay/types": "1.13.42",
|
|
107
107
|
"@types/cookie-parser": "^1.4.5",
|
|
108
108
|
"@types/cors": "^2.8.15",
|
|
109
109
|
"@types/dotenv-flow": "^3.3.2",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
"parser": "typescript"
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "bc5cda38ac03844a02463f1dfa129dbb556038f4"
|
|
144
144
|
}
|