@powerhousedao/reactor-workflow 6.2.3-dev.27 → 6.2.3-dev.29

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 CHANGED
@@ -138,8 +138,15 @@ One of them carries a caveat worth knowing before a deployment depends on it.
138
138
  **The secrets key is not optional in production.** Unset, `loadKey` generates
139
139
  `./.ph/secrets.key` — relative to the working directory, like the bundle cache
140
140
  and the attachment staging dir. A host whose working directory does not survive
141
- a restart comes back with a new key, and every stored connection secret is
142
- undecryptable.
141
+ a restart would come back with a new key, so the store guards against it:
142
+
143
+ - A host passes `secretsKeyFile: false` when its database outlives the working
144
+ directory, and the store then requires `PH_WORKFLOWS_SECRETS_MASTER_KEY`
145
+ (`MasterKeyRequiredError`). Switchboard does this when its read model is on
146
+ Postgres.
147
+ - The first key a namespace is used with is fingerprinted into
148
+ `secret_key_check`. Any other key is refused (`MasterKeyMismatchError`)
149
+ instead of failing later as an undecryptable secret.
143
150
 
144
151
  Only the host process reads any of these. The worker child is forked with an
145
152
  empty environment, so the two settings it enforces travel on the wire instead:
@@ -96,6 +96,56 @@ function describeHandshake(trigger) {
96
96
  paramName: trigger.handshakeConfiguration?.paramName
97
97
  };
98
98
  }
99
+ function optional(key, value) {
100
+ return value === void 0 ? {} : { [key]: value };
101
+ }
102
+ function describeOption(option) {
103
+ return {
104
+ label: option.label,
105
+ value: option.value,
106
+ ...typeof option.description === "string" && option.description ? { description: option.description } : {},
107
+ ...typeof option.icon === "string" && option.icon ? { icon: option.icon } : {}
108
+ };
109
+ }
110
+ function describeHints(prop) {
111
+ const hints = {};
112
+ if (prop.width === "half" || prop.width === "full") hints.width = prop.width;
113
+ for (const key of [
114
+ "icon",
115
+ "variant",
116
+ "display",
117
+ "formatProperty"
118
+ ]) {
119
+ const value = prop[key];
120
+ if (typeof value === "string" && value !== "") hints[key] = value;
121
+ }
122
+ for (const key of [
123
+ "min",
124
+ "max",
125
+ "step"
126
+ ]) {
127
+ const value = prop[key];
128
+ if (typeof value === "number" && Number.isFinite(value)) hints[key] = value;
129
+ }
130
+ if (Array.isArray(prop.reveals)) {
131
+ const reveals = prop.reveals.filter((name) => typeof name === "string");
132
+ if (reveals.length > 0) hints.reveals = reveals;
133
+ }
134
+ if (prop.refreshOnSearch === true) hints.refreshOnSearch = true;
135
+ return hints;
136
+ }
137
+ function describeGroups(groups) {
138
+ if (!Array.isArray(groups)) return void 0;
139
+ const described = groups.filter((group) => typeof group.key === "string" && typeof group.display === "string" && Array.isArray(group.props)).map((group) => ({
140
+ key: group.key,
141
+ display: group.display,
142
+ ...group.label ? { label: group.label } : {},
143
+ ...group.description ? { description: group.description } : {},
144
+ ...group.icon ? { icon: group.icon } : {},
145
+ props: group.props.filter((name) => typeof name === "string")
146
+ }));
147
+ return described.length > 0 ? described : void 0;
148
+ }
99
149
  function hasResolver(prop) {
100
150
  return typeof prop.options === "function" || typeof prop.props === "function";
101
151
  }
@@ -111,12 +161,15 @@ function toPropDescriptor(name, prop, resolverId) {
111
161
  if (typeof prop.description === "string" && prop.description !== "") descriptor.description = prop.description;
112
162
  if (typeof prop.placeholder === "string" && prop.placeholder !== "") descriptor.placeholder = prop.placeholder;
113
163
  if (prop.defaultValue !== void 0) descriptor.defaultValue = prop.defaultValue;
164
+ if (prop.advanced === true) descriptor.advanced = true;
114
165
  if (dynamic && resolverId) descriptor.dynamicResolverId = resolverId;
115
166
  if (dynamic && Array.isArray(prop.refreshers)) descriptor.refreshers = prop.refreshers.filter((entry) => typeof entry === "string");
116
- if (typeof prop.options === "object" && Array.isArray(prop.options.options)) descriptor.staticOptions = prop.options.options.map((o) => ({
117
- label: o.label,
118
- value: o.value
119
- }));
167
+ if (typeof prop.options === "object" && Array.isArray(prop.options.options)) {
168
+ descriptor.staticOptions = prop.options.options.map(describeOption);
169
+ if (prop.options.disabled === true) descriptor.staticDisabled = true;
170
+ if (typeof prop.options.placeholder === "string") descriptor.staticPlaceholder = prop.options.placeholder;
171
+ }
172
+ Object.assign(descriptor, describeHints(prop));
120
173
  if (prop.properties && typeof prop.properties === "object") {
121
174
  const nested = describeProperties(prop.properties);
122
175
  if (nested.length > 0) descriptor.properties = nested;
@@ -154,7 +207,10 @@ function buildDescriptor(piece, source) {
154
207
  requireAuth: action.requireAuth ?? false,
155
208
  props: describeProperties(action.props, (propName) => `activepieces:${source.packageName}#${actionName}.${propName}`),
156
209
  ...action.outputSchema !== void 0 ? { outputSchema: action.outputSchema } : {},
157
- ...action.audience !== void 0 ? { audience: action.audience } : {}
210
+ ...action.audience !== void 0 ? { audience: action.audience } : {},
211
+ ...optional("propertyGroups", describeGroups(action.propertyGroups)),
212
+ ...optional("classification", typeof action.classification === "string" ? action.classification : void 0),
213
+ ...optional("errorHandlingOptions", action.errorHandlingOptions)
158
214
  }));
159
215
  const triggers = Object.entries(getTriggers(piece)).map(([triggerName, trigger]) => ({
160
216
  name: trigger.name ?? triggerName,
@@ -168,6 +224,7 @@ function buildDescriptor(piece, source) {
168
224
  hasSampleData: trigger.sampleData !== void 0 && trigger.sampleData !== null,
169
225
  ...trigger.sampleData !== void 0 && trigger.sampleData !== null ? { sampleData: trigger.sampleData } : {},
170
226
  handshake: describeHandshake(trigger),
227
+ ...optional("propertyGroups", describeGroups(trigger.propertyGroups)),
171
228
  ...withUnsupported(unsupportedTrigger(trigger))
172
229
  }));
173
230
  const descriptor = {
@@ -177,6 +234,7 @@ function buildDescriptor(piece, source) {
177
234
  description: piece.description,
178
235
  logoUrl: piece.logoUrl,
179
236
  categories: piece.categories,
237
+ ...piece.deprecated === true ? { deprecated: true } : {},
180
238
  minimumSupportedRelease: piece.minimumSupportedRelease,
181
239
  maximumSupportedRelease: piece.maximumSupportedRelease,
182
240
  actions,
@@ -195,4 +253,4 @@ function buildDescriptor(piece, source) {
195
253
  //#endregion
196
254
  export { loadPieceFromDir as i, describeProperties as n, loadPiece as r, buildDescriptor as t };
197
255
 
198
- //# sourceMappingURL=descriptor-CtMB-wPx.js.map
256
+ //# sourceMappingURL=descriptor-BImUIBMP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-BImUIBMP.js","names":[],"sources":["../src/pieces/activepieces/loader.ts","../src/pieces/activepieces/descriptor.ts"],"sourcesContent":["import { readFileSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { ApPiece } from \"./types.js\";\n\nexport interface LoadedPiece {\n piece: ApPiece;\n entryPath: string;\n // Which duck-type check identified the export.\n check: \"constructor-name\" | \"structural\";\n}\n\n// Resolves a bundle's entry file. Published bundles typically carry only\n// `main` (no `exports`, no `type` — they are CJS).\nexport function resolveEntry(pieceDir: string): string {\n const raw = readFileSync(path.join(pieceDir, \"package.json\"), \"utf8\");\n const pkg = JSON.parse(raw) as {\n main?: string;\n module?: string;\n exports?: Record<string, unknown>;\n };\n const dotExport = pkg.exports?.[\".\"];\n const candidates: (string | undefined)[] = [];\n if (typeof dotExport === \"string\") candidates.push(dotExport);\n if (dotExport && typeof dotExport === \"object\") {\n const cond = dotExport as Record<string, unknown>;\n for (const key of [\"import\", \"require\", \"default\"]) {\n const value = cond[key];\n if (typeof value === \"string\") candidates.push(value);\n }\n }\n candidates.push(pkg.main, pkg.module, \"src/index.js\", \"index.js\", \"main.js\");\n // A bundle's manifest (or a symlink inside it) must not point the entry\n // outside pieceDir; realpath so a symlink can't launder the escape.\n const root = realpathSync(pieceDir);\n const rootWithSep = root + path.sep;\n for (const candidate of candidates) {\n if (!candidate) continue;\n const abs = path.resolve(pieceDir, candidate);\n let real: string;\n try {\n real = realpathSync(abs);\n } catch {\n continue; // candidate doesn't exist; try the next one\n }\n if (real !== root && !real.startsWith(rootWithSep)) continue;\n return abs;\n }\n throw new Error(`No entry file found for piece bundle at ${pieceDir}`);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\n// Identify the piece by constructor name (their own loader's check), falling\n// back to structure for bundles minified without keepNames. No `instanceof`.\nfunction findPiece(\n mod: Record<string, unknown>,\n): Pick<LoadedPiece, \"piece\" | \"check\"> | undefined {\n const candidates: unknown[] = [\n ...Object.values(mod),\n ...(isRecord(mod.default) ? Object.values(mod.default) : []),\n mod.default,\n ];\n for (const candidate of candidates) {\n // `constructor?.name`: a bundle may export an Object.create(null), and the\n // real piece is usually beside it in the same module.\n if (isRecord(candidate) && candidate.constructor?.name === \"Piece\") {\n return {\n piece: candidate as unknown as ApPiece,\n check: \"constructor-name\",\n };\n }\n }\n for (const candidate of candidates) {\n if (\n isRecord(candidate) &&\n typeof candidate.displayName === \"string\" &&\n (isRecord(candidate.actions) ||\n typeof candidate.actions === \"function\" ||\n typeof candidate.getAction === \"function\")\n ) {\n return { piece: candidate as unknown as ApPiece, check: \"structural\" };\n }\n }\n return undefined;\n}\n\n// A module the piece names and node cannot find. Dependencies are installed\n// with scripts disabled, so a native or downloaded one looks like this.\nfunction missingModule(entryPath: string, error: unknown): Error | undefined {\n const code = (error as { code?: unknown } | null)?.code;\n if (code !== \"ERR_MODULE_NOT_FOUND\" && code !== \"MODULE_NOT_FOUND\") {\n return undefined;\n }\n const detail = error instanceof Error ? error.message : String(error);\n return new Error(\n `Piece at ${entryPath} could not be loaded: it imports a module that is ` +\n `not there. Its dependencies are installed with lifecycle scripts ` +\n `disabled, so one that compiles or downloads on install -- a native ` +\n `addon, a browser download -- cannot be prepared here. ${detail}`,\n );\n}\n\n// ESM-first `import()` — Node's CJS interop handles the typical CJS bundle —\n// with a `require` fallback.\nexport async function loadPiece(entryPath: string): Promise<LoadedPiece> {\n let mod: Record<string, unknown>;\n try {\n mod = (await import(\n /* @vite-ignore */ pathToFileURL(entryPath).href\n )) as Record<string, unknown>;\n } catch (imported) {\n try {\n const require = createRequire(import.meta.url);\n mod = require(entryPath) as Record<string, unknown>;\n } catch (required) {\n // The import's error names the missing module; require's often names\n // only the entry it was handed.\n throw (\n missingModule(entryPath, imported) ??\n missingModule(entryPath, required) ??\n required\n );\n }\n }\n const found = findPiece(mod);\n if (!found) {\n throw new Error(\n `No Piece export found in ${entryPath}. Export keys: ${Object.keys(mod).join(\", \")}`,\n );\n }\n return { ...found, entryPath };\n}\n\nexport async function loadPieceFromDir(pieceDir: string): Promise<LoadedPiece> {\n return loadPiece(resolveEntry(pieceDir));\n}\n","import {\n getActions,\n getTriggers,\n type ApPiece,\n type ApProperty,\n type ApPropertyType,\n type ApDropdownOption,\n type ApPropertyGroup,\n type ApTrigger,\n type ApTriggerStrategy,\n} from \"./types.js\";\nimport {\n unsupportedAuth,\n unsupportedTrigger,\n type UnsupportedFeature,\n} from \"./unsupported.js\";\n\nexport interface PiecePropDescriptor {\n name: string;\n displayName: string;\n description?: string;\n placeholder?: string;\n type: ApPropertyType;\n required: boolean;\n defaultValue?: unknown;\n // STATIC_DROPDOWN choices, extracted so the editor needs no runtime call.\n staticOptions?: ApDropdownOption[];\n // True when the prop carries a design-time resolver (DROPDOWN options() / DYNAMIC props()).\n hasDynamicResolver: boolean;\n // Synthesised domain-provider id: activepieces:<pkg>#<action>.<prop> (doc 08 §6.3).\n // Only top-level props get one; nested resolvers are not addressable yet.\n dynamicResolverId?: string;\n // Sibling prop names whose values feed the resolver; the editor re-runs\n // it when any of them changes.\n refreshers?: string[];\n // Nested shape: an ARRAY item's fields, or the props a DYNAMIC resolver\n // produced (see describeProperties). OBJECT props are free-form and carry none.\n properties?: PiecePropDescriptor[];\n // Activepieces' layout hint: rendered in the collapsed advanced section.\n advanced?: boolean;\n // Layout and control hints (see describeHints); absent when not declared.\n width?: \"half\" | \"full\";\n icon?: string;\n reveals?: string[];\n variant?: string;\n display?: string;\n min?: number;\n max?: number;\n step?: number;\n refreshOnSearch?: boolean;\n formatProperty?: string;\n // A STATIC_DROPDOWN's own state, beside its options.\n staticDisabled?: boolean;\n staticPlaceholder?: string;\n}\n\nexport interface PiecePropertyGroupDescriptor {\n key: string;\n display: string;\n label?: string;\n description?: string;\n icon?: string;\n props: string[];\n}\n\nexport interface PieceErrorHandlingDescriptor {\n retryOnFailure?: { defaultValue?: boolean; hide?: boolean };\n continueOnFailure?: { defaultValue?: boolean; hide?: boolean };\n}\n\nexport interface PieceActionDescriptor {\n name: string;\n displayName: string;\n description?: string;\n // UI metadata only — not a credential contract (spike finding).\n requireAuth: boolean;\n props: PiecePropDescriptor[];\n // Carried verbatim: it is what the expression picker builds a later step's\n // field list from, and a package piece has no published listing to read.\n outputSchema?: unknown;\n // Orders the action picker, so a package piece that declares it must be\n // ordered by it too rather than counting as unset.\n audience?: string;\n propertyGroups?: PiecePropertyGroupDescriptor[];\n classification?: string;\n errorHandlingOptions?: PieceErrorHandlingDescriptor;\n}\n\nexport interface PieceTriggerDescriptor {\n name: string;\n displayName: string;\n description?: string;\n strategy: ApTriggerStrategy;\n testStrategy?: string;\n requireAuth: boolean;\n props: PiecePropDescriptor[];\n propertyGroups?: PiecePropertyGroupDescriptor[];\n outputSchema?: unknown;\n hasSampleData: boolean;\n // The sample itself, not just whether there is one: a trigger that declares\n // no outputSchema is read for its shape instead.\n sampleData?: unknown;\n // How the sender proves the endpoint exists before it will register it.\n // Absent when the trigger declares no handshake, or declares NONE.\n handshake?: { strategy: string; paramName?: string };\n // A trigger feature the engine cannot run; the piece's own is on the piece.\n unsupported?: UnsupportedFeature;\n}\n\nexport interface PieceAuthDescriptor {\n type: ApPropertyType;\n displayName?: string;\n description?: string;\n required?: boolean;\n // CUSTOM_AUTH's own fields. Without them a connection form has nothing to\n // ask for, which is what a piece read from a package rather than a published\n // listing would otherwise leave the editor with.\n props?: PiecePropDescriptor[];\n // Set when this engine can't sign in this way (OAuth2, for one).\n unsupported?: UnsupportedFeature;\n}\n\n// NONE is how the framework spells \"no handshake\", so it is not carried:\n// a caller checking the field would otherwise have to know that too.\nfunction describeHandshake(\n trigger: ApTrigger,\n): { strategy: string; paramName?: string } | undefined {\n const strategy = trigger.handshakeConfiguration?.strategy;\n if (!strategy || strategy === \"NONE\") return undefined;\n return { strategy, paramName: trigger.handshakeConfiguration?.paramName };\n}\n\nexport interface PieceSource {\n packageName: string;\n version: string;\n}\n\n// Serializable descriptor of an adapted piece; the engine never learns\n// Activepieces exists (doc 08 §6.2).\nexport interface PieceDescriptor {\n id: string;\n source: PieceSource;\n displayName: string;\n description?: string;\n logoUrl?: string;\n categories?: string[];\n deprecated?: boolean;\n // A list when the piece offers several sign-in methods.\n auth?: PieceAuthDescriptor | PieceAuthDescriptor[];\n minimumSupportedRelease?: string;\n maximumSupportedRelease?: string;\n actions: PieceActionDescriptor[];\n triggers: PieceTriggerDescriptor[];\n // Set when no block of the piece can run here, e.g. an OAuth2 piece.\n unsupported?: UnsupportedFeature;\n}\n\nfunction optional<K extends string, V>(\n key: K,\n value: V | undefined,\n): Partial<Record<K, V>> {\n return value === undefined ? {} : ({ [key]: value } as Record<K, V>);\n}\n\nexport function describeOption(option: ApDropdownOption): ApDropdownOption {\n return {\n label: option.label,\n value: option.value,\n ...(typeof option.description === \"string\" && option.description\n ? { description: option.description }\n : {}),\n ...(typeof option.icon === \"string\" && option.icon\n ? { icon: option.icon }\n : {}),\n };\n}\n\n// Copied only when well-formed: a foreign bundle may carry anything here.\nfunction describeHints(prop: ApProperty): Partial<PiecePropDescriptor> {\n const hints: Partial<PiecePropDescriptor> = {};\n if (prop.width === \"half\" || prop.width === \"full\") hints.width = prop.width;\n const strings = [\"icon\", \"variant\", \"display\", \"formatProperty\"] as const;\n for (const key of strings) {\n const value = prop[key];\n if (typeof value === \"string\" && value !== \"\") hints[key] = value;\n }\n const numbers = [\"min\", \"max\", \"step\"] as const;\n for (const key of numbers) {\n const value = prop[key];\n if (typeof value === \"number\" && Number.isFinite(value)) hints[key] = value;\n }\n if (Array.isArray(prop.reveals)) {\n const reveals = prop.reveals.filter(\n (name): name is string => typeof name === \"string\",\n );\n if (reveals.length > 0) hints.reveals = reveals;\n }\n if (prop.refreshOnSearch === true) hints.refreshOnSearch = true;\n return hints;\n}\n\nfunction describeGroups(\n groups: ApPropertyGroup[] | undefined,\n): PiecePropertyGroupDescriptor[] | undefined {\n if (!Array.isArray(groups)) return undefined;\n const described = groups\n .filter(\n (group) =>\n typeof group.key === \"string\" &&\n typeof group.display === \"string\" &&\n Array.isArray(group.props),\n )\n .map((group) => ({\n key: group.key!,\n display: group.display!,\n ...(group.label ? { label: group.label } : {}),\n ...(group.description ? { description: group.description } : {}),\n ...(group.icon ? { icon: group.icon } : {}),\n props: group.props!.filter(\n (name): name is string => typeof name === \"string\",\n ),\n }));\n return described.length > 0 ? described : undefined;\n}\n\nfunction hasResolver(prop: ApProperty): boolean {\n return typeof prop.options === \"function\" || typeof prop.props === \"function\";\n}\n\nfunction toPropDescriptor(\n name: string,\n prop: ApProperty,\n resolverId?: string,\n): PiecePropDescriptor {\n const dynamic = hasResolver(prop);\n const descriptor: PiecePropDescriptor = {\n name,\n displayName: prop.displayName ?? name,\n type: prop.type ?? \"UNKNOWN\",\n required: prop.required ?? false,\n hasDynamicResolver: dynamic,\n };\n if (typeof prop.description === \"string\" && prop.description !== \"\") {\n descriptor.description = prop.description;\n }\n if (typeof prop.placeholder === \"string\" && prop.placeholder !== \"\") {\n descriptor.placeholder = prop.placeholder;\n }\n if (prop.defaultValue !== undefined) {\n descriptor.defaultValue = prop.defaultValue;\n }\n if (prop.advanced === true) descriptor.advanced = true;\n if (dynamic && resolverId) {\n descriptor.dynamicResolverId = resolverId;\n }\n if (dynamic && Array.isArray(prop.refreshers)) {\n descriptor.refreshers = prop.refreshers.filter(\n (entry): entry is string => typeof entry === \"string\",\n );\n }\n if (typeof prop.options === \"object\" && Array.isArray(prop.options.options)) {\n descriptor.staticOptions = prop.options.options.map(describeOption);\n if (prop.options.disabled === true) descriptor.staticDisabled = true;\n if (typeof prop.options.placeholder === \"string\") {\n descriptor.staticPlaceholder = prop.options.placeholder;\n }\n }\n Object.assign(descriptor, describeHints(prop));\n if (prop.properties && typeof prop.properties === \"object\") {\n const nested = describeProperties(prop.properties);\n if (nested.length > 0) descriptor.properties = nested;\n }\n return descriptor;\n}\n\n// Descriptor list for a props map: nested ARRAY items and what a DYNAMIC\n// resolver returns, so the editor never sees raw piece properties.\nexport function describeProperties(\n props: Record<string, ApProperty> | null | undefined,\n resolverIdFor?: (propName: string) => string,\n): PiecePropDescriptor[] {\n if (!props || typeof props !== \"object\") return [];\n return Object.entries(props)\n .filter((entry): entry is [string, ApProperty] =>\n isPropertyObject(entry[1]),\n )\n .map(([propName, prop]) =>\n toPropDescriptor(propName, prop, resolverIdFor?.(propName)),\n );\n}\n\n// Bundles are duck-typed; a props map may carry non-object junk.\nfunction isPropertyObject(value: unknown): value is ApProperty {\n return value !== null && typeof value === \"object\";\n}\n\nfunction withUnsupported(feature: UnsupportedFeature | undefined): {\n unsupported?: UnsupportedFeature;\n} {\n return feature ? { unsupported: feature } : {};\n}\n\n// Pure translation over a loaded piece; performs no I/O and never executes\n// piece code beyond the actions()/triggers() accessors.\nfunction describeAuthMethod(auth: unknown): PieceAuthDescriptor | undefined {\n if (!auth || typeof auth !== \"object\") return undefined;\n const method = auth as ApProperty;\n // CUSTOM_AUTH carries a record here; a DYNAMIC prop would carry a\n // resolver function, which is not an auth shape at all.\n const props =\n method.props && typeof method.props === \"object\"\n ? describeProperties(method.props)\n : [];\n return {\n type: method.type ?? \"UNKNOWN\",\n displayName: method.displayName,\n description: method.description,\n required: method.required,\n ...(props.length > 0 ? { props } : {}),\n ...withUnsupported(unsupportedAuth(method)),\n };\n}\n\nexport function buildDescriptor(\n piece: ApPiece,\n source: PieceSource,\n): PieceDescriptor {\n const actions = Object.entries(getActions(piece)).map(\n ([actionName, action]): PieceActionDescriptor => ({\n name: action.name ?? actionName,\n displayName: action.displayName ?? actionName,\n description: action.description,\n requireAuth: action.requireAuth ?? false,\n props: describeProperties(\n action.props,\n (propName) =>\n `activepieces:${source.packageName}#${actionName}.${propName}`,\n ),\n ...(action.outputSchema !== undefined\n ? { outputSchema: action.outputSchema }\n : {}),\n ...(action.audience !== undefined ? { audience: action.audience } : {}),\n ...optional(\"propertyGroups\", describeGroups(action.propertyGroups)),\n ...optional(\n \"classification\",\n typeof action.classification === \"string\"\n ? action.classification\n : undefined,\n ),\n ...optional(\"errorHandlingOptions\", action.errorHandlingOptions),\n }),\n );\n\n const triggers = Object.entries(getTriggers(piece)).map(\n ([triggerName, trigger]): PieceTriggerDescriptor => ({\n name: trigger.name ?? triggerName,\n displayName: trigger.displayName ?? triggerName,\n description: trigger.description,\n strategy: trigger.type ?? \"UNKNOWN\",\n testStrategy: trigger.testStrategy,\n requireAuth: trigger.requireAuth ?? false,\n props: describeProperties(\n trigger.props,\n (propName) =>\n `activepieces:${source.packageName}#${triggerName}.${propName}`,\n ),\n ...(trigger.outputSchema !== undefined\n ? { outputSchema: trigger.outputSchema }\n : {}),\n hasSampleData:\n trigger.sampleData !== undefined && trigger.sampleData !== null,\n ...(trigger.sampleData !== undefined && trigger.sampleData !== null\n ? { sampleData: trigger.sampleData }\n : {}),\n handshake: describeHandshake(trigger),\n ...optional(\"propertyGroups\", describeGroups(trigger.propertyGroups)),\n ...withUnsupported(unsupportedTrigger(trigger)),\n }),\n );\n\n const descriptor: PieceDescriptor = {\n id: `activepieces:${source.packageName}`,\n source,\n displayName: piece.displayName,\n description: piece.description,\n logoUrl: piece.logoUrl,\n categories: piece.categories,\n ...(piece.deprecated === true ? { deprecated: true } : {}),\n minimumSupportedRelease: piece.minimumSupportedRelease,\n maximumSupportedRelease: piece.maximumSupportedRelease,\n actions,\n triggers,\n ...withUnsupported(unsupportedAuth(piece.auth)),\n };\n // Several methods stay a list, in the piece's order; each says whether this\n // engine can run it.\n if (Array.isArray(piece.auth)) {\n const methods = piece.auth\n .map(describeAuthMethod)\n .filter((method) => method !== undefined);\n if (methods.length > 0) descriptor.auth = methods;\n } else {\n const method = describeAuthMethod(piece.auth);\n if (method) descriptor.auth = method;\n }\n return descriptor;\n}\n"],"mappings":";;;;;;AAeA,SAAgB,aAAa,UAA0B;CACrD,MAAM,MAAM,aAAa,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C,IAAI,QAAQ,SAAS,GAAG,WAAW,OAAO;CAC5C,OAAO;EACL,MAAM,SAAS,mBAAmB,MAAM,IAAI;EAC5C,IAAI,QAAQ,WAAW,OAAO;CAChC;CACA,OAAO;AACT"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as PieceResolver, h as WorkflowRunResult, i as AttachmentPort, n as packagePieces, p as StepExecutionRecord, s as ConnectionRequest, t as PieceRegistry, u as SecretStore, v as PieceWorker, w as EgressPolicy, y as PieceWorkerResult } from "./piece-registry-D6dvy2OD.js";
1
+ import { S as PieceResolver, h as WorkflowRunResult, i as AttachmentPort, n as packagePieces, p as StepExecutionRecord, s as ConnectionRequest, t as PieceRegistry, u as SecretStore, v as PieceWorker, w as EgressPolicy, y as PieceWorkerResult } from "./piece-registry-DbYbKifY.js";
2
2
  import { ActionBase, TriggerBase } from "@powerhousedao/pieces-framework";
3
3
  import { ILogger, OperationWithContext } from "document-model";
4
4
  import { BaseReadModel, DocumentViewDatabase, IConsistencyTracker, IOperationIndex, IReactorClient, IWriteCache, ReadModelRegistrationStage } from "@powerhousedao/reactor";
@@ -45,6 +45,7 @@ interface WorkflowRuntimeHostDeps {
45
45
  attachments?: AttachmentClientLike;
46
46
  canReadAttachmentRef?(documentId: string, ref: string): Promise<boolean>;
47
47
  secrets?: SecretStore;
48
+ secretsKeyFile?: string | false;
48
49
  logger?: ILogger;
49
50
  }
50
51
  //#endregion
@@ -72,6 +73,7 @@ interface PieceSummary {
72
73
  categories: string[];
73
74
  auth: unknown;
74
75
  unsupported?: string;
76
+ deprecated?: boolean;
75
77
  }
76
78
  interface PieceActionEntry {
77
79
  name: string;
@@ -480,7 +482,7 @@ export declare class WorkflowRuntimeService {
480
482
  private servesRunDocument;
481
483
  private assertCanReadDocument;
482
484
  private assertCanWriteDocument;
483
- blockOptions(blockType: string, propName: string, input?: unknown, connectionId?: string, ctx?: WorkflowCaller): Promise<unknown>;
485
+ blockOptions(blockType: string, propName: string, input?: unknown, connectionId?: string, ctx?: WorkflowCaller, searchValue?: string): Promise<unknown>;
484
486
  blockOutputTree(blockType: string, config?: unknown): Promise<OutputTree>;
485
487
  private stateFields;
486
488
  private operationInputFields;