pinstripe 0.19.0 → 0.21.0
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/lib/commands/{generate_node_wrapper.js → generate_component.js} +3 -3
- package/lib/commands/generate_migration.js +2 -2
- package/lib/commands/generate_model.js +2 -2
- package/lib/commands/generate_service.js +2 -2
- package/lib/commands/generate_static_site.js +4 -5
- package/lib/components/pinstripe_anchor.js +2 -1
- package/lib/extensions/multi-tenant/services/database.js +1 -1
- package/lib/services/client_builder.js +1 -1
- package/lib/services/config.js +1 -1
- package/lib/services/initial_params.js +1 -1
- package/lib/services/params.js +1 -1
- package/lib/services/run_in_new_workspace.js +11 -0
- package/lib/services/send_mail.js +1 -1
- package/lib/services/server.js +1 -1
- package/lib/views/sign_in/index.js +4 -2
- package/package.json +2 -2
|
@@ -12,13 +12,13 @@ export default {
|
|
|
12
12
|
|
|
13
13
|
await inProjectRootDir(async () => {
|
|
14
14
|
|
|
15
|
-
await generateFile(`lib/
|
|
15
|
+
await generateFile(`lib/components/_file_importer.js`, { skipIfExists: true }, () => {
|
|
16
16
|
line();
|
|
17
|
-
line(`export {
|
|
17
|
+
line(`export { Component as default } from 'pinstripe';`);
|
|
18
18
|
line();
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
await generateFile(`lib/
|
|
21
|
+
await generateFile(`lib/components/${normalizedName}.js`, () => {
|
|
22
22
|
line();
|
|
23
23
|
line(`export default {`);
|
|
24
24
|
indent(() => {
|
|
@@ -21,9 +21,9 @@ export default {
|
|
|
21
21
|
|
|
22
22
|
await inProjectRootDir(async () => {
|
|
23
23
|
|
|
24
|
-
await generateFile(`lib/migrations/
|
|
24
|
+
await generateFile(`lib/migrations/_file_importer.js`, { skipIfExists: true }, () => {
|
|
25
25
|
line();
|
|
26
|
-
line(`export {
|
|
26
|
+
line(`export { Migration as default } from 'pinstripe/database';`);
|
|
27
27
|
line();
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -22,9 +22,9 @@ export default {
|
|
|
22
22
|
|
|
23
23
|
await inProjectRootDir(async () => {
|
|
24
24
|
|
|
25
|
-
await generateFile(`lib/models/
|
|
25
|
+
await generateFile(`lib/models/_file_importer.js`, { skipIfExists: true }, () => {
|
|
26
26
|
line();
|
|
27
|
-
line(`export {
|
|
27
|
+
line(`export { Row as default } from 'pinstripe/database';`);
|
|
28
28
|
line();
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -11,9 +11,9 @@ export default {
|
|
|
11
11
|
|
|
12
12
|
await inProjectRootDir(async () => {
|
|
13
13
|
|
|
14
|
-
await generateFile(`lib/services/
|
|
14
|
+
await generateFile(`lib/services/_file_importer.js`, { skipIfExists: true }, () => {
|
|
15
15
|
line();
|
|
16
|
-
line(`export {
|
|
16
|
+
line(`export { ServiceFactory as default } from 'pinstripe';`);
|
|
17
17
|
line();
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import { View } from '../view.js';
|
|
3
2
|
import { default as mimeTypes } from 'mime-types';
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
async run(){
|
|
7
6
|
this.pages = {};
|
|
8
7
|
const urls = this.viewNames.filter(path => !path.match(/(^|\/)_/)).map(path => {
|
|
9
|
-
return new URL(
|
|
8
|
+
return new URL(path, 'http://127.0.0.1/');
|
|
10
9
|
});
|
|
11
10
|
|
|
12
11
|
while(urls.length){
|
|
@@ -31,7 +30,7 @@ export default {
|
|
|
31
30
|
filePath = `${filePath}.${mimeTypes.extension(contentType)}`
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
const data = (await this.fetch({ _url: new URL(path, 'http://
|
|
33
|
+
const data = (await this.fetch({ _url: new URL(path, 'http://127.0.0.1/') }))[2];
|
|
35
34
|
|
|
36
35
|
await generateFile(filePath, () => {
|
|
37
36
|
echo(data.join(''));
|
|
@@ -65,8 +64,8 @@ export default {
|
|
|
65
64
|
['src', 'href'].forEach(name => {
|
|
66
65
|
const value = attributes[name];
|
|
67
66
|
if(!value) return;
|
|
68
|
-
const url = new URL(value, 'http://
|
|
69
|
-
if(url.host != '
|
|
67
|
+
const url = new URL(value, 'http://127.0.0.1/');
|
|
68
|
+
if(url.host != '127.0.0.1') return;
|
|
70
69
|
out.push(url);
|
|
71
70
|
});
|
|
72
71
|
});
|
|
@@ -8,9 +8,10 @@ export default {
|
|
|
8
8
|
const { ignoreEventsFromChildren = false } = this.data;
|
|
9
9
|
this.on('click', (event) => {
|
|
10
10
|
if(ignoreEventsFromChildren && event.target != this) return;
|
|
11
|
+
const { action = 'load', confirm, target = '_self', method = 'GET', href } = { ...this.attributes, ...this.data };
|
|
12
|
+
if(new URL(href, window.location.href).host != window.location.host) return;
|
|
11
13
|
event.preventDefault();
|
|
12
14
|
event.stopPropagation();
|
|
13
|
-
const { action = 'load', confirm, target = '_self', method = 'GET', href } = { ...this.attributes, ...this.data };
|
|
14
15
|
if(action == 'load') loadFrame.call(this, confirm, target, method, href);
|
|
15
16
|
if(action == 'remove') removeFrame.call(this, confirm, target);
|
|
16
17
|
});
|
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
if(out.info.tenants){
|
|
15
15
|
const headers = this.initialParams._headers;
|
|
16
16
|
const hostname = this.initialParams._url.hostname;
|
|
17
|
-
const host = (headers['host'] || hostname).toLowerCase();
|
|
17
|
+
const host = (headers['host'] || hostname).replace(/\:\d+$/, '').toLowerCase();
|
|
18
18
|
const { primaryDomain = '' } = await this.config;
|
|
19
19
|
const domainSuffix = `\.${primaryDomain}`.toLowerCase();
|
|
20
20
|
|
|
@@ -58,8 +58,8 @@ export default {
|
|
|
58
58
|
build.onLoad({ filter: /\.js$/ }, async args => {
|
|
59
59
|
const { path } = args;
|
|
60
60
|
const contents = await promisify(readFile)(path, 'utf8');
|
|
61
|
+
if(!contents.match(/pinstripe-if-client/)) return;
|
|
61
62
|
const alteredContents = contents.replace(/(.*)\/\/\s*pinstripe-if-client:\s*(.*)/g, '$2 // pinstripe-if-server: $1');
|
|
62
|
-
|
|
63
63
|
return { contents: alteredContents, loader: 'js' };
|
|
64
64
|
});
|
|
65
65
|
}
|
package/lib/services/config.js
CHANGED
package/lib/services/params.js
CHANGED
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
return this.defer(async () => {
|
|
8
8
|
const { mail: mailConfig = {} } = await this.config;
|
|
9
9
|
const { adapter = 'dummy', ...adapterConfig } = mailConfig;
|
|
10
|
-
if(adapter == 'dummy') return this.createDummy();
|
|
10
|
+
if(adapter == 'dummy') return this.createDummy(adapterConfig);
|
|
11
11
|
if(adapter == 'smtp') return this.createSmtp(adapterConfig);
|
|
12
12
|
throw new Error(`No such mail adapter '${adapter}' exists.`);
|
|
13
13
|
});
|
package/lib/services/server.js
CHANGED
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
|
|
39
39
|
async extractParams(request){
|
|
40
40
|
const { method, url, headers } = request;
|
|
41
|
-
const _url = new URL(url, 'http://
|
|
41
|
+
const _url = new URL(url, 'http://127.0.0.1');
|
|
42
42
|
|
|
43
43
|
const urlParams = {};
|
|
44
44
|
_url.searchParams.forEach((value, key) => {
|
|
@@ -17,10 +17,12 @@ export default {
|
|
|
17
17
|
const user = await this.database.users.where({ email }).first();
|
|
18
18
|
if(user){
|
|
19
19
|
const password = await user.generatePassword();
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
this.runInNewWorkspace(({ sendMail }) => sendMail({
|
|
21
22
|
to: email,
|
|
22
23
|
subject: 'Your one-time-password',
|
|
23
|
-
text: `Your one-time-password: "${password}" - this will be valid for approximately 3 mins.`
|
|
24
|
+
text: `Your one-time-password: "${password}" - this will be valid for approximately 3 mins.`
|
|
25
|
+
}));
|
|
24
26
|
}
|
|
25
27
|
return this.renderHtml`
|
|
26
28
|
<span data-component="pinstripe-anchor" data-trigger="click" data-href="/sign_in/verify_password?email=${email}"></span>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "pinstripe",
|
|
4
4
|
"description": "A slick web framework for Node.js.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.21.0",
|
|
6
6
|
"author": "Jody Salt",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"exports": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"tmp": "^0.2.1",
|
|
49
49
|
"unionfs": "^4.4.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "06e08e9cfe79fe037e2fb596d7b7971e5de69596"
|
|
52
52
|
}
|