@powerhousedao/pieces-framework 6.2.3-dev.23 → 6.2.3-dev.25

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
@@ -87,6 +87,39 @@ import { httpClient, HttpMethod } from "@powerhousedao/pieces-framework/common";
87
87
  Powerhouse documents is the reactor piece's job, and a workflow composes the
88
88
  two as separate steps.
89
89
 
90
+ To give a connection a status and an account label in Connect, declare
91
+ `validate` and `getConnectionIdentifier` on the auth. Both are handed the
92
+ flat auth value (here the props themselves, not `{ type, props }`):
93
+
94
+ ```ts
95
+ const invoicesAuth = PieceAuth.CustomAuth({
96
+ displayName: "Invoices",
97
+ required: true,
98
+ props: {
99
+ base_url: Property.ShortText({
100
+ displayName: "Base URL",
101
+ required: true,
102
+ }),
103
+ token: PieceAuth.SecretText({ displayName: "Token", required: true }),
104
+ },
105
+ validate: async ({ auth }) => {
106
+ try {
107
+ await clientFor(auth).ping();
108
+ return { valid: true };
109
+ } catch (error) {
110
+ return { valid: false, error: String(error) };
111
+ }
112
+ },
113
+ getConnectionIdentifier: async ({ auth }) =>
114
+ (await clientFor(auth).me()).email,
115
+ });
116
+ ```
117
+
118
+ A reactor runs `validate` for the check's result and, when it passes,
119
+ `getConnectionIdentifier` for the account label. The label is best-effort:
120
+ returning `undefined` or throwing keeps the previous label and still passes
121
+ the check.
122
+
90
123
  3. **Register it.** List the piece in `pieces/index.ts` as a `PackagePiece`
91
124
  and in the package manifest under `"pieces"`:
92
125
 
package/UPSTREAM.md CHANGED
@@ -43,16 +43,20 @@ Left out: `mime-db-min.cjs` (upstream's bundler alias that keeps `mime-db`,
43
43
  pulled in through `form-data`, out of piece bundles; aliasing is the piece
44
44
  build's job, so `ph build` may adopt it later) and upstream's unused `ai` and
45
45
  `semver` dependencies.
46
- Of the engine's own tests only `test/variables/props-validator.test.ts` and
47
- `test/variables/file-processor.test.ts` come along: the rest need
48
- `@activepieces/shared`, `props-resolver` or `FlowExecutorContext`.
46
+ Of the engine's own tests only those that exercise vendored code come along:
47
+ `test/variables/{props-validator,file-processor,dynamic-prop-keys}.test.ts`,
48
+ `test/helper/polling-helper.test.ts` and
49
+ `test/http/formdata-multipart-claim-verify.test.ts` (which guards the patched
50
+ `fetch-http-client.ts`). The rest need `@activepieces/shared`,
51
+ `props-resolver` or `FlowExecutorContext`.
49
52
 
50
53
  `@activepieces/shared` (8k lines of platform entities) is not vendored. The four
51
54
  piece packages never import it; the engine files do, so the codemod re-homes
52
55
  each symbol they use — `AUTHENTICATION_PROPERTY_NAME` and `AppConnectionValue`
53
56
  to `upstream/core-piece-types/`, which really defines them, and `PropertySettings`
54
- to `src/host/shared-shim.ts`, a Powerhouse-owned declaration of the minimal
55
- shape `props-processor.ts` reads. An unmapped symbol fails the sync.
57
+ and `PropertyExecutionType` to `src/host/shared-shim.ts`, a Powerhouse-owned
58
+ declaration of the minimal shapes `props-processor.ts` and its tests read. An
59
+ unmapped symbol fails the sync.
56
60
 
57
61
  `deepmerge-ts` is a devDependency only: `core-utils` imports it in
58
62
  `deepMergeAndCast`, which the framework barrel never re-exports, so the source
@@ -87,11 +91,11 @@ Upstream is CommonJS with extensionless imports; this package is ESM under
87
91
  resolver will not infer for a subpath of a dependency with no `"exports"`
88
92
  map (`dayjs/plugin/utc` becomes `dayjs/plugin/utc.js`).
89
93
  4. Prepends a two-line header naming the upstream path and the tag.
90
- 5. Runs `eslint --fix` with `scripts/sync-upstream.eslint.config.mjs`
91
- (`consistent-type-imports`, `consistent-type-exports`, prettier) so
92
- type-only imports and re-exports satisfy `verbatimModuleSyntax` and
93
- `isolatedModules`. Unused-directive reporting is off there, so upstream's
94
- `eslint-disable` comments survive even though their rules do not run.
94
+ 5. Marks type-only imports and re-exports with ts-morph
95
+ (`scripts/sync-upstream-type-only.mts`, a port of typescript-eslint's
96
+ `consistent-type-imports` and `consistent-type-exports` fixes) so they
97
+ satisfy `verbatimModuleSyntax` and `isolatedModules`, then formats the tree
98
+ with the repo's prettier config.
95
99
  6. Splits an `@activepieces/shared` import across the modules that really own
96
100
  each symbol, per `SHARED_SYMBOL_HOMES`.
97
101
  7. Applies the literal patches listed in `PATCHES` in
@@ -149,6 +153,11 @@ Current patches:
149
153
  `Property.MarkDown` always writes one and the exported type declares it,
150
154
  but the schema had no such key, so zod silently stripped
151
155
  `WARNING`/`TIP`/`BORDERLESS` variants on parse.
156
+ - `upstream/framework/lib/trigger/trigger.ts`: give `createTrigger`'s switch a
157
+ `default` that throws, naming the trigger and its `type`. The switch had none,
158
+ so a missing or misspelt strategy returned `undefined`, and the piece failed
159
+ later wherever that trigger was first read. TypeScript already rejects it;
160
+ this covers code that bypasses the types.
152
161
  - `upstream/framework/index.ts` and `upstream/framework/lib/property/index.ts`:
153
162
  re-export `SeekPage`, `McpAuthConfig` and `InputProperty` as values instead
154
163
  of `export type`. Each is a zod schema merged with a type; rolldown-plugin-dts
@@ -156,8 +165,14 @@ Current patches:
156
165
  type-only re-export let `import { SeekPage }` typecheck and then fail at link
157
166
  time. The runtime gains three exports upstream's lacks; `test/dist.test.ts`
158
167
  holds the d.ts to the runtime.
168
+ - `upstream/engine/lib/variables/props-processor.ts`: export
169
+ `validateProperty`, the validator half of `applyProcessorsAndValidators`.
170
+ A host that coerces values with its own processors first (reactor-workflow
171
+ hydrates FILE props itself) validates the result with it.
159
172
  - `test/upstream/framework/test/connection-identifier-flag.test.ts`: pass
160
173
  `authors: []` to `createPiece` (upstream does not typecheck its tests).
174
+ - `test/upstream/engine/test/variables/dynamic-prop-keys.test.ts`: pass
175
+ `auth: undefined` to `Property.DynamicProperties`, which requires it.
161
176
  - `test/upstream/core-utils/test/ai-provider-health.test.ts`: make the outcome
162
177
  reporter return `void` instead of `Array.prototype.push`'s number (three
163
178
  sites).
@@ -170,3 +185,35 @@ Current patches:
170
185
 
171
186
  The vendored trees are excluded from the root ESLint run: their lint stance is
172
187
  upstream's, and the codemod already applies this repo's formatting.
188
+
189
+ ## Conformance suite for reactor-workflow
190
+
191
+ The same sync also generates
192
+ [`../reactor-workflow/test/upstream/`](../reactor-workflow/test/upstream):
193
+ Activepieces engine tests that run against our engine instead of vendored code.
194
+ It lives in this script rather than a second one so that one run, from one
195
+ checkout, regenerates both trees under one codemod and one patch contract.
196
+
197
+ `CONFORMANCE` in `scripts/sync-upstream.mts` lists each upstream test and its
198
+ target, optionally cut down to literal `excerpt` segments. For each file the
199
+ sync:
200
+
201
+ 1. Rewrites `@activepieces/pieces-framework` and `@activepieces/pieces-common`
202
+ to our published `@powerhousedao/pieces-framework` entries.
203
+ 2. Rewrites every other upstream import through `IMPORT_REDIRECTS` to an adapter
204
+ in `../reactor-workflow/test/upstream-adapters/`, which exposes the upstream
205
+ API (`createContextStore`, `createConnectionResolver`, `ssrfGuard`,
206
+ `propsProcessor`, the `@activepieces/shared` symbols) over our code. An
207
+ import with no redirect fails the sync.
208
+ 3. Adds the header, formats, and applies `CONFORMANCE_PATCHES`, which carry the
209
+ same `count` and `why` as `PATCHES`.
210
+ 4. Marks each `CONFORMANCE_SKIPS` case `it.skip` and each `KNOWN_DIVERGENCES`
211
+ case `it.fails`, with a comment giving the reason and, for a divergence, the
212
+ issue or README item that fixes it; a deliberate divergence names none. A
213
+ name that no longer matches upstream fails the sync. When a fix lands, its
214
+ `it.fails` starts failing: drop the entry and re-sync.
215
+ 5. Writes `test/upstream/MANIFEST.json` there, with the upstream path and
216
+ SHA-256 of each original and the lists of divergences and skips.
217
+
218
+ Nothing is taken from `packages/ee/` or `packages/server/api/src/app/ee`, which
219
+ are not MIT.