@powerhousedao/pieces-framework 6.2.3-staging.0 → 6.3.0-dev.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/dist/workflow.js CHANGED
@@ -40,7 +40,7 @@ var ScheduleConfigError = class extends Error {
40
40
  }
41
41
  };
42
42
  const CRON_FIELD = /^[\d*?A-Za-z]+(?:[-/][\dA-Za-z]+)*(?:,[\d*?A-Za-z]+(?:[-/][\dA-Za-z]+)*)*$/;
43
- function isRecord(value) {
43
+ function isRecord$1(value) {
44
44
  return value !== null && typeof value === "object" && !Array.isArray(value);
45
45
  }
46
46
  function parseTimezone(value) {
@@ -74,7 +74,7 @@ function parseInterval(record) {
74
74
  };
75
75
  }
76
76
  function parseScheduleConfig(config) {
77
- if (!isRecord(config)) throw new ScheduleConfigError("the config must be an object");
77
+ if (!isRecord$1(config)) throw new ScheduleConfigError("the config must be an object");
78
78
  const timezone = parseTimezone(config.timezone);
79
79
  if (config.mode === "cron") return {
80
80
  mode: "cron",
@@ -121,11 +121,331 @@ const BRANCH_PORTS = [
121
121
  "false",
122
122
  ERROR_PORT
123
123
  ];
124
+ const STOP_PORTS = [ERROR_PORT];
125
+ const ROUTER_ACTION = "router";
126
+ const LOOP_ACTION = "loop";
127
+ const OTHERWISE_PORT = "otherwise";
128
+ const LOOP_EACH_PORT = "each";
129
+ const LOOP_PORTS = [
130
+ NEXT_PORT,
131
+ LOOP_EACH_PORT,
132
+ ERROR_PORT
133
+ ];
134
+ function isCoreAction(block, name) {
135
+ return block.kind === "action" && block.pieceName === "@powerhousedao/piece-core" && block.name === name;
136
+ }
137
+ function routerBranchPort(index) {
138
+ return `branch_${index}`;
139
+ }
140
+ function routerBranches(config) {
141
+ const branches = config !== null && typeof config === "object" ? config.branches : void 0;
142
+ if (!Array.isArray(branches)) return [];
143
+ return branches.map((branch) => branch !== null && typeof branch === "object" ? branch : {});
144
+ }
145
+ function routerBranchName(branch, index) {
146
+ return (typeof branch.name === "string" ? branch.name.trim() : "") || `Branch ${index}`;
147
+ }
148
+ const BRANCH_PORT = /^branch_[1-9]\d*$/;
149
+ function routerPorts(config, wired = []) {
150
+ const branches = config !== null && typeof config === "object" ? config.branches : void 0;
151
+ const dynamic = branches !== void 0 && branches !== null && !Array.isArray(branches);
152
+ return [
153
+ ...routerBranches(config).map((_, i) => routerBranchPort(i + 1)),
154
+ ...dynamic ? [...new Set(wired)].filter((port) => BRANCH_PORT.test(port)) : [],
155
+ OTHERWISE_PORT,
156
+ ERROR_PORT
157
+ ];
158
+ }
159
+ function stepPortLabel(block, config, port) {
160
+ if (isCoreAction(block, "router")) {
161
+ if (port === "otherwise") return "Otherwise";
162
+ const match = /^branch_(\d+)$/.exec(port);
163
+ const branches = routerBranches(config);
164
+ const index = match ? Number(match[1]) : 0;
165
+ if (index >= 1 && index <= branches.length) return routerBranchName(branches[index - 1], index);
166
+ return;
167
+ }
168
+ if (isCoreAction(block, "loop")) {
169
+ if (port === "each") return "For each item";
170
+ if (port === "next") return "After loop";
171
+ }
172
+ }
124
173
  function knownPorts(block) {
125
174
  if (block.kind === "trigger") return TRIGGER_PORTS;
126
- return block.pieceName === "@powerhousedao/piece-core" && block.name === "branch" ? BRANCH_PORTS : PIECE_ACTION_PORTS;
175
+ if (block.pieceName !== "@powerhousedao/piece-core") return PIECE_ACTION_PORTS;
176
+ if (block.name === "branch") return BRANCH_PORTS;
177
+ if (block.name === "stop") return STOP_PORTS;
178
+ if (block.name === "loop") return LOOP_PORTS;
179
+ if (block.name === "router") return routerPorts(void 0);
180
+ return PIECE_ACTION_PORTS;
181
+ }
182
+ function stepPorts(block, config, portsOf = knownPorts, wired) {
183
+ if (isCoreAction(block, "router")) return routerPorts(config, wired);
184
+ return portsOf(block);
185
+ }
186
+
187
+ //#endregion
188
+ //#region src/workflow/document-reference.ts
189
+ const DOCUMENT_REF_KEY = "$documentRef";
190
+ const DOCUMENT_KEYS = /* @__PURE__ */ new Set([
191
+ "header",
192
+ "state",
193
+ "initialState",
194
+ "operations",
195
+ "clipboard"
196
+ ]);
197
+ const MAX_DEPTH = 64;
198
+ function isPlainObject(value) {
199
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
200
+ const proto = Object.getPrototypeOf(value);
201
+ return proto === Object.prototype || proto === null;
202
+ }
203
+ function isRevision(value) {
204
+ return isPlainObject(value) && Object.values(value).every((entry) => typeof entry === "number" && Number.isFinite(entry));
205
+ }
206
+ function documentReference(header) {
207
+ return {
208
+ documentId: header.id,
209
+ documentType: header.documentType,
210
+ branch: header.branch,
211
+ revision: { ...header.revision }
212
+ };
213
+ }
214
+ function isDocumentReference(value) {
215
+ return isPlainObject(value) && typeof value.documentId === "string" && typeof value.documentType === "string" && typeof value.branch === "string" && isRevision(value.revision);
216
+ }
217
+ function isDocumentHeader(value) {
218
+ return isPlainObject(value) && typeof value.id === "string" && value.id !== "" && typeof value.documentType === "string" && value.documentType !== "" && typeof value.branch === "string" && isRevision(value.revision) && typeof value.createdAtUtcIso === "string" && typeof value.lastModifiedAtUtcIso === "string";
219
+ }
220
+ function isReactorDocument(value) {
221
+ return isPlainObject(value) && isDocumentHeader(value.header) && isPlainObject(value.state);
222
+ }
223
+ function isDocumentRefMarker(value) {
224
+ return isPlainObject(value) && isDocumentReference(value["$documentRef"]);
225
+ }
226
+ function walk(value, visit, depth, seen) {
227
+ if (depth > MAX_DEPTH || typeof value !== "object" || value === null) return value;
228
+ if (seen.has(value)) return value;
229
+ if (Array.isArray(value)) {
230
+ seen.add(value);
231
+ const mapped = value.map((item) => walk(item, visit, depth + 1, seen));
232
+ seen.delete(value);
233
+ return mapped;
234
+ }
235
+ if (!isPlainObject(value)) return value;
236
+ seen.add(value);
237
+ const replaced = visit(value);
238
+ const result = Object.fromEntries(Object.entries(replaced ?? value).map(([key, entry]) => [key, replaced && !(key in value) ? entry : walk(entry, visit, depth + 1, seen)]));
239
+ seen.delete(value);
240
+ return result;
241
+ }
242
+ function referenceDocuments(value) {
243
+ return walk(value, (node) => {
244
+ if (!isReactorDocument(node)) return void 0;
245
+ const rest = Object.entries(node).filter(([key]) => !DOCUMENT_KEYS.has(key));
246
+ return {
247
+ [DOCUMENT_REF_KEY]: documentReference(node.header),
248
+ ...Object.fromEntries(rest)
249
+ };
250
+ }, 0, /* @__PURE__ */ new WeakSet());
251
+ }
252
+ function documentRefsIn(value) {
253
+ const found = [];
254
+ walk(value, (node) => {
255
+ if (isDocumentRefMarker(node)) found.push(node[DOCUMENT_REF_KEY]);
256
+ }, 0, /* @__PURE__ */ new WeakSet());
257
+ return found;
258
+ }
259
+ function containsDocumentRef(value) {
260
+ return documentRefsIn(value).length > 0;
261
+ }
262
+ function expandDocumentRefs(value, expand) {
263
+ return walk(value, (node) => {
264
+ if (!isDocumentRefMarker(node)) return void 0;
265
+ const { [DOCUMENT_REF_KEY]: reference, ...rest } = node;
266
+ return {
267
+ ...rest,
268
+ ...expand(reference)
269
+ };
270
+ }, 0, /* @__PURE__ */ new WeakSet());
271
+ }
272
+
273
+ //#endregion
274
+ //#region src/workflow/manual-inputs.ts
275
+ const MANUAL_INPUT_TYPES = [
276
+ "text",
277
+ "text_area",
278
+ "number",
279
+ "toggle",
280
+ "date",
281
+ "dropdown",
282
+ "json"
283
+ ];
284
+ var ManualPayloadError = class extends Error {
285
+ fields;
286
+ constructor(fields) {
287
+ super(`Manual trigger payload: ${fields.map((entry) => entry.field ? `"${entry.field}" ${entry.message}` : entry.message).join("; ")}`);
288
+ this.name = "ManualPayloadError";
289
+ this.fields = fields;
290
+ }
291
+ };
292
+ function isRecord(value) {
293
+ return value !== null && typeof value === "object" && !Array.isArray(value);
294
+ }
295
+ const text = (value) => typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
296
+ function defaultText(value) {
297
+ if (value === void 0 || value === null || value === "") return void 0;
298
+ if (typeof value === "string") return value;
299
+ if (typeof value === "object") return JSON.stringify(value);
300
+ return String(value);
301
+ }
302
+ function parseManualOptions(value) {
303
+ const entries = Array.isArray(value) ? value.map(optionEntry) : typeof value === "string" ? value.split(/\r?\n/).map(optionLine) : [];
304
+ const byValue = /* @__PURE__ */ new Map();
305
+ for (const entry of entries) if (entry && !byValue.has(entry.value)) byValue.set(entry.value, entry);
306
+ return [...byValue.values()];
307
+ }
308
+ function optionLine(line) {
309
+ const at = line.indexOf(" = ");
310
+ const value = (at < 0 ? line : line.slice(at + 3)).trim();
311
+ if (value === "") return void 0;
312
+ const label = at < 0 ? value : line.slice(0, at).trim();
313
+ return {
314
+ label: label === "" ? value : label,
315
+ value
316
+ };
317
+ }
318
+ function optionEntry(entry) {
319
+ if (!isRecord(entry)) return optionLine(String(entry));
320
+ const value = defaultText(entry.value)?.trim();
321
+ if (!value) return void 0;
322
+ return {
323
+ label: text(entry.label) ?? value,
324
+ value
325
+ };
326
+ }
327
+ function parseManualInputs(config) {
328
+ const rows = isRecord(config) ? config.inputs : void 0;
329
+ if (!Array.isArray(rows)) return [];
330
+ const byName = /* @__PURE__ */ new Map();
331
+ for (const row of rows) {
332
+ if (!isRecord(row)) continue;
333
+ const name = text(row.name);
334
+ const type = row.type;
335
+ if (!name || !MANUAL_INPUT_TYPES.includes(type)) continue;
336
+ const description = text(row.description);
337
+ const defaultValue = defaultText(row.defaultValue);
338
+ byName.delete(name);
339
+ byName.set(name, {
340
+ name,
341
+ displayName: text(row.displayName) ?? name,
342
+ type,
343
+ required: row.required === true,
344
+ ...description ? { description } : {},
345
+ ...defaultValue !== void 0 ? { defaultValue } : {},
346
+ ...type === "dropdown" ? { options: parseManualOptions(row.options) } : {}
347
+ });
348
+ }
349
+ return [...byName.values()];
350
+ }
351
+ const ISO_DATE = /^\d{4}-\d{2}-\d{2}(?:[T ][\d:.]+(?:Z|[+-]\d{2}:?\d{2})?)?$/;
352
+ function coerceManualValue(input, raw) {
353
+ switch (input.type) {
354
+ case "text":
355
+ case "text_area":
356
+ if (typeof raw === "string") return { value: raw };
357
+ if (typeof raw === "number" || typeof raw === "boolean") return { value: String(raw) };
358
+ return { error: "must be text" };
359
+ case "number": {
360
+ if (typeof raw === "number" && Number.isFinite(raw)) return { value: raw };
361
+ const parsed = typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
362
+ return Number.isFinite(parsed) ? { value: parsed } : { error: "must be a number" };
363
+ }
364
+ case "toggle":
365
+ if (typeof raw === "boolean") return { value: raw };
366
+ if (typeof raw === "string" && /^(true|false)$/i.test(raw.trim())) return { value: raw.trim().toLowerCase() === "true" };
367
+ return { error: "must be true or false" };
368
+ case "date": {
369
+ const value = typeof raw === "string" ? raw.trim() : "";
370
+ const time = ISO_DATE.test(value) ? Date.parse(value) : NaN;
371
+ return Number.isNaN(time) ? { error: "must be an ISO 8601 date" } : { value: new Date(time).toISOString() };
372
+ }
373
+ case "dropdown": {
374
+ const value = typeof raw === "string" || typeof raw === "number" ? String(raw) : "";
375
+ const values = (input.options ?? []).map((option) => option.value);
376
+ if (values.length === 0 ? value !== "" : values.includes(value)) return { value };
377
+ return values.length > 0 ? { error: `must be one of ${values.map((v) => `"${v}"`).join(", ")}` } : { error: "must be text" };
378
+ }
379
+ case "json": return { value: raw };
380
+ }
381
+ }
382
+ function manualDefault(input) {
383
+ if (input.defaultValue === void 0) return void 0;
384
+ if (input.type === "json") try {
385
+ return JSON.parse(input.defaultValue);
386
+ } catch {
387
+ return input.defaultValue;
388
+ }
389
+ if (input.type === "dropdown") {
390
+ const options = input.options ?? [];
391
+ const match = options.find((option) => option.value === input.defaultValue) ?? options.find((option) => option.label === input.defaultValue);
392
+ if (match) return match.value;
393
+ }
394
+ const coerced = coerceManualValue(input, input.defaultValue);
395
+ return "value" in coerced ? coerced.value : void 0;
396
+ }
397
+ const isMissing = (value) => value === void 0 || value === null || value === "";
398
+ function coerceManualPayload(inputs, payload) {
399
+ if (payload !== void 0 && payload !== null && !isRecord(payload)) throw new ManualPayloadError([{
400
+ field: "",
401
+ message: "must be a JSON object"
402
+ }]);
403
+ const next = { ...payload };
404
+ const errors = [];
405
+ for (const input of inputs) {
406
+ let raw = next[input.name];
407
+ if (isMissing(raw)) raw = manualDefault(input);
408
+ if (isMissing(raw)) {
409
+ delete next[input.name];
410
+ if (input.required) errors.push({
411
+ field: input.name,
412
+ message: "is required"
413
+ });
414
+ continue;
415
+ }
416
+ const coerced = coerceManualValue(input, raw);
417
+ if ("error" in coerced) errors.push({
418
+ field: input.name,
419
+ message: coerced.error
420
+ });
421
+ else next[input.name] = coerced.value;
422
+ }
423
+ if (errors.length > 0) throw new ManualPayloadError(errors);
424
+ return next;
425
+ }
426
+ const TYPE_NAMES = {
427
+ text: "String",
428
+ text_area: "String",
429
+ number: "Float",
430
+ toggle: "Boolean",
431
+ date: "DateTime",
432
+ dropdown: "String",
433
+ json: "JSON"
434
+ };
435
+ function manualInputTypeName(input) {
436
+ const base = TYPE_NAMES[input.type];
437
+ return input.required ? `${base}!` : base;
438
+ }
439
+
440
+ //#endregion
441
+ //#region src/workflow/subflows.ts
442
+ const SUBFLOWS_PIECE = "@activepieces/piece-subflows";
443
+ const CALLABLE_FLOW_TRIGGER = "callableFlow";
444
+ const CALL_FLOW_ACTION = "callFlow";
445
+ function isCallableFlow(trigger) {
446
+ return (trigger.packageName ?? trigger.pieceName) === "@activepieces/piece-subflows" && trigger.triggerName === "callableFlow";
127
447
  }
128
448
 
129
449
  //#endregion
130
- export { APP_WEBHOOK_UNSUPPORTED, BRANCH_PORTS, CORE_PIECE_NAME, DEFAULT_TIMEZONE, ERROR_PORT, NEXT_PORT, PIECE_ACTION_PORTS, SCHEDULE_MODES, SCHEDULE_UNIT_MS, ScheduleConfigError, TRIGGER_PORTS, TriggerStrategyError, checkTriggerStrategy, flowPorts, knownPorts, parseCronText, parseScheduleConfig, scheduleConfigIssue, triggerDelivery, undeclaredPortEdges };
450
+ export { APP_WEBHOOK_UNSUPPORTED, BRANCH_PORTS, CALLABLE_FLOW_TRIGGER, CALL_FLOW_ACTION, CORE_PIECE_NAME, DEFAULT_TIMEZONE, DOCUMENT_REF_KEY, ERROR_PORT, LOOP_ACTION, LOOP_EACH_PORT, LOOP_PORTS, MANUAL_INPUT_TYPES, ManualPayloadError, NEXT_PORT, OTHERWISE_PORT, PIECE_ACTION_PORTS, ROUTER_ACTION, SCHEDULE_MODES, SCHEDULE_UNIT_MS, STOP_PORTS, SUBFLOWS_PIECE, ScheduleConfigError, TRIGGER_PORTS, TriggerStrategyError, checkTriggerStrategy, coerceManualPayload, coerceManualValue, containsDocumentRef, documentReference, documentRefsIn, expandDocumentRefs, flowPorts, isCallableFlow, isCoreAction, isDocumentRefMarker, isDocumentReference, isReactorDocument, knownPorts, manualDefault, manualInputTypeName, parseCronText, parseManualInputs, parseManualOptions, parseScheduleConfig, referenceDocuments, routerBranchName, routerBranchPort, routerBranches, routerPorts, scheduleConfigIssue, stepPortLabel, stepPorts, triggerDelivery, undeclaredPortEdges };
131
451
  //# sourceMappingURL=workflow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.js","names":[],"sources":["../src/workflow/strategy.ts","../src/workflow/schedule.ts","../src/workflow/ports.ts","../src/workflow/core.ts"],"sourcesContent":["// How a trigger is fed, decided from its resolved descriptor's strategy. The\n// runtime arms by it and the editor draws by it; nothing stores it.\n\nexport type TriggerDelivery = \"poll\" | \"webhook\" | \"manual\";\n\nexport type TriggerStrategyCheck =\n | { delivery: TriggerDelivery }\n | { issue: string };\n\nconst DELIVERIES: Record<string, TriggerDelivery> = {\n POLLING: \"poll\",\n WEBHOOK: \"webhook\",\n MANUAL: \"manual\",\n};\n\n// Activepieces routes APP_WEBHOOK events through one app-level endpoint and a\n// listener table; this runtime has neither, so it refuses them.\nexport const APP_WEBHOOK_UNSUPPORTED =\n \"TriggerStrategy.APP_WEBHOOK (app-level webhooks) is not supported\";\n\nexport class TriggerStrategyError extends Error {\n readonly strategy: unknown;\n\n constructor(strategy: unknown, issue: string) {\n super(issue);\n this.name = \"TriggerStrategyError\";\n this.strategy = strategy;\n }\n}\n\nexport function checkTriggerStrategy(strategy: unknown): TriggerStrategyCheck {\n if (typeof strategy === \"string\" && Object.hasOwn(DELIVERIES, strategy)) {\n return { delivery: DELIVERIES[strategy] };\n }\n if (strategy === \"APP_WEBHOOK\") return { issue: APP_WEBHOOK_UNSUPPORTED };\n return {\n issue:\n strategy === undefined || strategy === null || strategy === \"\"\n ? \"The trigger declares no strategy\"\n : `Unknown trigger strategy ${JSON.stringify(strategy)}`,\n };\n}\n\n// Throws TriggerStrategyError for an unsupported or unknown strategy.\nexport function triggerDelivery(strategy: unknown): TriggerDelivery {\n const check = checkTriggerStrategy(strategy);\n if (\"issue\" in check) throw new TriggerStrategyError(strategy, check.issue);\n return check.delivery;\n}\n","// The core piece's schedule trigger config, read the same way by the editor\n// and the runtime. The runtime also runs the cron through croner before arming it.\n\nexport const DEFAULT_TIMEZONE = \"UTC\";\n\nexport const SCHEDULE_UNIT_MS = {\n minutes: 60_000,\n hours: 3_600_000,\n days: 86_400_000,\n} as const;\n\nexport type ScheduleUnit = keyof typeof SCHEDULE_UNIT_MS;\n\nexport const SCHEDULE_MODES = [\"cron\", \"interval\"] as const;\n\nexport type ScheduleMode = (typeof SCHEDULE_MODES)[number];\n\nexport type ScheduleConfig =\n | { mode: \"cron\"; cron: string; timezone: string }\n | {\n mode: \"interval\";\n every: number;\n unit: ScheduleUnit;\n everyMs: number;\n timezone: string;\n };\n\nexport class ScheduleConfigError extends Error {\n constructor(message: string) {\n super(`Schedule: ${message}`);\n this.name = \"ScheduleConfigError\";\n }\n}\n\n// One cron field: digits, names, ranges, steps and lists; croner checks values.\nconst CRON_FIELD =\n /^[\\d*?A-Za-z]+(?:[-/][\\dA-Za-z]+)*(?:,[\\d*?A-Za-z]+(?:[-/][\\dA-Za-z]+)*)*$/;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n// Intl is the authority on IANA names, in the browser and in Node alike.\nfunction parseTimezone(value: unknown): string {\n if (value === undefined || value === null || value === \"\") {\n return DEFAULT_TIMEZONE;\n }\n if (typeof value !== \"string\") {\n throw new ScheduleConfigError('\"timezone\" must be an IANA name');\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: value });\n } catch {\n throw new ScheduleConfigError(\n `unknown timezone \"${value}\" (use an IANA name such as Europe/Lisbon)`,\n );\n }\n return value;\n}\n\n// Exactly five fields: minute hour day month weekday.\nexport function parseCronText(cron: unknown): string {\n if (typeof cron !== \"string\" || cron.trim() === \"\") {\n throw new ScheduleConfigError('\"cron\" is required in cron mode');\n }\n const pattern = cron.trim().replace(/\\s+/g, \" \");\n const fields = pattern.split(\" \");\n if (fields.length !== 5) {\n throw new ScheduleConfigError(\n `cron \"${pattern}\" must have exactly five fields (minute hour day month weekday)`,\n );\n }\n const bad = fields.find((field) => !CRON_FIELD.test(field));\n if (bad !== undefined) {\n throw new ScheduleConfigError(\n `cron \"${pattern}\" has an invalid field \"${bad}\"`,\n );\n }\n return pattern;\n}\n\nfunction parseInterval(record: Record<string, unknown>) {\n const { every, unit } = record;\n if (typeof every !== \"number\" || !Number.isInteger(every) || every < 1) {\n throw new ScheduleConfigError(\n '\"every\" must be a whole number of at least 1 in interval mode',\n );\n }\n if (typeof unit !== \"string\" || !Object.hasOwn(SCHEDULE_UNIT_MS, unit)) {\n throw new ScheduleConfigError(\n `\"unit\" must be one of ${Object.keys(SCHEDULE_UNIT_MS).join(\", \")}`,\n );\n }\n const key = unit as ScheduleUnit;\n return { every, unit: key, everyMs: every * SCHEDULE_UNIT_MS[key] };\n}\n\n// { mode, cron | every + unit, timezone? }; `mode` is required.\nexport function parseScheduleConfig(config: unknown): ScheduleConfig {\n if (!isRecord(config)) {\n throw new ScheduleConfigError(\"the config must be an object\");\n }\n const timezone = parseTimezone(config.timezone);\n if (config.mode === \"cron\") {\n return { mode: \"cron\", cron: parseCronText(config.cron), timezone };\n }\n if (config.mode === \"interval\") {\n return { mode: \"interval\", ...parseInterval(config), timezone };\n }\n throw new ScheduleConfigError(\n config.mode === undefined\n ? '\"mode\" is required (\"cron\" or \"interval\")'\n : `\"mode\" must be \"cron\" or \"interval\", not ${JSON.stringify(config.mode)}`,\n );\n}\n\n// The problem with a config, or undefined when it parses.\nexport function scheduleConfigIssue(config: unknown): string | undefined {\n try {\n parseScheduleConfig(config);\n return undefined;\n } catch (error) {\n return error instanceof Error ? error.message : String(error);\n }\n}\n","// Output ports a block declares. Descriptors carry them; the editor draws\n// only these, and the runtime warns about an edge on any other.\n\nexport const NEXT_PORT = \"next\";\nexport const ERROR_PORT = \"error\";\n\n// Every piece action: it succeeds onto \"next\" or fails onto \"error\".\nexport const PIECE_ACTION_PORTS: readonly string[] = [NEXT_PORT, ERROR_PORT];\n\n// A trigger starts the run on \"next\".\nexport const TRIGGER_PORTS: readonly string[] = [NEXT_PORT];\n\n// The ports that carry the flow on; \"error\" is a failure route.\nexport function flowPorts(ports: readonly string[]): string[] {\n return ports.filter((port) => port !== ERROR_PORT);\n}\n\nexport interface PortedEdge {\n id: string;\n from: string;\n port: string;\n}\n\n// Edges leaving on a port their source does not declare. A source whose\n// ports are not known (undefined) is not judged.\nexport function undeclaredPortEdges<E extends PortedEdge>(\n edges: readonly E[],\n portsOf: (sourceId: string) => readonly string[] | undefined,\n): E[] {\n return edges.filter((edge) => {\n const ports = portsOf(edge.from);\n return ports !== undefined && !ports.includes(edge.port);\n });\n}\n","// The built-in piece every reactor serves: branch, assert and the triggers\n// that belong to no service. Its version is the runtime's own.\nimport { ERROR_PORT, PIECE_ACTION_PORTS, TRIGGER_PORTS } from \"./ports.js\";\n\nexport const CORE_PIECE_NAME = \"@powerhousedao/piece-core\";\n\n// The core branch action leaves on \"true\" or \"false\".\nexport const BRANCH_PORTS: readonly string[] = [\"true\", \"false\", ERROR_PORT];\n\n// A block's ports as known before its descriptor loads: fixed per kind, and\n// the core branch's own.\nexport function knownPorts(block: {\n pieceName: string;\n kind: \"action\" | \"trigger\";\n name: string;\n}): readonly string[] {\n if (block.kind === \"trigger\") return TRIGGER_PORTS;\n return block.pie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AY,GAAG,cAAc,MAAM;EAAG;CAAS;CAEhE,MAAM,IAAI,oBACR,OAAO,SAAS,SACZ,oDACA,4CAA4C,KAAK,UAAU,OAAO,IAAI,GAC5E;AACF;AAGA,SAAgB,oBAAoB,QAAqC;CACvE,IAAI;EACF,oBAAoB,MAAM;EAC1B;CACF,SAAS,OAAO;EACd,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CAC9D;AACF;;;;ACzHA,MAAa,YAAY;AACzB,MAAa,aAAa;AAG1B,MAAa,qBAAwC,CAAC,WAAW,UAAU;AAG3E,MAAa,gBAAmC,CAAC,SAAS;AAG1D,SAAgB,UAAU,OAAoC;CAC5D,OAAO,MAAM,QAAQ,SAAS,SAAS,UAAU;AACnD;AAUA,SAAgB,oBACd,OACA,SACK;CACL,OAAO,MAAM,QAAQ,SAAS;EAC5B,MAAM,QAAQ,QAAQ,KAAK,IAAI;EAC/B,OAAO,UAAU,UAAa,CAAC,MAAM,SAAS,KAAK,IAAI;CACzD,CAAC;AACH;;;;AC7BA,MAAa,kBAAkB;AAG/B,MAAa,eAAkC;CAAC;CAAQ;CAAS;AAAU;AAI3E,SAAgB,WAAW,OAIL;CACpB,IAAI,MAAM,SAAS,WAAW,OAAO;CACrC,OAAO,MAAM,6CAAiC,MAAM,SAAS,WACzD,eACA;AACN"}
1
+ {"version":3,"file":"workflow.js","names":["isRecord"],"sources":["../src/workflow/strategy.ts","../src/workflow/schedule.ts","../src/workflow/ports.ts","../src/workflow/core.ts","../src/workflow/document-reference.ts","../src/workflow/manual-inputs.ts","../src/workflow/subflows.ts"],"sourcesContent":["// How a trigger is fed, decided from its resolved descriptor's strategy. The\n// runtime arms by it and the editor draws by it; nothing stores it.\n\nexport type TriggerDelivery = \"poll\" | \"webhook\" | \"manual\";\n\nexport type TriggerStrategyCheck =\n | { delivery: TriggerDelivery }\n | { issue: string };\n\nconst DELIVERIES: Record<string, TriggerDelivery> = {\n POLLING: \"poll\",\n WEBHOOK: \"webhook\",\n MANUAL: \"manual\",\n};\n\n// Activepieces routes APP_WEBHOOK events through one app-level endpoint and a\n// listener table; this runtime has neither, so it refuses them.\nexport const APP_WEBHOOK_UNSUPPORTED =\n \"TriggerStrategy.APP_WEBHOOK (app-level webhooks) is not supported\";\n\nexport class TriggerStrategyError extends Error {\n readonly strategy: unknown;\n\n constructor(strategy: unknown, issue: string) {\n super(issue);\n this.name = \"TriggerStrategyError\";\n this.strategy = strategy;\n }\n}\n\nexport function checkTriggerStrategy(strategy: unknown): TriggerStrategyCheck {\n if (typeof strategy === \"string\" && Object.hasOwn(DELIVERIES, strategy)) {\n return { delivery: DELIVERIES[strategy] };\n }\n if (strategy === \"APP_WEBHOOK\") return { issue: APP_WEBHOOK_UNSUPPORTED };\n return {\n issue:\n strategy === undefined || strategy === null || strategy === \"\"\n ? \"The trigger declares no strategy\"\n : `Unknown trigger strategy ${JSON.stringify(strategy)}`,\n };\n}\n\n// Throws TriggerStrategyError for an unsupported or unknown strategy.\nexport function triggerDelivery(strategy: unknown): TriggerDelivery {\n const check = checkTriggerStrategy(strategy);\n if (\"issue\" in check) throw new TriggerStrategyError(strategy, check.issue);\n return check.delivery;\n}\n","// The core piece's schedule trigger config, read the same way by the editor\n// and the runtime. The runtime also runs the cron through croner before arming it.\n\nexport const DEFAULT_TIMEZONE = \"UTC\";\n\nexport const SCHEDULE_UNIT_MS = {\n minutes: 60_000,\n hours: 3_600_000,\n days: 86_400_000,\n} as const;\n\nexport type ScheduleUnit = keyof typeof SCHEDULE_UNIT_MS;\n\nexport const SCHEDULE_MODES = [\"cron\", \"interval\"] as const;\n\nexport type ScheduleMode = (typeof SCHEDULE_MODES)[number];\n\nexport type ScheduleConfig =\n | { mode: \"cron\"; cron: string; timezone: string }\n | {\n mode: \"interval\";\n every: number;\n unit: ScheduleUnit;\n everyMs: number;\n timezone: string;\n };\n\nexport class ScheduleConfigError extends Error {\n constructor(message: string) {\n super(`Schedule: ${message}`);\n this.name = \"ScheduleConfigError\";\n }\n}\n\n// One cron field: digits, names, ranges, steps and lists; croner checks values.\nconst CRON_FIELD =\n /^[\\d*?A-Za-z]+(?:[-/][\\dA-Za-z]+)*(?:,[\\d*?A-Za-z]+(?:[-/][\\dA-Za-z]+)*)*$/;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n// Intl is the authority on IANA names, in the browser and in Node alike.\nfunction parseTimezone(value: unknown): string {\n if (value === undefined || value === null || value === \"\") {\n return DEFAULT_TIMEZONE;\n }\n if (typeof value !== \"string\") {\n throw new ScheduleConfigError('\"timezone\" must be an IANA name');\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: value });\n } catch {\n throw new ScheduleConfigError(\n `unknown timezone \"${value}\" (use an IANA name such as Europe/Lisbon)`,\n );\n }\n return value;\n}\n\n// Exactly five fields: minute hour day month weekday.\nexport function parseCronText(cron: unknown): string {\n if (typeof cron !== \"string\" || cron.trim() === \"\") {\n throw new ScheduleConfigError('\"cron\" is required in cron mode');\n }\n const pattern = cron.trim().replace(/\\s+/g, \" \");\n const fields = pattern.split(\" \");\n if (fields.length !== 5) {\n throw new ScheduleConfigError(\n `cron \"${pattern}\" must have exactly five fields (minute hour day month weekday)`,\n );\n }\n const bad = fields.find((field) => !CRON_FIELD.test(field));\n if (bad !== undefined) {\n throw new ScheduleConfigError(\n `cron \"${pattern}\" has an invalid field \"${bad}\"`,\n );\n }\n return pattern;\n}\n\nfunction parseInterval(record: Record<string, unknown>) {\n const { every, unit } = record;\n if (typeof every !== \"number\" || !Number.isInteger(every) || every < 1) {\n throw new ScheduleConfigError(\n '\"every\" must be a whole number of at least 1 in interval mode',\n );\n }\n if (typeof unit !== \"string\" || !Object.hasOwn(SCHEDULE_UNIT_MS, unit)) {\n throw new ScheduleConfigError(\n `\"unit\" must be one of ${Object.keys(SCHEDULE_UNIT_MS).join(\", \")}`,\n );\n }\n const key = unit as ScheduleUnit;\n return { every, unit: key, everyMs: every * SCHEDULE_UNIT_MS[key] };\n}\n\n// { mode, cron | every + unit, timezone? }; `mode` is required.\nexport function parseScheduleConfig(config: unknown): ScheduleConfig {\n if (!isRecord(config)) {\n throw new ScheduleConfigError(\"the config must be an object\");\n }\n const timezone = parseTimezone(config.timezone);\n if (config.mode === \"cron\") {\n return { mode: \"cron\", cron: parseCronText(config.cron), timezone };\n }\n if (config.mode === \"interval\") {\n return { mode: \"interval\", ...parseInterval(config), timezone };\n }\n throw new ScheduleConfigError(\n config.mode === undefined\n ? '\"mode\" is required (\"cron\" or \"interval\")'\n : `\"mode\" must be \"cron\" or \"interval\", not ${JSON.stringify(config.mode)}`,\n );\n}\n\n// The problem with a config, or undefined when it parses.\nexport function scheduleConfigIssue(config: unknown): string | undefined {\n try {\n parseScheduleConfig(config);\n return undefined;\n } catch (error) {\n return error instanceof Error ? error.message : String(error);\n }\n}\n","// Output ports a block declares. Descriptors carry them; the editor draws\n// only these, and the runtime warns about an edge on any other.\n\nexport const NEXT_PORT = \"next\";\nexport const ERROR_PORT = \"error\";\n\n// Every piece action: it succeeds onto \"next\" or fails onto \"error\".\nexport const PIECE_ACTION_PORTS: readonly string[] = [NEXT_PORT, ERROR_PORT];\n\n// A trigger starts the run on \"next\".\nexport const TRIGGER_PORTS: readonly string[] = [NEXT_PORT];\n\n// The ports that carry the flow on; \"error\" is a failure route.\nexport function flowPorts(ports: readonly string[]): string[] {\n return ports.filter((port) => port !== ERROR_PORT);\n}\n\nexport interface PortedEdge {\n id: string;\n from: string;\n port: string;\n}\n\n// Edges leaving on a port their source does not declare. A source whose\n// ports are not known (undefined) is not judged.\nexport function undeclaredPortEdges<E extends PortedEdge>(\n edges: readonly E[],\n portsOf: (sourceId: string) => readonly string[] | undefined,\n): E[] {\n return edges.filter((edge) => {\n const ports = portsOf(edge.from);\n return ports !== undefined && !ports.includes(edge.port);\n });\n}\n","// The built-in piece every reactor serves: branch, assert and the triggers\n// that belong to no service. Its version is the runtime's own.\nimport {\n ERROR_PORT,\n NEXT_PORT,\n PIECE_ACTION_PORTS,\n TRIGGER_PORTS,\n} from \"./ports.js\";\n\nexport const CORE_PIECE_NAME = \"@powerhousedao/piece-core\";\n\n// The core branch action leaves on \"true\" or \"false\".\nexport const BRANCH_PORTS: readonly string[] = [\"true\", \"false\", ERROR_PORT];\n\n// The core stop action ends the run, so it continues on no port.\nexport const STOP_PORTS: readonly string[] = [ERROR_PORT];\n\nexport const ROUTER_ACTION = \"router\";\nexport const LOOP_ACTION = \"loop\";\n\n// The router's port when no branch matches.\nexport const OTHERWISE_PORT = \"otherwise\";\n// The loop's body port; \"next\" is taken once every item has run, and comes\n// first so a step inserted on an edge keeps what follows after the loop.\nexport const LOOP_EACH_PORT = \"each\";\nexport const LOOP_PORTS: readonly string[] = [\n NEXT_PORT,\n LOOP_EACH_PORT,\n ERROR_PORT,\n];\n\nexport interface BlockKind {\n pieceName: string;\n kind: \"action\" | \"trigger\";\n name: string;\n}\n\nexport function isCoreAction(block: BlockKind, name: string): boolean {\n return (\n block.kind === \"action\" &&\n block.pieceName === CORE_PIECE_NAME &&\n block.name === name\n );\n}\n\n// The port of the router's 1-based branch `index`.\nexport function routerBranchPort(index: number): string {\n return `branch_${index}`;\n}\n\n// The configured branches; a list bound to one expression has none yet.\nexport function routerBranches(config: unknown): Record<string, unknown>[] {\n const branches =\n config !== null && typeof config === \"object\"\n ? (config as Record<string, unknown>).branches\n : undefined;\n if (!Array.isArray(branches)) return [];\n return branches.map((branch) =>\n branch !== null && typeof branch === \"object\"\n ? (branch as Record<string, unknown>)\n : {},\n );\n}\n\n// A branch's display name, else \"Branch N\".\nexport function routerBranchName(\n branch: Record<string, unknown>,\n index: number,\n): string {\n const name = typeof branch.name === \"string\" ? branch.name.trim() : \"\";\n return name || `Branch ${index}`;\n}\n\nconst BRANCH_PORT = /^branch_[1-9]\\d*$/;\n\n// Branches bound to an expression are known only at run time, so the branch\n// ports `wired` holds (the step's edges' ports) count as declared.\nexport function routerPorts(\n config: unknown,\n wired: readonly string[] = [],\n): string[] {\n const branches =\n config !== null && typeof config === \"object\"\n ? (config as Record<string, unknown>).branches\n : undefined;\n const dynamic =\n branches !== undefined && branches !== null && !Array.isArray(branches);\n return [\n ...routerBranches(config).map((_, i) => routerBranchPort(i + 1)),\n ...(dynamic\n ? [...new Set(wired)].filter((port) => BRANCH_PORT.test(port))\n : []),\n OTHERWISE_PORT,\n ERROR_PORT,\n ];\n}\n\n// Labels for config-dependent ports; undefined for any other port.\nexport function stepPortLabel(\n block: BlockKind,\n config: unknown,\n port: string,\n): string | undefined {\n if (isCoreAction(block, ROUTER_ACTION)) {\n if (port === OTHERWISE_PORT) return \"Otherwise\";\n const match = /^branch_(\\d+)$/.exec(port);\n const branches = routerBranches(config);\n const index = match ? Number(match[1]) : 0;\n if (index >= 1 && index <= branches.length) {\n return routerBranchName(branches[index - 1], index);\n }\n return undefined;\n }\n if (isCoreAction(block, LOOP_ACTION)) {\n if (port === LOOP_EACH_PORT) return \"For each item\";\n if (port === NEXT_PORT) return \"After loop\";\n }\n return undefined;\n}\n\n// A block's ports as known before its descriptor loads: fixed per kind, and\n// the core branch's and stop's own.\nexport function knownPorts(block: BlockKind): readonly string[] {\n if (block.kind === \"trigger\") return TRIGGER_PORTS;\n if (block.pieceName !== CORE_PIECE_NAME) return PIECE_ACTION_PORTS;\n if (block.name === \"branch\") return BRANCH_PORTS;\n if (block.name === \"stop\") return STOP_PORTS;\n if (block.name === LOOP_ACTION) return LOOP_PORTS;\n if (block.name === ROUTER_ACTION) return routerPorts(undefined);\n return PIECE_ACTION_PORTS;\n}\n\n// A step's ports: the router's follow its branches, the rest are its block's.\n// `wired` is the step's edges' ports, for branches bound to an expression.\nexport function stepPorts<B extends BlockKind>(\n block: B,\n config: unknown,\n portsOf: (block: B) => readonly string[] | undefined = knownPorts,\n wired?: readonly string[],\n): readonly string[] | undefined {\n if (isCoreAction(block, ROUTER_ACTION)) return routerPorts(config, wired);\n return portsOf(block);\n}\n","// A pointer to a reactor document, and the marker the run journal stores in\n// place of a document a step returned. No dependencies: the editor bundles it.\n\nexport interface DocumentReference {\n documentId: string;\n documentType: string;\n branch: string;\n // Operation count per scope when the reference was taken.\n revision: Record<string, number>;\n}\n\n// The journal's stand-in for a document: { \"$documentRef\": DocumentReference }.\nexport const DOCUMENT_REF_KEY = \"$documentRef\";\n\nexport interface DocumentRefMarker {\n [DOCUMENT_REF_KEY]: DocumentReference;\n}\n\ninterface HeaderLike {\n id: string;\n documentType: string;\n branch: string;\n revision: Record<string, number>;\n}\n\n// Keys of a PHDocument; anything else beside them is the step's own.\nconst DOCUMENT_KEYS = new Set([\n \"header\",\n \"state\",\n \"initialState\",\n \"operations\",\n \"clipboard\",\n]);\n\n// Past this depth a value is left as it is.\nconst MAX_DEPTH = 64;\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n const proto = Object.getPrototypeOf(value) as unknown;\n return proto === Object.prototype || proto === null;\n}\n\nfunction isRevision(value: unknown): value is Record<string, number> {\n return (\n isPlainObject(value) &&\n Object.values(value).every(\n (entry) => typeof entry === \"number\" && Number.isFinite(entry),\n )\n );\n}\n\nexport function documentReference(header: HeaderLike): DocumentReference {\n return {\n documentId: header.id,\n documentType: header.documentType,\n branch: header.branch,\n revision: { ...header.revision },\n };\n}\n\nexport function isDocumentReference(\n value: unknown,\n): value is DocumentReference {\n return (\n isPlainObject(value) &&\n typeof value.documentId === \"string\" &&\n typeof value.documentType === \"string\" &&\n typeof value.branch === \"string\" &&\n isRevision(value.revision)\n );\n}\n\n// A reactor document header: ids, branch, per-scope revisions and timestamps.\nfunction isDocumentHeader(value: unknown): value is HeaderLike {\n return (\n isPlainObject(value) &&\n typeof value.id === \"string\" &&\n value.id !== \"\" &&\n typeof value.documentType === \"string\" &&\n value.documentType !== \"\" &&\n typeof value.branch === \"string\" &&\n isRevision(value.revision) &&\n typeof value.createdAtUtcIso === \"string\" &&\n typeof value.lastModifiedAtUtcIso === \"string\"\n );\n}\n\n// Shaped like a reactor document: { header, state } with a full header.\nexport function isReactorDocument(\n value: unknown,\n): value is { header: HeaderLike; state: Record<string, unknown> } {\n return (\n isPlainObject(value) &&\n isDocumentHeader(value.header) &&\n isPlainObject(value.state)\n );\n}\n\nexport function isDocumentRefMarker(\n value: unknown,\n): value is DocumentRefMarker & Record<string, unknown> {\n return isPlainObject(value) && isDocumentReference(value[DOCUMENT_REF_KEY]);\n}\n\nfunction walk(\n value: unknown,\n visit: (node: Record<string, unknown>) => Record<string, unknown> | undefined,\n depth: number,\n seen: WeakSet<object>,\n): unknown {\n if (depth > MAX_DEPTH || typeof value !== \"object\" || value === null) {\n return value;\n }\n if (seen.has(value)) return value;\n if (Array.isArray(value)) {\n seen.add(value);\n const mapped = value.map((item) => walk(item, visit, depth + 1, seen));\n seen.delete(value);\n return mapped;\n }\n if (!isPlainObject(value)) return value;\n seen.add(value);\n const replaced = visit(value);\n const source = replaced ?? value;\n const result = Object.fromEntries(\n Object.entries(source).map(([key, entry]) => [\n key,\n replaced && !(key in value) ? entry : walk(entry, visit, depth + 1, seen),\n ]),\n );\n seen.delete(value);\n return result;\n}\n\n// Every document in the value, at any depth, swapped for its marker. Keys a\n// step set beside a document's (e.g. extractedFrom) stay next to the marker.\nexport function referenceDocuments(value: unknown): unknown {\n return walk(\n value,\n (node) => {\n if (!isReactorDocument(node)) return undefined;\n const rest = Object.entries(node).filter(\n ([key]) => !DOCUMENT_KEYS.has(key),\n );\n return {\n [DOCUMENT_REF_KEY]: documentReference(node.header),\n ...Object.fromEntries(rest),\n };\n },\n 0,\n new WeakSet(),\n );\n}\n\n// The references in a value's markers, in walk order.\nexport function documentRefsIn(value: unknown): DocumentReference[] {\n const found: DocumentReference[] = [];\n walk(\n value,\n (node) => {\n if (isDocumentRefMarker(node)) found.push(node[DOCUMENT_REF_KEY]);\n return undefined;\n },\n 0,\n new WeakSet(),\n );\n return found;\n}\n\nexport function containsDocumentRef(value: unknown): boolean {\n return documentRefsIn(value).length > 0;\n}\n\n// Each marker replaced by what `expand` gives for its reference, with the\n// marker's other keys kept beside it.\nexport function expandDocumentRefs(\n value: unknown,\n expand: (reference: DocumentReference) => Record<string, unknown>,\n): unknown {\n return walk(\n value,\n (node) => {\n if (!isDocumentRefMarker(node)) return undefined;\n const { [DOCUMENT_REF_KEY]: reference, ...rest } = node;\n return { ...rest, ...expand(reference) };\n },\n 0,\n new WeakSet(),\n );\n}\n","// The core manual trigger's `inputs` (Activepieces' web form fields, more\n// types), read the same way by the editor's run form and the runtime.\n\nexport const MANUAL_INPUT_TYPES = [\n \"text\",\n \"text_area\",\n \"number\",\n \"toggle\",\n \"date\",\n \"dropdown\",\n \"json\",\n] as const;\n\nexport type ManualInputType = (typeof MANUAL_INPUT_TYPES)[number];\n\nexport interface ManualInput {\n // The payload key.\n name: string;\n displayName: string;\n type: ManualInputType;\n required: boolean;\n description?: string;\n // As authored, text; coerced to the field's type when used.\n defaultValue?: string;\n // Dropdown only: the allowed values and the labels the run form shows.\n options?: ManualOption[];\n}\n\nexport interface ManualOption {\n label: string;\n value: string;\n}\n\nexport interface ManualPayloadFieldError {\n field: string;\n message: string;\n}\n\nexport class ManualPayloadError extends Error {\n readonly fields: ManualPayloadFieldError[];\n constructor(fields: ManualPayloadFieldError[]) {\n super(\n `Manual trigger payload: ${fields\n .map((entry) =>\n entry.field ? `\"${entry.field}\" ${entry.message}` : entry.message,\n )\n .join(\"; \")}`,\n );\n this.name = \"ManualPayloadError\";\n this.fields = fields;\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nconst text = (value: unknown) =>\n typeof value === \"string\" && value.trim() !== \"\" ? value.trim() : undefined;\n\nfunction defaultText(value: unknown): string | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n if (typeof value === \"string\") return value;\n if (typeof value === \"object\") return JSON.stringify(value);\n return String(value as number | boolean);\n}\n\n// One option per line as `Label = value` (split on the first \" = \") or a bare\n// value that is its own label; blanks dropped, a repeated value keeps the first.\nexport function parseManualOptions(value: unknown): ManualOption[] {\n const entries = Array.isArray(value)\n ? value.map(optionEntry)\n : typeof value === \"string\"\n ? value.split(/\\r?\\n/).map(optionLine)\n : [];\n const byValue = new Map<string, ManualOption>();\n for (const entry of entries) {\n if (entry && !byValue.has(entry.value)) byValue.set(entry.value, entry);\n }\n return [...byValue.values()];\n}\n\nfunction optionLine(line: string): ManualOption | undefined {\n const at = line.indexOf(\" = \");\n const value = (at < 0 ? line : line.slice(at + 3)).trim();\n if (value === \"\") return undefined;\n const label = at < 0 ? value : line.slice(0, at).trim();\n return { label: label === \"\" ? value : label, value };\n}\n\nfunction optionEntry(entry: unknown): ManualOption | undefined {\n if (!isRecord(entry)) return optionLine(String(entry));\n const value = defaultText(entry.value)?.trim();\n if (!value) return undefined;\n return { label: text(entry.label) ?? value, value };\n}\n\n// The trigger config's `inputs`; rows without a name or known type are dropped,\n// and a later row replaces an earlier one of the same name.\nexport function parseManualInputs(config: unknown): ManualInput[] {\n const rows = isRecord(config) ? config.inputs : undefined;\n if (!Array.isArray(rows)) return [];\n const byName = new Map<string, ManualInput>();\n for (const row of rows) {\n if (!isRecord(row)) continue;\n const name = text(row.name);\n const type = row.type as ManualInputType;\n if (!name || !MANUAL_INPUT_TYPES.includes(type)) continue;\n const description = text(row.description);\n const defaultValue = defaultText(row.defaultValue);\n byName.delete(name);\n byName.set(name, {\n name,\n displayName: text(row.displayName) ?? name,\n type,\n required: row.required === true,\n ...(description ? { description } : {}),\n ...(defaultValue !== undefined ? { defaultValue } : {}),\n ...(type === \"dropdown\"\n ? { options: parseManualOptions(row.options) }\n : {}),\n });\n }\n return [...byName.values()];\n}\n\n// Calendar date or date-time, ISO 8601.\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}(?:[T ][\\d:.]+(?:Z|[+-]\\d{2}:?\\d{2})?)?$/;\n\ntype Coerced = { value: unknown } | { error: string };\n\n// One value as the field's type, or why it isn't one.\nexport function coerceManualValue(input: ManualInput, raw: unknown): Coerced {\n switch (input.type) {\n case \"text\":\n case \"text_area\":\n if (typeof raw === \"string\") return { value: raw };\n if (typeof raw === \"number\" || typeof raw === \"boolean\") {\n return { value: String(raw) };\n }\n return { error: \"must be text\" };\n case \"number\": {\n if (typeof raw === \"number\" && Number.isFinite(raw))\n return { value: raw };\n const parsed =\n typeof raw === \"string\" && raw.trim() !== \"\" ? Number(raw) : NaN;\n return Number.isFinite(parsed)\n ? { value: parsed }\n : { error: \"must be a number\" };\n }\n case \"toggle\":\n if (typeof raw === \"boolean\") return { value: raw };\n if (typeof raw === \"string\" && /^(true|false)$/i.test(raw.trim())) {\n return { value: raw.trim().toLowerCase() === \"true\" };\n }\n return { error: \"must be true or false\" };\n case \"date\": {\n const value = typeof raw === \"string\" ? raw.trim() : \"\";\n const time = ISO_DATE.test(value) ? Date.parse(value) : NaN;\n return Number.isNaN(time)\n ? { error: \"must be an ISO 8601 date\" }\n : { value: new Date(time).toISOString() };\n }\n case \"dropdown\": {\n const value =\n typeof raw === \"string\" || typeof raw === \"number\" ? String(raw) : \"\";\n const values = (input.options ?? []).map((option) => option.value);\n if (values.length === 0 ? value !== \"\" : values.includes(value)) {\n return { value };\n }\n return values.length > 0\n ? { error: `must be one of ${values.map((v) => `\"${v}\"`).join(\", \")}` }\n : { error: \"must be text\" };\n }\n case \"json\":\n return { value: raw };\n }\n}\n\n// An authored default as the field's type; JSON text is parsed when it parses.\nexport function manualDefault(input: ManualInput): unknown {\n if (input.defaultValue === undefined) return undefined;\n if (input.type === \"json\") {\n try {\n return JSON.parse(input.defaultValue) as unknown;\n } catch {\n return input.defaultValue;\n }\n }\n if (input.type === \"dropdown\") {\n // A value, or failing that an option's label.\n const options = input.options ?? [];\n const match =\n options.find((option) => option.value === input.defaultValue) ??\n options.find((option) => option.label === input.defaultValue);\n if (match) return match.value;\n }\n const coerced = coerceManualValue(input, input.defaultValue);\n return \"value\" in coerced ? coerced.value : undefined;\n}\n\nconst isMissing = (value: unknown) =>\n value === undefined || value === null || value === \"\";\n\n// The payload with each declared field coerced and defaults filled in; keys no\n// field declares pass through. Throws ManualPayloadError.\nexport function coerceManualPayload(\n inputs: readonly ManualInput[],\n payload: unknown,\n): Record<string, unknown> {\n if (payload !== undefined && payload !== null && !isRecord(payload)) {\n throw new ManualPayloadError([\n { field: \"\", message: \"must be a JSON object\" },\n ]);\n }\n const next: Record<string, unknown> = { ...payload };\n const errors: ManualPayloadFieldError[] = [];\n for (const input of inputs) {\n let raw = next[input.name];\n if (isMissing(raw)) raw = manualDefault(input);\n if (isMissing(raw)) {\n delete next[input.name];\n if (input.required) {\n errors.push({ field: input.name, message: \"is required\" });\n }\n continue;\n }\n const coerced = coerceManualValue(input, raw);\n if (\"error\" in coerced) {\n errors.push({ field: input.name, message: coerced.error });\n } else next[input.name] = coerced.value;\n }\n if (errors.length > 0) throw new ManualPayloadError(errors);\n return next;\n}\n\nconst TYPE_NAMES: Record<ManualInputType, string> = {\n text: \"String\",\n text_area: \"String\",\n number: \"Float\",\n toggle: \"Boolean\",\n date: \"DateTime\",\n dropdown: \"String\",\n json: \"JSON\",\n};\n\n// The GraphQL-style type the expression picker shows for a field.\nexport function manualInputTypeName(input: ManualInput): string {\n const base = TYPE_NAMES[input.type];\n return input.required ? `${base}!` : base;\n}\n","// Activepieces' sub-flow piece: Call Flow calls a workflow whose trigger is\n// Callable Flow.\nexport const SUBFLOWS_PIECE = \"@activepieces/piece-subflows\";\nexport const CALLABLE_FLOW_TRIGGER = \"callableFlow\";\nexport const CALL_FLOW_ACTION = \"callFlow\";\n\n// A trigger binding (packageName) or a definition's trigger (pieceName).\nexport function isCallableFlow(trigger: {\n pieceName?: string;\n packageName?: string;\n triggerName?: string;\n}): boolean {\n return (\n (trigger.packageName ?? trigger.pieceName) === SUBFLOWS_PIECE &&\n trigger.triggerName === CALLABLE_FLOW_TRIGGER\n );\n}\n"],"mappings":";AASA,MAAM,aAA8C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,IAAI,UAAU,GAAG,GAAG;GAClB,OAAO,KAAK,MAAM;GAClB,IAAI,MAAM,UACR,OAAO,KAAK;IAAE,OAAO,MAAM;IAAM,SAAS;GAAc,CAAC;GAE3D;EACF;EACA,MAAM,UAAU,kBAAkB,OAAO,GAAG;EAC5C,IAAI,WAAW,SACb,OAAO,KAAK;GAAE,OAAO,MAAM;GAAM,SAAS,QAAQ;EAAM,CAAC;OACpD,KAAK,MAAM,QAAQ,QAAQ;CACpC;CACA,IAAI,OAAO,SAAS,GAAG,MAAM,IAAI,mBAAmB,MAAM;CAC1D,OAAO;AACT;AAEA,MAAM,aAA8C;CAClD,MAAM;CACN,WAAW;CACX,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,UAAU;CACV,MAAM;AACR;AAGA,SAAgB,oBAAoB,OAA4B;CAC9D,MAAM,OAAO,WAAW,MAAM;CAC9B,OAAO,MAAM,WAAW,GAAG,KAAK,KAAK;AACvC;;;;ACxPA,MAAa,iBAAiB;AAC9B,MAAa,wBAAwB;AACrC,MAAa,mBAAmB;AAGhC,SAAgB,eAAe,SAInB;CACV,QACG,QAAQ,eAAe,QAAQ,iDAChC,QAAQ;AAEZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/pieces-framework",
3
- "version": "6.2.3-staging.0",
3
+ "version": "6.3.0-dev.1",
4
4
  "description": "Powerhouse's published copy of the Activepieces piece framework, widened with the reactor context.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,13 +48,13 @@
48
48
  },
49
49
  "upstream": {
50
50
  "repository": "https://github.com/activepieces/activepieces",
51
- "tag": "0.91.0",
52
- "commit": "da4410d1bf6212054e55805a98d566ff1b9310b2",
51
+ "tag": "d078d47750b53c13b837b2bec86b0402b4bff94f",
52
+ "commit": "d078d47750b53c13b837b2bec86b0402b4bff94f",
53
53
  "packages": {
54
- "@activepieces/pieces-framework": "0.39.0",
55
- "@activepieces/pieces-common": "0.14.0",
56
- "@activepieces/core-piece-types": "0.11.1",
57
- "@activepieces/core-utils": "0.6.2",
54
+ "@activepieces/pieces-framework": "0.42.0",
55
+ "@activepieces/pieces-common": "0.15.1",
56
+ "@activepieces/core-piece-types": "0.12.3",
57
+ "@activepieces/core-utils": "0.11.0",
58
58
  "@activepieces/engine": "0.7.0"
59
59
  }
60
60
  },
@@ -63,16 +63,30 @@
63
63
  "form-data": "4.0.6",
64
64
  "ipaddr.js": "2.3.0",
65
65
  "nanoid": "3.3.17",
66
- "zod": "4.3.6"
66
+ "zod": "^4.5.4"
67
67
  },
68
68
  "devDependencies": {
69
+ "@powerhousedao/reactor": "6.3.0-dev.1",
70
+ "@powerhousedao/shared": "6.3.0-dev.1",
69
71
  "@types/node": "25.2.3",
70
72
  "deepmerge-ts": "7.1.0",
71
73
  "prettier": "3.8.1",
72
74
  "ts-morph": "27.0.2",
73
75
  "tsdown": "0.23.0",
74
76
  "tsx": "4.23.13",
75
- "vitest": "4.1.1"
77
+ "vitest": "5.0.3"
78
+ },
79
+ "peerDependencies": {
80
+ "@powerhousedao/reactor": "6.3.0-dev.1",
81
+ "@powerhousedao/shared": "6.3.0-dev.1"
82
+ },
83
+ "peerDependenciesMeta": {
84
+ "@powerhousedao/reactor": {
85
+ "optional": true
86
+ },
87
+ "@powerhousedao/shared": {
88
+ "optional": true
89
+ }
76
90
  },
77
91
  "scripts": {
78
92
  "tsc": "tsc",
@@ -1 +0,0 @@
1
- {"version":3,"file":"authentication-o-4CdAPR.js","names":[],"sources":["../upstream/core-piece-types/lib/app-connection.ts","../upstream/core-piece-types/lib/trigger.ts","../upstream/core-utils/lib/object-utils.ts","../upstream/framework/lib/property/authentication/common.ts","../upstream/framework/lib/property/authentication/basic-auth-prop.ts","../upstream/framework/lib/property/authentication/secret-text-property.ts","../upstream/framework/lib/property/authentication/custom-auth-prop.ts","../upstream/framework/lib/property/authentication/oidc-prop.ts","../upstream/framework/lib/property/authentication/oauth2-prop.ts","../upstream/framework/lib/property/authentication/index.ts"],"sourcesContent":["// Vendored from activepieces/activepieces@0.91.0 packages/core/piece-types/src/lib/app-connection.ts. MIT; see ../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum AppConnectionType {\n OAUTH2 = \"OAUTH2\",\n PLATFORM_OAUTH2 = \"PLATFORM_OAUTH2\",\n CLOUD_OAUTH2 = \"CLOUD_OAUTH2\",\n SECRET_TEXT = \"SECRET_TEXT\",\n BASIC_AUTH = \"BASIC_AUTH\",\n CUSTOM_AUTH = \"CUSTOM_AUTH\",\n OIDC = \"OIDC\",\n NO_AUTH = \"NO_AUTH\",\n}\n\nexport enum OAuth2GrantType {\n AUTHORIZATION_CODE = \"authorization_code\",\n CLIENT_CREDENTIALS = \"client_credentials\",\n}\n\nexport const BOTH_CLIENT_CREDENTIALS_AND_AUTHORIZATION_CODE =\n \"both_client_credentials_and_authorization_code\";\n\nexport type SecretTextConnectionValue = {\n type: AppConnectionType.SECRET_TEXT;\n secret_text: string;\n};\n\nexport type BasicAuthConnectionValue = {\n username: string;\n password: string;\n type: AppConnectionType.BASIC_AUTH;\n};\n\nexport type BaseOAuth2ConnectionValue = {\n expires_in?: number;\n client_id: string;\n token_type: string;\n access_token: string;\n claimed_at: number;\n refresh_token: string;\n scope: string;\n token_url: string;\n grant_type?: OAuth2GrantType;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any>;\n props?: Record<string, unknown>;\n};\n\nexport type CustomAuthConnectionValue<\n T extends Record<string, unknown> = Record<string, unknown>,\n> = {\n type: AppConnectionType.CUSTOM_AUTH;\n props: T;\n access_token?: string;\n token_refresh_at?: number;\n};\n\nexport type OIDCConnectionValue<\n T extends Record<string, unknown> = Record<string, unknown>,\n> = {\n type: AppConnectionType.OIDC;\n props: T;\n};\n\nexport type CloudOAuth2ConnectionValue = {\n type: AppConnectionType.CLOUD_OAUTH2;\n} & BaseOAuth2ConnectionValue;\n\nexport type PlatformOAuth2ConnectionValue = {\n type: AppConnectionType.PLATFORM_OAUTH2;\n redirect_url: string;\n} & BaseOAuth2ConnectionValue;\n\nexport type OAuth2ConnectionValueWithApp = {\n type: AppConnectionType.OAUTH2;\n client_secret: string;\n redirect_url: string;\n} & BaseOAuth2ConnectionValue;\n\nexport type NoAuthConnectionValue = {\n type: AppConnectionType.NO_AUTH;\n};\n\nexport type AppConnectionValue<\n T extends AppConnectionType = AppConnectionType,\n PropsType extends Record<string, unknown> = Record<string, unknown>,\n> = T extends AppConnectionType.SECRET_TEXT\n ? SecretTextConnectionValue\n : T extends AppConnectionType.BASIC_AUTH\n ? BasicAuthConnectionValue\n : T extends AppConnectionType.CLOUD_OAUTH2\n ? CloudOAuth2ConnectionValue\n : T extends AppConnectionType.PLATFORM_OAUTH2\n ? PlatformOAuth2ConnectionValue\n : T extends AppConnectionType.OAUTH2\n ? OAuth2ConnectionValueWithApp\n : T extends AppConnectionType.CUSTOM_AUTH\n ? CustomAuthConnectionValue<PropsType>\n : T extends AppConnectionType.OIDC\n ? OIDCConnectionValue<PropsType>\n : T extends AppConnectionType.NO_AUTH\n ? NoAuthConnectionValue\n : never;\n","// Vendored from activepieces/activepieces@0.91.0 packages/core/piece-types/src/lib/trigger.ts. MIT; see ../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\n\nexport enum TriggerStrategy {\n POLLING = \"POLLING\",\n WEBHOOK = \"WEBHOOK\",\n APP_WEBHOOK = \"APP_WEBHOOK\",\n MANUAL = \"MANUAL\",\n}\n\nexport enum WebhookHandshakeStrategy {\n NONE = \"NONE\",\n HEADER_PRESENT = \"HEADER_PRESENT\",\n QUERY_PRESENT = \"QUERY_PRESENT\",\n BODY_PARAM_PRESENT = \"BODY_PARAM_PRESENT\",\n HEAD_REQUEST = \"HEAD_REQUEST\",\n}\n\nexport const WebhookHandshakeConfiguration = z.object({\n strategy: z.enum(WebhookHandshakeStrategy),\n paramName: z.optional(z.string()),\n});\nexport type WebhookHandshakeConfiguration = z.infer<\n typeof WebhookHandshakeConfiguration\n>;\n\nexport enum TriggerTestStrategy {\n SIMULATION = \"SIMULATION\",\n TEST_FUNCTION = \"TEST_FUNCTION\",\n}\n\nexport const AUTHENTICATION_PROPERTY_NAME = \"auth\";\n","// Vendored from activepieces/activepieces@0.91.0 packages/core/utils/src/lib/object-utils.ts. MIT; see ../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport { isNil, isString } from \"./utils.js\";\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function deleteProperties(\n obj: Record<string, unknown>,\n props: string[],\n) {\n const copy = { ...obj };\n for (const prop of props) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete copy[prop];\n }\n return copy;\n}\n\nexport function omit<T extends object, K extends keyof T>(\n obj: T,\n keysToOmit: K[],\n): Omit<T, K> {\n return Object.fromEntries(\n Object.entries(obj).filter(([key]) => !keysToOmit.includes(key as K)),\n ) as Omit<T, K>;\n}\n\nexport const spreadIfNotUndefined = <T>(\n key: string,\n value: T | undefined,\n): Record<string, T> => {\n if (value === undefined) {\n return {};\n }\n return {\n [key]: value,\n };\n};\n\nexport const spreadIfDefined = <T>(\n key: string,\n value: T | undefined | null,\n): Record<string, T> => {\n if (isNil(value)) {\n return {};\n }\n return {\n [key]: value,\n };\n};\n\nexport function deleteProps<\n T extends Record<string, unknown>,\n K extends keyof T,\n>(obj: T, prop: K[]): Omit<T, K> {\n const newObj = { ...obj };\n for (const p of prop) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newObj[p];\n }\n return newObj;\n}\n\nexport function cloneResolvedValue(value: unknown): unknown {\n switch (typeof value) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n return value;\n case \"object\": {\n if (value === null) {\n return null;\n }\n const serialized = JSON.stringify(value);\n return isNil(serialized) ? undefined : JSON.parse(serialized);\n }\n default:\n return undefined;\n }\n}\n\nexport function sanitizeObjectForPostgresql<T>(input: T): T {\n return applyFunctionToValuesSync<T>(input, (str) => {\n if (isString(str)) {\n // Postgres text/jsonb cannot store NUL bytes or unpaired UTF-16 surrogates (e.g. a half-emoji\n // left behind by code-unit truncation) — both raise \"invalid input syntax for type json\".\n // eslint-disable-next-line no-control-regex\n const nullByteRegex = /\\u0000/g;\n const loneSurrogateRegex =\n /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/g;\n return str.replace(nullByteRegex, \"\").replace(loneSurrogateRegex, \"\");\n }\n return str;\n });\n}\nexport function applyFunctionToValuesSync<T>(\n obj: unknown,\n apply: (str: string) => unknown,\n): T {\n if (isNil(obj)) {\n return obj as T;\n } else if (isString(obj)) {\n return apply(obj) as T;\n } else if (Array.isArray(obj)) {\n return obj.map((item) =>\n applyFunctionToValuesSync(item, apply),\n ) as unknown as T;\n } else if (isObject(obj)) {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [\n key,\n applyFunctionToValuesSync(value, apply),\n ]),\n ) as T;\n }\n return obj as T;\n}\n\nexport async function applyFunctionToValues<T>(\n obj: unknown,\n apply: (str: string) => Promise<unknown>,\n): Promise<T> {\n if (isNil(obj)) {\n return obj as T;\n } else if (isString(obj)) {\n return (await apply(obj)) as T;\n } else if (Array.isArray(obj)) {\n // Create a new array and map over it with Promise.all\n const newArray = await Promise.all(\n obj.map((item) => applyFunctionToValues(item, apply)),\n );\n return newArray as unknown as T;\n } else if (isObject(obj)) {\n // Use Object.fromEntries and map entries asynchronously\n const newEntries = await Promise.all(\n Object.entries(obj).map(async ([key, value]) => [\n key,\n await applyFunctionToValues(value, apply),\n ]),\n );\n return Object.fromEntries(newEntries) as T;\n }\n return obj as T;\n}\n\nexport const isObject = (obj: unknown): obj is Record<string, unknown> => {\n return typeof obj === \"object\" && obj !== null && !Array.isArray(obj);\n};\n\nexport function groupBy<T, K extends string | number | symbol>(\n items: T[],\n keySelector: (item: T) => K,\n): Record<K, T[]> {\n const result = {} as Record<K, T[]>;\n\n for (const item of items) {\n const key = keySelector(item);\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/framework/src/lib/property/authentication/common.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\nimport type {\n AuthValidationServerContext,\n ServerContext,\n} from \"../../context/index.js\";\n\nexport const BasePieceAuthSchema = z.object({\n displayName: z.string(),\n description: z.optional(z.string()),\n hasConnectionIdentifier: z.optional(z.boolean()),\n});\n\nexport type BasePieceAuthSchema<AuthValueSchema> = {\n displayName: string;\n description?: string;\n validate?: (params: {\n auth: AuthValueSchema;\n server: AuthValidationServerContext;\n }) => Promise<\n | { valid: true }\n | {\n valid: false;\n error: string;\n }\n >;\n // Resolves a human-readable label for a connection made with this auth\n // (e.g. the account email, or Slack's \"display-name (workspace)\"), shown in\n // the UI so users can tell which account a connection belongs to. Best-effort.\n getConnectionIdentifier?: (params: {\n auth: AuthValueSchema;\n server: Omit<ServerContext, \"token\">;\n }) => Promise<string | undefined>;\n // Derived by Piece.metadata(), not authored: functions cannot survive metadata\n // serialization, so the server has no other way to tell whether the hook above\n // exists before paying for an engine round-trip.\n hasConnectionIdentifier?: boolean;\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/framework/src/lib/property/authentication/basic-auth-prop.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\nimport { TPropertyValue } from \"../input/common.js\";\nimport { PropertyType } from \"../input/property-type.js\";\nimport { BasePieceAuthSchema } from \"./common.js\";\n\nexport const BasicAuthPropertyValue = z.object({\n username: z.string(),\n password: z.string(),\n});\n\nexport type BasicAuthPropertyValue = z.infer<typeof BasicAuthPropertyValue>;\n\nexport const BasicAuthProperty = z.object({\n ...BasePieceAuthSchema.shape,\n username: z.object({\n displayName: z.string(),\n description: z.optional(z.string()),\n }),\n password: z.object({\n displayName: z.string(),\n description: z.optional(z.string()),\n }),\n ...TPropertyValue(BasicAuthPropertyValue, PropertyType.BASIC_AUTH).shape,\n});\n\nexport type BasicAuthProperty = BasePieceAuthSchema<BasicAuthPropertyValue> & {\n username: {\n displayName: string;\n description?: string;\n };\n password: {\n displayName: string;\n description?: string;\n };\n} & TPropertyValue<BasicAuthPropertyValue, PropertyType.BASIC_AUTH, true>;\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/framework/src/lib/property/authentication/secret-text-property.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\nimport { BasePieceAuthSchema } from \"./common.js\";\nimport { TPropertyValue } from \"../input/common.js\";\nimport { PropertyType } from \"../input/property-type.js\";\n\nexport const SecretTextProperty = z.object({\n ...BasePieceAuthSchema.shape,\n ...TPropertyValue(\n z.object({\n auth: z.string(),\n }),\n PropertyType.SECRET_TEXT,\n ).shape,\n});\n\nexport type SecretTextProperty<R extends boolean> =\n BasePieceAuthSchema<string> &\n TPropertyValue<string, PropertyType.SECRET_TEXT, R>;\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/framework/src/lib/property/authentication/custom-auth-prop.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\nimport { TPropertyValue } from \"../input/common.js\";\nimport { PropertyType } from \"../input/property-type.js\";\nimport { LongTextProperty, ShortTextProperty } from \"../input/text-property.js\";\nimport { NumberProperty } from \"../input/number-property.js\";\nimport { CheckboxProperty } from \"../input/checkbox-property.js\";\nimport { StaticMultiSelectDropdownProperty } from \"../input/dropdown/static-dropdown.js\";\nimport { StaticDropdownProperty } from \"../input/dropdown/static-dropdown.js\";\nimport type { StaticPropsValue } from \"../index.js\";\nimport { SecretTextProperty } from \"./secret-text-property.js\";\nimport { BasePieceAuthSchema } from \"./common.js\";\nimport { MarkDownProperty } from \"../input/markdown-property.js\";\nimport type { ServerContext } from \"../../context/index.js\";\n\nconst CustomAuthProps = z.record(\n z.string(),\n z.union([\n ShortTextProperty,\n LongTextProperty,\n SecretTextProperty,\n NumberProperty,\n StaticDropdownProperty,\n CheckboxProperty,\n MarkDownProperty,\n StaticMultiSelectDropdownProperty,\n ]),\n);\n\nexport type CustomAuthProps = Record<\n string,\n | ShortTextProperty<boolean>\n | LongTextProperty<boolean>\n | SecretTextProperty<boolean>\n | NumberProperty<boolean>\n | StaticDropdownProperty<unknown, boolean>\n | CheckboxProperty<boolean>\n | MarkDownProperty\n | StaticMultiSelectDropdownProperty<unknown, boolean>\n>;\n\nexport const CustomAuthProperty = z.object({\n ...BasePieceAuthSchema.shape,\n props: CustomAuthProps,\n ...TPropertyValue(z.unknown(), PropertyType.CUSTOM_AUTH).shape,\n});\n\nexport type CustomAuthRefresh<T extends CustomAuthProps> = {\n generate: (params: {\n auth: StaticPropsValue<T>;\n server: Omit<ServerContext, \"token\">;\n }) => Promise<{\n access_token: string;\n /**\n * Token lifetime in seconds. When omitted, `defaultExpiresIn` (or the framework\n * default) is used. Use `0` to mark the token as non-expiring — it is then cached\n * indefinitely and never refreshed. The server refreshes 15 minutes before expiry,\n * clamped to half the lifetime so short-lived tokens are not refreshed on every call.\n */\n expires_in?: number;\n }>;\n /** Fallback token lifetime in seconds when `generate` omits `expires_in`. `0` means non-expiring. */\n defaultExpiresIn?: number;\n};\n\nexport type CustomAuthProperty<T extends CustomAuthProps> = BasePieceAuthSchema<\n StaticPropsValue<T>\n> & {\n props: T;\n refresh?: CustomAuthRefresh<T>;\n} & TPropertyValue<StaticPropsValue<T>, PropertyType.CUSTOM_AUTH, true>;\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/framework/src/lib/property/authentication/oidc-prop.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\nimport { TPropertyValue } from \"../input/common.js\";\nimport { PropertyType } from \"../input/property-type.js\";\nimport { LongTextProperty, ShortTextProperty } from \"../input/text-property.js\";\nimport { NumberProperty } from \"../input/number-property.js\";\nimport { CheckboxProperty } from \"../input/checkbox-property.js\";\nimport {\n StaticDropdownProperty,\n StaticMultiSelectDropdownProperty,\n} from \"../input/dropdown/static-dropdown.js\";\nimport type { StaticPropsValue } from \"../index.js\";\nimport { SecretTextProperty } from \"./secret-text-property.js\";\nimport { BasePieceAuthSchema } from \"./common.js\";\nimport { MarkDownProperty } from \"../input/markdown-property.js\";\n\nconst OIDCAuthProps = z.record(\n z.string(),\n z.union([\n ShortTextProperty,\n LongTextProperty,\n SecretTextProperty,\n NumberProperty,\n CheckboxProperty,\n StaticDropdownProperty,\n StaticMultiSelectDropdownProperty,\n MarkDownProperty,\n ]),\n);\n\nexport type OIDCAuthProps = Record<\n string,\n | ShortTextProperty<boolean>\n | LongTextProperty<boolean>\n | SecretTextProperty<boolean>\n | NumberProperty<boolean>\n | StaticDropdownProperty<unknown, boolean>\n | CheckboxProperty<boolean>\n | MarkDownProperty\n | StaticMultiSelectDropdownProperty<unknown, boolean>\n>;\n\nexport const OIDCProperty = z.object({\n ...BasePieceAuthSchema.shape,\n props: OIDCAuthProps,\n ...TPropertyValue(z.unknown(), PropertyType.OIDC).shape,\n});\n\nexport type OIDCProperty<T extends OIDCAuthProps> = BasePieceAuthSchema<\n StaticPropsValue<T>\n> & {\n props: T;\n} & TPropertyValue<StaticPropsValue<T>, PropertyType.OIDC, true>;\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/framework/src/lib/property/authentication/oauth2-prop.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport {\n BOTH_CLIENT_CREDENTIALS_AND_AUTHORIZATION_CODE,\n OAuth2GrantType,\n} from \"../../../../core-piece-types/index.js\";\nimport * as z from \"zod/mini\";\nimport { ShortTextProperty } from \"../input/text-property.js\";\nimport { SecretTextProperty } from \"./secret-text-property.js\";\nimport { BasePieceAuthSchema } from \"./common.js\";\nimport { TPropertyValue } from \"../input/common.js\";\nimport { PropertyType } from \"../input/property-type.js\";\nimport { StaticDropdownProperty } from \"../input/dropdown/static-dropdown.js\";\nimport type { StaticPropsValue } from \"../index.js\";\n\nexport enum OAuth2AuthorizationMethod {\n HEADER = \"HEADER\",\n BODY = \"BODY\",\n}\n\nconst OAuthProp = z.union([\n ShortTextProperty,\n SecretTextProperty,\n StaticDropdownProperty,\n]);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype OAuthProp =\n | ShortTextProperty<boolean>\n | SecretTextProperty<boolean>\n | StaticDropdownProperty<any, boolean>;\n\nexport const OAuth2Props = z.record(z.string(), OAuthProp);\n\nexport type OAuth2Props = {\n [key: string]: OAuthProp;\n};\n\ntype OAuthPropsValue<T extends OAuth2Props> = StaticPropsValue<T>;\n\nconst OAuth2ExtraProps = z.object({\n props: z.optional(z.record(z.string(), OAuthProp)),\n authUrl: z.string(),\n tokenUrl: z.string(),\n scope: z.array(z.string()),\n prompt: z.optional(\n z.union([\n z.literal(\"none\"),\n z.literal(\"consent\"),\n z.literal(\"login\"),\n z.literal(\"omit\"),\n ]),\n ),\n pkce: z.optional(z.boolean()),\n pkceMethod: z.optional(z.union([z.literal(\"plain\"), z.literal(\"S256\")])),\n authorizationMethod: z.optional(z.enum(OAuth2AuthorizationMethod)),\n grantType: z.optional(\n z.union([\n z.enum(OAuth2GrantType),\n z.literal(BOTH_CLIENT_CREDENTIALS_AND_AUTHORIZATION_CODE),\n ]),\n ),\n extra: z.optional(z.record(z.string(), z.string())),\n});\n\ntype OAuth2ExtraProps = {\n props?: OAuth2Props;\n authUrl: string;\n tokenUrl: string;\n scope: string[];\n prompt?: \"none\" | \"consent\" | \"login\" | \"omit\";\n pkce?: boolean;\n pkceMethod?: \"plain\" | \"S256\";\n authorizationMethod?: OAuth2AuthorizationMethod;\n grantType?:\n | OAuth2GrantType\n | typeof BOTH_CLIENT_CREDENTIALS_AND_AUTHORIZATION_CODE;\n extra?: Record<string, string>;\n};\n\nexport const OAuth2PropertyValue = z.object({\n access_token: z.string(),\n props: z.optional(OAuth2Props),\n data: z.record(z.string(), z.any()),\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type OAuth2PropertyValue<T extends OAuth2Props = any> = {\n access_token: string;\n props?: OAuthPropsValue<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any>;\n};\n\nexport const OAuth2Property = z.object({\n ...BasePieceAuthSchema.shape,\n ...OAuth2ExtraProps.shape,\n ...TPropertyValue(OAuth2PropertyValue, PropertyType.OAUTH2).shape,\n});\n\nexport type OAuth2Property<T extends OAuth2Props> = BasePieceAuthSchema<\n OAuth2PropertyValue<T>\n> &\n OAuth2ExtraProps &\n TPropertyValue<OAuth2PropertyValue<T>, PropertyType.OAUTH2, true>;\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/framework/src/lib/property/authentication/index.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\n\nimport * as z from \"zod/mini\";\nimport { BasicAuthProperty } from \"./basic-auth-prop.js\";\nimport type { CustomAuthProps } from \"./custom-auth-prop.js\";\nimport { CustomAuthProperty } from \"./custom-auth-prop.js\";\nimport type { OIDCAuthProps } from \"./oidc-prop.js\";\nimport { OIDCProperty } from \"./oidc-prop.js\";\nimport { SecretTextProperty } from \"./secret-text-property.js\";\nimport { PropertyType } from \"../input/property-type.js\";\nimport type { OAuth2Props } from \"./oauth2-prop.js\";\nimport { OAuth2Property } from \"./oauth2-prop.js\";\nimport { isNil } from \"../../../../core-utils/index.js\";\nimport { AppConnectionType } from \"../../../../core-piece-types/index.js\";\n\nexport const PieceAuthProperty = z.union([\n BasicAuthProperty,\n CustomAuthProperty,\n OIDCProperty,\n OAuth2Property,\n SecretTextProperty,\n]);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PieceAuthProperty =\n | BasicAuthProperty\n | CustomAuthProperty<any>\n | OIDCProperty<any>\n | OAuth2Property<any>\n | SecretTextProperty<boolean>;\n\ntype AuthProperties<T> = Omit<Properties<T>, \"displayName\"> & {\n displayName?: string;\n};\n\ntype Properties<T> = Omit<\n T,\n \"valueSchema\" | \"type\" | \"defaultValidators\" | \"defaultProcessors\"\n>;\n\nexport const DEFAULT_CONNECTION_DISPLAY_NAME = \"Connection\";\nexport const PieceAuth = {\n SecretText<R extends boolean>(\n request: Properties<SecretTextProperty<R>>,\n ): R extends true ? SecretTextProperty<true> : SecretTextProperty<false> {\n return {\n ...request,\n valueSchema: undefined,\n type: PropertyType.SECRET_TEXT,\n } as unknown as R extends true\n ? SecretTextProperty<true>\n : SecretTextProperty<false>;\n },\n OAuth2<T extends OAuth2Props>(\n request: AuthProperties<OAuth2Property<T>>,\n ): OAuth2Property<T> {\n return {\n ...request,\n valueSchema: undefined,\n type: PropertyType.OAUTH2,\n displayName: request.displayName || DEFAULT_CONNECTION_DISPLAY_NAME,\n } as unknown as OAuth2Property<T>;\n },\n BasicAuth(request: AuthProperties<BasicAuthProperty>): BasicAuthProperty {\n return {\n ...request,\n valueSchema: undefined,\n type: PropertyType.BASIC_AUTH,\n displayName: request.displayName || DEFAULT_CONNECTION_DISPLAY_NAME,\n required: true,\n } as unknown as BasicAuthProperty;\n },\n CustomAuth<T extends CustomAuthProps>(\n request: AuthProperties<CustomAuthProperty<T>>,\n ): CustomAuthProperty<T> {\n return {\n ...request,\n valueSchema: undefined,\n type: PropertyType.CUSTOM_AUTH,\n displayName: request.displayName || DEFAULT_CONNECTION_DISPLAY_NAME,\n } as unknown as CustomAuthProperty<T>;\n },\n OIDC<T extends OIDCAuthProps>(\n request: AuthProperties<OIDCProperty<T>>,\n ): OIDCProperty<T> {\n return {\n ...request,\n valueSchema: undefined,\n type: PropertyType.OIDC,\n displayName: request.displayName || DEFAULT_CONNECTION_DISPLAY_NAME,\n } as unknown as OIDCProperty<T>;\n },\n None() {\n return undefined;\n },\n};\n\nexport type ExtractPieceAuthPropertyTypeForMethods<\n T extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n> = T extends PieceAuthProperty[]\n ? T[number]\n : T extends undefined\n ? undefined\n : T;\n\nexport function getAuthPropertyForValue({\n authValueType,\n pieceAuth,\n}: GetAuthPropertyForValue) {\n if (!Array.isArray(pieceAuth) || isNil(pieceAuth)) {\n return pieceAuth;\n }\n\n return (\n pieceAuth.find(\n (auth) => authConnectionTypeToPropertyType[authValueType] === auth.type,\n ) ?? pieceAuth.at(0)\n );\n}\n\ntype GetAuthPropertyForValue = {\n authValueType: AppConnectionType;\n pieceAuth: PieceAuthProperty | PieceAuthProperty[] | undefined;\n};\n\nconst authConnectionTypeToPropertyType: Record<\n AppConnectionType,\n PropertyType | undefined\n> = {\n [AppConnectionType.OAUTH2]: PropertyType.OAUTH2,\n [AppConnectionType.CLOUD_OAUTH2]: PropertyType.OAUTH2,\n [AppConnectionType.PLATFORM_OAUTH2]: PropertyType.OAUTH2,\n [AppConnectionType.BASIC_AUTH]: PropertyType.BASIC_AUTH,\n [AppConnectionType.CUSTOM_AUTH]: PropertyType.CUSTOM_AUTH,\n [AppConnectionType.OIDC]: PropertyType.OIDC,\n [AppConnectionType.SECRET_TEXT]: PropertyType.SECRET_TEXT,\n [AppConnectionType.NO_AUTH]: undefined,\n};\n"],"mappings":";;;;AAEA,IAAY,oBAAL;CACL;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AACF;AAEA,IAAY,kBAAL;CACL;CACA;;AACF;AAEA,MAAa,iDACX;;;;ACfF,IAAY,kBAAL;CACL;CACA;CACA;CACA;;AACF;AAEA,IAAY,2BAAL;CACL;CACA;CACA;CACA;CACA;;AACF;AAEA,MAAa,gCAAgC,EAAE,OAAO;CACpD,UAAU,EAAE,KAAK,wBAAwB;CACzC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;AAClC,CAAC;AAKD,IAAY,sBAAL;CACL;CACA;;AACF;AAEA,MAAa,+BAA+B;;;;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