@tapi-dev/sdk 0.1.34 → 0.1.38

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/dist/types.d.ts CHANGED
@@ -2,21 +2,21 @@ import type { LateInput } from "./late-input.js";
2
2
  export type RunStatus = "queued" | "running" | "waiting_for_input" | "completed" | "failed" | "cancelled" | "needs_developer_attention";
3
3
  export interface TapiClientOptions {
4
4
  baseUrl: string;
5
- apiKey: string;
5
+ authToken: string;
6
+ tappId: string;
6
7
  projectId?: string;
7
8
  dev?: boolean;
8
9
  fetch?: typeof fetch;
9
10
  localControlUrl?: string;
10
11
  webSocket?: LocalWebSocketConstructor;
11
12
  }
12
- export interface WebsiteApiRunRequest {
13
+ export interface ServiceRunRequest {
14
+ queueId: string;
13
15
  inputs?: Record<string, unknown | LateInput<unknown>>;
14
16
  runtime?: RuntimeRunOptions;
15
17
  priority?: number;
16
- runnerId?: string;
17
18
  idempotencyKey?: string;
18
19
  site?: string;
19
- sitemapId?: string;
20
20
  }
21
21
  export interface CloudRunOptions {
22
22
  windows?: boolean;
@@ -33,23 +33,23 @@ export interface CloudRunPaymentOptions {
33
33
  successUrl?: string;
34
34
  cancelUrl?: string;
35
35
  }
36
- export interface WebsiteApiCloudQuoteRequest {
36
+ export interface ServiceCloudQuoteRequest {
37
37
  inputs?: Array<Record<string, unknown>>;
38
38
  cloud?: CloudRunOptions;
39
39
  user?: CloudRunUser;
40
+ runtime?: RuntimeRunOptions;
40
41
  site?: string;
41
42
  }
42
- export interface WebsiteApiCloudBatchRequest {
43
+ export interface ServiceCloudBatchRequest {
43
44
  inputs: Array<Record<string, unknown>>;
45
+ queueId: string;
44
46
  cloud?: CloudRunOptions;
45
47
  user?: CloudRunUser;
48
+ runtime?: RuntimeRunOptions;
46
49
  payment?: CloudRunPaymentOptions;
47
50
  site?: string;
48
51
  idempotencyKey?: string;
49
52
  }
50
- export type ServiceRunRequest = WebsiteApiRunRequest;
51
- export type ServiceCloudQuoteRequest = WebsiteApiCloudQuoteRequest;
52
- export type ServiceCloudBatchRequest = WebsiteApiCloudBatchRequest;
53
53
  export interface CloudRunQuote {
54
54
  inputCount: number;
55
55
  windows: boolean;
@@ -71,8 +71,9 @@ export interface CloudRunQuote {
71
71
  export interface CloudBatchRun {
72
72
  id: string;
73
73
  status: RunStatus | "payment_required" | "provisioning";
74
- apiName?: string;
75
- requestKey?: string;
74
+ serviceName: string;
75
+ serviceKey: string;
76
+ serviceRun?: string;
76
77
  site?: string;
77
78
  inputCount?: number;
78
79
  completedCount?: number;
@@ -138,7 +139,7 @@ export interface CloudCreditCheckout {
138
139
  paymentProvider: "stripe" | string;
139
140
  paymentProviderEnabled: boolean;
140
141
  }
141
- export interface WebsiteApiInputContract {
142
+ export interface ServiceInputContract {
142
143
  key: string;
143
144
  label?: string;
144
145
  type?: string;
@@ -149,62 +150,58 @@ export interface WebsiteApiInputContract {
149
150
  default?: unknown;
150
151
  [key: string]: unknown;
151
152
  }
152
- export interface WebsiteApiOutputContract {
153
+ export interface ServiceOutputContract {
153
154
  key: string;
154
155
  type?: string;
155
156
  [key: string]: unknown;
156
157
  }
157
- export interface WebsiteApiOperation {
158
+ export interface ServiceOperation {
158
159
  name: string;
159
- namespace: string;
160
- operation: string;
160
+ serviceName: string;
161
+ serviceKey: string;
162
+ serviceRun?: string;
161
163
  site?: string;
162
- sitemapId?: string;
163
164
  version?: string;
164
165
  status?: string;
165
- publishedAt?: string | null;
166
166
  deviceMode?: "desktop" | "mobile" | string;
167
167
  runtime?: RuntimeRunOptions | Record<string, unknown>;
168
- inputs: WebsiteApiInputContract[];
169
- outputs?: WebsiteApiOutputContract[];
168
+ inputs: ServiceInputContract[];
169
+ outputs?: ServiceOutputContract[];
170
170
  inputSchema?: Record<string, unknown>;
171
171
  outputSchema?: Record<string, unknown>;
172
172
  [key: string]: unknown;
173
173
  }
174
- export interface WebsiteApiTriggerSchedule {
174
+ export interface ServiceTriggerSchedule {
175
175
  intervalSeconds?: number;
176
176
  cron?: string;
177
177
  [key: string]: unknown;
178
178
  }
179
- export interface WebsiteApiTriggerCreateRequest {
179
+ export interface ServiceTriggerCreateRequest {
180
180
  name: string;
181
- serviceRun?: string;
182
- service?: string;
183
- apiRequest?: string;
181
+ serviceRun: string;
184
182
  enabled?: boolean;
185
- schedule?: WebsiteApiTriggerSchedule;
183
+ schedule?: ServiceTriggerSchedule;
186
184
  inputs?: Record<string, unknown>;
187
185
  runtime?: RuntimeRunOptions;
188
- runnerId?: string;
186
+ queueId: string;
189
187
  priority?: number;
190
188
  site?: string;
191
- sitemapId?: string;
192
189
  }
193
- export interface WebsiteApiTriggerUpdateRequest {
190
+ export interface ServiceTriggerUpdateRequest {
194
191
  enabled: boolean;
195
192
  }
196
- export interface WebsiteApiTrigger {
193
+ export interface ServiceTrigger {
197
194
  id: string;
198
195
  name: string;
199
- apiRequest: string;
200
- apiName: string;
201
- requestKey: string;
196
+ serviceRun: string;
197
+ serviceName: string;
198
+ serviceKey: string;
202
199
  site?: string;
203
200
  enabled: boolean;
204
- schedule?: WebsiteApiTriggerSchedule | Record<string, unknown>;
201
+ schedule?: ServiceTriggerSchedule | Record<string, unknown>;
205
202
  inputs?: Record<string, unknown>;
206
203
  runtime?: RuntimeRunOptions | Record<string, unknown>;
207
- runnerId?: string;
204
+ queueId?: string;
208
205
  priority?: number;
209
206
  lastRun?: TapiRun | Record<string, unknown> | null;
210
207
  lastError?: string;
@@ -214,39 +211,43 @@ export interface WebsiteApiTrigger {
214
211
  updatedAt?: string;
215
212
  [key: string]: unknown;
216
213
  }
217
- export interface WebsiteApiTriggerList {
218
- triggers: WebsiteApiTrigger[];
214
+ export interface ServiceTriggerList {
215
+ triggers: ServiceTrigger[];
219
216
  }
220
- export interface WebsiteApiTriggerRunResult {
217
+ export interface ServiceTriggerRunResult {
221
218
  success: boolean;
222
- trigger: WebsiteApiTrigger;
219
+ trigger: ServiceTrigger;
223
220
  run: TapiRun | Record<string, unknown>;
224
221
  }
225
222
  export interface TapiRun {
226
223
  id: string;
227
224
  status: RunStatus;
228
- apiName?: string;
229
- requestKey?: string;
225
+ serviceName: string;
226
+ serviceKey: string;
227
+ serviceRun?: string;
228
+ tappId?: string;
229
+ queueId?: string;
230
+ runnerId?: string;
231
+ slotIndex?: number;
232
+ deviceId?: string;
230
233
  result?: Record<string, unknown> | null;
231
234
  error?: Record<string, unknown> | null;
232
235
  runtime?: RuntimeRunOptions | Record<string, unknown> | null;
233
- waitingInput?: WebsiteApiWaitingInput | null;
234
- pendingInputs?: WebsiteApiWaitingInput[];
236
+ waitingInput?: ServiceWaitingInput | null;
237
+ pendingInputs?: ServiceWaitingInput[];
235
238
  createdAt?: string;
236
239
  updatedAt?: string;
237
240
  [key: string]: unknown;
238
241
  }
239
- export type ServiceInputContract = WebsiteApiInputContract;
240
- export type ServiceOutputContract = WebsiteApiOutputContract;
241
- export type ServiceOperation = WebsiteApiOperation;
242
242
  export type TapiDevSessionStatus = "queued" | "running" | "waiting_for_input" | "awaiting_takeover" | "needs_developer_attention" | "completed" | "failed" | "cancelled" | string;
243
243
  export interface TapiDevSession {
244
244
  id: string;
245
245
  projectId: string;
246
246
  sitemap: string;
247
247
  site?: string;
248
- apiName: string;
249
- requestKey: string;
248
+ serviceName: string;
249
+ serviceKey: string;
250
+ serviceRun?: string;
250
251
  status: TapiDevSessionStatus;
251
252
  stateId?: number | null;
252
253
  stateLabel?: string;
@@ -269,7 +270,7 @@ export interface TapiDevSessionsList {
269
270
  projectId: string;
270
271
  groups: TapiDevSessionGroup[];
271
272
  }
272
- export interface WebsiteApiWaitingInput {
273
+ export interface ServiceWaitingInput {
273
274
  key: string;
274
275
  label?: string;
275
276
  stateId?: number;
@@ -318,6 +319,7 @@ export interface RuntimeProfile {
318
319
  [key: string]: unknown;
319
320
  }
320
321
  export interface RuntimeRunOptions {
322
+ owner?: "service_run";
321
323
  profileRef?: string;
322
324
  destroyOnRelease?: boolean;
323
325
  [key: string]: unknown;
@@ -378,24 +380,23 @@ export interface SdkCatalogRequest {
378
380
  status: string;
379
381
  operation?: string;
380
382
  sdkName?: string;
381
- sitemapId?: string;
382
383
  deviceMode?: "desktop" | "mobile" | string;
383
384
  runtime?: RuntimeRunOptions | Record<string, unknown>;
384
- inputs?: WebsiteApiInputContract[];
385
+ inputs?: ServiceInputContract[];
385
386
  inputSchema?: Record<string, unknown>;
386
387
  outputSchema?: Record<string, unknown>;
387
388
  responseSchema?: Record<string, unknown>;
388
389
  [key: string]: unknown;
389
390
  }
390
- export interface SdkCatalogApi {
391
+ export interface SdkCatalogService {
391
392
  name: string;
392
- version: string;
393
+ serviceName: string;
394
+ version?: string;
393
395
  site?: string;
394
- sitemapId?: string;
395
396
  requests: SdkCatalogRequest[];
396
397
  [key: string]: unknown;
397
398
  }
398
399
  export interface SdkCatalog {
399
- apis: SdkCatalogApi[];
400
+ services: SdkCatalogService[];
400
401
  [key: string]: unknown;
401
402
  }
@@ -1,10 +1,5 @@
1
1
  export declare const TAPI_WORKSPACE_DIR = ".tapi";
2
2
  export declare const TAPI_WORKSPACE_CONFIG = "project.json";
3
- export interface TapiGeneratedConfig {
4
- catalog?: string;
5
- typescript?: string;
6
- [key: string]: unknown;
7
- }
8
3
  export interface TapiServicesConfig {
9
4
  catalog?: string;
10
5
  typescript?: string;
@@ -16,7 +11,6 @@ export interface TapiWorkspaceConfig {
16
11
  projectSlug?: string;
17
12
  apiBaseUrl?: string;
18
13
  services?: TapiServicesConfig;
19
- generated?: TapiGeneratedConfig;
20
14
  [key: string]: unknown;
21
15
  }
22
16
  export interface TapiWorkspace {
package/dist/workspace.js CHANGED
@@ -3,6 +3,7 @@ import { mkdir, writeFile } from "node:fs/promises";
3
3
  import { dirname, join, resolve } from "node:path";
4
4
  export const TAPI_WORKSPACE_DIR = ".tapi";
5
5
  export const TAPI_WORKSPACE_CONFIG = "project.json";
6
+ const RETIRED_SERVICE_HELPER_CONFIG_KEY = "gener" + "ated";
6
7
  export function findWorkspaceConfigPath(startDir = process.cwd()) {
7
8
  let current = resolve(startDir);
8
9
  while (true) {
@@ -52,15 +53,17 @@ export function readWorkspaceConfig(configPath) {
52
53
  const projectSlug = optionalProjectValue(parsed.projectSlug, "projectSlug");
53
54
  const apiBaseUrl = typeof parsed.apiBaseUrl === "string" && parsed.apiBaseUrl.trim() ? parsed.apiBaseUrl.trim() : undefined;
54
55
  const services = isRecord(parsed.services) ? { ...parsed.services } : undefined;
55
- const generated = isRecord(parsed.generated) ? { ...parsed.generated } : undefined;
56
+ if (Object.prototype.hasOwnProperty.call(parsed, RETIRED_SERVICE_HELPER_CONFIG_KEY)) {
57
+ throw new Error(`Tapi workspace config at ${configPath} uses retired service helper config. Remove '${RETIRED_SERVICE_HELPER_CONFIG_KEY}' and use 'services' instead.`);
58
+ }
59
+ const config = { ...parsed };
56
60
  return {
57
- ...parsed,
61
+ ...config,
58
62
  version: 1,
59
63
  projectId,
60
64
  ...(projectSlug ? { projectSlug } : {}),
61
65
  ...(apiBaseUrl ? { apiBaseUrl } : {}),
62
66
  ...(services ? { services } : {}),
63
- ...(generated ? { generated } : {}),
64
67
  };
65
68
  }
66
69
  export async function writeWorkspaceConfig(options) {
@@ -78,7 +81,6 @@ export async function writeWorkspaceConfig(options) {
78
81
  ...(options.apiBaseUrl ? { apiBaseUrl: options.apiBaseUrl } : {}),
79
82
  services: {
80
83
  catalog: ".tapi/services/catalog.json",
81
- typescript: "src/tapi.services.ts",
82
84
  },
83
85
  };
84
86
  await mkdir(dirname(configPath), { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapi-dev/sdk",
3
- "version": "0.1.34",
3
+ "version": "0.1.38",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",