@boxyhq/saml-jackson 0.3.7-beta.678 → 0.3.7-beta.679
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/dist/controller/admin.d.ts +8 -0
- package/dist/controller/admin.js +27 -0
- package/dist/controller/api.d.ts +120 -6
- package/dist/controller/api.js +187 -10
- package/dist/controller/oauth.js +0 -6
- package/dist/db/db.d.ts +1 -0
- package/dist/db/db.js +9 -0
- package/dist/db/mem.d.ts +1 -0
- package/dist/db/mem.js +19 -0
- package/dist/db/mongo.d.ts +1 -0
- package/dist/db/mongo.js +23 -2
- package/dist/db/redis.d.ts +1 -0
- package/dist/db/redis.js +20 -0
- package/dist/db/sql/entity/JacksonStore.d.ts +2 -0
- package/dist/db/sql/entity/JacksonStore.js +13 -0
- package/dist/db/sql/sql.d.ts +1 -0
- package/dist/db/sql/sql.js +18 -1
- package/dist/db/store.js +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/typings.d.ts +9 -2
- package/migration/mariadb/1644332636666-createdAt.ts +16 -0
- package/migration/mysql/1644332641078-createdAt.ts +16 -0
- package/migration/postgres/1644332647279-createdAt.ts +16 -0
- package/package.json +4 -4
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.AdminController = void 0;
|
13
|
+
class AdminController {
|
14
|
+
constructor({ configStore }) {
|
15
|
+
this.configStore = configStore;
|
16
|
+
}
|
17
|
+
getAllConfig() {
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
19
|
+
const configList = (yield this.configStore.getAll());
|
20
|
+
if (!configList || !configList.length) {
|
21
|
+
return [];
|
22
|
+
}
|
23
|
+
return configList;
|
24
|
+
});
|
25
|
+
}
|
26
|
+
}
|
27
|
+
exports.AdminController = AdminController;
|
package/dist/controller/api.d.ts
CHANGED
@@ -18,10 +18,25 @@ export declare class APIController implements IAPIController {
|
|
18
18
|
* consumes:
|
19
19
|
* - application/x-www-form-urlencoded
|
20
20
|
* parameters:
|
21
|
+
* - name: name
|
22
|
+
* description: Name/identifier for the config
|
23
|
+
* type: string
|
24
|
+
* in: formData
|
25
|
+
* required: true
|
26
|
+
* example: cal-saml-config
|
27
|
+
* - name: description
|
28
|
+
* description: A short description for the config not more than 50 characters
|
29
|
+
* type: string
|
30
|
+
* in: formData
|
31
|
+
* required: true
|
32
|
+
* example: SAML login for cal.com app
|
21
33
|
* - name: encodedRawMetadata
|
22
34
|
* description: Base64 encoding of the XML metadata
|
23
35
|
* in: formData
|
24
|
-
*
|
36
|
+
* type: string
|
37
|
+
* - name: rawMetadata
|
38
|
+
* description: Raw XML metadata
|
39
|
+
* in: formData
|
25
40
|
* type: string
|
26
41
|
* - name: defaultRedirectUrl
|
27
42
|
* description: The redirect URL to use in the IdP login flow
|
@@ -67,6 +82,81 @@ export declare class APIController implements IAPIController {
|
|
67
82
|
* description: Unauthorized
|
68
83
|
*/
|
69
84
|
config(body: IdPConfig): Promise<OAuth>;
|
85
|
+
/**
|
86
|
+
* @swagger
|
87
|
+
*
|
88
|
+
* /api/v1/saml/config:
|
89
|
+
* patch:
|
90
|
+
* summary: Update SAML configuration
|
91
|
+
* operationId: update-saml-config
|
92
|
+
* tags: [SAML Config]
|
93
|
+
* consumes:
|
94
|
+
* - application/json
|
95
|
+
* - application/x-www-form-urlencoded
|
96
|
+
* parameters:
|
97
|
+
* - name: clientID
|
98
|
+
* description: Client ID for the config
|
99
|
+
* type: string
|
100
|
+
* in: formData
|
101
|
+
* required: true
|
102
|
+
* - name: clientSecret
|
103
|
+
* description: Client Secret for the config
|
104
|
+
* type: string
|
105
|
+
* in: formData
|
106
|
+
* required: true
|
107
|
+
* - name: name
|
108
|
+
* description: Name/identifier for the config
|
109
|
+
* type: string
|
110
|
+
* in: formData
|
111
|
+
* required: true
|
112
|
+
* example: cal-saml-config
|
113
|
+
* - name: description
|
114
|
+
* description: A short description for the config not more than 50 characters
|
115
|
+
* type: string
|
116
|
+
* in: formData
|
117
|
+
* required: true
|
118
|
+
* example: SAML login for cal.com app
|
119
|
+
* - name: encodedRawMetadata
|
120
|
+
* description: Base64 encoding of the XML metadata
|
121
|
+
* in: formData
|
122
|
+
* type: string
|
123
|
+
* - name: rawMetadata
|
124
|
+
* description: Raw XML metadata
|
125
|
+
* in: formData
|
126
|
+
* type: string
|
127
|
+
* - name: defaultRedirectUrl
|
128
|
+
* description: The redirect URL to use in the IdP login flow
|
129
|
+
* in: formData
|
130
|
+
* required: true
|
131
|
+
* type: string
|
132
|
+
* example: http://localhost:3000/login/saml
|
133
|
+
* - name: redirectUrl
|
134
|
+
* description: JSON encoded array containing a list of allowed redirect URLs
|
135
|
+
* in: formData
|
136
|
+
* required: true
|
137
|
+
* type: string
|
138
|
+
* example: '["http://localhost:3000/*"]'
|
139
|
+
* - name: tenant
|
140
|
+
* description: Tenant
|
141
|
+
* in: formData
|
142
|
+
* required: true
|
143
|
+
* type: string
|
144
|
+
* example: boxyhq.com
|
145
|
+
* - name: product
|
146
|
+
* description: Product
|
147
|
+
* in: formData
|
148
|
+
* required: true
|
149
|
+
* type: string
|
150
|
+
* example: demo
|
151
|
+
* responses:
|
152
|
+
* 204:
|
153
|
+
* description: Success
|
154
|
+
* 400:
|
155
|
+
* description: Please provide clientID | Please provide clientSecret | clientSecret mismatch | Tenant/Product config mismatch with IdP metadata
|
156
|
+
* 401:
|
157
|
+
* description: Unauthorized
|
158
|
+
*/
|
159
|
+
updateConfig(body: any): Promise<void>;
|
70
160
|
/**
|
71
161
|
* @swagger
|
72
162
|
*
|
@@ -96,11 +186,35 @@ export declare class APIController implements IAPIController {
|
|
96
186
|
* description: Success
|
97
187
|
* schema:
|
98
188
|
* type: object
|
99
|
-
* properties:
|
100
|
-
* provider:
|
101
|
-
* type: string
|
102
189
|
* example:
|
103
|
-
*
|
190
|
+
* {
|
191
|
+
* "config": {
|
192
|
+
* "idpMetadata": {
|
193
|
+
* "sso": {
|
194
|
+
* "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
|
195
|
+
* "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
|
196
|
+
* },
|
197
|
+
* "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
|
198
|
+
* "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
|
199
|
+
* "loginType": "idp",
|
200
|
+
* "provider": "okta.com"
|
201
|
+
* },
|
202
|
+
* "defaultRedirectUrl": "https://hoppscotch.io/",
|
203
|
+
* "redirectUrl": ["https://hoppscotch.io/"],
|
204
|
+
* "tenant": "hoppscotch.io",
|
205
|
+
* "product": "API Engine",
|
206
|
+
* "name": "Hoppscotch-SP",
|
207
|
+
* "description": "SP for hoppscotch.io",
|
208
|
+
* "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
|
209
|
+
* "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
|
210
|
+
* "certs": {
|
211
|
+
* "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
|
212
|
+
* "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
|
213
|
+
* }
|
214
|
+
* }
|
215
|
+
* }
|
216
|
+
* '400':
|
217
|
+
* description: Please provide `clientID` or `tenant`/`product`.
|
104
218
|
* '401':
|
105
219
|
* description: Unauthorized
|
106
220
|
*/
|
@@ -108,7 +222,7 @@ export declare class APIController implements IAPIController {
|
|
108
222
|
clientID: string;
|
109
223
|
tenant: string;
|
110
224
|
product: string;
|
111
|
-
}): Promise<
|
225
|
+
}): Promise<any>;
|
112
226
|
/**
|
113
227
|
* @swagger
|
114
228
|
* /api/v1/saml/config:
|
package/dist/controller/api.js
CHANGED
@@ -27,6 +27,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
27
27
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
28
28
|
});
|
29
29
|
};
|
30
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
31
|
+
var t = {};
|
32
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
33
|
+
t[p] = s[p];
|
34
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
35
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
36
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
37
|
+
t[p[i]] = s[p[i]];
|
38
|
+
}
|
39
|
+
return t;
|
40
|
+
};
|
30
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
31
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
32
43
|
};
|
@@ -43,7 +54,7 @@ class APIController {
|
|
43
54
|
this.configStore = configStore;
|
44
55
|
}
|
45
56
|
_validateIdPConfig(body) {
|
46
|
-
const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product } = body;
|
57
|
+
const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product, name } = body;
|
47
58
|
if (!rawMetadata && !encodedRawMetadata) {
|
48
59
|
throw new error_1.JacksonError('Please provide rawMetadata or encodedRawMetadata', 400);
|
49
60
|
}
|
@@ -59,6 +70,9 @@ class APIController {
|
|
59
70
|
if (!product) {
|
60
71
|
throw new error_1.JacksonError('Please provide product', 400);
|
61
72
|
}
|
73
|
+
if (!name) {
|
74
|
+
throw new error_1.JacksonError('Please provide a friendly name', 400);
|
75
|
+
}
|
62
76
|
}
|
63
77
|
/**
|
64
78
|
* @swagger
|
@@ -73,10 +87,25 @@ class APIController {
|
|
73
87
|
* consumes:
|
74
88
|
* - application/x-www-form-urlencoded
|
75
89
|
* parameters:
|
90
|
+
* - name: name
|
91
|
+
* description: Name/identifier for the config
|
92
|
+
* type: string
|
93
|
+
* in: formData
|
94
|
+
* required: true
|
95
|
+
* example: cal-saml-config
|
96
|
+
* - name: description
|
97
|
+
* description: A short description for the config not more than 50 characters
|
98
|
+
* type: string
|
99
|
+
* in: formData
|
100
|
+
* required: true
|
101
|
+
* example: SAML login for cal.com app
|
76
102
|
* - name: encodedRawMetadata
|
77
103
|
* description: Base64 encoding of the XML metadata
|
78
104
|
* in: formData
|
79
|
-
*
|
105
|
+
* type: string
|
106
|
+
* - name: rawMetadata
|
107
|
+
* description: Raw XML metadata
|
108
|
+
* in: formData
|
80
109
|
* type: string
|
81
110
|
* - name: defaultRedirectUrl
|
82
111
|
* description: The redirect URL to use in the IdP login flow
|
@@ -123,7 +152,7 @@ class APIController {
|
|
123
152
|
*/
|
124
153
|
config(body) {
|
125
154
|
return __awaiter(this, void 0, void 0, function* () {
|
126
|
-
const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product } = body;
|
155
|
+
const { encodedRawMetadata, rawMetadata, defaultRedirectUrl, redirectUrl, tenant, product, name, description, } = body;
|
127
156
|
this._validateIdPConfig(body);
|
128
157
|
let metaData = rawMetadata;
|
129
158
|
if (encodedRawMetadata) {
|
@@ -155,6 +184,8 @@ class APIController {
|
|
155
184
|
redirectUrl: JSON.parse(redirectUrl),
|
156
185
|
tenant,
|
157
186
|
product,
|
187
|
+
name,
|
188
|
+
description,
|
158
189
|
clientID,
|
159
190
|
clientSecret,
|
160
191
|
certs,
|
@@ -174,6 +205,128 @@ class APIController {
|
|
174
205
|
};
|
175
206
|
});
|
176
207
|
}
|
208
|
+
/**
|
209
|
+
* @swagger
|
210
|
+
*
|
211
|
+
* /api/v1/saml/config:
|
212
|
+
* patch:
|
213
|
+
* summary: Update SAML configuration
|
214
|
+
* operationId: update-saml-config
|
215
|
+
* tags: [SAML Config]
|
216
|
+
* consumes:
|
217
|
+
* - application/json
|
218
|
+
* - application/x-www-form-urlencoded
|
219
|
+
* parameters:
|
220
|
+
* - name: clientID
|
221
|
+
* description: Client ID for the config
|
222
|
+
* type: string
|
223
|
+
* in: formData
|
224
|
+
* required: true
|
225
|
+
* - name: clientSecret
|
226
|
+
* description: Client Secret for the config
|
227
|
+
* type: string
|
228
|
+
* in: formData
|
229
|
+
* required: true
|
230
|
+
* - name: name
|
231
|
+
* description: Name/identifier for the config
|
232
|
+
* type: string
|
233
|
+
* in: formData
|
234
|
+
* required: true
|
235
|
+
* example: cal-saml-config
|
236
|
+
* - name: description
|
237
|
+
* description: A short description for the config not more than 50 characters
|
238
|
+
* type: string
|
239
|
+
* in: formData
|
240
|
+
* required: true
|
241
|
+
* example: SAML login for cal.com app
|
242
|
+
* - name: encodedRawMetadata
|
243
|
+
* description: Base64 encoding of the XML metadata
|
244
|
+
* in: formData
|
245
|
+
* type: string
|
246
|
+
* - name: rawMetadata
|
247
|
+
* description: Raw XML metadata
|
248
|
+
* in: formData
|
249
|
+
* type: string
|
250
|
+
* - name: defaultRedirectUrl
|
251
|
+
* description: The redirect URL to use in the IdP login flow
|
252
|
+
* in: formData
|
253
|
+
* required: true
|
254
|
+
* type: string
|
255
|
+
* example: http://localhost:3000/login/saml
|
256
|
+
* - name: redirectUrl
|
257
|
+
* description: JSON encoded array containing a list of allowed redirect URLs
|
258
|
+
* in: formData
|
259
|
+
* required: true
|
260
|
+
* type: string
|
261
|
+
* example: '["http://localhost:3000/*"]'
|
262
|
+
* - name: tenant
|
263
|
+
* description: Tenant
|
264
|
+
* in: formData
|
265
|
+
* required: true
|
266
|
+
* type: string
|
267
|
+
* example: boxyhq.com
|
268
|
+
* - name: product
|
269
|
+
* description: Product
|
270
|
+
* in: formData
|
271
|
+
* required: true
|
272
|
+
* type: string
|
273
|
+
* example: demo
|
274
|
+
* responses:
|
275
|
+
* 204:
|
276
|
+
* description: Success
|
277
|
+
* 400:
|
278
|
+
* description: Please provide clientID | Please provide clientSecret | clientSecret mismatch | Tenant/Product config mismatch with IdP metadata
|
279
|
+
* 401:
|
280
|
+
* description: Unauthorized
|
281
|
+
*/
|
282
|
+
updateConfig(body) {
|
283
|
+
var _a;
|
284
|
+
return __awaiter(this, void 0, void 0, function* () {
|
285
|
+
const { encodedRawMetadata, // could be empty
|
286
|
+
rawMetadata, // could be empty
|
287
|
+
defaultRedirectUrl, redirectUrl, name, description } = body, clientInfo = __rest(body, ["encodedRawMetadata", "rawMetadata", "defaultRedirectUrl", "redirectUrl", "name", "description"]);
|
288
|
+
if (!(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID)) {
|
289
|
+
throw new error_1.JacksonError('Please provide clientID', 400);
|
290
|
+
}
|
291
|
+
if (!(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientSecret)) {
|
292
|
+
throw new error_1.JacksonError('Please provide clientSecret', 400);
|
293
|
+
}
|
294
|
+
const _currentConfig = (_a = (yield this.getConfig(clientInfo))) === null || _a === void 0 ? void 0 : _a.config;
|
295
|
+
if (_currentConfig.clientSecret !== (clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientSecret)) {
|
296
|
+
throw new error_1.JacksonError('clientSecret mismatch', 400);
|
297
|
+
}
|
298
|
+
let metaData = rawMetadata;
|
299
|
+
if (encodedRawMetadata) {
|
300
|
+
metaData = Buffer.from(encodedRawMetadata, 'base64').toString();
|
301
|
+
}
|
302
|
+
let newMetadata;
|
303
|
+
if (metaData) {
|
304
|
+
newMetadata = yield saml_1.default.parseMetadataAsync(metaData);
|
305
|
+
// extract provider
|
306
|
+
let providerName = extractHostName(newMetadata.entityID);
|
307
|
+
if (!providerName) {
|
308
|
+
providerName = extractHostName(newMetadata.sso.redirectUrl || newMetadata.sso.postUrl);
|
309
|
+
}
|
310
|
+
newMetadata.provider = providerName ? providerName : 'Unknown';
|
311
|
+
}
|
312
|
+
if (newMetadata) {
|
313
|
+
// check if clientID matches with new metadata payload
|
314
|
+
const clientID = dbutils.keyDigest(dbutils.keyFromParts(clientInfo.tenant, clientInfo.product, newMetadata.entityID));
|
315
|
+
if (clientID !== (clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID)) {
|
316
|
+
throw new error_1.JacksonError('Tenant/Product config mismatch with IdP metadata', 400);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
yield this.configStore.put(clientInfo === null || clientInfo === void 0 ? void 0 : clientInfo.clientID, Object.assign(Object.assign({}, _currentConfig), { name: name ? name : _currentConfig.name, description: description ? description : _currentConfig.description, idpMetadata: newMetadata ? newMetadata : _currentConfig.idpMetadata, defaultRedirectUrl: defaultRedirectUrl ? defaultRedirectUrl : _currentConfig.defaultRedirectUrl, redirectUrl: redirectUrl ? JSON.parse(redirectUrl) : _currentConfig.redirectUrl }), {
|
320
|
+
// secondary index on entityID
|
321
|
+
name: utils_1.IndexNames.EntityID,
|
322
|
+
value: _currentConfig.idpMetadata.entityID,
|
323
|
+
}, {
|
324
|
+
// secondary index on tenant + product
|
325
|
+
name: utils_1.IndexNames.TenantProduct,
|
326
|
+
value: dbutils.keyFromParts(_currentConfig.tenant, _currentConfig.product),
|
327
|
+
});
|
328
|
+
});
|
329
|
+
}
|
177
330
|
/**
|
178
331
|
* @swagger
|
179
332
|
*
|
@@ -203,11 +356,35 @@ class APIController {
|
|
203
356
|
* description: Success
|
204
357
|
* schema:
|
205
358
|
* type: object
|
206
|
-
* properties:
|
207
|
-
* provider:
|
208
|
-
* type: string
|
209
359
|
* example:
|
210
|
-
*
|
360
|
+
* {
|
361
|
+
* "config": {
|
362
|
+
* "idpMetadata": {
|
363
|
+
* "sso": {
|
364
|
+
* "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml",
|
365
|
+
* "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxxx/sso/saml"
|
366
|
+
* },
|
367
|
+
* "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
|
368
|
+
* "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
|
369
|
+
* "loginType": "idp",
|
370
|
+
* "provider": "okta.com"
|
371
|
+
* },
|
372
|
+
* "defaultRedirectUrl": "https://hoppscotch.io/",
|
373
|
+
* "redirectUrl": ["https://hoppscotch.io/"],
|
374
|
+
* "tenant": "hoppscotch.io",
|
375
|
+
* "product": "API Engine",
|
376
|
+
* "name": "Hoppscotch-SP",
|
377
|
+
* "description": "SP for hoppscotch.io",
|
378
|
+
* "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
|
379
|
+
* "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
|
380
|
+
* "certs": {
|
381
|
+
* "publicKey": "-----BEGIN CERTIFICATE-----.......-----END CERTIFICATE-----",
|
382
|
+
* "privateKey": "-----BEGIN PRIVATE KEY-----......-----END PRIVATE KEY-----"
|
383
|
+
* }
|
384
|
+
* }
|
385
|
+
* }
|
386
|
+
* '400':
|
387
|
+
* description: Please provide `clientID` or `tenant`/`product`.
|
211
388
|
* '401':
|
212
389
|
* description: Unauthorized
|
213
390
|
*/
|
@@ -216,7 +393,7 @@ class APIController {
|
|
216
393
|
const { clientID, tenant, product } = body;
|
217
394
|
if (clientID) {
|
218
395
|
const samlConfig = yield this.configStore.get(clientID);
|
219
|
-
return samlConfig ? {
|
396
|
+
return samlConfig ? { config: samlConfig } : {};
|
220
397
|
}
|
221
398
|
if (tenant && product) {
|
222
399
|
const samlConfigs = yield this.configStore.getByIndex({
|
@@ -226,7 +403,7 @@ class APIController {
|
|
226
403
|
if (!samlConfigs || !samlConfigs.length) {
|
227
404
|
return {};
|
228
405
|
}
|
229
|
-
return {
|
406
|
+
return { config: samlConfigs[0] };
|
230
407
|
}
|
231
408
|
throw new error_1.JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
|
232
409
|
});
|
@@ -280,7 +457,7 @@ class APIController {
|
|
280
457
|
yield this.configStore.delete(clientID);
|
281
458
|
}
|
282
459
|
else {
|
283
|
-
throw new error_1.JacksonError('clientSecret mismatch
|
460
|
+
throw new error_1.JacksonError('clientSecret mismatch', 400);
|
284
461
|
}
|
285
462
|
return;
|
286
463
|
}
|
package/dist/controller/oauth.js
CHANGED
@@ -292,12 +292,6 @@ class OAuthController {
|
|
292
292
|
throw new error_1.JacksonError('Invalid client_id or client_secret', 401);
|
293
293
|
}
|
294
294
|
}
|
295
|
-
else {
|
296
|
-
// encoded client_id, verify client_secret
|
297
|
-
if (client_secret !== this.opts.clientSecretVerifier) {
|
298
|
-
throw new error_1.JacksonError('Invalid client_secret', 401);
|
299
|
-
}
|
300
|
-
}
|
301
295
|
}
|
302
296
|
}
|
303
297
|
else if (codeVal && codeVal.session) {
|
package/dist/db/db.d.ts
CHANGED
@@ -4,6 +4,7 @@ declare class DB implements DatabaseDriver {
|
|
4
4
|
private encryptionKey;
|
5
5
|
constructor(db: DatabaseDriver, encryptionKey: EncryptionKey);
|
6
6
|
get(namespace: string, key: string): Promise<unknown>;
|
7
|
+
getAll(namespace: any): Promise<unknown[]>;
|
7
8
|
getByIndex(namespace: string, idx: Index): Promise<unknown[]>;
|
8
9
|
put(namespace: string, key: string, val: unknown, ttl?: number, ...indexes: Index[]): Promise<unknown>;
|
9
10
|
delete(namespace: string, key: string): Promise<unknown>;
|
package/dist/db/db.js
CHANGED
@@ -57,6 +57,15 @@ class DB {
|
|
57
57
|
return decrypt(res, this.encryptionKey);
|
58
58
|
});
|
59
59
|
}
|
60
|
+
getAll(namespace) {
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
62
|
+
const res = (yield this.db.getAll(namespace));
|
63
|
+
const encryptionKey = this.encryptionKey;
|
64
|
+
return res.map((r) => {
|
65
|
+
return decrypt(r, encryptionKey);
|
66
|
+
});
|
67
|
+
});
|
68
|
+
}
|
60
69
|
getByIndex(namespace, idx) {
|
61
70
|
return __awaiter(this, void 0, void 0, function* () {
|
62
71
|
const res = yield this.db.getByIndex(namespace, idx);
|
package/dist/db/mem.d.ts
CHANGED
@@ -10,6 +10,7 @@ declare class Mem implements DatabaseDriver {
|
|
10
10
|
constructor(options: DatabaseOption);
|
11
11
|
init(): Promise<Mem>;
|
12
12
|
get(namespace: string, key: string): Promise<any>;
|
13
|
+
getAll(namespace: string): Promise<unknown[]>;
|
13
14
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
14
15
|
put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<any>;
|
15
16
|
delete(namespace: string, key: string): Promise<any>;
|
package/dist/db/mem.js
CHANGED
@@ -66,6 +66,21 @@ class Mem {
|
|
66
66
|
return null;
|
67
67
|
});
|
68
68
|
}
|
69
|
+
getAll(namespace) {
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
71
|
+
const returnValue = [];
|
72
|
+
if (namespace) {
|
73
|
+
for (const key in this.store) {
|
74
|
+
if (key.startsWith(namespace)) {
|
75
|
+
returnValue.push(this.store[key]);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
if (returnValue)
|
80
|
+
return returnValue;
|
81
|
+
return [];
|
82
|
+
});
|
83
|
+
}
|
69
84
|
getByIndex(namespace, idx) {
|
70
85
|
return __awaiter(this, void 0, void 0, function* () {
|
71
86
|
const dbKeys = yield this.indexes[dbutils.keyForIndex(namespace, idx)];
|
@@ -80,6 +95,10 @@ class Mem {
|
|
80
95
|
return __awaiter(this, void 0, void 0, function* () {
|
81
96
|
const k = dbutils.key(namespace, key);
|
82
97
|
this.store[k] = val;
|
98
|
+
if (!Date.parse(this.store['createdAt']))
|
99
|
+
this.store['createdAt'] = new Date().toISOString();
|
100
|
+
this.store['modifiedAt'] = new Date().toISOString();
|
101
|
+
// console.log(this.store)
|
83
102
|
if (ttl) {
|
84
103
|
this.ttlStore[k] = {
|
85
104
|
namespace,
|
package/dist/db/mongo.d.ts
CHANGED
@@ -7,6 +7,7 @@ declare class Mongo implements DatabaseDriver {
|
|
7
7
|
constructor(options: DatabaseOption);
|
8
8
|
init(): Promise<Mongo>;
|
9
9
|
get(namespace: string, key: string): Promise<any>;
|
10
|
+
getAll(namespace: string): Promise<unknown[]>;
|
10
11
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
11
12
|
put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
|
12
13
|
delete(namespace: string, key: string): Promise<any>;
|
package/dist/db/mongo.js
CHANGED
@@ -36,8 +36,16 @@ class Mongo {
|
|
36
36
|
}
|
37
37
|
init() {
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
39
|
-
|
40
|
-
|
39
|
+
try {
|
40
|
+
if (!this.options.url) {
|
41
|
+
throw Error('Please specify a db url');
|
42
|
+
}
|
43
|
+
this.client = new mongodb_1.MongoClient(this.options.url);
|
44
|
+
yield this.client.connect();
|
45
|
+
}
|
46
|
+
catch (err) {
|
47
|
+
console.error(`error connecting to ${this.options.type} db: ${err}`);
|
48
|
+
}
|
41
49
|
this.db = this.client.db();
|
42
50
|
this.collection = this.db.collection('jacksonStore');
|
43
51
|
yield this.collection.createIndex({ indexes: 1 });
|
@@ -56,6 +64,15 @@ class Mongo {
|
|
56
64
|
return null;
|
57
65
|
});
|
58
66
|
}
|
67
|
+
getAll(namespace) {
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
69
|
+
const _namespaceMatch = new RegExp(`^${namespace}:.*`);
|
70
|
+
const docs = yield this.collection.find({ _id: _namespaceMatch }).toArray();
|
71
|
+
if (docs)
|
72
|
+
return docs.map(({ value }) => value);
|
73
|
+
return [];
|
74
|
+
});
|
75
|
+
}
|
59
76
|
getByIndex(namespace, idx) {
|
60
77
|
return __awaiter(this, void 0, void 0, function* () {
|
61
78
|
const docs = yield this.collection
|
@@ -86,8 +103,12 @@ class Mongo {
|
|
86
103
|
}
|
87
104
|
doc.indexes.push(idxKey);
|
88
105
|
}
|
106
|
+
doc.modifiedAt = new Date().toISOString();
|
89
107
|
yield this.collection.updateOne({ _id: dbutils.key(namespace, key) }, {
|
90
108
|
$set: doc,
|
109
|
+
$setOnInsert: {
|
110
|
+
createdAt: new Date().toISOString(),
|
111
|
+
},
|
91
112
|
}, { upsert: true });
|
92
113
|
});
|
93
114
|
}
|
package/dist/db/redis.d.ts
CHANGED
@@ -5,6 +5,7 @@ declare class Redis implements DatabaseDriver {
|
|
5
5
|
constructor(options: DatabaseOption);
|
6
6
|
init(): Promise<Redis>;
|
7
7
|
get(namespace: string, key: string): Promise<any>;
|
8
|
+
getAll(namespace: string): Promise<unknown[]>;
|
8
9
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
9
10
|
put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
|
10
11
|
delete(namespace: string, key: string): Promise<any>;
|
package/dist/db/redis.js
CHANGED
@@ -57,6 +57,26 @@ class Redis {
|
|
57
57
|
return null;
|
58
58
|
});
|
59
59
|
}
|
60
|
+
getAll(namespace) {
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
62
|
+
const keys = yield this.client.sendCommand(['keys', namespace + ':*']);
|
63
|
+
const returnValue = [];
|
64
|
+
for (let i = 0; i < keys.length; i++) {
|
65
|
+
try {
|
66
|
+
if (this.client.get(keys[i])) {
|
67
|
+
const value = yield this.client.get(keys[i]);
|
68
|
+
returnValue.push(JSON.parse(value));
|
69
|
+
}
|
70
|
+
}
|
71
|
+
catch (error) {
|
72
|
+
console.error(error);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
if (returnValue)
|
76
|
+
return returnValue;
|
77
|
+
return [];
|
78
|
+
});
|
79
|
+
}
|
60
80
|
getByIndex(namespace, idx) {
|
61
81
|
return __awaiter(this, void 0, void 0, function* () {
|
62
82
|
const dbKeys = yield this.client.sMembers(dbutils.keyForIndex(namespace, idx));
|
@@ -36,6 +36,19 @@ __decorate([
|
|
36
36
|
nullable: true,
|
37
37
|
})
|
38
38
|
], JacksonStore.prototype, "tag", void 0);
|
39
|
+
__decorate([
|
40
|
+
(0, typeorm_1.Column)({
|
41
|
+
type: 'timestamp',
|
42
|
+
default: () => 'CURRENT_TIMESTAMP',
|
43
|
+
nullable: false,
|
44
|
+
})
|
45
|
+
], JacksonStore.prototype, "createdAt", void 0);
|
46
|
+
__decorate([
|
47
|
+
(0, typeorm_1.Column)({
|
48
|
+
type: 'timestamp',
|
49
|
+
nullable: true,
|
50
|
+
})
|
51
|
+
], JacksonStore.prototype, "modifiedAt", void 0);
|
39
52
|
JacksonStore = __decorate([
|
40
53
|
(0, typeorm_1.Entity)()
|
41
54
|
], JacksonStore);
|
package/dist/db/sql/sql.d.ts
CHANGED
@@ -10,6 +10,7 @@ declare class Sql implements DatabaseDriver {
|
|
10
10
|
constructor(options: DatabaseOption);
|
11
11
|
init(): Promise<Sql>;
|
12
12
|
get(namespace: string, key: string): Promise<any>;
|
13
|
+
getAll(namespace: string): Promise<unknown[]>;
|
13
14
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
14
15
|
put(namespace: string, key: string, val: Encrypted, ttl?: number, ...indexes: any[]): Promise<void>;
|
15
16
|
delete(namespace: string, key: string): Promise<any>;
|
package/dist/db/sql/sql.js
CHANGED
@@ -95,7 +95,7 @@ class Sql {
|
|
95
95
|
}
|
96
96
|
get(namespace, key) {
|
97
97
|
return __awaiter(this, void 0, void 0, function* () {
|
98
|
-
|
98
|
+
const res = yield this.storeRepository.findOne({
|
99
99
|
key: dbutils.key(namespace, key),
|
100
100
|
});
|
101
101
|
if (res && res.value) {
|
@@ -108,6 +108,22 @@ class Sql {
|
|
108
108
|
return null;
|
109
109
|
});
|
110
110
|
}
|
111
|
+
getAll(namespace) {
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
113
|
+
const response = yield this.storeRepository.find({
|
114
|
+
where: { key: (0, typeorm_1.Like)(`%${namespace}%`) },
|
115
|
+
select: ['value', 'iv', 'tag'],
|
116
|
+
order: {
|
117
|
+
['createdAt']: 'DESC',
|
118
|
+
// ['createdAt']: 'ASC',
|
119
|
+
},
|
120
|
+
});
|
121
|
+
const returnValue = JSON.parse(JSON.stringify(response));
|
122
|
+
if (returnValue)
|
123
|
+
return returnValue;
|
124
|
+
return [];
|
125
|
+
});
|
126
|
+
}
|
111
127
|
getByIndex(namespace, idx) {
|
112
128
|
return __awaiter(this, void 0, void 0, function* () {
|
113
129
|
const res = yield this.indexRepository.find({
|
@@ -135,6 +151,7 @@ class Sql {
|
|
135
151
|
store.value = val.value;
|
136
152
|
store.iv = val.iv;
|
137
153
|
store.tag = val.tag;
|
154
|
+
store.modifiedAt = new Date().toISOString();
|
138
155
|
yield transactionalEntityManager.save(store);
|
139
156
|
if (ttl) {
|
140
157
|
const ttlRec = new JacksonTTL_1.JacksonTTL();
|
package/dist/db/store.js
CHANGED
@@ -40,6 +40,11 @@ class Store {
|
|
40
40
|
return yield this.db.get(this.namespace, dbutils.keyDigest(key));
|
41
41
|
});
|
42
42
|
}
|
43
|
+
getAll() {
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
45
|
+
return yield this.db.getAll(this.namespace);
|
46
|
+
});
|
47
|
+
}
|
43
48
|
getByIndex(idx) {
|
44
49
|
return __awaiter(this, void 0, void 0, function* () {
|
45
50
|
idx.value = dbutils.keyDigest(idx.value);
|
package/dist/index.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
import { JacksonOption } from './typings';
|
2
2
|
import { APIController } from './controller/api';
|
3
3
|
import { OAuthController } from './controller/oauth';
|
4
|
+
import { AdminController } from './controller/admin';
|
4
5
|
export declare const controllers: (opts: JacksonOption) => Promise<{
|
5
6
|
apiController: APIController;
|
6
7
|
oauthController: OAuthController;
|
8
|
+
adminController: AdminController;
|
7
9
|
}>;
|
8
10
|
export default controllers;
|
9
11
|
export * from './typings';
|
package/dist/index.js
CHANGED
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.controllers = void 0;
|
26
26
|
const api_1 = require("./controller/api");
|
27
27
|
const oauth_1 = require("./controller/oauth");
|
28
|
+
const admin_1 = require("./controller/admin");
|
28
29
|
const db_1 = __importDefault(require("./db/db"));
|
29
30
|
const read_config_1 = __importDefault(require("./read-config"));
|
30
31
|
const defaultOpts = (opts) => {
|
@@ -44,7 +45,6 @@ const defaultOpts = (opts) => {
|
|
44
45
|
newOpts.db.type = newOpts.db.type || 'postgres'; // Only needed if DB_ENGINE is sql.
|
45
46
|
newOpts.db.ttl = (newOpts.db.ttl || 300) * 1; // TTL for the code, session and token stores (in seconds)
|
46
47
|
newOpts.db.cleanupLimit = (newOpts.db.cleanupLimit || 1000) * 1; // Limit cleanup of TTL entries to this many items at a time
|
47
|
-
newOpts.clientSecretVerifier = newOpts.clientSecretVerifier || 'dummy';
|
48
48
|
return newOpts;
|
49
49
|
};
|
50
50
|
const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -55,6 +55,7 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
55
|
const codeStore = db.store('oauth:code', opts.db.ttl);
|
56
56
|
const tokenStore = db.store('oauth:token', opts.db.ttl);
|
57
57
|
const apiController = new api_1.APIController({ configStore });
|
58
|
+
const adminController = new admin_1.AdminController({ configStore });
|
58
59
|
const oauthController = new oauth_1.OAuthController({
|
59
60
|
configStore,
|
60
61
|
sessionStore,
|
@@ -75,6 +76,7 @@ const controllers = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
76
|
return {
|
76
77
|
apiController,
|
77
78
|
oauthController,
|
79
|
+
adminController,
|
78
80
|
};
|
79
81
|
});
|
80
82
|
exports.controllers = controllers;
|
package/dist/typings.d.ts
CHANGED
@@ -3,6 +3,8 @@ export declare type IdPConfig = {
|
|
3
3
|
redirectUrl: string;
|
4
4
|
tenant: string;
|
5
5
|
product: string;
|
6
|
+
name: string;
|
7
|
+
description: string;
|
6
8
|
rawMetadata?: string;
|
7
9
|
encodedRawMetadata?: string;
|
8
10
|
};
|
@@ -13,11 +15,12 @@ export interface OAuth {
|
|
13
15
|
}
|
14
16
|
export interface IAPIController {
|
15
17
|
config(body: IdPConfig): Promise<OAuth>;
|
18
|
+
updateConfig(body: any): Promise<void>;
|
16
19
|
getConfig(body: {
|
17
20
|
clientID?: string;
|
18
21
|
tenant?: string;
|
19
22
|
product?: string;
|
20
|
-
}): Promise<
|
23
|
+
}): Promise<any>;
|
21
24
|
deleteConfig(body: {
|
22
25
|
clientID?: string;
|
23
26
|
clientSecret?: string;
|
@@ -35,6 +38,9 @@ export interface IOAuthController {
|
|
35
38
|
token(body: OAuthTokenReq): Promise<OAuthTokenRes>;
|
36
39
|
userInfo(token: string): Promise<Profile>;
|
37
40
|
}
|
41
|
+
export interface IAdminController {
|
42
|
+
getAllConfig(): any;
|
43
|
+
}
|
38
44
|
export interface OAuthReqBody {
|
39
45
|
response_type: 'code';
|
40
46
|
client_id: string;
|
@@ -73,12 +79,14 @@ export interface Index {
|
|
73
79
|
value: string;
|
74
80
|
}
|
75
81
|
export interface DatabaseDriver {
|
82
|
+
getAll(namespace: string): Promise<unknown[]>;
|
76
83
|
get(namespace: string, key: string): Promise<any>;
|
77
84
|
put(namespace: string, key: string, val: any, ttl: number, ...indexes: Index[]): Promise<any>;
|
78
85
|
delete(namespace: string, key: string): Promise<any>;
|
79
86
|
getByIndex(namespace: string, idx: Index): Promise<any>;
|
80
87
|
}
|
81
88
|
export interface Storable {
|
89
|
+
getAll(): Promise<unknown[]>;
|
82
90
|
get(key: string): Promise<any>;
|
83
91
|
put(key: string, val: any, ...indexes: Index[]): Promise<any>;
|
84
92
|
delete(key: string): Promise<any>;
|
@@ -123,5 +131,4 @@ export interface JacksonOption {
|
|
123
131
|
preLoadedConfig?: string;
|
124
132
|
idpEnabled?: boolean;
|
125
133
|
db: DatabaseOption;
|
126
|
-
clientSecretVerifier?: string;
|
127
134
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
2
|
+
|
3
|
+
export class createdAt1644332636666 implements MigrationInterface {
|
4
|
+
name = 'createdAt1644332636666'
|
5
|
+
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
7
|
+
await queryRunner.query(`ALTER TABLE \`jackson_store\` ADD \`createdAt\` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP()`);
|
8
|
+
await queryRunner.query(`ALTER TABLE \`jackson_store\` ADD \`modifiedAt\` timestamp NULL`);
|
9
|
+
}
|
10
|
+
|
11
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
12
|
+
await queryRunner.query(`ALTER TABLE \`jackson_store\` DROP COLUMN \`modifiedAt\``);
|
13
|
+
await queryRunner.query(`ALTER TABLE \`jackson_store\` DROP COLUMN \`createdAt\``);
|
14
|
+
}
|
15
|
+
|
16
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
2
|
+
|
3
|
+
export class createdAt1644332641078 implements MigrationInterface {
|
4
|
+
name = 'createdAt1644332641078'
|
5
|
+
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
7
|
+
await queryRunner.query(`ALTER TABLE \`jackson_store\` ADD \`createdAt\` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP`);
|
8
|
+
await queryRunner.query(`ALTER TABLE \`jackson_store\` ADD \`modifiedAt\` timestamp NULL`);
|
9
|
+
}
|
10
|
+
|
11
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
12
|
+
await queryRunner.query(`ALTER TABLE \`jackson_store\` DROP COLUMN \`modifiedAt\``);
|
13
|
+
await queryRunner.query(`ALTER TABLE \`jackson_store\` DROP COLUMN \`createdAt\``);
|
14
|
+
}
|
15
|
+
|
16
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
2
|
+
|
3
|
+
export class createdAt1644332647279 implements MigrationInterface {
|
4
|
+
name = 'createdAt1644332647279'
|
5
|
+
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
7
|
+
await queryRunner.query(`ALTER TABLE "jackson_store" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`);
|
8
|
+
await queryRunner.query(`ALTER TABLE "jackson_store" ADD "modifiedAt" TIMESTAMP`);
|
9
|
+
}
|
10
|
+
|
11
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
12
|
+
await queryRunner.query(`ALTER TABLE "jackson_store" DROP COLUMN "modifiedAt"`);
|
13
|
+
await queryRunner.query(`ALTER TABLE "jackson_store" DROP COLUMN "createdAt"`);
|
14
|
+
}
|
15
|
+
|
16
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@boxyhq/saml-jackson",
|
3
|
-
"version": "0.3.7-beta.
|
3
|
+
"version": "0.3.7-beta.679",
|
4
4
|
"description": "SAML 2.0 service",
|
5
5
|
"keywords": [
|
6
6
|
"SAML 2.0"
|
@@ -18,9 +18,9 @@
|
|
18
18
|
],
|
19
19
|
"scripts": {
|
20
20
|
"build": "tsc -p tsconfig.build.json",
|
21
|
-
"db:migration:generate:postgres": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n
|
22
|
-
"db:migration:generate:mysql": "cross-env DB_TYPE=mysql DB_URL=mysql://root:mysql@localhost:3307/mysql ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n
|
23
|
-
"db:migration:generate:mariadb": "cross-env DB_TYPE=mariadb DB_URL=mariadb://root@localhost:3306/mysql ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n
|
21
|
+
"db:migration:generate:postgres": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n createdAt",
|
22
|
+
"db:migration:generate:mysql": "cross-env DB_TYPE=mysql DB_URL=mysql://root:mysql@localhost:3307/mysql ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n createdAt",
|
23
|
+
"db:migration:generate:mariadb": "cross-env DB_TYPE=mariadb DB_URL=mariadb://root@localhost:3306/mysql ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n createdAt",
|
24
24
|
"db:migration:run:postgres": "ts-node --transpile-only ./node_modules/typeorm/cli.js migration:run",
|
25
25
|
"db:migration:run:mysql": "cross-env DB_TYPE=mysql DB_URL=mysql://root:mysql@localhost:3307/mysql ts-node --transpile-only ./node_modules/typeorm/cli.js migration:run",
|
26
26
|
"db:migration:run:mariadb": "cross-env DB_TYPE=mariadb DB_URL=mariadb://root@localhost:3306/mysql ts-node --transpile-only ./node_modules/typeorm/cli.js migration:run",
|