@diagonal-hq/workflows 0.3.0 → 0.3.1
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 +9 -9
- package/dist/chunks/chunk-KXVTSLCN.js +428 -0
- package/dist/chunks/{chunk-RTCHH3JG.js → chunk-RWZW4V74.js} +89 -1
- package/dist/generated/capabilities.d.ts +1 -1
- package/dist/generated/profiles/migration.d.ts +155 -0
- package/dist/generated/profiles/test.d.ts +190 -0
- package/dist/index.js +45 -389
- package/dist/profiles/migration.d.ts +8 -2
- package/dist/profiles/migration.js +238 -4
- package/dist/profiles/shared.d.ts +4 -0
- package/dist/profiles/test.d.ts +8 -2
- package/dist/profiles/test.js +283 -4
- package/dist/testing/index.js +1 -2
- package/package.json +1 -1
- package/dist/chunks/chunk-3EO3FSI5.js +0 -94
- /package/dist/chunks/{chunk-NUFRM6SI.js → chunk-CSWWU6TP.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,18 +1,55 @@
|
|
|
1
|
-
import "./chunks/chunk-NUFRM6SI.js";
|
|
2
1
|
import {
|
|
2
|
+
SDK_VERSION,
|
|
3
|
+
ai,
|
|
4
|
+
auth,
|
|
5
|
+
calendar,
|
|
6
|
+
callback,
|
|
7
|
+
chart,
|
|
8
|
+
data,
|
|
9
|
+
date,
|
|
10
|
+
file,
|
|
11
|
+
guard,
|
|
12
|
+
http,
|
|
13
|
+
lifecycle,
|
|
14
|
+
mail,
|
|
15
|
+
markdown,
|
|
16
|
+
mediaLibrary,
|
|
17
|
+
money,
|
|
18
|
+
notification,
|
|
19
|
+
number,
|
|
20
|
+
package_,
|
|
21
|
+
page,
|
|
22
|
+
payables,
|
|
23
|
+
payment,
|
|
24
|
+
payments,
|
|
25
|
+
phone,
|
|
26
|
+
scheduling,
|
|
27
|
+
schema,
|
|
28
|
+
security,
|
|
29
|
+
sms,
|
|
30
|
+
subscriptions,
|
|
31
|
+
text,
|
|
32
|
+
time,
|
|
33
|
+
timezone,
|
|
34
|
+
tiptap,
|
|
35
|
+
transaction,
|
|
36
|
+
user,
|
|
37
|
+
web,
|
|
38
|
+
workflow,
|
|
39
|
+
workspace
|
|
40
|
+
} from "./chunks/chunk-KXVTSLCN.js";
|
|
41
|
+
import {
|
|
42
|
+
InputField,
|
|
43
|
+
InputSchema,
|
|
3
44
|
defineWorkflow,
|
|
4
45
|
invoke,
|
|
5
46
|
parseWorkflowInput,
|
|
6
47
|
redirect,
|
|
7
48
|
respond,
|
|
8
49
|
setTransport,
|
|
50
|
+
v,
|
|
9
51
|
validateWorkflowInput
|
|
10
|
-
} from "./chunks/chunk-
|
|
11
|
-
import {
|
|
12
|
-
InputField,
|
|
13
|
-
InputSchema,
|
|
14
|
-
v
|
|
15
|
-
} from "./chunks/chunk-RTCHH3JG.js";
|
|
52
|
+
} from "./chunks/chunk-RWZW4V74.js";
|
|
16
53
|
import {
|
|
17
54
|
HostError,
|
|
18
55
|
WorkflowFailure,
|
|
@@ -20,387 +57,6 @@ import {
|
|
|
20
57
|
validationError
|
|
21
58
|
} from "./chunks/chunk-OF5QITP7.js";
|
|
22
59
|
|
|
23
|
-
// packages/workflows/src/transaction.ts
|
|
24
|
-
async function transaction(fn) {
|
|
25
|
-
await invoke("transaction.begin", {});
|
|
26
|
-
let result;
|
|
27
|
-
try {
|
|
28
|
-
result = await fn();
|
|
29
|
-
} catch (error) {
|
|
30
|
-
await invoke("transaction.rollback", {});
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
await invoke("transaction.commit", {});
|
|
35
|
-
} catch (error) {
|
|
36
|
-
if (error instanceof HostError && error.code === "transaction_concurrent") {
|
|
37
|
-
await invoke("transaction.rollback", {});
|
|
38
|
-
}
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// packages/workflows/src/generated/capabilities.ts
|
|
45
|
-
var SDK_VERSION = 56;
|
|
46
|
-
var ai = {
|
|
47
|
-
/** Ask a decisions model typed questions about some content and get labelled answers with their probabilities */
|
|
48
|
-
decide: (input) => invoke("ai.decide", input),
|
|
49
|
-
/** Hand a prompt to the AI assistant, which can look up data and take action in your workspace */
|
|
50
|
-
runPrompt: (input) => invoke("ai.run_prompt", input)
|
|
51
|
-
};
|
|
52
|
-
var auth = {
|
|
53
|
-
/** Impersonate an authenticatable user, switching the current session to act as that user */
|
|
54
|
-
impersonate: (input) => invoke("auth.impersonate", input),
|
|
55
|
-
/** Login an authenticatable record */
|
|
56
|
-
login: (input) => invoke("auth.login", input)
|
|
57
|
-
};
|
|
58
|
-
var calendar = {
|
|
59
|
-
/** Generate a shareable calendar link (Google, Apple, Outlook) for an eventable record */
|
|
60
|
-
generateLink: (input) => invoke("calendar.generate_link", input),
|
|
61
|
-
/** Find eventable records occurring in a date window no wider than 3 months, expanding recurring events into one row per occurrence and per calendar the record appears on. Returns every match, so narrow the window or filters on a busy resource */
|
|
62
|
-
searchEvents: (input) => invoke("calendar.search_events", input)
|
|
63
|
-
};
|
|
64
|
-
var callback = {
|
|
65
|
-
/** Get a callback value */
|
|
66
|
-
get: (input) => invoke("callback.get", input),
|
|
67
|
-
/** Remove a callback value */
|
|
68
|
-
remove: (input) => invoke("callback.remove", input),
|
|
69
|
-
/** Set a callback value */
|
|
70
|
-
set: (input) => invoke("callback.set", input)
|
|
71
|
-
};
|
|
72
|
-
var chart = {
|
|
73
|
-
/** Group data by category for pie or donut charts */
|
|
74
|
-
distribution: (input) => invoke("chart.distribution", input),
|
|
75
|
-
/** Calculate a single metric value (total revenue, order count, etc.) */
|
|
76
|
-
kpi: (input) => invoke("chart.kpi", input),
|
|
77
|
-
/** Rank entities by a metric (top customers, best sellers, etc.) */
|
|
78
|
-
leaderboard: (input) => invoke("chart.leaderboard", input),
|
|
79
|
-
/** Aggregate data over time for line or area charts */
|
|
80
|
-
timeSeries: (input) => invoke("chart.time_series", input)
|
|
81
|
-
};
|
|
82
|
-
var data = {
|
|
83
|
-
/** Compute grouped metrics (count, sum, avg, etc.) over records */
|
|
84
|
-
aggregateMetrics: (input) => invoke("data.aggregate_metrics", input),
|
|
85
|
-
/** Count the number of records matching the filters */
|
|
86
|
-
count: (input) => invoke("data.count", input),
|
|
87
|
-
/** Create a new record */
|
|
88
|
-
create: (input) => invoke("data.create", input),
|
|
89
|
-
/** Create many records at once */
|
|
90
|
-
createMany: (input) => invoke("data.create-many", input),
|
|
91
|
-
/** Delete a record */
|
|
92
|
-
delete: (input) => invoke("data.delete", input),
|
|
93
|
-
/** Delete all records matching filter conditions */
|
|
94
|
-
deleteMany: (input) => invoke("data.delete-many", input),
|
|
95
|
-
/** Find a single record by ID or by filters */
|
|
96
|
-
find: (input) => invoke("data.find", input),
|
|
97
|
-
/** Find a record by attributes, or create a new one when no match exists */
|
|
98
|
-
findOrCreate: (input) => invoke("data.find-or-create", input),
|
|
99
|
-
relation: {
|
|
100
|
-
/** Attach a related record to a singular relation (BelongsTo, HasOne) */
|
|
101
|
-
attach: (input) => invoke("data.relation.attach", input),
|
|
102
|
-
/** Attach related records to a plural relation (BelongsToMany, HasMany) */
|
|
103
|
-
attachMany: (input) => invoke("data.relation.attach-many", input),
|
|
104
|
-
/** Detach a related record. */
|
|
105
|
-
detach: (input) => invoke("data.relation.detach", input),
|
|
106
|
-
/** Detach related records from a plural relation (BelongsToMany, HasMany) */
|
|
107
|
-
detachMany: (input) => invoke("data.relation.detach-many", input),
|
|
108
|
-
/** Sync related records for a relation (replaces all existing) */
|
|
109
|
-
sync: (input) => invoke("data.relation.sync", input)
|
|
110
|
-
},
|
|
111
|
-
/** Restore an archived record */
|
|
112
|
-
restore: (input) => invoke("data.restore", input),
|
|
113
|
-
/** Search for records */
|
|
114
|
-
search: (input) => invoke("data.search", input),
|
|
115
|
-
/** Search for records by semantic similarity */
|
|
116
|
-
semanticSearch: (input) => invoke("data.semantic_search", input),
|
|
117
|
-
/** Sum a numeric field across records matching the filters */
|
|
118
|
-
sum: (input) => invoke("data.sum", input),
|
|
119
|
-
/** Update an existing record found by ID or by filters */
|
|
120
|
-
update: (input) => invoke("data.update", input),
|
|
121
|
-
/** Find a record by attributes and update it, or create a new one */
|
|
122
|
-
updateOrCreate: (input) => invoke("data.update-or-create", input),
|
|
123
|
-
/** Validate a record */
|
|
124
|
-
validate: (input) => invoke("data.validate", input)
|
|
125
|
-
};
|
|
126
|
-
var date = {
|
|
127
|
-
/** Add N days/weeks/months/years to a date */
|
|
128
|
-
add: (input) => invoke("date.add", input),
|
|
129
|
-
/** Difference between two dates in a specified unit */
|
|
130
|
-
diff: (input) => invoke("date.diff", input),
|
|
131
|
-
/** Snap a date to the end of a period (week, month, quarter, year) */
|
|
132
|
-
endOf: (input) => invoke("date.end_of", input),
|
|
133
|
-
/** Format a date string using ICU date format syntax (e.g., "yyyy-MM-dd", "MMM d, yyyy"). */
|
|
134
|
-
format: (input) => invoke("date.format", input),
|
|
135
|
-
/** Snap a date to the start of a period (week, month, quarter, year) */
|
|
136
|
-
startOf: (input) => invoke("date.start_of", input),
|
|
137
|
-
/** Subtract N days/weeks/months/years from a date */
|
|
138
|
-
subtract: (input) => invoke("date.subtract", input)
|
|
139
|
-
};
|
|
140
|
-
var file = {
|
|
141
|
-
/** Change a file's visibility by moving it between private and public storage */
|
|
142
|
-
changeVisibility: (input) => invoke("file.change_visibility", input),
|
|
143
|
-
/** Download a file from a public http(s) URL and save it privately in the workspace */
|
|
144
|
-
createFromUrl: (input) => invoke("file.create_from_url", input),
|
|
145
|
-
/** Create a public library master from an accessible workspace file, preserving external sources. Accepts images, video, audio and PDF by the type detected from bytes. Store other files in a record file field. Returns the library File ID */
|
|
146
|
-
createMediaLibraryItem: (input) => invoke("file.create_media_library_item", input),
|
|
147
|
-
/** Generate a QR code PNG image that encodes a value and save it privately in the workspace */
|
|
148
|
-
createQrCode: (input) => invoke("file.create_qr_code", input)
|
|
149
|
-
};
|
|
150
|
-
var guard = {
|
|
151
|
-
/** Perform a validation check */
|
|
152
|
-
validate: (input) => invoke("guard.validate", input)
|
|
153
|
-
};
|
|
154
|
-
var http = {
|
|
155
|
-
/** Send an HTTP request */
|
|
156
|
-
request: (input) => invoke("http.request", input)
|
|
157
|
-
};
|
|
158
|
-
var lifecycle = {
|
|
159
|
-
/** Return modified record fields from a record lifecycle workflow */
|
|
160
|
-
output: (input) => invoke("lifecycle.output", input)
|
|
161
|
-
};
|
|
162
|
-
var mail = {
|
|
163
|
-
/** Find tracked emails by recipient, linked record, subject, sender, status, or date, newest first, with the delivery status of each recipient, including hard and soft bounces. Searches without a record, or that include the record's current addresses, require a Run As identity with the Manage Notifications permission */
|
|
164
|
-
search: (input) => invoke("mail.search", input),
|
|
165
|
-
/** Send an email */
|
|
166
|
-
send: (input) => invoke("mail.send", input),
|
|
167
|
-
/** Send an email using a notification type and template */
|
|
168
|
-
sendNotification: (input) => invoke("mail.send-notification", input)
|
|
169
|
-
};
|
|
170
|
-
var markdown = {
|
|
171
|
-
/** Convert rich Content into a markdown string */
|
|
172
|
-
fromContent: (input) => invoke("markdown.from_content", input),
|
|
173
|
-
/** Convert a markdown string into rich Content. Nodes a destination Content field disallows may be rejected by that field. */
|
|
174
|
-
toContent: (input) => invoke("markdown.to_content", input)
|
|
175
|
-
};
|
|
176
|
-
var mediaLibrary = {
|
|
177
|
-
/** Create a media library folder */
|
|
178
|
-
createFolder: (input) => invoke("media_library.create_folder", input),
|
|
179
|
-
/** Detach a file from the media library */
|
|
180
|
-
deleteItem: (input) => invoke("media_library.delete_item", input),
|
|
181
|
-
/** Move media library items into a target folder */
|
|
182
|
-
moveItems: (input) => invoke("media_library.move_items", input),
|
|
183
|
-
/** Rename a media library item and/or move it into a folder */
|
|
184
|
-
updateItem: (input) => invoke("media_library.update_item", input)
|
|
185
|
-
};
|
|
186
|
-
var money = {
|
|
187
|
-
/** Format a money value as a currency string */
|
|
188
|
-
format: (input) => invoke("money.format", input)
|
|
189
|
-
};
|
|
190
|
-
var notification = {
|
|
191
|
-
/** Send a notification email to a notifiable record */
|
|
192
|
-
send: (input) => invoke("notification.send", input),
|
|
193
|
-
/** Find records with filters and send each record’s notification to the type’s configured recipient resource */
|
|
194
|
-
sendBulkNotifications: (input) => invoke("notification.send-bulk-notifications", input),
|
|
195
|
-
/** Send a notification template to a full record of the type’s recipient resource */
|
|
196
|
-
sendNotification: (input) => invoke("notification.send-notification", input),
|
|
197
|
-
/** Record whether a notifiable record agreed to receive email or SMS */
|
|
198
|
-
setConsent: (input) => invoke("notification.set-consent", input)
|
|
199
|
-
};
|
|
200
|
-
var number = {
|
|
201
|
-
/** Format a number with configurable decimal places */
|
|
202
|
-
format: (input) => invoke("number.format", input)
|
|
203
|
-
};
|
|
204
|
-
var package_ = {
|
|
205
|
-
/** Read an input value collected when this package was installed */
|
|
206
|
-
installInput: (input) => invoke("package.install-input", input)
|
|
207
|
-
};
|
|
208
|
-
var page = {
|
|
209
|
-
/** Get the URL for a page with route parameters */
|
|
210
|
-
url: (input) => invoke("page.url", input)
|
|
211
|
-
};
|
|
212
|
-
var payables = {
|
|
213
|
-
/** Void an unpaid draft or open invoice. Rejects collected payments and payments in progress. Does not refund payments or cancel subscriptions. */
|
|
214
|
-
void: (input) => invoke("payables.void", input),
|
|
215
|
-
/** Write off all or part of an open invoice while preserving its original total. */
|
|
216
|
-
writeOff: (input) => invoke("payables.write-off", input)
|
|
217
|
-
};
|
|
218
|
-
var payment = {
|
|
219
|
-
/** Record a manual payment against a payable record */
|
|
220
|
-
createManual: (input) => invoke("payment.create_manual", input)
|
|
221
|
-
};
|
|
222
|
-
var payments = {
|
|
223
|
-
/** Charge a payable record using the payer default Stripe payment method */
|
|
224
|
-
charge: (input) => invoke("payments.charge", input),
|
|
225
|
-
/** Create a Stripe Checkout session to collect payment against a payable record */
|
|
226
|
-
checkout: (input) => invoke("payments.checkout", input),
|
|
227
|
-
/** Confirm new or saved payment details collected by PaymentForm. Return this output to the form for authentication. Run after committing checkout choices; Stripe charges cannot be rolled back. */
|
|
228
|
-
confirm: (input) => invoke("payments.confirm", input),
|
|
229
|
-
/** Process a full or partial refund against a payment record */
|
|
230
|
-
refund: (input) => invoke("payments.refund", input)
|
|
231
|
-
};
|
|
232
|
-
var phone = {
|
|
233
|
-
/** Format a phone number into a human-readable string */
|
|
234
|
-
format: (input) => invoke("phone.format", input)
|
|
235
|
-
};
|
|
236
|
-
var scheduling = {
|
|
237
|
-
/** Book a slot that Find Slots returned, as the run identity. Check the slot and return the booking with the caller's view. Return only the booking id if the caller cannot read the booking. Search accepts the Find Slots input with camelCase or snake_case keys. A pool tries its next free member when admission refuses the pick; a slot that is gone fails with the $capacity error */
|
|
238
|
-
bookSlot: (input) => invoke("scheduling.book_slot", input),
|
|
239
|
-
/** Find the times a booking can start across groups of Schedulable records, inside their open hours and outside the time bookings take, without changing records. A Request workflow that runs as another identity searches with the view of the person who called it */
|
|
240
|
-
findSlots: (input) => invoke("scheduling.find_slots", input)
|
|
241
|
-
};
|
|
242
|
-
var schema = {
|
|
243
|
-
/** Convert a schema definition into its JSON Schema document — the shape used to constrain AI and extraction output */
|
|
244
|
-
toJsonSchema: (input) => invoke("schema.to_json_schema", input)
|
|
245
|
-
};
|
|
246
|
-
var security = {
|
|
247
|
-
/** Generate a secure random password */
|
|
248
|
-
randomPassword: (input) => invoke("security.random_password", input)
|
|
249
|
-
};
|
|
250
|
-
var sms = {
|
|
251
|
-
/** Send a notification template by SMS to a full record of the type’s recipient resource */
|
|
252
|
-
sendNotification: (input) => invoke("sms.send-notification", input)
|
|
253
|
-
};
|
|
254
|
-
var subscriptions = {
|
|
255
|
-
/** Start a draft subscription using its snapshotted activation and trial policies */
|
|
256
|
-
activate: (input) => invoke("subscriptions.activate", input),
|
|
257
|
-
/** Cancel a subscription immediately, or at the end of the current billing period */
|
|
258
|
-
cancel: (input) => invoke("subscriptions.cancel", input),
|
|
259
|
-
/** Change subscription items now with optional proration, schedule the selection for the next renewal or a later billing period, or revise an eligible unpaid current or upcoming renewal invoice. An incomplete subscription can change now without a revision scope; this revises its first invoice in place. Renewal revisions use full-period prices without proration. Net prorated credits first reduce open current-period invoices of the subscription, then go to the payer balance. */
|
|
260
|
-
changeItems: (input) => invoke("subscriptions.change_items", input),
|
|
261
|
-
/** Create and activate a subscription for a payer in one step: the record, an item per price, and optionally the first invoice */
|
|
262
|
-
create: (input) => invoke("subscriptions.create", input),
|
|
263
|
-
/** Generate the payable invoice for the saved subscription schedule; partial calendar periods prorate recurring lines and full periods use the original prices */
|
|
264
|
-
generateInvoice: (input) => invoke("subscriptions.generate_invoice", input),
|
|
265
|
-
/** Pause a billing subscription so no further invoices generate until it is resumed */
|
|
266
|
-
pause: (input) => invoke("subscriptions.pause", input),
|
|
267
|
-
/** Preview initial subscription charges, covered dates, and renewal amounts without creating records or collecting payment */
|
|
268
|
-
preview: (input) => invoke("subscriptions.preview", input),
|
|
269
|
-
/** Preview a complete subscription item selection effective now, at the next renewal, or at a later billing period, without changing records */
|
|
270
|
-
previewChange: (input) => invoke("subscriptions.preview_change", input),
|
|
271
|
-
/** Resume a paused subscription; its status re-derives from the latest invoice */
|
|
272
|
-
resume: (input) => invoke("subscriptions.resume", input),
|
|
273
|
-
/** Safely replace the complete price selection that takes effect in the next billing period */
|
|
274
|
-
setUpcomingItems: (input) => invoke("subscriptions.set_upcoming_items", input)
|
|
275
|
-
};
|
|
276
|
-
var text = {
|
|
277
|
-
/** Generate a random string with configurable character sets */
|
|
278
|
-
generate: (input) => invoke("text.generate", input),
|
|
279
|
-
/** Hash a text value */
|
|
280
|
-
hash: (input) => invoke("text.hash", input),
|
|
281
|
-
/** Generate a random UUID v7 */
|
|
282
|
-
randomUuid: (input) => invoke("text.random_uuid", input),
|
|
283
|
-
/** Convert a plain text string into rich Content */
|
|
284
|
-
toContent: (input) => invoke("text.to_content", input)
|
|
285
|
-
};
|
|
286
|
-
var time = {
|
|
287
|
-
/** Add N seconds/minutes/hours/days/weeks/months/years to a datetime */
|
|
288
|
-
add: (input) => invoke("time.add", input),
|
|
289
|
-
/** Difference between two datetimes in a specified unit */
|
|
290
|
-
diff: (input) => invoke("time.diff", input),
|
|
291
|
-
/** Snap a datetime to the end of a period (hour, day, week, month, quarter, year) */
|
|
292
|
-
endOf: (input) => invoke("time.end_of", input),
|
|
293
|
-
/** Format a datetime string using ICU date format syntax (e.g., "yyyy-MM-dd HH:mm:ss", "MMM d, yyyy h:mm a"). */
|
|
294
|
-
format: (input) => invoke("time.format", input),
|
|
295
|
-
/** Snap a datetime to the start of a period (hour, day, week, month, quarter, year) */
|
|
296
|
-
startOf: (input) => invoke("time.start_of", input),
|
|
297
|
-
/** Subtract N seconds/minutes/hours/days/weeks/months/years from a datetime */
|
|
298
|
-
subtract: (input) => invoke("time.subtract", input)
|
|
299
|
-
};
|
|
300
|
-
var timezone = {
|
|
301
|
-
/** Format a timezone identifier into a human-readable string. Supports formats: full (region/city with offset), offset (UTC offset), abbreviation (timezone abbreviation), and city (city name only). */
|
|
302
|
-
format: (input) => invoke("timezone.format", input),
|
|
303
|
-
/** Interpret a local date or datetime in a timezone and return the canonical UTC datetime string. */
|
|
304
|
-
interpret: (input) => invoke("timezone.interpret", input)
|
|
305
|
-
};
|
|
306
|
-
var tiptap = {
|
|
307
|
-
/** Parse Tiptap content to HTML or text */
|
|
308
|
-
parse: (input) => invoke("tiptap.parse", input)
|
|
309
|
-
};
|
|
310
|
-
var user = {
|
|
311
|
-
/** Check user permissions for authorization */
|
|
312
|
-
authorize: (input) => invoke("user.authorize", input)
|
|
313
|
-
};
|
|
314
|
-
var web = {
|
|
315
|
-
/** Extract structured data from a web page, guided by a natural-language prompt and a required shape */
|
|
316
|
-
agent: (input) => invoke("web.agent", input),
|
|
317
|
-
/** Scrape multiple web pages in one batch and poll until every page is finished */
|
|
318
|
-
batchScrape: (input) => invoke("web.batch_scrape", input),
|
|
319
|
-
/** Crawl a site and return multi-page content (polls to completion) */
|
|
320
|
-
crawl: (input) => invoke("web.crawl", input),
|
|
321
|
-
/** Extract structured data from one or more web pages, guided by a required shape and a supporting prompt */
|
|
322
|
-
extract: (input) => invoke("web.extract", input),
|
|
323
|
-
/** Search Google and return the organic results */
|
|
324
|
-
googleSearch: (input) => invoke("web.google_search", input),
|
|
325
|
-
/** Map a site and return all of its discoverable URLs */
|
|
326
|
-
map: (input) => invoke("web.map", input),
|
|
327
|
-
/** Render a web page to a PDF document */
|
|
328
|
-
pdf: (input) => invoke("web.pdf", input),
|
|
329
|
-
/** Scrape a web page in content mode (markdown/HTML plus metadata) or JSON mode (structured data extracted against a schema) */
|
|
330
|
-
scrape: (input) => invoke("web.scrape", input),
|
|
331
|
-
/** Render a web page to a screenshot (PNG, JPEG, or WebP) */
|
|
332
|
-
screenshot: (input) => invoke("web.screenshot", input),
|
|
333
|
-
/** Search the web for a query and return ranked results */
|
|
334
|
-
searchRanked: (input) => invoke("web.search_ranked", input)
|
|
335
|
-
};
|
|
336
|
-
var workflow = {
|
|
337
|
-
/** Runs a workflow using its published version */
|
|
338
|
-
run: (input) => invoke("workflow.run", input),
|
|
339
|
-
/** Get the URL for a workflow with route parameters */
|
|
340
|
-
url: (input) => invoke("workflow.url", input)
|
|
341
|
-
};
|
|
342
|
-
var workspace = {
|
|
343
|
-
/** Get the login URL for an authenticatable resource */
|
|
344
|
-
loginUrl: (input) => invoke("workspace.login_url", input),
|
|
345
|
-
/** Set the value of a field in a workspace */
|
|
346
|
-
setValue: (input) => invoke("workspace.set_value", input),
|
|
347
|
-
/** Set multiple workspace field values at once from a key => value map */
|
|
348
|
-
setValues: (input) => invoke("workspace.set_values", input),
|
|
349
|
-
/** Get the value of a field in a workspace */
|
|
350
|
-
value: (input) => invoke("workspace.value", input),
|
|
351
|
-
/** Get all workspace field values as a dictionary */
|
|
352
|
-
values: (input) => invoke("workspace.values", input)
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
// packages/workflows/src/data.ts
|
|
356
|
-
var EACH_PAGE_SIZE = 100;
|
|
357
|
-
function each(input) {
|
|
358
|
-
const { maxRecords, ...search } = input;
|
|
359
|
-
if (maxRecords !== void 0 && (!Number.isInteger(maxRecords) || maxRecords < 1)) {
|
|
360
|
-
throw new RangeError(`maxRecords must be a positive integer. Received ${maxRecords}.`);
|
|
361
|
-
}
|
|
362
|
-
const query = JSON.parse(JSON.stringify(search));
|
|
363
|
-
return walk(query, maxRecords ?? Number.POSITIVE_INFINITY);
|
|
364
|
-
}
|
|
365
|
-
async function* walk(query, maxRecords) {
|
|
366
|
-
let remaining = maxRecords;
|
|
367
|
-
let after = null;
|
|
368
|
-
while (remaining > 0) {
|
|
369
|
-
const page2 = await invoke("data.search", {
|
|
370
|
-
...query,
|
|
371
|
-
paging: "cursor",
|
|
372
|
-
pageSize: Math.min(EACH_PAGE_SIZE, remaining),
|
|
373
|
-
...after === null ? {} : { after }
|
|
374
|
-
});
|
|
375
|
-
for (const record of page2.data ?? []) {
|
|
376
|
-
yield record;
|
|
377
|
-
remaining--;
|
|
378
|
-
if (remaining === 0) {
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
if (typeof page2.cursor !== "string") {
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
after = page2.cursor;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
var data2 = {
|
|
389
|
-
...data,
|
|
390
|
-
create: (input) => invoke("data.create", input),
|
|
391
|
-
find: (input) => invoke("data.find", input),
|
|
392
|
-
update: (input) => invoke("data.update", input),
|
|
393
|
-
search: (input) => invoke("data.search", input),
|
|
394
|
-
each,
|
|
395
|
-
delete: (input) => invoke("data.delete", input),
|
|
396
|
-
restore: (input) => invoke("data.restore", input),
|
|
397
|
-
count: (input) => invoke("data.count", input),
|
|
398
|
-
findOrCreate: (input) => invoke("data.find-or-create", input),
|
|
399
|
-
updateOrCreate: (input) => invoke("data.update-or-create", input),
|
|
400
|
-
createMany: (input) => invoke("data.create-many", input),
|
|
401
|
-
deleteMany: (input) => invoke("data.delete-many", input)
|
|
402
|
-
};
|
|
403
|
-
|
|
404
60
|
// packages/workflows/src/notifications.ts
|
|
405
61
|
var mail2 = {
|
|
406
62
|
...mail,
|
|
@@ -427,7 +83,7 @@ export {
|
|
|
427
83
|
calendar,
|
|
428
84
|
callback,
|
|
429
85
|
chart,
|
|
430
|
-
|
|
86
|
+
data,
|
|
431
87
|
date,
|
|
432
88
|
defineWorkflow,
|
|
433
89
|
fail,
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import "../console.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { data as rootData } from "../data.js";
|
|
3
|
+
import { data as migrationData } from "../generated/profiles/migration.js";
|
|
4
|
+
export * from "./shared.js";
|
|
5
|
+
export * from "../generated/profiles/migration.js";
|
|
6
|
+
export { transaction } from "../transaction.js";
|
|
7
|
+
export declare const data: typeof migrationData & {
|
|
8
|
+
each: typeof rootData.each;
|
|
9
|
+
};
|