tripit 0.1.2 → 0.1.3
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 +29 -5
- package/bin/tripit.js +5 -4
- package/index.ts +0 -2
- package/package.json +1 -1
- package/src/auth.ts +5 -2
- package/src/constants.ts +3 -0
- package/src/types.ts +2 -2
package/README.md
CHANGED
|
@@ -27,10 +27,34 @@ Show available commands:
|
|
|
27
27
|
tripit --help
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
###
|
|
30
|
+
### Agent Skill Installation
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
Install with `npx skills`:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx skills add dvcrn/tripit
|
|
36
|
+
npx skills add dvcrn/tripit --full-depth --list
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Install with Claude plugin marketplace CLI:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
claude plugin marketplace add dvcrn/tripit
|
|
43
|
+
claude plugin install tripit@dvcrn-tripit --scope user
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If the marketplace is already configured, update before reinstall tests:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
claude plugin marketplace update dvcrn-tripit
|
|
50
|
+
claude plugin install tripit@dvcrn-tripit --scope user
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Claude UI flow:
|
|
54
|
+
|
|
55
|
+
1. Open Claude plugin marketplace UI.
|
|
56
|
+
2. Add or select `dvcrn/tripit`.
|
|
57
|
+
3. Install plugin `tripit` from marketplace `dvcrn-tripit`.
|
|
34
58
|
|
|
35
59
|
### Common Workflow
|
|
36
60
|
|
|
@@ -103,8 +127,6 @@ tripit trips delete <TRIP_UUID>
|
|
|
103
127
|
import TripIt from "tripit";
|
|
104
128
|
|
|
105
129
|
const client = new TripIt({
|
|
106
|
-
clientId: process.env.TRIPIT_CLIENT_ID!,
|
|
107
|
-
clientSecret: process.env.TRIPIT_CLIENT_SECRET!,
|
|
108
130
|
username: process.env.TRIPIT_USERNAME!,
|
|
109
131
|
password: process.env.TRIPIT_PASSWORD!,
|
|
110
132
|
});
|
|
@@ -124,4 +146,6 @@ const created = await client.createTrip({
|
|
|
124
146
|
console.log(created.Trip.uuid);
|
|
125
147
|
```
|
|
126
148
|
|
|
149
|
+
`clientId` is optional. If omitted, the library uses the public TripIt mobile app client ID by default.
|
|
150
|
+
|
|
127
151
|
The package also exports types from `src/types.ts`.
|
package/bin/tripit.js
CHANGED
|
@@ -49871,6 +49871,7 @@ var BASE_URL = "https://www.tripit.com";
|
|
|
49871
49871
|
var API_BASE_URL = "https://api.tripit.com";
|
|
49872
49872
|
var REDIRECT_URI = "com.tripit://completeAuthorize";
|
|
49873
49873
|
var SCOPES = "offline_access email";
|
|
49874
|
+
var DEFAULT_CLIENT_ID = "e400234a-f684-11e7-9d05-9cb654932688";
|
|
49874
49875
|
var BROWSER_HEADERS = {
|
|
49875
49876
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:142.0) Gecko/20100101 Firefox/142.0",
|
|
49876
49877
|
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
@@ -50093,11 +50094,12 @@ async function submitLogin(fetchFn, config, formHtml, formAction) {
|
|
|
50093
50094
|
throw new Error(`Unexpected login response status: ${res.status}`);
|
|
50094
50095
|
}
|
|
50095
50096
|
async function exchangeCodeForToken(config, code, codeVerifier) {
|
|
50097
|
+
const clientId = config.clientId ?? DEFAULT_CLIENT_ID;
|
|
50096
50098
|
const params = new URLSearchParams({
|
|
50097
50099
|
grant_type: "authorization_code",
|
|
50098
50100
|
code,
|
|
50099
50101
|
redirect_uri: REDIRECT_URI,
|
|
50100
|
-
client_id:
|
|
50102
|
+
client_id: clientId,
|
|
50101
50103
|
code_verifier: codeVerifier
|
|
50102
50104
|
});
|
|
50103
50105
|
const res = await fetch(`${API_BASE_URL}/oauth2/token`, {
|
|
@@ -50112,6 +50114,7 @@ async function exchangeCodeForToken(config, code, codeVerifier) {
|
|
|
50112
50114
|
return res.json();
|
|
50113
50115
|
}
|
|
50114
50116
|
async function authenticate(config) {
|
|
50117
|
+
const clientId = config.clientId ?? DEFAULT_CLIENT_ID;
|
|
50115
50118
|
const cached = loadCachedToken();
|
|
50116
50119
|
if (cached && cached.expiresAt > Date.now()) {
|
|
50117
50120
|
return cached.access_token;
|
|
@@ -50123,7 +50126,7 @@ async function authenticate(config) {
|
|
|
50123
50126
|
const codeVerifier = crypto.randomBytes(32).toString("hex");
|
|
50124
50127
|
const codeChallenge = crypto.createHash("sha256").update(codeVerifier).digest().toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
50125
50128
|
const state = crypto.randomBytes(16).toString("hex");
|
|
50126
|
-
const authUrl = `${BASE_URL}/auth/oauth2/authorize?client_id=${encodeURIComponent(
|
|
50129
|
+
const authUrl = `${BASE_URL}/auth/oauth2/authorize?client_id=${encodeURIComponent(clientId)}&response_type=code&redirect_uri=${encodeURIComponent(REDIRECT_URI)}&scope=${encodeURIComponent(SCOPES)}&state=${encodeURIComponent(state)}&code_challenge=${encodeURIComponent(codeChallenge)}&code_challenge_method=S256&response_mode=query&action=sign_in`;
|
|
50127
50130
|
const { html: html3, formAction } = await followRedirects(fetchWithCookie, authUrl);
|
|
50128
50131
|
const redirectUrl = await submitLogin(fetchWithCookie, config, html3, formAction);
|
|
50129
50132
|
const parsedUrl = new URL(redirectUrl, "http://localhost");
|
|
@@ -50912,8 +50915,6 @@ function requiredEnv(name) {
|
|
|
50912
50915
|
}
|
|
50913
50916
|
function createClient() {
|
|
50914
50917
|
return new TripIt({
|
|
50915
|
-
clientId: requiredEnv("TRIPIT_CLIENT_ID"),
|
|
50916
|
-
clientSecret: requiredEnv("TRIPIT_CLIENT_SECRET"),
|
|
50917
50918
|
username: requiredEnv("TRIPIT_USERNAME"),
|
|
50918
50919
|
password: requiredEnv("TRIPIT_PASSWORD")
|
|
50919
50920
|
});
|
package/index.ts
CHANGED
|
@@ -9,8 +9,6 @@ function requiredEnv(name: string): string {
|
|
|
9
9
|
|
|
10
10
|
function createClient(): TripIt {
|
|
11
11
|
return new TripIt({
|
|
12
|
-
clientId: requiredEnv("TRIPIT_CLIENT_ID"),
|
|
13
|
-
clientSecret: requiredEnv("TRIPIT_CLIENT_SECRET"),
|
|
14
12
|
username: requiredEnv("TRIPIT_USERNAME"),
|
|
15
13
|
password: requiredEnv("TRIPIT_PASSWORD"),
|
|
16
14
|
});
|
package/package.json
CHANGED
package/src/auth.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
BASE_URL,
|
|
8
8
|
BROWSER_HEADERS,
|
|
9
9
|
CACHE_DIR,
|
|
10
|
+
DEFAULT_CLIENT_ID,
|
|
10
11
|
REDIRECT_URI,
|
|
11
12
|
SCOPES,
|
|
12
13
|
TOKEN_CACHE_FILE,
|
|
@@ -148,11 +149,12 @@ async function exchangeCodeForToken(
|
|
|
148
149
|
code: string,
|
|
149
150
|
codeVerifier: string,
|
|
150
151
|
): Promise<any> {
|
|
152
|
+
const clientId = config.clientId ?? DEFAULT_CLIENT_ID;
|
|
151
153
|
const params = new URLSearchParams({
|
|
152
154
|
grant_type: "authorization_code",
|
|
153
155
|
code,
|
|
154
156
|
redirect_uri: REDIRECT_URI,
|
|
155
|
-
client_id:
|
|
157
|
+
client_id: clientId,
|
|
156
158
|
code_verifier: codeVerifier,
|
|
157
159
|
});
|
|
158
160
|
|
|
@@ -171,6 +173,7 @@ async function exchangeCodeForToken(
|
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
export async function authenticate(config: TripItConfig): Promise<string> {
|
|
176
|
+
const clientId = config.clientId ?? DEFAULT_CLIENT_ID;
|
|
174
177
|
const cached = loadCachedToken();
|
|
175
178
|
if (cached && cached.expiresAt > Date.now()) {
|
|
176
179
|
return cached.access_token;
|
|
@@ -197,7 +200,7 @@ export async function authenticate(config: TripItConfig): Promise<string> {
|
|
|
197
200
|
|
|
198
201
|
const authUrl =
|
|
199
202
|
`${BASE_URL}/auth/oauth2/authorize?` +
|
|
200
|
-
`client_id=${encodeURIComponent(
|
|
203
|
+
`client_id=${encodeURIComponent(clientId)}` +
|
|
201
204
|
`&response_type=code` +
|
|
202
205
|
`&redirect_uri=${encodeURIComponent(REDIRECT_URI)}` +
|
|
203
206
|
`&scope=${encodeURIComponent(SCOPES)}` +
|
package/src/constants.ts
CHANGED
|
@@ -9,6 +9,9 @@ export const API_BASE_URL = "https://api.tripit.com";
|
|
|
9
9
|
export const REDIRECT_URI = "com.tripit://completeAuthorize";
|
|
10
10
|
export const SCOPES = "offline_access email";
|
|
11
11
|
|
|
12
|
+
// TripIt mobile app client ID (public, extracted from iOS/Android app)
|
|
13
|
+
export const DEFAULT_CLIENT_ID = "e400234a-f684-11e7-9d05-9cb654932688";
|
|
14
|
+
|
|
12
15
|
export const BROWSER_HEADERS = {
|
|
13
16
|
"User-Agent":
|
|
14
17
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:142.0) Gecko/20100101 Firefox/142.0",
|