@37signals/basecamp 0.13.0 → 0.14.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/README.md +3 -2
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/metadata.d.ts.map +1 -1
- package/dist/generated/metadata.js +12 -1
- package/dist/generated/metadata.js.map +1 -1
- package/dist/generated/metadata.ts +12 -1
- package/dist/generated/openapi-stripped.json +280 -1
- package/dist/generated/path-mapping.d.ts.map +1 -1
- package/dist/generated/path-mapping.js +1 -0
- package/dist/generated/path-mapping.js.map +1 -1
- package/dist/generated/path-mapping.ts +1 -0
- package/dist/generated/schema.d.ts +209 -2
- package/dist/generated/services/uploads.d.ts +36 -2
- package/dist/generated/services/uploads.d.ts.map +1 -1
- package/dist/generated/services/uploads.js +37 -1
- package/dist/generated/services/uploads.js.map +1 -1
- package/dist/generated/services/uploads.ts +65 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth/authorization-document.d.ts +201 -0
- package/dist/oauth/authorization-document.d.ts.map +1 -0
- package/dist/oauth/authorization-document.js +130 -0
- package/dist/oauth/authorization-document.js.map +1 -0
- package/dist/oauth/identity.d.ts +7 -1
- package/dist/oauth/identity.d.ts.map +1 -1
- package/dist/oauth/identity.js +8 -19
- package/dist/oauth/identity.js.map +1 -1
- package/dist/oauth/index.d.ts +1 -0
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +2 -0
- package/dist/oauth/index.js.map +1 -1
- package/dist/services/authorization.d.ts +22 -52
- package/dist/services/authorization.d.ts.map +1 -1
- package/dist/services/authorization.js +14 -32
- package/dist/services/authorization.js.map +1 -1
- package/package.json +2 -2
- package/src/generated/metadata.ts +12 -1
- package/src/generated/openapi-stripped.json +280 -1
- package/src/generated/path-mapping.ts +1 -0
- package/src/generated/schema.d.ts +209 -2
- package/src/generated/services/uploads.ts +65 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-document.js","sourceRoot":"","sources":["../../src/oauth/authorization-document.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AA0HH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,KAAyC;IACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,2EAA2E;QAC3E,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC9C,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAA6B,EAC7B,OAAe;IAEf,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;IAC1F,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,EAAE,OAAO,EAAE,IAA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AAE,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACzB,CAAC;IACD,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;QACvC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/oauth/identity.d.ts
CHANGED
|
@@ -3,9 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Fetches authorization information (identity and accounts) from
|
|
5
5
|
* the Launchpad endpoint without requiring a full client instance.
|
|
6
|
+
*
|
|
7
|
+
* The endpoint is fixed to Launchpad here — unlike
|
|
8
|
+
* {@link ../services/authorization.js | AuthorizationService.getInfo}, which
|
|
9
|
+
* accepts an `endpoint:` override and so can be pointed at a BC5 issuer. Both
|
|
10
|
+
* share one mapping regardless; see `./authorization-document.js` for why the two
|
|
11
|
+
* documents differ and how the shared parser reconciles them.
|
|
6
12
|
*/
|
|
7
13
|
import type { TokenProvider } from "../client.js";
|
|
8
|
-
import type
|
|
14
|
+
import { type AuthorizationInfo } from "./authorization-document.js";
|
|
9
15
|
/**
|
|
10
16
|
* Fetches authorization information using an access token.
|
|
11
17
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/oauth/identity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/oauth/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,6BAA6B,CAAC;AAIrC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAoC7F"}
|
package/dist/oauth/identity.js
CHANGED
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Fetches authorization information (identity and accounts) from
|
|
5
5
|
* the Launchpad endpoint without requiring a full client instance.
|
|
6
|
+
*
|
|
7
|
+
* The endpoint is fixed to Launchpad here — unlike
|
|
8
|
+
* {@link ../services/authorization.js | AuthorizationService.getInfo}, which
|
|
9
|
+
* accepts an `endpoint:` override and so can be pointed at a BC5 issuer. Both
|
|
10
|
+
* share one mapping regardless; see `./authorization-document.js` for why the two
|
|
11
|
+
* documents differ and how the shared parser reconciles them.
|
|
6
12
|
*/
|
|
7
13
|
import { BasecampError } from "../errors.js";
|
|
14
|
+
import { parseAuthorizationDocument, } from "./authorization-document.js";
|
|
8
15
|
const AUTHORIZATION_ENDPOINT = "https://launchpad.37signals.com/authorization.json";
|
|
9
16
|
/**
|
|
10
17
|
* Fetches authorization information using an access token.
|
|
@@ -59,24 +66,6 @@ export async function discoverIdentity(accessToken) {
|
|
|
59
66
|
catch {
|
|
60
67
|
throw new BasecampError("api_error", "Identity discovery returned invalid JSON");
|
|
61
68
|
}
|
|
62
|
-
return
|
|
63
|
-
expiresAt: new Date(raw.expires_at),
|
|
64
|
-
identity: {
|
|
65
|
-
id: raw.identity.id,
|
|
66
|
-
firstName: raw.identity.first_name,
|
|
67
|
-
lastName: raw.identity.last_name,
|
|
68
|
-
emailAddress: raw.identity.email_address,
|
|
69
|
-
},
|
|
70
|
-
accounts: raw.accounts.map((a) => ({
|
|
71
|
-
id: a.id,
|
|
72
|
-
name: a.name,
|
|
73
|
-
product: a.product,
|
|
74
|
-
href: a.href,
|
|
75
|
-
appHref: a.app_href ?? "",
|
|
76
|
-
hidden: a.hidden,
|
|
77
|
-
expired: a.expired,
|
|
78
|
-
featured: a.featured,
|
|
79
|
-
})),
|
|
80
|
-
};
|
|
69
|
+
return parseAuthorizationDocument(raw);
|
|
81
70
|
}
|
|
82
71
|
//# sourceMappingURL=identity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/oauth/identity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/oauth/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EACL,0BAA0B,GAG3B,MAAM,6BAA6B,CAAC;AAErC,MAAM,sBAAsB,GAAG,oDAAoD,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,WAA0B;IAC/D,MAAM,KAAK,GAAG,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;IAEpF,IAAI,QAAkB,CAAC;IACvB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,KAAK,CAAC,sBAAsB,EAAE;YAC7C,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,aAAa,CAAC,SAAS,EAAE,8BAA8B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvH,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,aAAa,CAAC,eAAe,EAAE,iCAAiC,EAAE;gBAC1E,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,2CAA2C;aAClD,CAAC,CAAC;QACL,CAAC;QACD,MAAM,IAAI,aAAa,CAAC,WAAW,EAAE,mCAAmC,QAAQ,CAAC,MAAM,EAAE,EAAE;YACzF,UAAU,EAAE,QAAQ,CAAC,MAAM;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,IAAI,GAA6B,CAAC;IAClC,IAAI,CAAC;QACH,GAAG,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA6B,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,aAAa,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,0BAA0B,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/oauth/index.d.ts
CHANGED
|
@@ -50,4 +50,5 @@ export { TokenManager, type TokenManagerOptions, } from "./token-manager.js";
|
|
|
50
50
|
export { startCallbackServer, type CallbackResult, type CallbackServerOptions, } from "./callback-server.js";
|
|
51
51
|
export { performInteractiveLogin, type InteractiveLoginOptions, } from "./interactive-login.js";
|
|
52
52
|
export { discoverIdentity, } from "./identity.js";
|
|
53
|
+
export { parseAuthorizationDocument, parseExpiresAt, filterAccountsByProduct, type RawAuthorizationDocument, } from "./authorization-document.js";
|
|
53
54
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/oauth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,YAAY,EACV,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,EACtB,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,2BAA2B,GACjC,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,KAAK,YAAY,GAClB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,KAAK,IAAI,GACV,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,qBAAqB,EACrB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/oauth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,YAAY,EACV,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,EACtB,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,2BAA2B,GACjC,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,KAAK,YAAY,GAClB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,KAAK,IAAI,GACV,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,qBAAqB,EACrB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,6BAA6B,CAAC"}
|
package/dist/oauth/index.js
CHANGED
|
@@ -59,4 +59,6 @@ export { startCallbackServer, } from "./callback-server.js";
|
|
|
59
59
|
export { performInteractiveLogin, } from "./interactive-login.js";
|
|
60
60
|
// Identity
|
|
61
61
|
export { discoverIdentity, } from "./identity.js";
|
|
62
|
+
// The authorization document, shared by discoverIdentity and AuthorizationService
|
|
63
|
+
export { parseAuthorizationDocument, parseExpiresAt, filterAccountsByProduct, } from "./authorization-document.js";
|
|
62
64
|
//# sourceMappingURL=index.js.map
|
package/dist/oauth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oauth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAiBH,yBAAyB;AACzB,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,GAIvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAE5B,YAAY;AACZ,OAAO,EACL,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,GAGnB,MAAM,gBAAgB,CAAC;AAExB,iBAAiB;AACjB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,GAEf,MAAM,eAAe,CAAC;AAEvB,iBAAiB;AACjB,OAAO,EACL,YAAY,EACZ,aAAa,GAEd,MAAM,WAAW,CAAC;AAEnB,oBAAoB;AACpB,OAAO,EACL,qBAAqB,GAEtB,MAAM,gBAAgB,CAAC;AAExB,cAAc;AACd,OAAO,EACL,cAAc,GAEf,MAAM,kBAAkB,CAAC;AAE1B,gBAAgB;AAChB,OAAO,EACL,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAE5B,kBAAkB;AAClB,OAAO,EACL,mBAAmB,GAGpB,MAAM,sBAAsB,CAAC;AAE9B,oBAAoB;AACpB,OAAO,EACL,uBAAuB,GAExB,MAAM,wB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|
7
7
|
import { BaseService, type RawClient } from "./base.js";
|
|
8
8
|
import type { BasecampHooks } from "../hooks.js";
|
|
9
9
|
import type { AuthStrategy } from "../auth-strategy.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
export interface Identity {
|
|
14
|
-
/** User's unique identifier */
|
|
15
|
-
id: number;
|
|
16
|
-
/** User's first name */
|
|
17
|
-
firstName: string;
|
|
18
|
-
/** User's last name */
|
|
19
|
-
lastName: string;
|
|
20
|
-
/** User's email address */
|
|
21
|
-
emailAddress: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A Basecamp account the user has access to.
|
|
25
|
-
*/
|
|
26
|
-
export interface AuthorizedAccount {
|
|
27
|
-
/** Account's unique identifier */
|
|
28
|
-
id: number;
|
|
29
|
-
/** Account name */
|
|
30
|
-
name: string;
|
|
31
|
-
/** Product type (e.g., "bc3" for Basecamp, "hey" for HEY) */
|
|
32
|
-
product: string;
|
|
33
|
-
/** API URL for this account */
|
|
34
|
-
href: string;
|
|
35
|
-
/** Web app URL for this account */
|
|
36
|
-
appHref: string;
|
|
37
|
-
/** Whether the account is hidden from the user's view */
|
|
38
|
-
hidden?: boolean;
|
|
39
|
-
/** Whether the account subscription has expired */
|
|
40
|
-
expired?: boolean;
|
|
41
|
-
/** Whether this is the user's featured/primary account */
|
|
42
|
-
featured?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Authorization information response.
|
|
46
|
-
*/
|
|
47
|
-
export interface AuthorizationInfo {
|
|
48
|
-
/** Token expiration timestamp */
|
|
49
|
-
expiresAt: Date;
|
|
50
|
-
/** The authenticated user's identity */
|
|
51
|
-
identity: Identity;
|
|
52
|
-
/** List of accounts the user can access */
|
|
53
|
-
accounts: AuthorizedAccount[];
|
|
54
|
-
}
|
|
10
|
+
import { type AuthorizationInfo } from "../oauth/authorization-document.js";
|
|
11
|
+
export type { Identity, AuthorizedAccount, AuthorizationInfo, } from "../oauth/authorization-document.js";
|
|
55
12
|
/**
|
|
56
13
|
* Options for fetching authorization information.
|
|
57
14
|
*/
|
|
@@ -59,19 +16,29 @@ export interface GetAuthorizationInfoOptions {
|
|
|
59
16
|
/**
|
|
60
17
|
* Override the default authorization endpoint URL.
|
|
61
18
|
* Defaults to "https://launchpad.37signals.com/authorization.json"
|
|
19
|
+
*
|
|
20
|
+
* This is also how you point at a BC5 issuer, whose document is a different
|
|
21
|
+
* shape — see `../oauth/authorization-document.js`.
|
|
62
22
|
*/
|
|
63
23
|
endpoint?: string;
|
|
64
24
|
/**
|
|
65
25
|
* Filter accounts by product type.
|
|
66
26
|
* Common values: "bc3" (Basecamp), "bcx" (Basecamp 2), "hey" (HEY)
|
|
27
|
+
*
|
|
28
|
+
* A BC5 document carries no `product` on any account, so the filter cannot
|
|
29
|
+
* apply there. In that case all accounts are returned and
|
|
30
|
+
* `AuthorizationInfo.productFilterApplied` is `false`, rather than the empty
|
|
31
|
+
* list a literal filter would produce.
|
|
67
32
|
*/
|
|
68
33
|
filterProduct?: string;
|
|
69
34
|
}
|
|
70
35
|
/**
|
|
71
36
|
* Service for authorization-related operations.
|
|
72
37
|
*
|
|
73
|
-
* This service communicates with
|
|
74
|
-
* rather than the standard Basecamp
|
|
38
|
+
* This service communicates with an authorization endpoint — Launchpad by
|
|
39
|
+
* default, or a BC5 issuer via `endpoint:` — rather than the standard Basecamp
|
|
40
|
+
* API. The two serve different-shaped documents; see
|
|
41
|
+
* `../oauth/authorization-document.js`.
|
|
75
42
|
*
|
|
76
43
|
* @example
|
|
77
44
|
* ```ts
|
|
@@ -84,9 +51,11 @@ export interface GetAuthorizationInfoOptions {
|
|
|
84
51
|
*
|
|
85
52
|
* // Get all accounts
|
|
86
53
|
* const info = await client.authorization.getInfo();
|
|
87
|
-
* console.log(`Logged in as ${info.identity.
|
|
54
|
+
* console.log(`Logged in as identity ${info.identity.id}`);
|
|
88
55
|
*
|
|
89
|
-
* // Filter to only Basecamp accounts
|
|
56
|
+
* // Filter to only Basecamp accounts. Against a BC5 issuer, whose accounts
|
|
57
|
+
* // carry no `product`, this returns every account with
|
|
58
|
+
* // `productFilterApplied === false` instead of an empty list.
|
|
90
59
|
* const bc3Info = await client.authorization.getInfo({ filterProduct: "bc3" });
|
|
91
60
|
* for (const account of bc3Info.accounts) {
|
|
92
61
|
* console.log(account.name);
|
|
@@ -110,12 +79,13 @@ export declare class AuthorizationService extends BaseService {
|
|
|
110
79
|
* ```ts
|
|
111
80
|
* const info = await authService.getInfo();
|
|
112
81
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
82
|
+
* // A BC5 issuer emits only `identity.id`; the name and email fields are
|
|
83
|
+
* // Launchpad's and are `undefined` there.
|
|
84
|
+
* console.log(`User: ${info.identity.id}`);
|
|
115
85
|
* console.log(`Token expires: ${info.expiresAt}`);
|
|
116
86
|
*
|
|
117
87
|
* for (const account of info.accounts) {
|
|
118
|
-
* console.log(`${account.name}
|
|
88
|
+
* console.log(`${account.name}: ${account.href}`);
|
|
119
89
|
* }
|
|
120
90
|
* ```
|
|
121
91
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../src/services/authorization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../src/services/authorization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,oCAAoC,CAAC;AAI5C,YAAY,EACV,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,SAAS,CAAS;gBAGxB,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,MAAM;IAOnB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,OAAO,CAAC,OAAO,GAAE,2BAAgC,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAsCrF"}
|
|
@@ -6,12 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { BaseService } from "./base.js";
|
|
8
8
|
import { requireSecureEndpoint } from "../security.js";
|
|
9
|
+
import { parseAuthorizationDocument, } from "../oauth/authorization-document.js";
|
|
9
10
|
const DEFAULT_AUTHORIZATION_ENDPOINT = "https://launchpad.37signals.com/authorization.json";
|
|
10
11
|
/**
|
|
11
12
|
* Service for authorization-related operations.
|
|
12
13
|
*
|
|
13
|
-
* This service communicates with
|
|
14
|
-
* rather than the standard Basecamp
|
|
14
|
+
* This service communicates with an authorization endpoint — Launchpad by
|
|
15
|
+
* default, or a BC5 issuer via `endpoint:` — rather than the standard Basecamp
|
|
16
|
+
* API. The two serve different-shaped documents; see
|
|
17
|
+
* `../oauth/authorization-document.js`.
|
|
15
18
|
*
|
|
16
19
|
* @example
|
|
17
20
|
* ```ts
|
|
@@ -24,9 +27,11 @@ const DEFAULT_AUTHORIZATION_ENDPOINT = "https://launchpad.37signals.com/authoriz
|
|
|
24
27
|
*
|
|
25
28
|
* // Get all accounts
|
|
26
29
|
* const info = await client.authorization.getInfo();
|
|
27
|
-
* console.log(`Logged in as ${info.identity.
|
|
30
|
+
* console.log(`Logged in as identity ${info.identity.id}`);
|
|
28
31
|
*
|
|
29
|
-
* // Filter to only Basecamp accounts
|
|
32
|
+
* // Filter to only Basecamp accounts. Against a BC5 issuer, whose accounts
|
|
33
|
+
* // carry no `product`, this returns every account with
|
|
34
|
+
* // `productFilterApplied === false` instead of an empty list.
|
|
30
35
|
* const bc3Info = await client.authorization.getInfo({ filterProduct: "bc3" });
|
|
31
36
|
* for (const account of bc3Info.accounts) {
|
|
32
37
|
* console.log(account.name);
|
|
@@ -54,12 +59,13 @@ export class AuthorizationService extends BaseService {
|
|
|
54
59
|
* ```ts
|
|
55
60
|
* const info = await authService.getInfo();
|
|
56
61
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
62
|
+
* // A BC5 issuer emits only `identity.id`; the name and email fields are
|
|
63
|
+
* // Launchpad's and are `undefined` there.
|
|
64
|
+
* console.log(`User: ${info.identity.id}`);
|
|
59
65
|
* console.log(`Token expires: ${info.expiresAt}`);
|
|
60
66
|
*
|
|
61
67
|
* for (const account of info.accounts) {
|
|
62
|
-
* console.log(`${account.name}
|
|
68
|
+
* console.log(`${account.name}: ${account.href}`);
|
|
63
69
|
* }
|
|
64
70
|
* ```
|
|
65
71
|
*/
|
|
@@ -88,31 +94,7 @@ export class AuthorizationService extends BaseService {
|
|
|
88
94
|
return { data: undefined, error: undefined, response };
|
|
89
95
|
}
|
|
90
96
|
const raw = (await response.json());
|
|
91
|
-
|
|
92
|
-
let accounts = raw.accounts.map((a) => ({
|
|
93
|
-
id: a.id,
|
|
94
|
-
name: a.name,
|
|
95
|
-
product: a.product,
|
|
96
|
-
href: a.href,
|
|
97
|
-
appHref: a.app_href,
|
|
98
|
-
hidden: a.hidden,
|
|
99
|
-
expired: a.expired,
|
|
100
|
-
featured: a.featured,
|
|
101
|
-
}));
|
|
102
|
-
// Filter by product if requested
|
|
103
|
-
if (options.filterProduct) {
|
|
104
|
-
accounts = accounts.filter((a) => a.product === options.filterProduct);
|
|
105
|
-
}
|
|
106
|
-
const data = {
|
|
107
|
-
expiresAt: new Date(raw.expires_at),
|
|
108
|
-
identity: {
|
|
109
|
-
id: raw.identity.id,
|
|
110
|
-
firstName: raw.identity.first_name,
|
|
111
|
-
lastName: raw.identity.last_name,
|
|
112
|
-
emailAddress: raw.identity.email_address,
|
|
113
|
-
},
|
|
114
|
-
accounts,
|
|
115
|
-
};
|
|
97
|
+
const data = parseAuthorizationDocument(raw, { filterProduct: options.filterProduct });
|
|
116
98
|
return { data, error: undefined, response };
|
|
117
99
|
});
|
|
118
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src/services/authorization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src/services/authorization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,0BAA0B,GAG3B,MAAM,oCAAoC,CAAC;AAkC5C,MAAM,8BAA8B,GAAG,oDAAoD,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IAC3C,YAAY,CAAe;IAC3B,SAAS,CAAS;IAE1B,YACE,MAAiB,EACjB,KAAgC,EAChC,YAA0B,EAC1B,SAAiB;QA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AAE,QAAQ,EAAE,CAAC;QAC9C,CAAC,CACF,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@37signals/basecamp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "TypeScript SDK for the Basecamp API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"minimatch": ">=10.2.1",
|
|
71
71
|
"brace-expansion": ">=5.0.9",
|
|
72
72
|
"fast-uri": ">=3.1.5 <4",
|
|
73
|
-
"js-yaml": "
|
|
73
|
+
"js-yaml": ">=4.3.1 <5"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -37,7 +37,7 @@ export interface MetadataOutput {
|
|
|
37
37
|
const metadata: MetadataOutput = {
|
|
38
38
|
"$schema": "https://basecamp.com/schemas/sdk-metadata.json",
|
|
39
39
|
"version": "1.0.0",
|
|
40
|
-
"generated": "2026-08-
|
|
40
|
+
"generated": "2026-08-07T11:11:59.965Z",
|
|
41
41
|
"operations": {
|
|
42
42
|
"GetAccount": {
|
|
43
43
|
"retry": {
|
|
@@ -3185,6 +3185,17 @@ const metadata: MetadataOutput = {
|
|
|
3185
3185
|
"maxPageSize": 50
|
|
3186
3186
|
}
|
|
3187
3187
|
},
|
|
3188
|
+
"CreateUploadVersion": {
|
|
3189
|
+
"retry": {
|
|
3190
|
+
"maxAttempts": 2,
|
|
3191
|
+
"baseDelayMs": 1000,
|
|
3192
|
+
"backoff": "exponential",
|
|
3193
|
+
"retryOn": [
|
|
3194
|
+
429,
|
|
3195
|
+
503
|
|
3196
|
+
]
|
|
3197
|
+
}
|
|
3198
|
+
},
|
|
3188
3199
|
"GetVault": {
|
|
3189
3200
|
"retry": {
|
|
3190
3201
|
"maxAttempts": 3,
|