@tapi-dev/sdk 0.1.39 → 0.1.44
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 +36 -41
- package/dist/cli.d.ts +3 -6
- package/dist/cli.js +163 -262
- package/dist/studio-dev.d.ts +1 -0
- package/dist/studio-dev.js +312 -0
- package/dist/workspace.d.ts +0 -2
- package/dist/workspace.js +7 -100
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,9 +17,8 @@ locally and `tapi` is not on `PATH`, use `npx tapi` as a fallback.
|
|
|
17
17
|
|
|
18
18
|
Tapi Studio is launched from the signed-in developer account. Running
|
|
19
19
|
`tapi studio` lists the Tapps available to that account, asks which one to open,
|
|
20
|
-
then starts Studio in that Tapp context.
|
|
21
|
-
|
|
22
|
-
know which Tapp to show.
|
|
20
|
+
then starts Studio in that Tapp context. Studio no longer reads project identity
|
|
21
|
+
from the current directory.
|
|
23
22
|
|
|
24
23
|
```bash
|
|
25
24
|
npm install @tapi-dev/sdk
|
|
@@ -66,8 +65,6 @@ Useful commands:
|
|
|
66
65
|
|
|
67
66
|
```bash
|
|
68
67
|
tapi login
|
|
69
|
-
tapi init --project brokerage
|
|
70
|
-
tapi link --project brokerage
|
|
71
68
|
tapi studio
|
|
72
69
|
tapi studio --tapp brokerage
|
|
73
70
|
tapi service install --channel pilot
|
|
@@ -75,21 +72,14 @@ tapi service status
|
|
|
75
72
|
tapi services describe schwab.place_order
|
|
76
73
|
tapi tapp create brokerage
|
|
77
74
|
tapi queue create "John"
|
|
78
|
-
tapi
|
|
79
|
-
tapi runner setup --runner-id john-laptop
|
|
80
|
-
tapi runner slot set john-laptop 1 queue_abc123
|
|
75
|
+
tapi runner gui
|
|
76
|
+
tapi runner setup --runner-id john-laptop
|
|
77
|
+
tapi runner slot set john-laptop 1 queue_abc123
|
|
81
78
|
tapi tapp service add brokerage schwab.place_order --service-map sm_123 --entry place_order
|
|
82
79
|
tapi triggers sync
|
|
83
80
|
tapi sessions
|
|
84
81
|
```
|
|
85
82
|
|
|
86
|
-
Local project identity lives in the app repo:
|
|
87
|
-
|
|
88
|
-
```text
|
|
89
|
-
.tapi/project.json
|
|
90
|
-
.tapi/services/catalog.json
|
|
91
|
-
```
|
|
92
|
-
|
|
93
83
|
ServiceMaps and service-run contracts are saved in the bound Tapi server
|
|
94
84
|
project. Runtime SDK calls read the service catalog from that project.
|
|
95
85
|
|
|
@@ -100,32 +90,39 @@ tapi tapp service add brokerage schwab.place_order \
|
|
|
100
90
|
--entry place_order
|
|
101
91
|
```
|
|
102
92
|
|
|
103
|
-
Create a queue
|
|
104
|
-
|
|
93
|
+
Create a queue and point one or more runner slots at that queue. Your app or
|
|
94
|
+
Tapp user supplies the same queue id when it starts a service run:
|
|
105
95
|
|
|
106
96
|
```bash
|
|
107
|
-
tapi queue create "John"
|
|
108
|
-
tapi tapp queue add brokerage queue_abc123
|
|
97
|
+
tapi queue create "John"
|
|
109
98
|
|
|
110
|
-
tapi runner slot set john-laptop 1 queue_abc123
|
|
111
|
-
--project brokerage
|
|
99
|
+
tapi runner slot set john-laptop 1 queue_abc123
|
|
112
100
|
```
|
|
113
101
|
|
|
114
|
-
For users setting up a local runner
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
For users setting up a local runner on Windows, open the installed desktop app
|
|
103
|
+
from Start by searching for `Tapi Runner`, or launch it from the CLI:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
tapi runner gui
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The desktop app reads the local runner identity, creates Railway queues, assigns
|
|
110
|
+
queue ids to runner slots, and copies queue ids so they can be pasted into the
|
|
111
|
+
Tapp/user setup flow.
|
|
112
|
+
|
|
113
|
+
`tapi runner setup` is kept as a legacy localhost setup page for development and
|
|
114
|
+
automation fallback:
|
|
117
115
|
|
|
118
116
|
```bash
|
|
119
117
|
tapi runner setup \
|
|
120
|
-
--runner-id john-laptop
|
|
121
|
-
--project brokerage
|
|
118
|
+
--runner-id john-laptop
|
|
122
119
|
```
|
|
123
120
|
|
|
124
121
|
## Quick Start
|
|
125
122
|
|
|
126
123
|
Create one TAPI client in server-side app code. Use a Firebase ID token for the
|
|
127
|
-
developer identity that owns and pays for the Tapp, the Tapp id that owns
|
|
128
|
-
service call
|
|
124
|
+
developer identity that owns and pays for the Tapp, plus the Tapp id that owns
|
|
125
|
+
the service call.
|
|
129
126
|
|
|
130
127
|
```ts
|
|
131
128
|
import { TapiClient } from "@tapi-dev/sdk";
|
|
@@ -165,7 +162,7 @@ const tapi = new TapiClient({
|
|
|
165
162
|
});
|
|
166
163
|
```
|
|
167
164
|
|
|
168
|
-
Inspect preserved sessions
|
|
165
|
+
Inspect preserved sessions:
|
|
169
166
|
|
|
170
167
|
```bash
|
|
171
168
|
tapi sessions
|
|
@@ -185,8 +182,7 @@ and selecting inputs/outputs. The SDK sees the public service-run name:
|
|
|
185
182
|
```
|
|
186
183
|
|
|
187
184
|
A service run is routed through a queue. The queue id is the only routing handle:
|
|
188
|
-
|
|
189
|
-
with the same queue id.
|
|
185
|
+
one or more runner slots must be configured with the same queue id.
|
|
190
186
|
|
|
191
187
|
```ts
|
|
192
188
|
const operation = await tapi.services.describe("schwab.place_order");
|
|
@@ -266,8 +262,8 @@ the website itself should stay as normal service outputs.
|
|
|
266
262
|
|
|
267
263
|
## Service Triggers
|
|
268
264
|
|
|
269
|
-
Triggers are scheduled service runs. Keep trigger definitions in the app repo
|
|
270
|
-
and sync them with
|
|
265
|
+
Triggers are scheduled service runs. Keep trigger definitions in the app repo
|
|
266
|
+
and sync them with an explicit Tapp/project context:
|
|
271
267
|
|
|
272
268
|
```ts
|
|
273
269
|
// tapi.config.ts
|
|
@@ -284,12 +280,11 @@ export default {
|
|
|
284
280
|
```
|
|
285
281
|
|
|
286
282
|
```bash
|
|
287
|
-
tapi triggers sync
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
`triggers sync` upserts by trigger name for the
|
|
291
|
-
|
|
292
|
-
numbers of seconds / strings like `30s`, `15m`, `2h`, and `1d`.
|
|
283
|
+
tapi triggers sync --project brokerage
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
`triggers sync` upserts by trigger name for the selected project. Schedules support standard five-field cron strings or intervals as
|
|
287
|
+
numbers of seconds / strings like `30s`, `15m`, `2h`, and `1d`.
|
|
293
288
|
|
|
294
289
|
You can also manage triggers directly:
|
|
295
290
|
|
|
@@ -342,7 +337,7 @@ await tapi.services.run("walmart.reorder", {
|
|
|
342
337
|
```
|
|
343
338
|
|
|
344
339
|
Use `TempProfile` for throwaway work. Temp profiles can be cloned from a
|
|
345
|
-
template profile and
|
|
340
|
+
template profile and different proxies:
|
|
346
341
|
|
|
347
342
|
```ts
|
|
348
343
|
const temp = await tapi.runtime.tempProfiles.provisionMany({
|
|
@@ -399,7 +394,7 @@ TAPI_PROJECT_ID=brokerage
|
|
|
399
394
|
```
|
|
400
395
|
|
|
401
396
|
`tappId` is required. Service calls are made for that Tapp, and the developer
|
|
402
|
-
who owns the Tapp pays for the service
|
|
397
|
+
who owns the Tapp pays for the service runner. If provided, `projectId` is
|
|
403
398
|
sent as the `X-Tapi-Project` header and the server rejects mismatches.
|
|
404
399
|
|
|
405
400
|
## Common Project Setup
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import type { TapiDevSession } from "./types.js";
|
|
3
|
-
import { type TapiWorkspace } from "./workspace.js";
|
|
4
3
|
export declare const PORTABLE_STUDIO_SERVER_READY_TIMEOUT_MS = 120000;
|
|
5
4
|
export type StudioChannel = "pilot" | "stable" | "nightly";
|
|
6
5
|
export interface StudioReleaseManifest {
|
|
@@ -62,11 +61,9 @@ export interface StudioCliOptions {
|
|
|
62
61
|
exePath?: string;
|
|
63
62
|
installToken?: string;
|
|
64
63
|
installTokenSource?: "option" | "env" | "minted";
|
|
65
|
-
workspace?: TapiWorkspace;
|
|
66
|
-
workspaceRoot?: string;
|
|
67
64
|
projectId?: string;
|
|
68
65
|
projectSlug?: string;
|
|
69
|
-
projectIdSource?: "option" | "env" | "
|
|
66
|
+
projectIdSource?: "option" | "env" | "selection";
|
|
70
67
|
workspaceMode: boolean;
|
|
71
68
|
launchUrlQuery?: string;
|
|
72
69
|
tappSelectionMode: "auto" | "select" | "last" | "none";
|
|
@@ -74,7 +71,6 @@ export interface StudioCliOptions {
|
|
|
74
71
|
export interface RunnerSetupCliOptions {
|
|
75
72
|
apiBaseUrl: string;
|
|
76
73
|
authToken?: string;
|
|
77
|
-
projectId: string;
|
|
78
74
|
runnerId: string;
|
|
79
75
|
port: number;
|
|
80
76
|
openBrowser: boolean;
|
|
@@ -89,7 +85,6 @@ export interface RunnerSetupAction {
|
|
|
89
85
|
export interface RunnerSetupActionResult {
|
|
90
86
|
queueId: string;
|
|
91
87
|
queue: Record<string, unknown>;
|
|
92
|
-
attachment: Record<string, unknown>;
|
|
93
88
|
slots: Record<string, unknown>[];
|
|
94
89
|
}
|
|
95
90
|
export interface RunnerSetupServerHandle {
|
|
@@ -148,10 +143,12 @@ export declare function validateStudioManifest(input: unknown): StudioReleaseMan
|
|
|
148
143
|
export declare function validateServiceReleaseManifest(input: unknown): ServiceReleaseManifest;
|
|
149
144
|
export declare function compareVersions(left: string, right: string): number;
|
|
150
145
|
export declare function memoizeStudioInstallToken(options: StudioCliOptions, installToken?: string, source?: StudioCliOptions["installTokenSource"]): string;
|
|
146
|
+
export declare function resolveStudioTappSelection(options: StudioCliOptions): Promise<StudioCliOptions>;
|
|
151
147
|
export declare function closeExistingPortableStudioServersForFreshLaunch(stopProcesses?: () => Promise<number>): Promise<{
|
|
152
148
|
stopped: number;
|
|
153
149
|
recordsRemoved: number;
|
|
154
150
|
}>;
|
|
151
|
+
export declare function studioServerLaunchArgs(): string[];
|
|
155
152
|
export declare function findPortablePlaywrightBrowsersDir(exePath: string): string | undefined;
|
|
156
153
|
export declare function waitForHttpOk(url: string, timeoutMs?: number, intervalMs?: number, fetchImpl?: FetchLike): Promise<void>;
|
|
157
154
|
export declare function chooseStudioPort(preferred?: number, options?: {
|