asana 0.18.5 → 1.0.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/.github/workflows/build.yml +27 -0
- package/.github/workflows/publish-to-github-releases.yml +26 -0
- package/.github/workflows/publish-to-npmjs.yml +21 -0
- package/README.md +22 -6
- package/VERSION +1 -1
- package/bower.json +1 -1
- package/gulpfile.js +75 -18
- package/lib/auth/app.js +2 -2
- package/lib/client.js +2 -8
- package/lib/resources/gen/attachments.js +4 -5
- package/lib/resources/gen/audit_log_api.js +45 -0
- package/lib/resources/gen/goals.js +321 -0
- package/lib/resources/gen/portfolios.js +1 -1
- package/lib/resources/gen/project_briefs.js +93 -0
- package/lib/resources/gen/project_templates.js +101 -0
- package/lib/resources/gen/projects.js +18 -0
- package/lib/resources/gen/status_updates.js +95 -0
- package/lib/resources/gen/tasks.js +2 -5
- package/lib/resources/gen/teams.js +27 -11
- package/lib/resources/gen/time_periods.js +62 -0
- package/lib/resources/gen/typeahead.js +1 -1
- package/lib/resources/gen/users.js +1 -2
- package/lib/resources/gen/webhooks.js +18 -0
- package/package.json +1 -1
- package/samples/attachments_sample.yaml +3 -3
- package/samples/audit_log_api_sample.yaml +12 -0
- package/samples/goals_sample.yaml +177 -0
- package/samples/project_briefs_sample.yaml +45 -0
- package/samples/project_templates_sample.yaml +45 -0
- package/samples/projects_sample.yaml +11 -0
- package/samples/status_updates_sample.yaml +45 -0
- package/samples/teams_sample.yaml +15 -4
- package/samples/time_periods_sample.yaml +23 -0
- package/samples/webhooks_sample.yaml +11 -0
- package/dist/asana-min.js +0 -1
- package/dist/asana.js +0 -39710
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
name: Run npm build and npm test
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
node-version: [8.x, 9.x, 12.x]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v3
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v3
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: npm i
|
|
26
|
+
- run: npm run build --if-present
|
|
27
|
+
- run: npm test
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish to GitHub Releases
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-n-publish-to-github:
|
|
10
|
+
name: Build and publish to GitHub Releases
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v3
|
|
14
|
+
- uses: actions/setup-node@v3
|
|
15
|
+
with:
|
|
16
|
+
node-version: '8.x'
|
|
17
|
+
- name: Bundle the code, full version to asana.js and minified to asana-min.js
|
|
18
|
+
run: |
|
|
19
|
+
npm i gulp
|
|
20
|
+
gulp bundle
|
|
21
|
+
- name: Publish to GitHub Releases
|
|
22
|
+
uses: softprops/action-gh-release@v1
|
|
23
|
+
with:
|
|
24
|
+
files: |
|
|
25
|
+
dist/asana.js
|
|
26
|
+
dist/asana-min.js
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Publish 📦 to npmjs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-n-publish-to-npmjs:
|
|
10
|
+
name: Build and publish 📦 to npmjs
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v3
|
|
14
|
+
- uses: actions/setup-node@v3
|
|
15
|
+
with:
|
|
16
|
+
node-version: '8.x'
|
|
17
|
+
registry-url: 'https://registry.npmjs.com'
|
|
18
|
+
- run: npm i
|
|
19
|
+
- run: npm publish
|
|
20
|
+
env:
|
|
21
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Asana [![GitHub release][release-image]]() [![Build Status][
|
|
1
|
+
# Asana [![GitHub release][release-image]]() [![Build Status][github-actions-image]][github-actions-url] [![NPM Version][npm-image]][npm-url]
|
|
2
2
|
|
|
3
3
|
A JavaScript client (for both Node and browser) for the Asana API v1.0.
|
|
4
4
|
|
|
@@ -314,18 +314,34 @@ See our [openapi spec][https://github.com/Asana/developer-docs/blob/master/defs/
|
|
|
314
314
|
|
|
315
315
|
**Repo Owners Only.** Take the following steps to issue a new release of the library.
|
|
316
316
|
|
|
317
|
+
#### Automatic Deployment
|
|
318
|
+
|
|
317
319
|
1. Merge in the desired changes into the `master` branch and commit them.
|
|
318
320
|
2. Clone the repo; work on `master`.
|
|
319
|
-
3. Bump the package version to indicate the [semantic version](http://semver.org) change, using one of: `gulp bump-patch`, `gulp bump-
|
|
321
|
+
3. Bump the package version to indicate the [semantic version](http://semver.org) change, using one of: `gulp bump-patch`, `gulp bump-minor`, or `gulp bump-major`
|
|
322
|
+
(NOTE: If this is your first time running `gulp` please install `gulp` globally using `npm i -g gulp`)
|
|
320
323
|
4. Push changes to origin, including tags:
|
|
321
|
-
`git push origin master
|
|
324
|
+
`git push --tags origin master:master`
|
|
325
|
+
|
|
326
|
+
#### Manual Deployment
|
|
327
|
+
|
|
328
|
+
1. Merge in the desired changes into the `master` branch and commit them.
|
|
329
|
+
2. Clone the repo, work on master.
|
|
330
|
+
3. Edit package version in `package.json`, `bower.json` and `VERSION` to indicate the [semantic version](http://semver.org/) change.
|
|
331
|
+
4. Commit the change
|
|
332
|
+
5. Tag the commit with `v` plus the same version number you set in the file.
|
|
333
|
+
`git tag v1.2.3`
|
|
334
|
+
6. Push changes to origin, including tags:
|
|
335
|
+
`git push --tags origin master:master`
|
|
336
|
+
|
|
337
|
+
GitHub Actions will automatically build and deploy the tagged release.
|
|
322
338
|
|
|
323
|
-
|
|
339
|
+
:reminder_ribbon: Make sure to edit the [new release](https://github.com/Asana/node-asana/releases) description on GitHub after it has been deployed. Please use bullet points to indicate notable changes since the last version.
|
|
324
340
|
|
|
325
341
|
[release-image]: https://img.shields.io/github/release/asana/node-asana.svg
|
|
326
342
|
|
|
327
|
-
[
|
|
328
|
-
[
|
|
343
|
+
[github-actions-url]: https://github.com/Asana/node-asana/actions
|
|
344
|
+
[github-actions-image]: https://github.com/Asana/node-asana/workflows/Build/badge.svg
|
|
329
345
|
|
|
330
346
|
[npm-url]: https://www.npmjs.org/package/asana
|
|
331
347
|
[npm-image]: http://img.shields.io/npm/v/asana.svg?style=flat-square
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1.18.14
|
package/bower.json
CHANGED
package/gulpfile.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var browserify = require('browserify');
|
|
2
|
+
var fs = require('fs');
|
|
2
3
|
var bump = require('gulp-bump');
|
|
3
4
|
var filter = require('gulp-filter');
|
|
4
5
|
var git = require('gulp-git');
|
|
@@ -51,8 +52,10 @@ function browserTask(minify) {
|
|
|
51
52
|
function ensureGitClean(done) {
|
|
52
53
|
git.status(function(err, out) {
|
|
53
54
|
if (err) { throw err; }
|
|
54
|
-
if (!/
|
|
55
|
-
throw new Error(
|
|
55
|
+
if (!/nothing to commit/.exec(out)) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
'Git working directory not clean, will not bump version'
|
|
58
|
+
);
|
|
56
59
|
}
|
|
57
60
|
});
|
|
58
61
|
|
|
@@ -66,33 +69,87 @@ gulp.task('ensure-git-clean', ensureGitClean);
|
|
|
66
69
|
*
|
|
67
70
|
* You can use the commands
|
|
68
71
|
*
|
|
69
|
-
* gulp bump-patch
|
|
70
|
-
* gulp bump-
|
|
71
|
-
* gulp bump-
|
|
72
|
+
* gulp bump-patch # makes v0.1.0 → v0.1.1
|
|
73
|
+
* gulp bump-minor # makes v0.1.1 → v0.2.0
|
|
74
|
+
* gulp bump-major # makes v0.2.1 → v1.0.0
|
|
72
75
|
*
|
|
73
76
|
* To bump the version numbers accordingly after you did a patch,
|
|
74
77
|
* introduced a feature or made a backwards-incompatible release.
|
|
75
78
|
*/
|
|
76
79
|
function bumpVersion(importance) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
// Update VERSION file
|
|
81
|
+
function updateVersionFile(cb) {
|
|
82
|
+
fs.readFile('VERSION', 'utf-8', function (err, data) {
|
|
83
|
+
if (err) {
|
|
84
|
+
console.log(err);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var versionArray = data.split('.');
|
|
88
|
+
var major = versionArray[0];
|
|
89
|
+
var minor = versionArray[1];
|
|
90
|
+
var patch = versionArray[2];
|
|
91
|
+
|
|
92
|
+
if (importance === 'major') {
|
|
93
|
+
major = (parseInt(major) + 1).toString();
|
|
94
|
+
}
|
|
95
|
+
if (importance === 'minor') {
|
|
96
|
+
minor = (parseInt(minor) + 1).toString();
|
|
97
|
+
}
|
|
98
|
+
if (importance === 'patch') {
|
|
99
|
+
patch = (parseInt(patch) + 1).toString();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var updatedVersion = [major, minor, patch].join('.');
|
|
103
|
+
|
|
104
|
+
fs.writeFile('VERSION', updatedVersion, function (err) {
|
|
105
|
+
if (err) {
|
|
106
|
+
console.log(err);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
cb();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Bump version in package.json and bower.json
|
|
114
|
+
function updateVersion() {
|
|
115
|
+
return gulp
|
|
116
|
+
.src(['./package.json', './bower.json'])
|
|
117
|
+
.pipe(bump({ type: importance }))
|
|
118
|
+
.pipe(gulp.dest('./'));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Add, commit version files and tag commit with new version
|
|
122
|
+
function addCommitTagPush(cb) {
|
|
123
|
+
gulp
|
|
124
|
+
.src(['./package.json', './bower.json', './VERSION'])
|
|
125
|
+
.pipe(git.add())
|
|
126
|
+
.pipe(git.commit('Bump package version'))
|
|
81
127
|
.pipe(filter('package.json'))
|
|
82
128
|
.pipe(tagVersion());
|
|
129
|
+
cb();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Update the version files in parallel and then commit the changes
|
|
133
|
+
return gulp.series(
|
|
134
|
+
gulp.parallel(updateVersionFile, updateVersion),
|
|
135
|
+
addCommitTagPush
|
|
136
|
+
)();
|
|
83
137
|
}
|
|
84
|
-
function bumpPatch() {
|
|
85
|
-
|
|
138
|
+
function bumpPatch(cb) {
|
|
139
|
+
bumpVersion('patch');
|
|
140
|
+
cb();
|
|
86
141
|
}
|
|
87
142
|
gulp.task('bump-patch', gulp.series('ensure-git-clean', bumpPatch));
|
|
88
|
-
function
|
|
89
|
-
|
|
143
|
+
function bumpMinor(cb) {
|
|
144
|
+
bumpVersion('minor');
|
|
145
|
+
cb();
|
|
90
146
|
}
|
|
91
|
-
gulp.task('bump-
|
|
92
|
-
function
|
|
93
|
-
|
|
147
|
+
gulp.task('bump-minor', gulp.series('ensure-git-clean', bumpMinor));
|
|
148
|
+
function bumpMajor(cb) {
|
|
149
|
+
bumpVersion('major');
|
|
150
|
+
cb();
|
|
94
151
|
}
|
|
95
|
-
gulp.task('bump-
|
|
152
|
+
gulp.task('bump-major', gulp.series('ensure-git-clean', bumpMajor));
|
|
96
153
|
|
|
97
154
|
/**
|
|
98
155
|
* Lints all of the JavaScript files and fails if the tasks do not pass
|
|
@@ -117,7 +174,7 @@ function spec(callback) {
|
|
|
117
174
|
.on('finish', function() {
|
|
118
175
|
gulp.src(test)
|
|
119
176
|
.pipe(mocha({
|
|
120
|
-
reporter:
|
|
177
|
+
reporter: 'nyan'
|
|
121
178
|
}))
|
|
122
179
|
.pipe(istanbul.writeReports({
|
|
123
180
|
reporters: ['text', 'text-summary']
|
package/lib/auth/app.js
CHANGED
|
@@ -97,7 +97,7 @@ App.prototype.accessTokenFromCode = function(code, options) {
|
|
|
97
97
|
var params = {
|
|
98
98
|
method: 'POST',
|
|
99
99
|
url: this.asanaTokenUrl(options),
|
|
100
|
-
|
|
100
|
+
form: {
|
|
101
101
|
'grant_type': 'authorization_code',
|
|
102
102
|
'client_id': this.clientId,
|
|
103
103
|
'client_secret': this.clientSecret,
|
|
@@ -121,7 +121,7 @@ App.prototype.accessTokenFromRefreshToken = function(refreshToken, options) {
|
|
|
121
121
|
var params = {
|
|
122
122
|
method: 'POST',
|
|
123
123
|
url: this.asanaTokenUrl(options),
|
|
124
|
-
|
|
124
|
+
form: {
|
|
125
125
|
'grant_type': 'refresh_token',
|
|
126
126
|
'client_id': this.clientId,
|
|
127
127
|
'client_secret': this.clientSecret,
|
package/lib/client.js
CHANGED
|
@@ -204,7 +204,7 @@ Client.prototype.useAccessToken = function(accessToken) {
|
|
|
204
204
|
* @option {Function} [refreshCredentialsCallback] An optional callback
|
|
205
205
|
* function to execute once the authenticator auto refreshes
|
|
206
206
|
* access credentials.
|
|
207
|
-
* For Example:
|
|
207
|
+
* For Example:
|
|
208
208
|
* function(credentials){
|
|
209
209
|
* console.log("Your new credentials are:"+credentials)
|
|
210
210
|
* }
|
|
@@ -238,13 +238,7 @@ Client.prototype.useOauth = function(options) {
|
|
|
238
238
|
Client.create = function(options) {
|
|
239
239
|
options = options || {};
|
|
240
240
|
return new Client(
|
|
241
|
-
new Dispatcher(
|
|
242
|
-
asanaBaseUrl: options.asanaBaseUrl,
|
|
243
|
-
timeout: options.requestTimeout,
|
|
244
|
-
defaultHeaders: options.defaultHeaders,
|
|
245
|
-
defaultProxy: options.defaultProxy,
|
|
246
|
-
logAsanaChangeWarnings: options.logAsanaChangeWarnings
|
|
247
|
-
}),
|
|
241
|
+
new Dispatcher(options),
|
|
248
242
|
options);
|
|
249
243
|
};
|
|
250
244
|
|
|
@@ -55,9 +55,9 @@ Attachments.prototype.getAttachment = function(
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Get attachments
|
|
59
|
-
* @param {String} taskGid: (required) The task to operate on.
|
|
58
|
+
* Get attachments from an object
|
|
60
59
|
* @param {Object} params: Parameters for the request
|
|
60
|
+
- parent {String}: (required) Globally unique identifier for object to fetch statuses from. Must be a GID for a task or project_brief.
|
|
61
61
|
- offset {String}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
|
|
62
62
|
- limit {Number}: Results per page. The number of objects to return per page. The value must be between 1 and 100.
|
|
63
63
|
- optFields {[String]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
|
|
@@ -65,12 +65,11 @@ Attachments.prototype.getAttachment = function(
|
|
|
65
65
|
* @param {Object} [dispatchOptions]: Options, if any, to pass the dispatcher for the request
|
|
66
66
|
* @return {Promise} The requested resource
|
|
67
67
|
*/
|
|
68
|
-
Attachments.prototype.
|
|
69
|
-
taskGid,
|
|
68
|
+
Attachments.prototype.getAttachmentsForObject = function(
|
|
70
69
|
params,
|
|
71
70
|
dispatchOptions
|
|
72
71
|
) {
|
|
73
|
-
var path = "/
|
|
72
|
+
var path = "/attachments";
|
|
74
73
|
|
|
75
74
|
return this.dispatchGetCollection(path, params, dispatchOptions)
|
|
76
75
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated by our openapi spec.
|
|
3
|
+
* We try to keep the generated code pretty clean but there will be lint
|
|
4
|
+
* errors that are just not worth fixing (like unused requires).
|
|
5
|
+
* TODO: maybe we can just disable those specifically and keep this code
|
|
6
|
+
* pretty lint-free too!
|
|
7
|
+
*/
|
|
8
|
+
/* jshint ignore:start */
|
|
9
|
+
var Resource = require('../resource');
|
|
10
|
+
var util = require('util');
|
|
11
|
+
var _ = require('lodash');
|
|
12
|
+
|
|
13
|
+
function AuditLogAPI(dispatcher) {
|
|
14
|
+
Resource.call(this, dispatcher);
|
|
15
|
+
}
|
|
16
|
+
util.inherits(AuditLogAPI, Resource);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get audit log events
|
|
21
|
+
* @param {String} workspaceGid: (required) Globally unique identifier for the workspace or organization.
|
|
22
|
+
* @param {Object} params: Parameters for the request
|
|
23
|
+
- startAt {Date}: Filter to events created after this time (inclusive).
|
|
24
|
+
- endAt {Date}: Filter to events created before this time (exclusive).
|
|
25
|
+
- eventType {String}: Filter to events of this type. Refer to the [Supported AuditLogEvents](/docs/supported-auditlogevents) for a full list of values.
|
|
26
|
+
- actorType {String}: Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded.
|
|
27
|
+
- actorGid {String}: Filter to events triggered by the actor with this ID.
|
|
28
|
+
- resourceGid {String}: Filter to events with this resource ID.
|
|
29
|
+
- offset {String}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
|
|
30
|
+
- limit {Number}: Results per page. The number of objects to return per page. The value must be between 1 and 100.
|
|
31
|
+
* @param {Object} [dispatchOptions]: Options, if any, to pass the dispatcher for the request
|
|
32
|
+
* @return {Promise} The requested resource
|
|
33
|
+
*/
|
|
34
|
+
AuditLogAPI.prototype.getAuditLogEvents = function(
|
|
35
|
+
workspaceGid,
|
|
36
|
+
params,
|
|
37
|
+
dispatchOptions
|
|
38
|
+
) {
|
|
39
|
+
var path = "/workspaces/{workspace_gid}/audit_log_events".replace("{workspace_gid}", workspaceGid);
|
|
40
|
+
|
|
41
|
+
return this.dispatchGetCollection(path, params, dispatchOptions)
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports = AuditLogAPI;
|
|
45
|
+
/* jshint ignore:end */
|