runline 0.31.0 → 0.33.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.
Files changed (30) hide show
  1. package/dist/plugin/schema.d.ts +2 -4
  2. package/dist/plugin/schema.js +47 -12
  3. package/dist/plugins/_shared/{imageFile.js → mediaFile.js} +33 -12
  4. package/dist/plugins/_shared/provider.js +22 -16
  5. package/dist/plugins/_shared/shiftCloud.js +34 -10
  6. package/dist/plugins/_shared/shiftUpload.js +1 -1
  7. package/dist/plugins/elevenlabs/src/index.js +277 -0
  8. package/dist/plugins/elevenlabs/src/schemas.js +115 -0
  9. package/dist/plugins/elevenlabs/src/shared.js +272 -0
  10. package/dist/plugins/elevenlabs/src/workflows.js +191 -0
  11. package/dist/plugins/fal/src/index.js +181 -0
  12. package/dist/plugins/fal/src/shared.js +303 -0
  13. package/dist/plugins/googleImage/src/index.js +1 -1
  14. package/dist/plugins/openai/src/index.js +1 -1
  15. package/dist/plugins/recraft/src/index.js +1 -1
  16. package/dist/plugins/replicate/src/index.js +5 -6
  17. package/dist/plugins/shiftBwm/src/collections.js +201 -0
  18. package/dist/plugins/shiftBwm/src/index.js +33 -0
  19. package/dist/plugins/shiftBwm/src/records.js +180 -0
  20. package/dist/plugins/shiftBwm/src/shared.js +143 -0
  21. package/dist/plugins/shiftBwm/src/vendor/client.js +227 -0
  22. package/dist/plugins/shiftBwm/src/vendor/contracts.js +59 -0
  23. package/dist/plugins/shiftBwm/src/vendor/models.js +525 -0
  24. package/dist/plugins/shiftObjects/src/objects.js +1 -2
  25. package/dist/plugins/shiftOcr/src/index.js +3 -1
  26. package/dist/plugins/shiftTranscription/src/shared.js +1 -1
  27. package/dist/plugins/shiftTranscription/src/transcription.js +4 -3
  28. package/dist/plugins/together/src/index.js +1 -1
  29. package/dist/plugins/xai/src/index.js +1 -1
  30. package/package.json +3 -2
@@ -0,0 +1,227 @@
1
+ /**
2
+ * SYNCED_FROM shift-labs-ai/cloud@42c9f13
3
+ * packages/business-world-model-service/src/client.ts
4
+ *
5
+ * Verbatim copy; only the import paths and the route-prefix constant are
6
+ * rewritten. Do not edit here.
7
+ */
8
+ /**
9
+ * Browser-safe HTTP client for the Business World Model API. Talks the
10
+ * same envelope the controller serves; the server derives the organization
11
+ * from the caller's principal.
12
+ */
13
+ import { BWM_OBJECT_TYPE_PATHS, BWM_ROUTE_PREFIX } from "./contracts.js";
14
+ import { z } from "zod";
15
+ import { BwmDefinitions, BwmFieldDefinition, BwmFieldHistory, BwmFile, BwmFileUpload, BwmFileUrl, BwmGroup, BwmLinks, BwmList, BwmMemberPage, BwmMerge, BwmMergeResult, BwmObjectType, BwmPipeline, BwmRecord, BwmRecordPage, BwmRelationshipDefinition, } from "./models.js";
16
+ /**
17
+ * A failed request. `type` is the coarse kind (`not_found`, …); `code` is
18
+ * the finer service code when the server sent one, else the type; `param`
19
+ * names the offending request location (`fields.$name`).
20
+ */
21
+ export class BwmClientError extends Error {
22
+ status;
23
+ body;
24
+ type;
25
+ code;
26
+ param;
27
+ constructor(status, error, body) {
28
+ super(error.message);
29
+ this.status = status;
30
+ this.body = body;
31
+ this.name = "BwmClientError";
32
+ this.type = error.type;
33
+ this.code = error.code ?? error.type;
34
+ this.param = error.param;
35
+ }
36
+ }
37
+ /** URL segment for an object type: built-in path or `objects/{slug}`. */
38
+ export function objectTypePath(objectType) {
39
+ return (BWM_OBJECT_TYPE_PATHS[objectType] ??
40
+ `objects/${objectType}`);
41
+ }
42
+ export class BusinessWorldModelClient {
43
+ options;
44
+ prefix;
45
+ fetchImpl;
46
+ constructor(options) {
47
+ this.options = options;
48
+ this.prefix = `${options.baseUrl.replace(/\/$/, "")}${BWM_ROUTE_PREFIX}`;
49
+ this.fetchImpl = options.fetch ?? ((input, init) => fetch(input, init));
50
+ }
51
+ listObjectTypes() {
52
+ return this.get("/object-types", z.object({ objectTypes: z.array(BwmObjectType) })).then((r) => r.objectTypes);
53
+ }
54
+ createObjectType(input) {
55
+ return this.send("POST", "/object-types", input, z.object({ objectType: BwmObjectType })).then((r) => r.objectType);
56
+ }
57
+ getDefinitions(objectType) {
58
+ return this.get(`/${objectTypePath(objectType)}/definitions`, BwmDefinitions);
59
+ }
60
+ createField(objectType, input) {
61
+ return this.send("POST", `/${objectTypePath(objectType)}/fields`, input, z.object({ field: BwmFieldDefinition })).then((r) => r.field);
62
+ }
63
+ createRelationshipDefinition(objectType, input) {
64
+ return this.send("POST", `/${objectTypePath(objectType)}/relationships`, input, z.object({ relationship: BwmRelationshipDefinition })).then((r) => r.relationship);
65
+ }
66
+ listPipelines() {
67
+ return this.get("/pipelines", z.object({ pipelines: z.array(BwmPipeline) })).then((r) => r.pipelines);
68
+ }
69
+ createPipeline(input) {
70
+ return this.send("POST", "/pipelines", input, z.object({ pipeline: BwmPipeline })).then((r) => r.pipeline);
71
+ }
72
+ listRecords(objectType, options = {}) {
73
+ return this.get(`/${objectTypePath(objectType)}${listSearch(options)}`, BwmRecordPage);
74
+ }
75
+ getRecord(objectType, id) {
76
+ return this.get(`/${objectTypePath(objectType)}/${encodeURIComponent(id)}`, BwmRecord);
77
+ }
78
+ createRecord(objectType, input) {
79
+ return this.send("POST", `/${objectTypePath(objectType)}`, input, BwmRecord);
80
+ }
81
+ updateRecord(objectType, id, input) {
82
+ return this.send("PATCH", `/${objectTypePath(objectType)}/${encodeURIComponent(id)}`, input, BwmRecord);
83
+ }
84
+ archiveRecord(objectType, id) {
85
+ return this.send("DELETE", `/${objectTypePath(objectType)}/${encodeURIComponent(id)}`, undefined, BwmRecord);
86
+ }
87
+ getFieldHistory(objectType, id, fieldKey, query = {}) {
88
+ const search = new URLSearchParams();
89
+ if (query.limit)
90
+ search.set("limit", String(query.limit));
91
+ if (query.after)
92
+ search.set("after", query.after);
93
+ const suffix = search.size ? `?${search}` : "";
94
+ return this.get(`/${objectTypePath(objectType)}/${encodeURIComponent(id)}/fields/${encodeURIComponent(fieldKey)}/history${suffix}`, BwmFieldHistory);
95
+ }
96
+ mergeRecords(objectType, input) {
97
+ return this.send("POST", `/${objectTypePath(objectType)}/merge`, input, BwmMergeResult);
98
+ }
99
+ getMerge(id) {
100
+ return this.get(`/merges/${encodeURIComponent(id)}`, BwmMerge);
101
+ }
102
+ listLinks(id, direction = "both") {
103
+ return this.get(`/records/${encodeURIComponent(id)}/links?direction=${direction}`, BwmLinks);
104
+ }
105
+ listChangeEvents(id) {
106
+ return this.get(`/records/${encodeURIComponent(id)}/change-events`, z.object({ changeEvents: z.array(z.custom()) })).then((r) => r.changeEvents);
107
+ }
108
+ listLists() {
109
+ return this.get("/lists", z.object({ lists: z.array(BwmList) })).then((r) => r.lists);
110
+ }
111
+ getList(id) {
112
+ return this.get(`/lists/${encodeURIComponent(id)}`, BwmList);
113
+ }
114
+ createList(input) {
115
+ return this.send("POST", "/lists", input, BwmList);
116
+ }
117
+ updateList(id, input) {
118
+ return this.send("PATCH", `/lists/${encodeURIComponent(id)}`, input, BwmList);
119
+ }
120
+ listListRecords(id, options = {}) {
121
+ return this.get(`/lists/${encodeURIComponent(id)}/records${listSearch(options)}`, BwmRecordPage);
122
+ }
123
+ listGroups() {
124
+ return this.get("/groups", z.object({ groups: z.array(BwmGroup) })).then((r) => r.groups);
125
+ }
126
+ createGroup(input) {
127
+ return this.send("POST", "/groups", input, z.object({ group: BwmGroup })).then((r) => r.group);
128
+ }
129
+ updateGroup(id, input) {
130
+ return this.send("PATCH", `/groups/${encodeURIComponent(id)}`, input, z.object({ group: BwmGroup })).then((r) => r.group);
131
+ }
132
+ updateGroupMembers(id, input) {
133
+ return this.send("POST", `/groups/${encodeURIComponent(id)}/members`, input, z.object({ group: BwmGroup })).then((r) => r.group);
134
+ }
135
+ deleteGroup(id) {
136
+ return this.send("DELETE", `/groups/${encodeURIComponent(id)}`, undefined, z.undefined());
137
+ }
138
+ listMembers(query = {}) {
139
+ const search = new URLSearchParams();
140
+ if (query.limit)
141
+ search.set("limit", String(query.limit));
142
+ if (query.offset)
143
+ search.set("offset", String(query.offset));
144
+ return this.get(`/members${search.size ? `?${search}` : ""}`, BwmMemberPage);
145
+ }
146
+ createFileUpload(input) {
147
+ return this.send("POST", "/files", input, BwmFileUpload);
148
+ }
149
+ completeFileUpload(id) {
150
+ return this.send("POST", `/files/${encodeURIComponent(id)}/complete`, undefined, BwmFile);
151
+ }
152
+ getRecordFileUrl(recordId, fileId) {
153
+ return this.get(`/records/${encodeURIComponent(recordId)}/files/${encodeURIComponent(fileId)}/url`, BwmFileUrl);
154
+ }
155
+ get(path, schema) {
156
+ return this.send("GET", path, undefined, schema);
157
+ }
158
+ async send(method, path, body, schema) {
159
+ const extra = typeof this.options.headers === "function"
160
+ ? await this.options.headers()
161
+ : (this.options.headers ?? {});
162
+ const headers = new Headers(extra);
163
+ if (body !== undefined)
164
+ headers.set("content-type", "application/json");
165
+ const response = await this.fetchImpl(`${this.prefix}${path}`, {
166
+ method,
167
+ headers,
168
+ body: body === undefined ? undefined : JSON.stringify(body),
169
+ });
170
+ if (response.status === 204)
171
+ return schema.parse(undefined);
172
+ const text = await response.text();
173
+ let payload = text;
174
+ try {
175
+ payload = text ? JSON.parse(text) : undefined;
176
+ }
177
+ catch {
178
+ // Non-JSON error bodies are reported verbatim.
179
+ }
180
+ if (!response.ok) {
181
+ throw new BwmClientError(response.status, errorOf(payload, response), payload);
182
+ }
183
+ return schema.parse(payload);
184
+ }
185
+ }
186
+ function errorOf(payload, response) {
187
+ const fallback = {
188
+ type: response.status === 401
189
+ ? "unauthorized"
190
+ : response.status === 403
191
+ ? "forbidden"
192
+ : "error",
193
+ message: typeof payload === "string" && payload
194
+ ? payload
195
+ : response.statusText || `HTTP ${response.status}`,
196
+ };
197
+ if (!payload || typeof payload !== "object" || !("error" in payload))
198
+ return fallback;
199
+ const error = payload.error;
200
+ if (typeof error === "string")
201
+ return { ...fallback, message: error, code: error };
202
+ if (!error || typeof error !== "object")
203
+ return fallback;
204
+ const shaped = error;
205
+ return {
206
+ type: typeof shaped.type === "string" ? shaped.type : fallback.type,
207
+ message: typeof shaped.message === "string" ? shaped.message : fallback.message,
208
+ code: typeof shaped.code === "string" ? shaped.code : undefined,
209
+ param: typeof shaped.param === "string" ? shaped.param : undefined,
210
+ };
211
+ }
212
+ function listSearch(options) {
213
+ const search = new URLSearchParams();
214
+ if (options.limit)
215
+ search.set("limit", String(options.limit));
216
+ if (options.offset)
217
+ search.set("offset", String(options.offset));
218
+ if (options.includeArchived)
219
+ search.set("includeArchived", "true");
220
+ for (const filter of options.filters ?? []) {
221
+ const operator = filter.operator
222
+ ? `[${filter.negate ? "-" : ""}${filter.operator}]`
223
+ : "";
224
+ search.append(`${filter.key}${operator}`, filter.value);
225
+ }
226
+ return search.size ? `?${search}` : "";
227
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * SYNCED_FROM shift-labs-ai/cloud
3
+ * packages/contracts/src/business-world-model.ts
4
+ * packages/contracts/src/services.ts (SERVICE_ROUTE_PREFIXES.BUSINESS_WORLD_MODEL)
5
+ *
6
+ * Verbatim copy of the constants the vendored client and models need.
7
+ * Do not edit here; update the cloud source and re-copy.
8
+ */
9
+ export const BWM_BUILT_IN_OBJECT_TYPES = [
10
+ "account",
11
+ "contact",
12
+ "opportunity",
13
+ "activity",
14
+ "task",
15
+ "note",
16
+ ];
17
+ /** URL segment for each built-in object type. Custom types live under `objects/{slug}`. */
18
+ export const BWM_OBJECT_TYPE_PATHS = {
19
+ account: "accounts",
20
+ contact: "contacts",
21
+ opportunity: "opportunities",
22
+ activity: "activities",
23
+ task: "tasks",
24
+ note: "notes",
25
+ };
26
+ export const BWM_VALUE_TYPES = [
27
+ "TEXT",
28
+ "NUMBER",
29
+ "CHECKBOX",
30
+ "CURRENCY",
31
+ "DATE",
32
+ "DATETIME",
33
+ "EMAIL",
34
+ "TELEPHONE",
35
+ "URL",
36
+ "SOCIAL_HANDLE",
37
+ "ADDRESS",
38
+ "FULL_NAME",
39
+ "MARKDOWN",
40
+ "SINGLE_SELECT",
41
+ "MULTI_SELECT",
42
+ "JSON",
43
+ ];
44
+ export const BWM_CARDINALITIES = ["HAS_ONE", "HAS_MANY"];
45
+ export const BWM_VISIBILITY_MODES = ["org", "group", "private"];
46
+ export const BWM_SOCIAL_HANDLE_SERVICES = [
47
+ "TWITTER",
48
+ "LINKEDIN",
49
+ "FACEBOOK",
50
+ "INSTAGRAM",
51
+ ];
52
+ /** System field and relationship keys carry this prefix; custom keys are bare slugs. */
53
+ export const BWM_SYSTEM_KEY_PREFIX = "$";
54
+ export const BWM_LIST_DEFAULT_LIMIT = 25;
55
+ export const BWM_LIST_MAX_LIMIT = 100;
56
+ export const BWM_HISTORY_DEFAULT_LIMIT = 20;
57
+ export const BWM_HISTORY_MAX_LIMIT = 100;
58
+ /** `SERVICE_ROUTE_PREFIXES.BUSINESS_WORLD_MODEL` in cloud: `/v1/services/business-world-model`. */
59
+ export const BWM_ROUTE_PREFIX = "/v1/services/business-world-model";