@webresto/graphql 1.3.1 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/eventHelper.js +1 -0
- package/lib/eventHelper.ts +1 -0
- package/package.json +1 -1
- package/src/additionalResolvers.js +33 -5
- package/src/additionalResolvers.ts +38 -5
- package/src/graphql.js +35 -22
- package/src/graphql.ts +38 -25
- package/src/resolvers/cart.d.ts +225 -7
- package/src/resolvers/cart.js +27 -7
- package/src/resolvers/cart.ts +24 -8
- package/src/resolvers/checkout.js +9 -7
- package/src/resolvers/checkout.ts +14 -9
- package/test/{_bootstrap.js → bootstrap.js} +6 -7
- package/test/bootstrap.ts +3 -0
- package/test/fixture/.sailsrc +14 -0
- package/test/fixture/api/controllers/.gitkeep +0 -0
- package/test/fixture/api/models/.gitkeep +0 -0
- package/test/fixture/api/services/.gitkeep +0 -0
- package/test/fixture/app-export.js +73 -73
- package/test/fixture/app.js +56 -56
- package/test/fixture/config/adminpanel.js +25 -3
- package/test/fixture/config/bootstrap.js +161 -0
- package/test/fixture/config/connections.js +9 -9
- package/test/fixture/config/env/development.js +10 -10
- package/test/fixture/config/env/production.js +16 -16
- package/test/fixture/config/globals.js +16 -16
- package/test/fixture/config/hookTimeout.js +8 -8
- package/test/fixture/config/http.js +93 -93
- package/test/fixture/config/i18n.js +57 -57
- package/test/fixture/config/log.js +29 -29
- package/test/fixture/config/models.js +8 -8
- package/test/fixture/config/modulemanager.js +22 -22
- package/test/fixture/config/policies.js +51 -51
- package/test/fixture/config/routes.js +49 -49
- package/test/fixture/config/session.js +100 -100
- package/test/fixture/config/sockets.js +141 -141
- package/test/fixture/config/views.js +94 -94
- package/test/fixture/hacks/waterline.js +39 -0
- package/test/fixture/package.json +33 -30
- package/test/fixture/seeds/dish.json +37042 -0
- package/test/fixture/seeds/group.json +1418 -0
- package/test/fixture/seeds/iikoDiscount.json +365 -0
- package/test/fixture/views/403.ejs +68 -68
- package/test/fixture/views/404.ejs +68 -68
- package/test/fixture/views/500.ejs +73 -73
- package/test/fixture/views/homepage.ejs +74 -74
- package/test/fixture/views/layout.ejs +91 -91
- package/test/integration/graphql.test.js +11 -0
- package/test/integration/graphql.test.ts +15 -0
- package/test/integration/order.test.js +86 -0
- package/test/integration/order.test.ts +108 -0
- package/test/{unit → integration}/sails_not_crash.test.js +0 -0
- package/test/{unit → integration}/sails_not_crash.test.ts +0 -0
- package/test/unit/first.test.js +1 -1
- package/test/unit/first.test.ts +1 -1
- package/test/fixture/.tmp/localDiskDb/archive.db +0 -1
- package/test/fixture/.tmp/localDiskDb/dish.db +0 -1
- package/test/fixture/.tmp/localDiskDb/dish_images__image_dish.db +0 -1
- package/test/fixture/.tmp/localDiskDb/group.db +0 -1
- package/test/fixture/.tmp/localDiskDb/group_images__image_group.db +0 -1
- package/test/fixture/.tmp/localDiskDb/image.db +0 -1
- package/test/fixture/.tmp/localDiskDb/maintenance.db +0 -1
- package/test/fixture/.tmp/localDiskDb/order.db +0 -1
- package/test/fixture/.tmp/localDiskDb/orderdish.db +0 -1
- package/test/fixture/.tmp/localDiskDb/paymentdocument.db +0 -1
- package/test/fixture/.tmp/localDiskDb/paymentmethod.db +0 -2
- package/test/fixture/.tmp/localDiskDb/place.db +0 -1
- package/test/fixture/.tmp/localDiskDb/settings.db +0 -2
- package/test/fixture/.tmp/localDiskDb/street.db +0 -1
- package/test/fixture/package-lock.json +0 -9805
- package/test.zip +0 -0
@@ -1,141 +1,141 @@
|
|
1
|
-
/**
|
2
|
-
* WebSocket Server Settings
|
3
|
-
* (sails.config.sockets)
|
4
|
-
*
|
5
|
-
* These settings provide transparent access to the options for Sails'
|
6
|
-
* encapsulated WebSocket server, as well as some additional Sails-specific
|
7
|
-
* configuration layered on top.
|
8
|
-
*
|
9
|
-
* For more information on sockets configuration, including advanced config options, see:
|
10
|
-
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.sockets.html
|
11
|
-
*/
|
12
|
-
|
13
|
-
module.exports.sockets = {
|
14
|
-
|
15
|
-
|
16
|
-
/***************************************************************************
|
17
|
-
* *
|
18
|
-
* Node.js (and consequently Sails.js) apps scale horizontally. It's a *
|
19
|
-
* powerful, efficient approach, but it involves a tiny bit of planning. At *
|
20
|
-
* scale, you'll want to be able to copy your app onto multiple Sails.js *
|
21
|
-
* servers and throw them behind a load balancer. *
|
22
|
-
* *
|
23
|
-
* One of the big challenges of scaling an application is that these sorts *
|
24
|
-
* of clustered deployments cannot share memory, since they are on *
|
25
|
-
* physically different machines. On top of that, there is no guarantee *
|
26
|
-
* that a user will "stick" with the same server between requests (whether *
|
27
|
-
* HTTP or sockets), since the load balancer will route each request to the *
|
28
|
-
* Sails server with the most available resources. However that means that *
|
29
|
-
* all room/pubsub/socket processing and shared memory has to be offloaded *
|
30
|
-
* to a shared, remote messaging queue (usually Redis) *
|
31
|
-
* *
|
32
|
-
* Luckily, Socket.io (and consequently Sails.js) apps support Redis for *
|
33
|
-
* sockets by default. To enable a remote redis pubsub server, uncomment *
|
34
|
-
* the config below. *
|
35
|
-
* *
|
36
|
-
* Worth mentioning is that, if `adapter` config is `redis`, but host/port *
|
37
|
-
* is left unset, Sails will try to connect to redis running on localhost *
|
38
|
-
* via port 6379 *
|
39
|
-
* *
|
40
|
-
***************************************************************************/
|
41
|
-
// adapter: 'memory',
|
42
|
-
|
43
|
-
//
|
44
|
-
// -OR-
|
45
|
-
//
|
46
|
-
|
47
|
-
// adapter: 'socket.io-redis',
|
48
|
-
// host: '127.0.0.1',
|
49
|
-
// port: 6379,
|
50
|
-
// db: 0,
|
51
|
-
// pass: '<redis auth password>',
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
/***************************************************************************
|
56
|
-
* *
|
57
|
-
* Whether to expose a 'get /__getcookie' route with CORS support that sets *
|
58
|
-
* a cookie (this is used by the sails.io.js socket client to get access to *
|
59
|
-
* a 3rd party cookie and to enable sessions). *
|
60
|
-
* *
|
61
|
-
* Warning: Currently in this scenario, CORS settings apply to interpreted *
|
62
|
-
* requests sent via a socket.io connection that used this cookie to *
|
63
|
-
* connect, even for non-browser clients! (e.g. iOS apps, toasters, node.js *
|
64
|
-
* unit tests) *
|
65
|
-
* *
|
66
|
-
***************************************************************************/
|
67
|
-
|
68
|
-
// grant3rdPartyCookie: true,
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
/***************************************************************************
|
73
|
-
* *
|
74
|
-
* `beforeConnect` *
|
75
|
-
* *
|
76
|
-
* This custom beforeConnect function will be run each time BEFORE a new *
|
77
|
-
* socket is allowed to connect, when the initial socket.io handshake is *
|
78
|
-
* performed with the server. *
|
79
|
-
* *
|
80
|
-
* By default, when a socket tries to connect, Sails allows it, every time. *
|
81
|
-
* (much in the same way any HTTP request is allowed to reach your routes. *
|
82
|
-
* If no valid cookie was sent, a temporary session will be created for the *
|
83
|
-
* connecting socket. *
|
84
|
-
* *
|
85
|
-
* If the cookie sent as part of the connection request doesn't match any *
|
86
|
-
* known user session, a new user session is created for it. *
|
87
|
-
* *
|
88
|
-
* In most cases, the user would already have a cookie since they loaded *
|
89
|
-
* the socket.io client and the initial HTML page you're building. *
|
90
|
-
* *
|
91
|
-
* However, in the case of cross-domain requests, it is possible to receive *
|
92
|
-
* a connection upgrade request WITHOUT A COOKIE (for certain transports) *
|
93
|
-
* In this case, there is no way to keep track of the requesting user *
|
94
|
-
* between requests, since there is no identifying information to link *
|
95
|
-
* him/her with a session. The sails.io.js client solves this by connecting *
|
96
|
-
* to a CORS/jsonp endpoint first to get a 3rd party cookie(fortunately this*
|
97
|
-
* works, even in Safari), then opening the connection. *
|
98
|
-
* *
|
99
|
-
* You can also pass along a ?cookie query parameter to the upgrade url, *
|
100
|
-
* which Sails will use in the absence of a proper cookie e.g. (when *
|
101
|
-
* connecting from the client): *
|
102
|
-
* io.sails.connect('http://localhost:1337?cookie=smokeybear') *
|
103
|
-
* *
|
104
|
-
* Finally note that the user's cookie is NOT (and will never be) accessible*
|
105
|
-
* from client-side javascript. Using HTTP-only cookies is crucial for your *
|
106
|
-
* app's security. *
|
107
|
-
* *
|
108
|
-
***************************************************************************/
|
109
|
-
// beforeConnect: function(handshake, cb) {
|
110
|
-
// // `true` allows the connection
|
111
|
-
// return cb(null, true);
|
112
|
-
//
|
113
|
-
// // (`false` would reject the connection)
|
114
|
-
// },
|
115
|
-
|
116
|
-
|
117
|
-
/***************************************************************************
|
118
|
-
* *
|
119
|
-
* `afterDisconnect` *
|
120
|
-
* *
|
121
|
-
* This custom afterDisconnect function will be run each time a socket *
|
122
|
-
* disconnects *
|
123
|
-
* *
|
124
|
-
***************************************************************************/
|
125
|
-
// afterDisconnect: function(session, socket, cb) {
|
126
|
-
// // By default: do nothing.
|
127
|
-
// return cb();
|
128
|
-
// },
|
129
|
-
|
130
|
-
/***************************************************************************
|
131
|
-
* *
|
132
|
-
* `transports` *
|
133
|
-
* *
|
134
|
-
* A array of allowed transport methods which the clients will try to use. *
|
135
|
-
* On server environments that don't support sticky sessions, the "polling" *
|
136
|
-
* transport should be disabled. *
|
137
|
-
* *
|
138
|
-
***************************************************************************/
|
139
|
-
// transports: ["polling", "websocket"]
|
140
|
-
|
141
|
-
};
|
1
|
+
/**
|
2
|
+
* WebSocket Server Settings
|
3
|
+
* (sails.config.sockets)
|
4
|
+
*
|
5
|
+
* These settings provide transparent access to the options for Sails'
|
6
|
+
* encapsulated WebSocket server, as well as some additional Sails-specific
|
7
|
+
* configuration layered on top.
|
8
|
+
*
|
9
|
+
* For more information on sockets configuration, including advanced config options, see:
|
10
|
+
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.sockets.html
|
11
|
+
*/
|
12
|
+
|
13
|
+
module.exports.sockets = {
|
14
|
+
|
15
|
+
|
16
|
+
/***************************************************************************
|
17
|
+
* *
|
18
|
+
* Node.js (and consequently Sails.js) apps scale horizontally. It's a *
|
19
|
+
* powerful, efficient approach, but it involves a tiny bit of planning. At *
|
20
|
+
* scale, you'll want to be able to copy your app onto multiple Sails.js *
|
21
|
+
* servers and throw them behind a load balancer. *
|
22
|
+
* *
|
23
|
+
* One of the big challenges of scaling an application is that these sorts *
|
24
|
+
* of clustered deployments cannot share memory, since they are on *
|
25
|
+
* physically different machines. On top of that, there is no guarantee *
|
26
|
+
* that a user will "stick" with the same server between requests (whether *
|
27
|
+
* HTTP or sockets), since the load balancer will route each request to the *
|
28
|
+
* Sails server with the most available resources. However that means that *
|
29
|
+
* all room/pubsub/socket processing and shared memory has to be offloaded *
|
30
|
+
* to a shared, remote messaging queue (usually Redis) *
|
31
|
+
* *
|
32
|
+
* Luckily, Socket.io (and consequently Sails.js) apps support Redis for *
|
33
|
+
* sockets by default. To enable a remote redis pubsub server, uncomment *
|
34
|
+
* the config below. *
|
35
|
+
* *
|
36
|
+
* Worth mentioning is that, if `adapter` config is `redis`, but host/port *
|
37
|
+
* is left unset, Sails will try to connect to redis running on localhost *
|
38
|
+
* via port 6379 *
|
39
|
+
* *
|
40
|
+
***************************************************************************/
|
41
|
+
// adapter: 'memory',
|
42
|
+
|
43
|
+
//
|
44
|
+
// -OR-
|
45
|
+
//
|
46
|
+
|
47
|
+
// adapter: 'socket.io-redis',
|
48
|
+
// host: '127.0.0.1',
|
49
|
+
// port: 6379,
|
50
|
+
// db: 0,
|
51
|
+
// pass: '<redis auth password>',
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
/***************************************************************************
|
56
|
+
* *
|
57
|
+
* Whether to expose a 'get /__getcookie' route with CORS support that sets *
|
58
|
+
* a cookie (this is used by the sails.io.js socket client to get access to *
|
59
|
+
* a 3rd party cookie and to enable sessions). *
|
60
|
+
* *
|
61
|
+
* Warning: Currently in this scenario, CORS settings apply to interpreted *
|
62
|
+
* requests sent via a socket.io connection that used this cookie to *
|
63
|
+
* connect, even for non-browser clients! (e.g. iOS apps, toasters, node.js *
|
64
|
+
* unit tests) *
|
65
|
+
* *
|
66
|
+
***************************************************************************/
|
67
|
+
|
68
|
+
// grant3rdPartyCookie: true,
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
/***************************************************************************
|
73
|
+
* *
|
74
|
+
* `beforeConnect` *
|
75
|
+
* *
|
76
|
+
* This custom beforeConnect function will be run each time BEFORE a new *
|
77
|
+
* socket is allowed to connect, when the initial socket.io handshake is *
|
78
|
+
* performed with the server. *
|
79
|
+
* *
|
80
|
+
* By default, when a socket tries to connect, Sails allows it, every time. *
|
81
|
+
* (much in the same way any HTTP request is allowed to reach your routes. *
|
82
|
+
* If no valid cookie was sent, a temporary session will be created for the *
|
83
|
+
* connecting socket. *
|
84
|
+
* *
|
85
|
+
* If the cookie sent as part of the connection request doesn't match any *
|
86
|
+
* known user session, a new user session is created for it. *
|
87
|
+
* *
|
88
|
+
* In most cases, the user would already have a cookie since they loaded *
|
89
|
+
* the socket.io client and the initial HTML page you're building. *
|
90
|
+
* *
|
91
|
+
* However, in the case of cross-domain requests, it is possible to receive *
|
92
|
+
* a connection upgrade request WITHOUT A COOKIE (for certain transports) *
|
93
|
+
* In this case, there is no way to keep track of the requesting user *
|
94
|
+
* between requests, since there is no identifying information to link *
|
95
|
+
* him/her with a session. The sails.io.js client solves this by connecting *
|
96
|
+
* to a CORS/jsonp endpoint first to get a 3rd party cookie(fortunately this*
|
97
|
+
* works, even in Safari), then opening the connection. *
|
98
|
+
* *
|
99
|
+
* You can also pass along a ?cookie query parameter to the upgrade url, *
|
100
|
+
* which Sails will use in the absence of a proper cookie e.g. (when *
|
101
|
+
* connecting from the client): *
|
102
|
+
* io.sails.connect('http://localhost:1337?cookie=smokeybear') *
|
103
|
+
* *
|
104
|
+
* Finally note that the user's cookie is NOT (and will never be) accessible*
|
105
|
+
* from client-side javascript. Using HTTP-only cookies is crucial for your *
|
106
|
+
* app's security. *
|
107
|
+
* *
|
108
|
+
***************************************************************************/
|
109
|
+
// beforeConnect: function(handshake, cb) {
|
110
|
+
// // `true` allows the connection
|
111
|
+
// return cb(null, true);
|
112
|
+
//
|
113
|
+
// // (`false` would reject the connection)
|
114
|
+
// },
|
115
|
+
|
116
|
+
|
117
|
+
/***************************************************************************
|
118
|
+
* *
|
119
|
+
* `afterDisconnect` *
|
120
|
+
* *
|
121
|
+
* This custom afterDisconnect function will be run each time a socket *
|
122
|
+
* disconnects *
|
123
|
+
* *
|
124
|
+
***************************************************************************/
|
125
|
+
// afterDisconnect: function(session, socket, cb) {
|
126
|
+
// // By default: do nothing.
|
127
|
+
// return cb();
|
128
|
+
// },
|
129
|
+
|
130
|
+
/***************************************************************************
|
131
|
+
* *
|
132
|
+
* `transports` *
|
133
|
+
* *
|
134
|
+
* A array of allowed transport methods which the clients will try to use. *
|
135
|
+
* On server environments that don't support sticky sessions, the "polling" *
|
136
|
+
* transport should be disabled. *
|
137
|
+
* *
|
138
|
+
***************************************************************************/
|
139
|
+
// transports: ["polling", "websocket"]
|
140
|
+
|
141
|
+
};
|
@@ -1,95 +1,95 @@
|
|
1
|
-
/**
|
2
|
-
* View Engine Configuration
|
3
|
-
* (sails.config.views)
|
4
|
-
*
|
5
|
-
* Server-sent views are a classic and effective way to get your app up
|
6
|
-
* and running. Views are normally served from controllers. Below, you can
|
7
|
-
* configure your templating language/framework of choice and configure
|
8
|
-
* Sails' layout support.
|
9
|
-
*
|
10
|
-
* For more information on views and layouts, check out:
|
11
|
-
* http://sailsjs.org/#!/documentation/concepts/Views
|
12
|
-
*/
|
13
|
-
|
14
|
-
module.exports.views = {
|
15
|
-
|
16
|
-
/****************************************************************************
|
17
|
-
* *
|
18
|
-
* View engine (aka template language) to use for your app's *server-side* *
|
19
|
-
* views *
|
20
|
-
* *
|
21
|
-
* Sails+Express supports all view engines which implement TJ Holowaychuk's *
|
22
|
-
* `consolidate.js`, including, but not limited to: *
|
23
|
-
* *
|
24
|
-
* ejs, jade, handlebars, mustache underscore, hogan, haml, haml-coffee, *
|
25
|
-
* dust atpl, eco, ect, jazz, jqtpl, JUST, liquor, QEJS, swig, templayed, *
|
26
|
-
* toffee, walrus, & whiskers *
|
27
|
-
* *
|
28
|
-
* For more options, check out the docs: *
|
29
|
-
* https://github.com/balderdashy/sails-wiki/blob/0.9/config.views.md#engine *
|
30
|
-
* *
|
31
|
-
****************************************************************************/
|
32
|
-
|
33
|
-
engine: 'ejs',
|
34
|
-
|
35
|
-
|
36
|
-
/****************************************************************************
|
37
|
-
* *
|
38
|
-
* Layouts are simply top-level HTML templates you can use as wrappers for *
|
39
|
-
* your server-side views. If you're using ejs or jade, you can take *
|
40
|
-
* advantage of Sails' built-in `layout` support. *
|
41
|
-
* *
|
42
|
-
* When using a layout, when one of your views is served, it is injected *
|
43
|
-
* into the `body` partial defined in the layout. This lets you reuse header *
|
44
|
-
* and footer logic between views. *
|
45
|
-
* *
|
46
|
-
* NOTE: Layout support is only implemented for the `ejs` view engine! *
|
47
|
-
* For most other engines, it is not necessary, since they implement *
|
48
|
-
* partials/layouts themselves. In those cases, this config will be *
|
49
|
-
* silently ignored. *
|
50
|
-
* *
|
51
|
-
* The `layout` setting may be set to one of the following: *
|
52
|
-
* *
|
53
|
-
* If `false`, layouts will be disabled. Otherwise, if a string is *
|
54
|
-
* specified, it will be interpreted as the relative path to your layout *
|
55
|
-
* file from `views/` folder. (the file extension, ".ejs", should be *
|
56
|
-
* omitted) *
|
57
|
-
* *
|
58
|
-
****************************************************************************/
|
59
|
-
|
60
|
-
/****************************************************************************
|
61
|
-
* *
|
62
|
-
* Using Multiple Layouts *
|
63
|
-
* *
|
64
|
-
* If you're using the default `ejs` or `handlebars` Sails supports the use *
|
65
|
-
* of multiple `layout` files. To take advantage of this, before rendering a *
|
66
|
-
* view, override the `layout` local in your controller by setting *
|
67
|
-
* `res.locals.layout`. (this is handy if you parts of your app's UI look *
|
68
|
-
* completely different from each other) *
|
69
|
-
* *
|
70
|
-
* e.g. your default might be *
|
71
|
-
* layout: 'layouts/public' *
|
72
|
-
* *
|
73
|
-
* But you might override that in some of your controllers with: *
|
74
|
-
* layout: 'layouts/internal' *
|
75
|
-
* *
|
76
|
-
****************************************************************************/
|
77
|
-
|
78
|
-
layout: 'layout',
|
79
|
-
|
80
|
-
/****************************************************************************
|
81
|
-
* *
|
82
|
-
* Partials are simply top-level snippets you can leverage to reuse template *
|
83
|
-
* for your server-side views. If you're using handlebars, you can take *
|
84
|
-
* advantage of Sails' built-in `partials` support. *
|
85
|
-
* *
|
86
|
-
* If `false` or empty partials will be located in the same folder as views. *
|
87
|
-
* Otherwise, if a string is specified, it will be interpreted as the *
|
88
|
-
* relative path to your partial files from `views/` folder. *
|
89
|
-
* *
|
90
|
-
****************************************************************************/
|
91
|
-
|
92
|
-
partials: false
|
93
|
-
|
94
|
-
|
1
|
+
/**
|
2
|
+
* View Engine Configuration
|
3
|
+
* (sails.config.views)
|
4
|
+
*
|
5
|
+
* Server-sent views are a classic and effective way to get your app up
|
6
|
+
* and running. Views are normally served from controllers. Below, you can
|
7
|
+
* configure your templating language/framework of choice and configure
|
8
|
+
* Sails' layout support.
|
9
|
+
*
|
10
|
+
* For more information on views and layouts, check out:
|
11
|
+
* http://sailsjs.org/#!/documentation/concepts/Views
|
12
|
+
*/
|
13
|
+
|
14
|
+
module.exports.views = {
|
15
|
+
|
16
|
+
/****************************************************************************
|
17
|
+
* *
|
18
|
+
* View engine (aka template language) to use for your app's *server-side* *
|
19
|
+
* views *
|
20
|
+
* *
|
21
|
+
* Sails+Express supports all view engines which implement TJ Holowaychuk's *
|
22
|
+
* `consolidate.js`, including, but not limited to: *
|
23
|
+
* *
|
24
|
+
* ejs, jade, handlebars, mustache underscore, hogan, haml, haml-coffee, *
|
25
|
+
* dust atpl, eco, ect, jazz, jqtpl, JUST, liquor, QEJS, swig, templayed, *
|
26
|
+
* toffee, walrus, & whiskers *
|
27
|
+
* *
|
28
|
+
* For more options, check out the docs: *
|
29
|
+
* https://github.com/balderdashy/sails-wiki/blob/0.9/config.views.md#engine *
|
30
|
+
* *
|
31
|
+
****************************************************************************/
|
32
|
+
|
33
|
+
engine: 'ejs',
|
34
|
+
|
35
|
+
|
36
|
+
/****************************************************************************
|
37
|
+
* *
|
38
|
+
* Layouts are simply top-level HTML templates you can use as wrappers for *
|
39
|
+
* your server-side views. If you're using ejs or jade, you can take *
|
40
|
+
* advantage of Sails' built-in `layout` support. *
|
41
|
+
* *
|
42
|
+
* When using a layout, when one of your views is served, it is injected *
|
43
|
+
* into the `body` partial defined in the layout. This lets you reuse header *
|
44
|
+
* and footer logic between views. *
|
45
|
+
* *
|
46
|
+
* NOTE: Layout support is only implemented for the `ejs` view engine! *
|
47
|
+
* For most other engines, it is not necessary, since they implement *
|
48
|
+
* partials/layouts themselves. In those cases, this config will be *
|
49
|
+
* silently ignored. *
|
50
|
+
* *
|
51
|
+
* The `layout` setting may be set to one of the following: *
|
52
|
+
* *
|
53
|
+
* If `false`, layouts will be disabled. Otherwise, if a string is *
|
54
|
+
* specified, it will be interpreted as the relative path to your layout *
|
55
|
+
* file from `views/` folder. (the file extension, ".ejs", should be *
|
56
|
+
* omitted) *
|
57
|
+
* *
|
58
|
+
****************************************************************************/
|
59
|
+
|
60
|
+
/****************************************************************************
|
61
|
+
* *
|
62
|
+
* Using Multiple Layouts *
|
63
|
+
* *
|
64
|
+
* If you're using the default `ejs` or `handlebars` Sails supports the use *
|
65
|
+
* of multiple `layout` files. To take advantage of this, before rendering a *
|
66
|
+
* view, override the `layout` local in your controller by setting *
|
67
|
+
* `res.locals.layout`. (this is handy if you parts of your app's UI look *
|
68
|
+
* completely different from each other) *
|
69
|
+
* *
|
70
|
+
* e.g. your default might be *
|
71
|
+
* layout: 'layouts/public' *
|
72
|
+
* *
|
73
|
+
* But you might override that in some of your controllers with: *
|
74
|
+
* layout: 'layouts/internal' *
|
75
|
+
* *
|
76
|
+
****************************************************************************/
|
77
|
+
|
78
|
+
layout: 'layout',
|
79
|
+
|
80
|
+
/****************************************************************************
|
81
|
+
* *
|
82
|
+
* Partials are simply top-level snippets you can leverage to reuse template *
|
83
|
+
* for your server-side views. If you're using handlebars, you can take *
|
84
|
+
* advantage of Sails' built-in `partials` support. *
|
85
|
+
* *
|
86
|
+
* If `false` or empty partials will be located in the same folder as views. *
|
87
|
+
* Otherwise, if a string is specified, it will be interpreted as the *
|
88
|
+
* relative path to your partial files from `views/` folder. *
|
89
|
+
* *
|
90
|
+
****************************************************************************/
|
91
|
+
|
92
|
+
partials: false
|
93
|
+
|
94
|
+
|
95
95
|
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* WRONG SAILS HACK
|
3
|
+
*/
|
4
|
+
|
5
|
+
console.warn("WRONG SAILS HACK v0.2");
|
6
|
+
let PWD = process.cwd()
|
7
|
+
const replace = require("replace-in-file");
|
8
|
+
|
9
|
+
/**
|
10
|
+
* 1.
|
11
|
+
* Patch for allow unknow types
|
12
|
+
* bash equals: find $PWD/node_modules/waterline-schema/ -type f -print0 | xargs -0 sed -i 's|if (_.indexOf(validProperties, propertyName) < 0) {|if (false) {|g'
|
13
|
+
*/
|
14
|
+
console.log(PWD + "/../**/sails-hook-orm/lib/validate-model-def.js",);
|
15
|
+
const results = replace.sync({
|
16
|
+
files: [
|
17
|
+
//for test system
|
18
|
+
PWD + "/../**/sails-hook-orm/lib/validate-model-def.js",
|
19
|
+
PWD + "/../**/waterline-schema/schema.js",
|
20
|
+
PWD + "/../**/sails-disk/index.js",
|
21
|
+
PWD + "/../**/query/private/normalize-value-to-set.js",
|
22
|
+
|
23
|
+
],
|
24
|
+
from: [
|
25
|
+
"(_.isFunction(val.defaultsTo))",
|
26
|
+
"(_.indexOf(validProperties, propertyName) < 0)",
|
27
|
+
"(_.has(attribute, 'defaultsTo') && _.isNull(attribute.defaultsTo))",
|
28
|
+
"(_.has(primaryKeyAttribute, 'defaultsTo') && !_.isUndefined(primaryKeyAttribute, 'defaultsTo'))",
|
29
|
+
"(attribute.required && _.has(attribute, 'defaultsTo') && !_.isUndefined(attribute, 'defaultsTo'))",
|
30
|
+
"(_.has(attribute, 'defaultsTo'))",
|
31
|
+
"(isProvidingNullForIncompatibleOptionalAttr)",
|
32
|
+
"(primaryKeyAttr.required !== true && (!primaryKeyAttr.autoMigrations || primaryKeyAttr.autoMigrations.autoIncrement !== true))"
|
33
|
+
],
|
34
|
+
to: "(false)",
|
35
|
+
});
|
36
|
+
|
37
|
+
console.log(results);
|
38
|
+
|
39
|
+
// Stranger things
|
@@ -1,30 +1,33 @@
|
|
1
|
-
{
|
2
|
-
"name": "test-app",
|
3
|
-
"private": true,
|
4
|
-
"version": "0.0.0",
|
5
|
-
"description": "Sails test application",
|
6
|
-
"keywords": [],
|
7
|
-
|
8
|
-
|
9
|
-
"@webresto/
|
10
|
-
"@webresto/
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"sails
|
16
|
-
"sails-hook-
|
17
|
-
"sails-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
1
|
+
{
|
2
|
+
"name": "test-app",
|
3
|
+
"private": true,
|
4
|
+
"version": "0.0.0",
|
5
|
+
"description": "Sails test application",
|
6
|
+
"keywords": [],
|
7
|
+
"dependencies": {
|
8
|
+
"@webresto/core": "file:../../node_modules/@webresto/core",
|
9
|
+
"@webresto/graphql": "file:../..",
|
10
|
+
"@webresto/worktime": "file:../../node_modules/@webresto/worktime",
|
11
|
+
"replace-in-file": "^6.3.2",
|
12
|
+
"include-all": "^1.0.8",
|
13
|
+
"rc": "^1.0.1",
|
14
|
+
"request": "^2.88.2",
|
15
|
+
"sails": "^1.5.0",
|
16
|
+
"sails-hook-orm": "^2.1.1",
|
17
|
+
"sails-hook-stateflow": "^1.0.6",
|
18
|
+
"connect-flash": "^0.1.1",
|
19
|
+
"sails-memory": "^0.10.7"
|
20
|
+
},
|
21
|
+
"scripts": {
|
22
|
+
"debug": "node debug app.js",
|
23
|
+
"start": "node app.js",
|
24
|
+
"postinstall": "node ./hacks/waterline.js"
|
25
|
+
},
|
26
|
+
"main": "app.js",
|
27
|
+
"repository": {
|
28
|
+
"type": "git",
|
29
|
+
"url": "git://github.com/webresto/app.git"
|
30
|
+
},
|
31
|
+
"author": "webresto",
|
32
|
+
"license": "MIT"
|
33
|
+
}
|