@webresto/graphql 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/additionalResolvers.js +1 -1
- package/src/additionalResolvers.ts +1 -1
- package/src/graphql.js +40 -22
- package/src/graphql.ts +42 -25
- package/src/resolvers/cart.d.ts +225 -7
- package/src/resolvers/cart.js +21 -7
- package/src/resolvers/cart.ts +23 -8
- package/src/resolvers/checkout.ts +1 -0
- 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/{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,100 +1,100 @@
|
|
1
|
-
/**
|
2
|
-
* Session Configuration
|
3
|
-
* (sails.config.session)
|
4
|
-
*
|
5
|
-
* Sails session integration leans heavily on the great work already done by
|
6
|
-
* Express, but also unifies Socket.io with the Connect session store. It uses
|
7
|
-
* Connect's cookie parser to normalize configuration differences between Express
|
8
|
-
* and Socket.io and hooks into Sails' middleware interpreter to allow you to access
|
9
|
-
* and auto-save to `req.session` with Socket.io the same way you would with Express.
|
10
|
-
*
|
11
|
-
* For more information on configuring the session, check out:
|
12
|
-
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.session.html
|
13
|
-
*/
|
14
|
-
|
15
|
-
module.exports.session = {
|
16
|
-
|
17
|
-
/***************************************************************************
|
18
|
-
* *
|
19
|
-
* Session secret is automatically generated when your new app is created *
|
20
|
-
* Replace at your own risk in production-- you will invalidate the cookies *
|
21
|
-
* of your users, forcing them to log in again. *
|
22
|
-
* *
|
23
|
-
***************************************************************************/
|
24
|
-
secret: 'ffbef9b6711dc3130e47e22d46fee23c',
|
25
|
-
|
26
|
-
|
27
|
-
/***************************************************************************
|
28
|
-
* *
|
29
|
-
* Set the session cookie expire time The maxAge is set by milliseconds, *
|
30
|
-
* the example below is for 24 hours *
|
31
|
-
* *
|
32
|
-
***************************************************************************/
|
33
|
-
|
34
|
-
// cookie: {
|
35
|
-
// maxAge: 24 * 60 * 60 * 1000
|
36
|
-
// },
|
37
|
-
|
38
|
-
/***************************************************************************
|
39
|
-
* *
|
40
|
-
* Uncomment the following lines to set up a Redis session store that can *
|
41
|
-
* be shared across multiple Sails.js servers. *
|
42
|
-
* *
|
43
|
-
* Requires connect-redis (https://www.npmjs.com/package/connect-redis) *
|
44
|
-
* *
|
45
|
-
***************************************************************************/
|
46
|
-
|
47
|
-
// adapter: 'redis',
|
48
|
-
|
49
|
-
/***************************************************************************
|
50
|
-
* *
|
51
|
-
* The following values are optional, if no options are set a redis *
|
52
|
-
* instance running on localhost is expected. Read more about options at: *
|
53
|
-
* *
|
54
|
-
* https://github.com/visionmedia/connect-redis *
|
55
|
-
* *
|
56
|
-
***************************************************************************/
|
57
|
-
|
58
|
-
// host: 'localhost',
|
59
|
-
// port: 6379,
|
60
|
-
// ttl: <redis session TTL in seconds>,
|
61
|
-
// db: 0,
|
62
|
-
// pass: <redis auth password>,
|
63
|
-
// prefix: 'sess:',
|
64
|
-
|
65
|
-
|
66
|
-
/***************************************************************************
|
67
|
-
* *
|
68
|
-
* Uncomment the following lines to set up a MongoDB session store that can *
|
69
|
-
* be shared across multiple Sails.js servers. *
|
70
|
-
* *
|
71
|
-
* Requires connect-mongo (https://www.npmjs.com/package/connect-mongo) *
|
72
|
-
* Use version 0.8.2 with Node version <= 0.12 *
|
73
|
-
* Use the latest version with Node >= 4.0 *
|
74
|
-
* *
|
75
|
-
***************************************************************************/
|
76
|
-
|
77
|
-
// adapter: 'mongo',
|
78
|
-
// url: 'mongodb://user:password@localhost:27017/dbname', // user, password and port optional
|
79
|
-
|
80
|
-
/***************************************************************************
|
81
|
-
* *
|
82
|
-
* Optional Values: *
|
83
|
-
* *
|
84
|
-
* See https://github.com/kcbanner/connect-mongo for more *
|
85
|
-
* information about connect-mongo options. *
|
86
|
-
* *
|
87
|
-
* See http://bit.ly/mongooptions for more information about options *
|
88
|
-
* available in `mongoOptions` *
|
89
|
-
* *
|
90
|
-
***************************************************************************/
|
91
|
-
|
92
|
-
// collection: 'sessions',
|
93
|
-
// stringify: true,
|
94
|
-
// mongoOptions: {
|
95
|
-
// server: {
|
96
|
-
// ssl: true
|
97
|
-
// }
|
98
|
-
// }
|
99
|
-
|
100
|
-
};
|
1
|
+
/**
|
2
|
+
* Session Configuration
|
3
|
+
* (sails.config.session)
|
4
|
+
*
|
5
|
+
* Sails session integration leans heavily on the great work already done by
|
6
|
+
* Express, but also unifies Socket.io with the Connect session store. It uses
|
7
|
+
* Connect's cookie parser to normalize configuration differences between Express
|
8
|
+
* and Socket.io and hooks into Sails' middleware interpreter to allow you to access
|
9
|
+
* and auto-save to `req.session` with Socket.io the same way you would with Express.
|
10
|
+
*
|
11
|
+
* For more information on configuring the session, check out:
|
12
|
+
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.session.html
|
13
|
+
*/
|
14
|
+
|
15
|
+
module.exports.session = {
|
16
|
+
|
17
|
+
/***************************************************************************
|
18
|
+
* *
|
19
|
+
* Session secret is automatically generated when your new app is created *
|
20
|
+
* Replace at your own risk in production-- you will invalidate the cookies *
|
21
|
+
* of your users, forcing them to log in again. *
|
22
|
+
* *
|
23
|
+
***************************************************************************/
|
24
|
+
secret: 'ffbef9b6711dc3130e47e22d46fee23c',
|
25
|
+
|
26
|
+
|
27
|
+
/***************************************************************************
|
28
|
+
* *
|
29
|
+
* Set the session cookie expire time The maxAge is set by milliseconds, *
|
30
|
+
* the example below is for 24 hours *
|
31
|
+
* *
|
32
|
+
***************************************************************************/
|
33
|
+
|
34
|
+
// cookie: {
|
35
|
+
// maxAge: 24 * 60 * 60 * 1000
|
36
|
+
// },
|
37
|
+
|
38
|
+
/***************************************************************************
|
39
|
+
* *
|
40
|
+
* Uncomment the following lines to set up a Redis session store that can *
|
41
|
+
* be shared across multiple Sails.js servers. *
|
42
|
+
* *
|
43
|
+
* Requires connect-redis (https://www.npmjs.com/package/connect-redis) *
|
44
|
+
* *
|
45
|
+
***************************************************************************/
|
46
|
+
|
47
|
+
// adapter: 'redis',
|
48
|
+
|
49
|
+
/***************************************************************************
|
50
|
+
* *
|
51
|
+
* The following values are optional, if no options are set a redis *
|
52
|
+
* instance running on localhost is expected. Read more about options at: *
|
53
|
+
* *
|
54
|
+
* https://github.com/visionmedia/connect-redis *
|
55
|
+
* *
|
56
|
+
***************************************************************************/
|
57
|
+
|
58
|
+
// host: 'localhost',
|
59
|
+
// port: 6379,
|
60
|
+
// ttl: <redis session TTL in seconds>,
|
61
|
+
// db: 0,
|
62
|
+
// pass: <redis auth password>,
|
63
|
+
// prefix: 'sess:',
|
64
|
+
|
65
|
+
|
66
|
+
/***************************************************************************
|
67
|
+
* *
|
68
|
+
* Uncomment the following lines to set up a MongoDB session store that can *
|
69
|
+
* be shared across multiple Sails.js servers. *
|
70
|
+
* *
|
71
|
+
* Requires connect-mongo (https://www.npmjs.com/package/connect-mongo) *
|
72
|
+
* Use version 0.8.2 with Node version <= 0.12 *
|
73
|
+
* Use the latest version with Node >= 4.0 *
|
74
|
+
* *
|
75
|
+
***************************************************************************/
|
76
|
+
|
77
|
+
// adapter: 'mongo',
|
78
|
+
// url: 'mongodb://user:password@localhost:27017/dbname', // user, password and port optional
|
79
|
+
|
80
|
+
/***************************************************************************
|
81
|
+
* *
|
82
|
+
* Optional Values: *
|
83
|
+
* *
|
84
|
+
* See https://github.com/kcbanner/connect-mongo for more *
|
85
|
+
* information about connect-mongo options. *
|
86
|
+
* *
|
87
|
+
* See http://bit.ly/mongooptions for more information about options *
|
88
|
+
* available in `mongoOptions` *
|
89
|
+
* *
|
90
|
+
***************************************************************************/
|
91
|
+
|
92
|
+
// collection: 'sessions',
|
93
|
+
// stringify: true,
|
94
|
+
// mongoOptions: {
|
95
|
+
// server: {
|
96
|
+
// ssl: true
|
97
|
+
// }
|
98
|
+
// }
|
99
|
+
|
100
|
+
};
|
@@ -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
|
+
};
|