@kabobcompany/lift 0.1.1 → 0.3.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 +18 -0
- package/dist/index.d.ts +378 -0
- package/dist/index.js +332 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,6 +16,24 @@ environment, where Lift puts them.
|
|
|
16
16
|
`importMedia(session, { url, name })` has Lookr download a file into the media library, and
|
|
17
17
|
`mediaReady(session, id)` waits until a video has finished transcoding.
|
|
18
18
|
|
|
19
|
+
`openai(path, body, options)` and `seedance(method, path, body, options)` call OpenAI and
|
|
20
|
+
BytePlus ModelArk on Kabob's account, with the services' own bodies and answers; Lift holds
|
|
21
|
+
the keys and counts what each call used. `startVideo` and `videoDone` make a Seedance video,
|
|
22
|
+
and `usage({ days, tag, companyId, by })` reads back what the app used, for one company or
|
|
23
|
+
split by company when asked.
|
|
24
|
+
|
|
25
|
+
`keepFile(bytes, { name, contentType })` keeps a file in Lift's storage and `fileUrl(id)`
|
|
26
|
+
gives an address to read it from for a while; `keepFromUrl`, `files`, `file`, `deleteFile`
|
|
27
|
+
and `storage` are the rest. An app reaches only its own files.
|
|
28
|
+
|
|
29
|
+
`enqueue(name, payload, { delay, key })` asks Lift to run a job in the background, and
|
|
30
|
+
`handleJob(request, handlers)` answers Lift's call when a job or a schedule from the app's
|
|
31
|
+
`lift.json` is due; `jobRuns`, `jobRun`, `cancelJob` and `jobs` show how they went.
|
|
32
|
+
|
|
33
|
+
`sendEmail({ to, subject, text, html })` sends an email from the app's own address and
|
|
34
|
+
`sendSms({ to, text })` a text message to one phone, both on Kabob's account and within
|
|
35
|
+
the limits Lift sets; `email()` and `sms()` say what those are and what was sent today.
|
|
36
|
+
|
|
19
37
|
A refusal is thrown as a `LiftError` with `status`, `code`, `message` and, on a 422,
|
|
20
38
|
`issues`.
|
|
21
39
|
|
package/dist/index.d.ts
CHANGED
|
@@ -118,4 +118,382 @@ export declare const runAction: (id: string) => Promise<{
|
|
|
118
118
|
export declare const stopAction: (id: string) => Promise<{
|
|
119
119
|
stopped_device_ids: number[];
|
|
120
120
|
}>;
|
|
121
|
+
export type Paid = {
|
|
122
|
+
/** The person signed in, to count the call under them. Without it the app calls for itself, as on a kiosk. */
|
|
123
|
+
who?: Signed | null;
|
|
124
|
+
/** Whose use this is, in the app's own words (a brand, a kiosk), at most 64 bytes. Usage can be read back per tag. */
|
|
125
|
+
tag?: string;
|
|
126
|
+
/**
|
|
127
|
+
* The Kabob company to count it under. With `who`: one of their companies
|
|
128
|
+
* (default: their current one). Without `who`: the company the app is
|
|
129
|
+
* working for, which Lift takes at the app's word; without it the call is
|
|
130
|
+
* counted under no company.
|
|
131
|
+
*/
|
|
132
|
+
companyId?: number | null;
|
|
133
|
+
/** How long to wait for the answer. Default: 3 minutes. */
|
|
134
|
+
timeoutMs?: number;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Call OpenAI through Lift, with OpenAI's own body and answer:
|
|
138
|
+
*
|
|
139
|
+
* const answer = await openai("responses", { model, input: "…" }, { tag: `brand-${brand.id}` })
|
|
140
|
+
*
|
|
141
|
+
* Paths: responses, chat/completions, embeddings, images/generations,
|
|
142
|
+
* images/edits, audio/transcriptions (pass a FormData for the last two).
|
|
143
|
+
* For a streamed answer or for speech, which is audio, use `openaiRaw`.
|
|
144
|
+
*/
|
|
145
|
+
export declare function openai<T = unknown>(path: string, body: unknown, options?: Paid): Promise<T>;
|
|
146
|
+
/**
|
|
147
|
+
* The same call, answered with the Response itself: for `stream: true`
|
|
148
|
+
* (responses and chat/completions; read `response.body` as server-sent
|
|
149
|
+
* events) and for audio/speech (`await response.arrayBuffer()`). A refusal is
|
|
150
|
+
* still thrown as a LiftError.
|
|
151
|
+
*/
|
|
152
|
+
export declare function openaiRaw(path: string, body: unknown, options?: Paid): Promise<Response>;
|
|
153
|
+
/** What Seedance says about a video task. `content.video_url` is there once `status` is "succeeded", for 24 hours. */
|
|
154
|
+
export type VideoTask = {
|
|
155
|
+
id: string;
|
|
156
|
+
model?: string;
|
|
157
|
+
status: "queued" | "running" | "succeeded" | "failed" | "cancelled" | "expired";
|
|
158
|
+
content?: {
|
|
159
|
+
video_url?: string;
|
|
160
|
+
last_frame_url?: string;
|
|
161
|
+
};
|
|
162
|
+
error?: {
|
|
163
|
+
code?: string;
|
|
164
|
+
message?: string;
|
|
165
|
+
};
|
|
166
|
+
usage?: {
|
|
167
|
+
completion_tokens?: number;
|
|
168
|
+
total_tokens?: number;
|
|
169
|
+
};
|
|
170
|
+
duration?: number;
|
|
171
|
+
resolution?: string;
|
|
172
|
+
ratio?: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Call BytePlus ModelArk through Lift, with its own body and answer:
|
|
176
|
+
*
|
|
177
|
+
* const { id } = await seedance("POST", "contents/generations/tasks", { model, content: [...] })
|
|
178
|
+
* const images = await seedance("POST", "images/generations", { model, prompt: "…" })
|
|
179
|
+
*
|
|
180
|
+
* A video is a task: see `startVideo` and `videoDone`.
|
|
181
|
+
*/
|
|
182
|
+
export declare function seedance<T = unknown>(method: "GET" | "POST" | "DELETE", path: string, body?: unknown, options?: Paid): Promise<T>;
|
|
183
|
+
/** Start making a video. Answers with the task's id at once; the video takes minutes. Keep the id. */
|
|
184
|
+
export declare const startVideo: (body: {
|
|
185
|
+
model: string;
|
|
186
|
+
content: unknown[];
|
|
187
|
+
[key: string]: unknown;
|
|
188
|
+
}, options?: Paid) => Promise<{
|
|
189
|
+
id: string;
|
|
190
|
+
}>;
|
|
191
|
+
/** The task now. Only the app that started a task can ask about it. */
|
|
192
|
+
export declare const video: (id: string, options?: Paid) => Promise<VideoTask>;
|
|
193
|
+
/** Cancel a task that is still waiting, or delete the record of a finished one. */
|
|
194
|
+
export declare const cancelVideo: (id: string, options?: Paid) => Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Wait until a video task has ended and answer it. Throws a LiftError with
|
|
197
|
+
* code "video_failed" when it failed or was cancelled, and "video_not_ready"
|
|
198
|
+
* when it is still being made after `timeoutMs` (15 minutes unless said
|
|
199
|
+
* otherwise): keep the id and ask again later with `video(id)`.
|
|
200
|
+
*/
|
|
201
|
+
export declare function videoDone(id: string, options?: Paid & {
|
|
202
|
+
everyMs?: number;
|
|
203
|
+
}): Promise<VideoTask>;
|
|
204
|
+
/** One model's use, added up. */
|
|
205
|
+
export type Used = {
|
|
206
|
+
integration: "openai" | "seedance";
|
|
207
|
+
kind: "text" | "embedding" | "image" | "speech" | "transcription" | "video";
|
|
208
|
+
model: string | null;
|
|
209
|
+
/** Calls that used something. */
|
|
210
|
+
calls: number;
|
|
211
|
+
/** How many of them are videos not finished yet, so not counted yet. */
|
|
212
|
+
pending: number;
|
|
213
|
+
input_tokens: number | null;
|
|
214
|
+
output_tokens: number | null;
|
|
215
|
+
total_tokens: number | null;
|
|
216
|
+
/** What was made that isn't tokens: `quantity` of `unit` ("images", "seconds", "characters"). */
|
|
217
|
+
quantity: number | null;
|
|
218
|
+
unit: string | null;
|
|
219
|
+
/** Only with `by: "company"`: the company these calls were counted under, or null for calls counted under none. */
|
|
220
|
+
company_id?: number | null;
|
|
221
|
+
/** Only with `by: "company"`: its name the last time a signed-in person's call said it, or null. */
|
|
222
|
+
company_name?: string | null;
|
|
223
|
+
/** Only with `by: "tag"`: the tag these calls were sent with, or null for calls sent with none. */
|
|
224
|
+
tag?: string | null;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* What this app used in the last `days` (30 unless said otherwise), per
|
|
228
|
+
* model. `tag` keeps only what was sent with that tag, `companyId` only what
|
|
229
|
+
* was counted under that company, and `by: "company"` or `by: "tag"` answers
|
|
230
|
+
* one row per model and company, or per model and tag.
|
|
231
|
+
*/
|
|
232
|
+
export declare function usage(options?: {
|
|
233
|
+
days?: number;
|
|
234
|
+
tag?: string;
|
|
235
|
+
companyId?: number;
|
|
236
|
+
by?: "company" | "tag";
|
|
237
|
+
}): Promise<{
|
|
238
|
+
since: string;
|
|
239
|
+
usage: Used[];
|
|
240
|
+
}>;
|
|
241
|
+
export type StoredFile = {
|
|
242
|
+
id: string;
|
|
243
|
+
name: string;
|
|
244
|
+
content_type: string;
|
|
245
|
+
size: number;
|
|
246
|
+
/** `pending` until its bytes have arrived. */
|
|
247
|
+
state: "pending" | "ready";
|
|
248
|
+
tag: string | null;
|
|
249
|
+
company_id: number | null;
|
|
250
|
+
created_at: string;
|
|
251
|
+
/** When Lift deletes it by itself; null for a file that is kept. */
|
|
252
|
+
expires_at: string | null;
|
|
253
|
+
};
|
|
254
|
+
export type Keep = Paid & {
|
|
255
|
+
/** What the file is called, such as "poster.png". Shown, and used when it is saved; not a path. */
|
|
256
|
+
name: string;
|
|
257
|
+
/** Its media type, such as "image/png". Lift keeps images, video, audio, PDF, text, CSV, JSON and Office documents. */
|
|
258
|
+
contentType: string;
|
|
259
|
+
/** Delete it by itself after this many seconds (60 to a year). Without it the file is kept until deleted. */
|
|
260
|
+
expiresIn?: number;
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Keep a file in Lift's storage:
|
|
264
|
+
*
|
|
265
|
+
* const file = await keepFile(bytes, { name: "poster.png", contentType: "image/png", tag: `brand-${brand.id}` })
|
|
266
|
+
* const { url } = await fileUrl(file.id) // to show it, or for a QR code
|
|
267
|
+
*
|
|
268
|
+
* `bytes` is a Buffer, Uint8Array, ArrayBuffer or Blob: all of it, as its
|
|
269
|
+
* length is announced first and checked after. The bytes go straight to
|
|
270
|
+
* storage, not through Lift.
|
|
271
|
+
*/
|
|
272
|
+
export declare function keepFile(bytes: Uint8Array | ArrayBuffer | Blob, options: Keep): Promise<StoredFile>;
|
|
273
|
+
/**
|
|
274
|
+
* Copy a file from an address into storage, such as a finished video, whose
|
|
275
|
+
* address at the service stops working after about a day:
|
|
276
|
+
*
|
|
277
|
+
* const file = await keepFromUrl(task.content.video_url, { name: "ad.mp4", tag })
|
|
278
|
+
*
|
|
279
|
+
* The app's server downloads it, so only give it addresses the app got from
|
|
280
|
+
* a service, never one a visitor typed.
|
|
281
|
+
*/
|
|
282
|
+
export declare function keepFromUrl(url: string, options: Omit<Keep, "contentType"> & {
|
|
283
|
+
contentType?: string;
|
|
284
|
+
}): Promise<StoredFile>;
|
|
285
|
+
/** The app's files, newest first; 50 at a time unless `limit` says otherwise (200 at most). */
|
|
286
|
+
export declare function files(options?: Paid & {
|
|
287
|
+
limit?: number;
|
|
288
|
+
offset?: number;
|
|
289
|
+
ofCompany?: number;
|
|
290
|
+
}): Promise<StoredFile[]>;
|
|
291
|
+
export declare const file: (id: string, options?: Paid) => Promise<StoredFile>;
|
|
292
|
+
/**
|
|
293
|
+
* An address the file can be read from, by anyone who has it, for
|
|
294
|
+
* `expiresIn` seconds (default an hour, a week at most, never longer than the
|
|
295
|
+
* file is kept). `download` makes a browser save it instead of showing it.
|
|
296
|
+
*/
|
|
297
|
+
export declare const fileUrl: (id: string, options?: Paid & {
|
|
298
|
+
expiresIn?: number;
|
|
299
|
+
download?: boolean;
|
|
300
|
+
}) => Promise<{
|
|
301
|
+
url: string;
|
|
302
|
+
expires_at: string;
|
|
303
|
+
}>;
|
|
304
|
+
export declare const deleteFile: (id: string, options?: Paid) => Promise<void>;
|
|
305
|
+
/** How much the app holds and how much it may. */
|
|
306
|
+
export declare const storage: (options?: Paid) => Promise<{
|
|
307
|
+
held: {
|
|
308
|
+
files: number;
|
|
309
|
+
bytes: number;
|
|
310
|
+
};
|
|
311
|
+
limits: {
|
|
312
|
+
max_file_bytes: number;
|
|
313
|
+
app_bytes: number;
|
|
314
|
+
app_files: number;
|
|
315
|
+
content_types: string[];
|
|
316
|
+
};
|
|
317
|
+
}>;
|
|
318
|
+
export type JobRun = {
|
|
319
|
+
id: string;
|
|
320
|
+
name: string;
|
|
321
|
+
/** `cron` for a schedule coming due, `job` for one the app asked for. */
|
|
322
|
+
kind: "cron" | "job";
|
|
323
|
+
key: string | null;
|
|
324
|
+
state: "queued" | "running" | "done" | "failed" | "cancelled";
|
|
325
|
+
/** How many times it has been tried so far. */
|
|
326
|
+
attempt: number;
|
|
327
|
+
max_attempts: number;
|
|
328
|
+
/** Seconds one attempt may take. */
|
|
329
|
+
timeout: number;
|
|
330
|
+
payload: unknown;
|
|
331
|
+
run_at: string;
|
|
332
|
+
started_at: string | null;
|
|
333
|
+
finished_at: string | null;
|
|
334
|
+
duration_ms: number | null;
|
|
335
|
+
/** The HTTP status the app answered the last attempt with. */
|
|
336
|
+
status: number | null;
|
|
337
|
+
/** The start of what the app answered. */
|
|
338
|
+
output: string | null;
|
|
339
|
+
/** Why the last attempt failed: status, timeout, unreachable, no_handler, not_started, not_running, interrupted. */
|
|
340
|
+
error: string | null;
|
|
341
|
+
created_at: string;
|
|
342
|
+
};
|
|
343
|
+
export type JobSchedule = {
|
|
344
|
+
name: string;
|
|
345
|
+
/** Five cron fields, such as "0 3 * * *". */
|
|
346
|
+
schedule: string;
|
|
347
|
+
/** Minutes ahead of UTC the schedule's clock is. */
|
|
348
|
+
utc_offset: number;
|
|
349
|
+
timeout: number;
|
|
350
|
+
attempts: number;
|
|
351
|
+
next_run_at: string | null;
|
|
352
|
+
last: JobRun | null;
|
|
353
|
+
};
|
|
354
|
+
/** What a job handler is given. */
|
|
355
|
+
export type Job<P = unknown> = {
|
|
356
|
+
/** The run's id: the same on every attempt, so use it to not do the work twice. */
|
|
357
|
+
id: string;
|
|
358
|
+
name: string;
|
|
359
|
+
kind: "cron" | "job";
|
|
360
|
+
/** 1 on the first try. */
|
|
361
|
+
attempt: number;
|
|
362
|
+
maxAttempts: number;
|
|
363
|
+
/** When it was due. */
|
|
364
|
+
scheduledAt: string;
|
|
365
|
+
payload: P;
|
|
366
|
+
};
|
|
367
|
+
/** Does the work of one job. What it returns is kept as the run's output; throwing fails the attempt. */
|
|
368
|
+
export type JobHandler = (job: Job<any>) => unknown | Promise<unknown>;
|
|
369
|
+
/**
|
|
370
|
+
* Ask Lift to run a job, now or later:
|
|
371
|
+
*
|
|
372
|
+
* await enqueue("send-report", { brandId: 7 })
|
|
373
|
+
* await enqueue("check-video", { taskId }, { delay: 30, key: taskId })
|
|
374
|
+
*
|
|
375
|
+
* Lift then calls the app's handler of that name with the payload. `delay`
|
|
376
|
+
* is seconds from now and `runAt` a time (a month ahead at most); `attempts`
|
|
377
|
+
* is how often to try (3 unless said, 10 at most) and `timeout` how many
|
|
378
|
+
* seconds one try may take. With a `key`, asking again while a run of that
|
|
379
|
+
* name and key waits or runs gives that run back instead of a second one.
|
|
380
|
+
* The payload is JSON, 64 KB at most: keep the data in the app and pass ids.
|
|
381
|
+
*/
|
|
382
|
+
export declare function enqueue(name: string, payload?: unknown, options?: {
|
|
383
|
+
delay?: number;
|
|
384
|
+
runAt?: Date | string;
|
|
385
|
+
attempts?: number;
|
|
386
|
+
timeout?: number;
|
|
387
|
+
key?: string;
|
|
388
|
+
}): Promise<JobRun>;
|
|
389
|
+
/** The app's runs, newest first; 50 at a time unless `limit` says otherwise (200 at most). */
|
|
390
|
+
export declare function jobRuns(options?: {
|
|
391
|
+
name?: string;
|
|
392
|
+
state?: JobRun["state"];
|
|
393
|
+
kind?: JobRun["kind"];
|
|
394
|
+
limit?: number;
|
|
395
|
+
offset?: number;
|
|
396
|
+
}): Promise<JobRun[]>;
|
|
397
|
+
export declare const jobRun: (id: string) => Promise<JobRun>;
|
|
398
|
+
/** Takes back a run that hasn't started; a 409 `not_queued` if it has. */
|
|
399
|
+
export declare const cancelJob: (id: string) => Promise<JobRun>;
|
|
400
|
+
/** The app's schedules, how many runs wait, run and failed in the last day, and the limits. */
|
|
401
|
+
export declare const jobs: () => Promise<{
|
|
402
|
+
schedules: JobSchedule[];
|
|
403
|
+
counts: {
|
|
404
|
+
queued: number;
|
|
405
|
+
running: number;
|
|
406
|
+
failed: number;
|
|
407
|
+
};
|
|
408
|
+
limits: {
|
|
409
|
+
max_seconds: number;
|
|
410
|
+
max_attempts: number;
|
|
411
|
+
queued_per_app: number;
|
|
412
|
+
payload_bytes: number;
|
|
413
|
+
};
|
|
414
|
+
}>;
|
|
415
|
+
/**
|
|
416
|
+
* Answers Lift's call to run a job. Mount it at POST /_lift/jobs/:name:
|
|
417
|
+
*
|
|
418
|
+
* app.post("/_lift/jobs/:name", (c) => handleJob(c.req.raw, handlers))
|
|
419
|
+
*
|
|
420
|
+
* It checks that the call is Lift's (signed with the app's client secret,
|
|
421
|
+
* within the last five minutes), runs the handler of that name and answers
|
|
422
|
+
* for it: 200 with what the handler returned, 500 if it threw (Lift tries
|
|
423
|
+
* again while the run has attempts left), 404 for a name with no handler
|
|
424
|
+
* (not tried again).
|
|
425
|
+
*
|
|
426
|
+
* A job may run more than once: an attempt whose answer never reached Lift
|
|
427
|
+
* is tried again. Make handlers safe to repeat.
|
|
428
|
+
*/
|
|
429
|
+
export declare function handleJob(request: Request, handlers: Record<string, JobHandler>): Promise<Response>;
|
|
430
|
+
export type SentEmail = {
|
|
431
|
+
id: string;
|
|
432
|
+
from: string;
|
|
433
|
+
to: string[];
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
436
|
+
* Send an email:
|
|
437
|
+
*
|
|
438
|
+
* await sendEmail({ to: customer.email, subject: "Your try-on", html, text }, { tag: `brand-${brand.id}` })
|
|
439
|
+
*
|
|
440
|
+
* It comes from the app's own address (`<app>@lift.kabob.io`) under the
|
|
441
|
+
* app's name; set `replyTo` to where answers should go. Give `text`, `html`
|
|
442
|
+
* or both (256 KB together at most), to 10 addresses at most. There are no
|
|
443
|
+
* attachments: put the file in storage and link to it with `fileUrl`.
|
|
444
|
+
*
|
|
445
|
+
* Throws a `LiftError`: 429 `daily_limit` (the app sent its day's worth),
|
|
446
|
+
* 429 `recipient_limit` (that address got enough from this app for now),
|
|
447
|
+
* 422 `refused` (the mail service won't send this one; `message` says why).
|
|
448
|
+
*/
|
|
449
|
+
export declare function sendEmail(message: {
|
|
450
|
+
to: string | string[];
|
|
451
|
+
subject: string;
|
|
452
|
+
text?: string;
|
|
453
|
+
html?: string;
|
|
454
|
+
replyTo?: string | string[];
|
|
455
|
+
}, options?: Paid): Promise<SentEmail>;
|
|
456
|
+
/** The app's address, how many emails it sent today, and its limits. */
|
|
457
|
+
export declare const email: (options?: Paid) => Promise<{
|
|
458
|
+
from: string;
|
|
459
|
+
sent_today: number;
|
|
460
|
+
limits: {
|
|
461
|
+
app_per_day: number;
|
|
462
|
+
max_recipients: number;
|
|
463
|
+
max_bytes: number;
|
|
464
|
+
};
|
|
465
|
+
}>;
|
|
466
|
+
export type SentSms = {
|
|
467
|
+
id: string;
|
|
468
|
+
to: string;
|
|
469
|
+
segments: number;
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Send a text message to one phone:
|
|
473
|
+
*
|
|
474
|
+
* await sendSms({ to: "+886912345678", text: `Your code is ${code}` }, { tag })
|
|
475
|
+
*
|
|
476
|
+
* `to` has its country code; Lift only texts the countries it lists
|
|
477
|
+
* (`sms()`), Taiwan unless set otherwise. Every message costs money by
|
|
478
|
+
* segment: 160 plain letters, or 70 with Chinese or emoji, and three
|
|
479
|
+
* segments at most. Send one only when a person asked for it, and never let
|
|
480
|
+
* a visitor choose the text.
|
|
481
|
+
*
|
|
482
|
+
* Throws a `LiftError`: 403 `country_not_allowed`, 413 `too_long`, 429
|
|
483
|
+
* `daily_limit`, 429 `recipient_limit` (a number gets a few an hour), 422
|
|
484
|
+
* `refused` (the network won't send this one; `message` says why).
|
|
485
|
+
*/
|
|
486
|
+
export declare function sendSms(message: {
|
|
487
|
+
to: string;
|
|
488
|
+
text: string;
|
|
489
|
+
}, options?: Paid): Promise<SentSms>;
|
|
490
|
+
/** How many segments the app sent today, its limits, and the countries Lift texts. */
|
|
491
|
+
export declare const sms: (options?: Paid) => Promise<{
|
|
492
|
+
sent_today: number;
|
|
493
|
+
limits: {
|
|
494
|
+
app_per_day: number;
|
|
495
|
+
max_segments: number;
|
|
496
|
+
countries: string[];
|
|
497
|
+
};
|
|
498
|
+
}>;
|
|
121
499
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @kabobcompany/lift: what an app hosted on Lift uses to work with Kabob
|
|
2
|
-
// products through Lift
|
|
2
|
+
// products through Lift, and to call the paid services Lift holds the keys
|
|
3
|
+
// to (OpenAI, Seedance). Server side only.
|
|
3
4
|
//
|
|
4
5
|
// Lift sets LIFT_ISSUER, LIFT_CLIENT_ID and LIFT_CLIENT_SECRET in the app's
|
|
5
6
|
// container; this package reads them, or what configure() was given.
|
|
@@ -135,3 +136,333 @@ export const listAllActions = async () => (await asApp("GET", "actions")).action
|
|
|
135
136
|
export const runAction = (id) => asApp("POST", `actions/${encodeURIComponent(id)}/run`);
|
|
136
137
|
/** End the action's last run before its time is up. */
|
|
137
138
|
export const stopAction = (id) => asApp("POST", `actions/${encodeURIComponent(id)}/stop`);
|
|
139
|
+
async function paid(service, method, path, body, options) {
|
|
140
|
+
const { issuer, clientId, clientSecret } = settings();
|
|
141
|
+
const who = options.who;
|
|
142
|
+
const signedIn = !!who?.accessToken && (who.accessTokenExpiresAt ?? 0) > Date.now() / 1000;
|
|
143
|
+
if (!signedIn && (!clientId || !clientSecret)) {
|
|
144
|
+
throw new LiftError(503, "not_configured", "Calling a paid service with nobody signed in needs LIFT_CLIENT_ID and LIFT_CLIENT_SECRET.");
|
|
145
|
+
}
|
|
146
|
+
const url = new URL(`${issuer}/integrations/${service}/${path.replace(/^\//, "")}`.replace(/\/$/, ""));
|
|
147
|
+
if (options.companyId != null)
|
|
148
|
+
url.searchParams.set("company_id", String(options.companyId));
|
|
149
|
+
const form = typeof FormData !== "undefined" && body instanceof FormData;
|
|
150
|
+
return fetch(url, {
|
|
151
|
+
method,
|
|
152
|
+
headers: {
|
|
153
|
+
authorization: signedIn
|
|
154
|
+
? `Bearer ${who.accessToken}`
|
|
155
|
+
: `Basic ${Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString("base64")}`,
|
|
156
|
+
...(options.tag && { "x-lift-tag": options.tag }),
|
|
157
|
+
// A form sets its own content type, with its boundary.
|
|
158
|
+
...(body !== undefined && !form && { "content-type": "application/json" }),
|
|
159
|
+
},
|
|
160
|
+
body: body === undefined ? undefined : form ? body : JSON.stringify(body),
|
|
161
|
+
signal: AbortSignal.timeout(options.timeoutMs ?? 180_000),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// Both services answer a refusal with { error: { code or type, message } }; Lift with { error, message }.
|
|
165
|
+
async function paidAnswer(response, service) {
|
|
166
|
+
if (response.status === 204)
|
|
167
|
+
return undefined;
|
|
168
|
+
const body = (await response.json().catch(() => null));
|
|
169
|
+
if (!response.ok) {
|
|
170
|
+
const error = body?.error;
|
|
171
|
+
const theirs = error && typeof error === "object" ? error : null;
|
|
172
|
+
throw new LiftError(response.status, String(theirs?.code ?? theirs?.type ?? error ?? "integration_error"), String(theirs?.message ?? body?.message ?? `${service} answered ${response.status}.`));
|
|
173
|
+
}
|
|
174
|
+
return body;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Call OpenAI through Lift, with OpenAI's own body and answer:
|
|
178
|
+
*
|
|
179
|
+
* const answer = await openai("responses", { model, input: "…" }, { tag: `brand-${brand.id}` })
|
|
180
|
+
*
|
|
181
|
+
* Paths: responses, chat/completions, embeddings, images/generations,
|
|
182
|
+
* images/edits, audio/transcriptions (pass a FormData for the last two).
|
|
183
|
+
* For a streamed answer or for speech, which is audio, use `openaiRaw`.
|
|
184
|
+
*/
|
|
185
|
+
export async function openai(path, body, options = {}) {
|
|
186
|
+
return paidAnswer(await paid("openai", "POST", path, body, options), "OpenAI");
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The same call, answered with the Response itself: for `stream: true`
|
|
190
|
+
* (responses and chat/completions; read `response.body` as server-sent
|
|
191
|
+
* events) and for audio/speech (`await response.arrayBuffer()`). A refusal is
|
|
192
|
+
* still thrown as a LiftError.
|
|
193
|
+
*/
|
|
194
|
+
export async function openaiRaw(path, body, options = {}) {
|
|
195
|
+
const response = await paid("openai", "POST", path, body, options);
|
|
196
|
+
if (!response.ok)
|
|
197
|
+
return paidAnswer(response, "OpenAI");
|
|
198
|
+
return response;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Call BytePlus ModelArk through Lift, with its own body and answer:
|
|
202
|
+
*
|
|
203
|
+
* const { id } = await seedance("POST", "contents/generations/tasks", { model, content: [...] })
|
|
204
|
+
* const images = await seedance("POST", "images/generations", { model, prompt: "…" })
|
|
205
|
+
*
|
|
206
|
+
* A video is a task: see `startVideo` and `videoDone`.
|
|
207
|
+
*/
|
|
208
|
+
export async function seedance(method, path, body, options = {}) {
|
|
209
|
+
return paidAnswer(await paid("seedance", method, path, body, options), "Seedance");
|
|
210
|
+
}
|
|
211
|
+
/** Start making a video. Answers with the task's id at once; the video takes minutes. Keep the id. */
|
|
212
|
+
export const startVideo = (body, options = {}) => seedance("POST", "contents/generations/tasks", body, options);
|
|
213
|
+
/** The task now. Only the app that started a task can ask about it. */
|
|
214
|
+
export const video = (id, options = {}) => seedance("GET", `contents/generations/tasks/${encodeURIComponent(id)}`, undefined, options);
|
|
215
|
+
/** Cancel a task that is still waiting, or delete the record of a finished one. */
|
|
216
|
+
export const cancelVideo = (id, options = {}) => seedance("DELETE", `contents/generations/tasks/${encodeURIComponent(id)}`, undefined, options);
|
|
217
|
+
/**
|
|
218
|
+
* Wait until a video task has ended and answer it. Throws a LiftError with
|
|
219
|
+
* code "video_failed" when it failed or was cancelled, and "video_not_ready"
|
|
220
|
+
* when it is still being made after `timeoutMs` (15 minutes unless said
|
|
221
|
+
* otherwise): keep the id and ask again later with `video(id)`.
|
|
222
|
+
*/
|
|
223
|
+
export async function videoDone(id, options = {}) {
|
|
224
|
+
const until = Date.now() + (options.timeoutMs ?? 900_000);
|
|
225
|
+
for (;;) {
|
|
226
|
+
const task = await video(id, { ...options, timeoutMs: 30_000 });
|
|
227
|
+
if (task.status === "succeeded")
|
|
228
|
+
return task;
|
|
229
|
+
if (task.status !== "queued" && task.status !== "running") {
|
|
230
|
+
throw new LiftError(422, "video_failed", task.error?.message ?? `The video was not made (${task.status}).`);
|
|
231
|
+
}
|
|
232
|
+
if (Date.now() >= until)
|
|
233
|
+
throw new LiftError(504, "video_not_ready", "The video is still being made. Ask again in a few minutes.");
|
|
234
|
+
await new Promise((resolve) => setTimeout(resolve, options.everyMs ?? 5_000));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* What this app used in the last `days` (30 unless said otherwise), per
|
|
239
|
+
* model. `tag` keeps only what was sent with that tag, `companyId` only what
|
|
240
|
+
* was counted under that company, and `by: "company"` or `by: "tag"` answers
|
|
241
|
+
* one row per model and company, or per model and tag.
|
|
242
|
+
*/
|
|
243
|
+
export async function usage(options = {}) {
|
|
244
|
+
const { issuer, clientId, clientSecret } = settings();
|
|
245
|
+
if (!clientId || !clientSecret)
|
|
246
|
+
throw new LiftError(503, "not_configured", "Reading usage needs LIFT_CLIENT_ID and LIFT_CLIENT_SECRET.");
|
|
247
|
+
const url = new URL(`${issuer}/integrations/usage`);
|
|
248
|
+
if (options.days != null)
|
|
249
|
+
url.searchParams.set("days", String(options.days));
|
|
250
|
+
if (options.tag != null)
|
|
251
|
+
url.searchParams.set("tag", options.tag);
|
|
252
|
+
if (options.companyId != null)
|
|
253
|
+
url.searchParams.set("company_id", String(options.companyId));
|
|
254
|
+
if (options.by != null)
|
|
255
|
+
url.searchParams.set("by", options.by);
|
|
256
|
+
const basic = Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString("base64");
|
|
257
|
+
const response = await fetch(url, { headers: { authorization: `Basic ${basic}` }, signal: AbortSignal.timeout(25_000) });
|
|
258
|
+
return answer(response, "Lift");
|
|
259
|
+
}
|
|
260
|
+
const stored = async (method, path, body, options) => paidAnswer(await paid("storage", method, path, body, { timeoutMs: 25_000, ...options }), "Lift");
|
|
261
|
+
/**
|
|
262
|
+
* Keep a file in Lift's storage:
|
|
263
|
+
*
|
|
264
|
+
* const file = await keepFile(bytes, { name: "poster.png", contentType: "image/png", tag: `brand-${brand.id}` })
|
|
265
|
+
* const { url } = await fileUrl(file.id) // to show it, or for a QR code
|
|
266
|
+
*
|
|
267
|
+
* `bytes` is a Buffer, Uint8Array, ArrayBuffer or Blob: all of it, as its
|
|
268
|
+
* length is announced first and checked after. The bytes go straight to
|
|
269
|
+
* storage, not through Lift.
|
|
270
|
+
*/
|
|
271
|
+
export async function keepFile(bytes, options) {
|
|
272
|
+
const { name, contentType, expiresIn, ...who } = options;
|
|
273
|
+
const blob = bytes instanceof Blob ? bytes : new Blob([bytes]);
|
|
274
|
+
const { file, upload } = await stored("POST", "files", { name, content_type: contentType, size: blob.size, ...(expiresIn != null && { expires_in: expiresIn }) }, who);
|
|
275
|
+
// fetch sets the length from the body itself.
|
|
276
|
+
const sent = await fetch(upload.url, {
|
|
277
|
+
method: upload.method,
|
|
278
|
+
headers: { "content-type": upload.headers["content-type"] },
|
|
279
|
+
body: blob,
|
|
280
|
+
signal: AbortSignal.timeout(options.timeoutMs ?? 600_000),
|
|
281
|
+
});
|
|
282
|
+
if (!sent.ok) {
|
|
283
|
+
await stored("DELETE", `files/${file.id}`, undefined, who).catch(() => { });
|
|
284
|
+
throw new LiftError(502, "upload_failed", `Storage refused the upload (${sent.status}).`);
|
|
285
|
+
}
|
|
286
|
+
return (await stored("POST", `files/${file.id}/done`, undefined, who)).file;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Copy a file from an address into storage, such as a finished video, whose
|
|
290
|
+
* address at the service stops working after about a day:
|
|
291
|
+
*
|
|
292
|
+
* const file = await keepFromUrl(task.content.video_url, { name: "ad.mp4", tag })
|
|
293
|
+
*
|
|
294
|
+
* The app's server downloads it, so only give it addresses the app got from
|
|
295
|
+
* a service, never one a visitor typed.
|
|
296
|
+
*/
|
|
297
|
+
export async function keepFromUrl(url, options) {
|
|
298
|
+
const response = await fetch(url, { signal: AbortSignal.timeout(options.timeoutMs ?? 600_000) });
|
|
299
|
+
if (!response.ok)
|
|
300
|
+
throw new LiftError(502, "download_failed", `The file couldn't be downloaded (${response.status}).`);
|
|
301
|
+
const blob = await response.blob();
|
|
302
|
+
const contentType = options.contentType ?? response.headers.get("content-type")?.split(";")[0] ?? "application/octet-stream";
|
|
303
|
+
return keepFile(blob, { ...options, contentType });
|
|
304
|
+
}
|
|
305
|
+
/** The app's files, newest first; 50 at a time unless `limit` says otherwise (200 at most). */
|
|
306
|
+
export async function files(options = {}) {
|
|
307
|
+
const { limit, offset, ofCompany, ...who } = options;
|
|
308
|
+
const query = new URLSearchParams();
|
|
309
|
+
if (limit != null)
|
|
310
|
+
query.set("limit", String(limit));
|
|
311
|
+
if (offset != null)
|
|
312
|
+
query.set("offset", String(offset));
|
|
313
|
+
if (who.tag != null)
|
|
314
|
+
query.set("tag", who.tag);
|
|
315
|
+
// `companyId` both says who is asking for and narrows to that company's files.
|
|
316
|
+
const companyId = ofCompany ?? who.companyId;
|
|
317
|
+
return (await stored("GET", `files?${query}`, undefined, { ...who, tag: undefined, companyId })).files;
|
|
318
|
+
}
|
|
319
|
+
export const file = async (id, options = {}) => (await stored("GET", `files/${encodeURIComponent(id)}`, undefined, options)).file;
|
|
320
|
+
/**
|
|
321
|
+
* An address the file can be read from, by anyone who has it, for
|
|
322
|
+
* `expiresIn` seconds (default an hour, a week at most, never longer than the
|
|
323
|
+
* file is kept). `download` makes a browser save it instead of showing it.
|
|
324
|
+
*/
|
|
325
|
+
export const fileUrl = (id, options = {}) => {
|
|
326
|
+
const { expiresIn, download, ...who } = options;
|
|
327
|
+
const query = new URLSearchParams();
|
|
328
|
+
if (expiresIn != null)
|
|
329
|
+
query.set("expires_in", String(expiresIn));
|
|
330
|
+
if (download)
|
|
331
|
+
query.set("download", "1");
|
|
332
|
+
return stored("GET", `files/${encodeURIComponent(id)}/url?${query}`, undefined, who);
|
|
333
|
+
};
|
|
334
|
+
export const deleteFile = (id, options = {}) => stored("DELETE", `files/${encodeURIComponent(id)}`, undefined, options);
|
|
335
|
+
/** How much the app holds and how much it may. */
|
|
336
|
+
export const storage = (options = {}) => stored("GET", "", undefined, options);
|
|
337
|
+
const jobsCall = async (method, path, body) => paidAnswer(await paid("jobs", method, path, body, { timeoutMs: 25_000 }), "Lift");
|
|
338
|
+
/**
|
|
339
|
+
* Ask Lift to run a job, now or later:
|
|
340
|
+
*
|
|
341
|
+
* await enqueue("send-report", { brandId: 7 })
|
|
342
|
+
* await enqueue("check-video", { taskId }, { delay: 30, key: taskId })
|
|
343
|
+
*
|
|
344
|
+
* Lift then calls the app's handler of that name with the payload. `delay`
|
|
345
|
+
* is seconds from now and `runAt` a time (a month ahead at most); `attempts`
|
|
346
|
+
* is how often to try (3 unless said, 10 at most) and `timeout` how many
|
|
347
|
+
* seconds one try may take. With a `key`, asking again while a run of that
|
|
348
|
+
* name and key waits or runs gives that run back instead of a second one.
|
|
349
|
+
* The payload is JSON, 64 KB at most: keep the data in the app and pass ids.
|
|
350
|
+
*/
|
|
351
|
+
export async function enqueue(name, payload, options = {}) {
|
|
352
|
+
const { runAt, ...rest } = options;
|
|
353
|
+
const body = {
|
|
354
|
+
name,
|
|
355
|
+
...(payload !== undefined && { payload }),
|
|
356
|
+
...rest,
|
|
357
|
+
...(runAt != null && { run_at: runAt instanceof Date ? runAt.toISOString() : runAt }),
|
|
358
|
+
};
|
|
359
|
+
return (await jobsCall("POST", "runs", body)).run;
|
|
360
|
+
}
|
|
361
|
+
/** The app's runs, newest first; 50 at a time unless `limit` says otherwise (200 at most). */
|
|
362
|
+
export async function jobRuns(options = {}) {
|
|
363
|
+
const query = new URLSearchParams();
|
|
364
|
+
for (const [key, value] of Object.entries(options))
|
|
365
|
+
if (value != null)
|
|
366
|
+
query.set(key, String(value));
|
|
367
|
+
return (await jobsCall("GET", `runs?${query}`)).runs;
|
|
368
|
+
}
|
|
369
|
+
export const jobRun = async (id) => (await jobsCall("GET", `runs/${encodeURIComponent(id)}`)).run;
|
|
370
|
+
/** Takes back a run that hasn't started; a 409 `not_queued` if it has. */
|
|
371
|
+
export const cancelJob = async (id) => (await jobsCall("POST", `runs/${encodeURIComponent(id)}/cancel`)).run;
|
|
372
|
+
/** The app's schedules, how many runs wait, run and failed in the last day, and the limits. */
|
|
373
|
+
export const jobs = () => jobsCall("GET", "");
|
|
374
|
+
const reply = (status, body) => new Response(JSON.stringify(body), { status, headers: { "content-type": "application/json" } });
|
|
375
|
+
/**
|
|
376
|
+
* Answers Lift's call to run a job. Mount it at POST /_lift/jobs/:name:
|
|
377
|
+
*
|
|
378
|
+
* app.post("/_lift/jobs/:name", (c) => handleJob(c.req.raw, handlers))
|
|
379
|
+
*
|
|
380
|
+
* It checks that the call is Lift's (signed with the app's client secret,
|
|
381
|
+
* within the last five minutes), runs the handler of that name and answers
|
|
382
|
+
* for it: 200 with what the handler returned, 500 if it threw (Lift tries
|
|
383
|
+
* again while the run has attempts left), 404 for a name with no handler
|
|
384
|
+
* (not tried again).
|
|
385
|
+
*
|
|
386
|
+
* A job may run more than once: an attempt whose answer never reached Lift
|
|
387
|
+
* is tried again. Make handlers safe to repeat.
|
|
388
|
+
*/
|
|
389
|
+
export async function handleJob(request, handlers) {
|
|
390
|
+
const { clientSecret } = settings();
|
|
391
|
+
if (!clientSecret)
|
|
392
|
+
return reply(503, { error: "not_configured", message: "Jobs need LIFT_CLIENT_SECRET." });
|
|
393
|
+
const body = await request.text();
|
|
394
|
+
const timestamp = request.headers.get("x-lift-timestamp") ?? "";
|
|
395
|
+
const signature = request.headers.get("x-lift-signature") ?? "";
|
|
396
|
+
const { createHmac, timingSafeEqual } = await import("node:crypto");
|
|
397
|
+
const expected = Buffer.from("v1=" + createHmac("sha256", clientSecret).update(`${timestamp}.${body}`).digest("hex"));
|
|
398
|
+
const given = Buffer.from(signature);
|
|
399
|
+
const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) <= 300;
|
|
400
|
+
if (!fresh || given.length !== expected.length || !timingSafeEqual(given, expected)) {
|
|
401
|
+
return reply(401, { error: "bad_signature", message: "This call isn't from Lift." });
|
|
402
|
+
}
|
|
403
|
+
const sent = JSON.parse(body);
|
|
404
|
+
const handler = Object.hasOwn(handlers, sent.name) ? handlers[sent.name] : undefined;
|
|
405
|
+
if (!handler)
|
|
406
|
+
return reply(404, { error: "unknown_job", message: `This app has no job called ${sent.name}.` });
|
|
407
|
+
try {
|
|
408
|
+
const result = await handler({
|
|
409
|
+
id: sent.id,
|
|
410
|
+
name: sent.name,
|
|
411
|
+
kind: sent.kind,
|
|
412
|
+
attempt: sent.attempt,
|
|
413
|
+
maxAttempts: sent.max_attempts,
|
|
414
|
+
scheduledAt: sent.scheduled_at,
|
|
415
|
+
payload: sent.payload,
|
|
416
|
+
});
|
|
417
|
+
return reply(200, result === undefined ? { ok: true } : result);
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
console.error(`Job ${sent.name} (${sent.id}) failed:`, error);
|
|
421
|
+
return reply(500, { error: "job_failed", message: error instanceof Error ? error.message : String(error) });
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
// Email and text messages, on Kabob's account. Lift decides who they come
|
|
425
|
+
// from and limits how much an app sends and how many one person gets.
|
|
426
|
+
// Needs the app's Email or Text messages switch on Lift.
|
|
427
|
+
const sending = async (service, method, path, body, options) => paidAnswer(await paid(service, method, path, body, { timeoutMs: 25_000, ...options }), "Lift");
|
|
428
|
+
/**
|
|
429
|
+
* Send an email:
|
|
430
|
+
*
|
|
431
|
+
* await sendEmail({ to: customer.email, subject: "Your try-on", html, text }, { tag: `brand-${brand.id}` })
|
|
432
|
+
*
|
|
433
|
+
* It comes from the app's own address (`<app>@lift.kabob.io`) under the
|
|
434
|
+
* app's name; set `replyTo` to where answers should go. Give `text`, `html`
|
|
435
|
+
* or both (256 KB together at most), to 10 addresses at most. There are no
|
|
436
|
+
* attachments: put the file in storage and link to it with `fileUrl`.
|
|
437
|
+
*
|
|
438
|
+
* Throws a `LiftError`: 429 `daily_limit` (the app sent its day's worth),
|
|
439
|
+
* 429 `recipient_limit` (that address got enough from this app for now),
|
|
440
|
+
* 422 `refused` (the mail service won't send this one; `message` says why).
|
|
441
|
+
*/
|
|
442
|
+
export async function sendEmail(message, options = {}) {
|
|
443
|
+
const { replyTo, ...rest } = message;
|
|
444
|
+
const body = { ...rest, ...(replyTo != null && { reply_to: replyTo }) };
|
|
445
|
+
return (await sending("email", "POST", "messages", body, options)).message;
|
|
446
|
+
}
|
|
447
|
+
/** The app's address, how many emails it sent today, and its limits. */
|
|
448
|
+
export const email = (options = {}) => sending("email", "GET", "", undefined, options);
|
|
449
|
+
/**
|
|
450
|
+
* Send a text message to one phone:
|
|
451
|
+
*
|
|
452
|
+
* await sendSms({ to: "+886912345678", text: `Your code is ${code}` }, { tag })
|
|
453
|
+
*
|
|
454
|
+
* `to` has its country code; Lift only texts the countries it lists
|
|
455
|
+
* (`sms()`), Taiwan unless set otherwise. Every message costs money by
|
|
456
|
+
* segment: 160 plain letters, or 70 with Chinese or emoji, and three
|
|
457
|
+
* segments at most. Send one only when a person asked for it, and never let
|
|
458
|
+
* a visitor choose the text.
|
|
459
|
+
*
|
|
460
|
+
* Throws a `LiftError`: 403 `country_not_allowed`, 413 `too_long`, 429
|
|
461
|
+
* `daily_limit`, 429 `recipient_limit` (a number gets a few an hour), 422
|
|
462
|
+
* `refused` (the network won't send this one; `message` says why).
|
|
463
|
+
*/
|
|
464
|
+
export async function sendSms(message, options = {}) {
|
|
465
|
+
return (await sending("sms", "POST", "messages", message, options)).message;
|
|
466
|
+
}
|
|
467
|
+
/** How many segments the app sent today, its limits, and the countries Lift texts. */
|
|
468
|
+
export const sms = (options = {}) => sending("sms", "GET", "", undefined, options);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kabobcompany/lift",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "For apps hosted on Lift: call Kabob products (Lookr) as the signed-in person, and run
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "For apps hosted on Lift: call Kabob products (Lookr) as the signed-in person, run public actions, use OpenAI and Seedance on Kabob's account, keep files in Lift's storage, run background jobs, and send email and text messages.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|