@@ -7,8 +7,8 @@ _PS: This is actually also a gulp plugin._
7
7
## Required [ ![ Dependency Status] [ david-image ]] [ david-url ] [ ![ devDependency Status] [ david-image-dev ]] [ david-url-dev ]
8
8
9
9
* node.js 4+
10
-
11
-
10
+
11
+
12
12
13
13
## Quick start
14
14
``` bash
@@ -19,8 +19,8 @@ _PS: This is actually also a gulp plugin._
19
19
- Create a ` nsconfig.json ` file in the root of you project with at least __ email__ , __ password__ , __ account__ , __ script__ number and __ deployment__ number.
20
20
21
21
- Use it with gulp or with the CLI (see CLI section below)
22
-
23
-
22
+
23
+
24
24
``` javascript
25
25
var nscabinet = require (' nscabinet' );
26
26
gulp .src (' myProject/dist/**/*.js' ).pipe (nscabinet ({ rootPath : ' /Templates' }));
@@ -68,7 +68,7 @@ __Connection__
68
68
* ` script `
69
69
70
70
* ` deployment ` defaults to 1.
71
-
71
+
72
72
* ` conffile ` overrides default ` nsconfig.json ` file name, allowing multiple project setting.
73
73
74
74
__ Path__
@@ -78,6 +78,23 @@ __Path__
78
78
Example: Upload file with path ` img/image.jpg ` to rootPath ` /Templates ` will "upsert" the file
79
79
onto '/Templates/img/image.jpg'.
80
80
81
+ __ Token Based Authentication__
82
+
83
+ * ` consumerKey `
84
+
85
+ * ` consumerSecret `
86
+
87
+ * ` token `
88
+
89
+ * ` tokenSecret `
90
+
91
+ Setup:
92
+ - Enable Token-based Authentication (Enable Features > SuiteCloud > Manage Authentication)
93
+ - Create an integration record to generate a consumer key and secret
94
+ - Generate a user token (must enable a role with User Access Tokens permission - Administrator role cannot be used)
95
+
96
+ The email and password are ignored when token based authentication is used. (They are still required but can just have placeholder values)
97
+
81
98
## nscabinet.upload
82
99
83
100
``` javascript
@@ -113,25 +130,25 @@ nscabinet.download(['MyProject/*.js','/Web Site Hosting Files/My Site/*.html'])
113
130
```
114
131
115
132
* ` files ` file selector (one or many).
116
-
133
+
117
134
* ` * ` is accepted on the file part. The restlet then runs a file search by name
118
135
in which ` * ` is replaced with ` % ` .
119
-
136
+
120
137
* Paths are also relative to ` opts.rootPath ` . If a file selector begins with ` / ` , files will be queried
121
138
by absolute path in netsuite, but saved locally inside the ` cabinet_root ` folder.
122
-
139
+
123
140
* If a path has ` /**/ ` , a recursive search will be done. This can be used to search
124
141
just by file name, regardless of path.
125
-
142
+
126
143
* (PS: While the syntax is similar, don't expect full glob funcionality. It's not a glob!)
127
-
128
-
144
+
145
+
129
146
* ` opts ` Common options.
130
147
131
148
132
149
## nscabinet.url ( file : string , [ opts] ) : Promise[ string]
133
150
134
- Get the url (internal or external) of a cabinet file. Returns a promise.
151
+ Get the url (internal or external) of a cabinet file. Returns a promise.
135
152
Useful for email campaign stuff.
136
153
137
154
Options: receives the ones which make sense here (ex: rootPath, realm, etc...) in the
@@ -176,18 +193,18 @@ Uploading Views/view.html to /SuiteScripts
176
193
## Contributing
177
194
178
195
- If you add new funcionality, also add a new test!
179
-
196
+
180
197
At the time tests are run locally. To set up the tests:
181
198
182
199
- Install the restlet in an available account;
183
-
200
+
184
201
- Set up nsconfig.json, pointing to that account; Don't forget to set
185
202
a rootPath to where the tests will play around and create its lots of files;
186
-
203
+
187
204
- Run 'gulp'
188
-
189
-
190
-
205
+
206
+
207
+
191
208
[ npm-url ] : https://npmjs.org/package/nscabinet
192
209
[ npm-image ] : http://img.shields.io/npm/v/nscabinet.svg
193
210
0 commit comments