@flowrunner/cli 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/ai-docs/instructions/service-code-format/08-polling-triggers.md +2 -2
  2. package/dist/cli.js +15 -8
  3. package/dist/cli.js.map +2 -2
  4. package/dist/index.js +14 -7
  5. package/dist/index.js.map +2 -2
  6. package/dist/types/shared/src/constants/error-codes.d.ts +1 -0
  7. package/dist/types/shared/src/constants/knowledge-base.d.ts +1 -0
  8. package/dist/types/shared/src/constants/notification-types.d.ts +95 -22
  9. package/dist/types/shared/src/constants/shared-extensions.d.ts +9 -0
  10. package/dist/types/shared/src/errors/k8s.d.ts +10 -0
  11. package/dist/types/shared/src/scheme/crm/dto.d.ts +2 -2
  12. package/dist/types/shared/src/scheme/flowrunner/custom-elements.d.ts +20 -29
  13. package/dist/types/shared/src/scheme/integration-connection/dto.d.ts +2 -2
  14. package/dist/types/shared/src/scheme/knowledge-base/dto.d.ts +80 -0
  15. package/dist/types/shared/src/scheme/notifications/dto.d.ts +3 -0
  16. package/dist/types/shared/src/scheme/notifications/rest.d.ts +6 -0
  17. package/dist/types/shared/src/scheme/shared-extensions/config.d.ts +20 -20
  18. package/dist/types/shared/src/scheme/shared-extensions/custom-extensions.d.ts +30 -36
  19. package/dist/types/shared/src/scheme/shared-extensions/extension.d.ts +40 -40
  20. package/dist/types/shared/src/scheme/shared-extensions/index.d.ts +1 -0
  21. package/dist/types/shared/src/scheme/shared-extensions/resolve.d.ts +15 -24
  22. package/dist/types/shared/src/scheme/shared-extensions/search.d.ts +10 -10
  23. package/dist/types/shared/src/scheme/shared-extensions/workspace-stack.d.ts +44 -0
  24. package/dist/types/shared/src/scheme/workspace/dto.d.ts +1 -1
  25. package/package.json +1 -1
  26. package/runtime/index.js +14 -7
  27. package/runtime/index.js.map +2 -2
  28. package/runtime/types/shared/src/constants/error-codes.d.ts +1 -0
  29. package/runtime/types/shared/src/constants/knowledge-base.d.ts +1 -0
  30. package/runtime/types/shared/src/constants/notification-types.d.ts +95 -22
  31. package/runtime/types/shared/src/constants/shared-extensions.d.ts +9 -0
  32. package/runtime/types/shared/src/errors/k8s.d.ts +10 -0
  33. package/runtime/types/shared/src/scheme/flowrunner/custom-elements.d.ts +20 -29
  34. package/runtime/types/shared/src/scheme/integration-connection/dto.d.ts +2 -2
  35. package/runtime/types/shared/src/scheme/knowledge-base/dto.d.ts +80 -0
  36. package/runtime/types/shared/src/scheme/notifications/dto.d.ts +3 -0
  37. package/runtime/types/shared/src/scheme/notifications/rest.d.ts +6 -0
  38. package/runtime/types/shared/src/scheme/shared-extensions/config.d.ts +20 -20
  39. package/runtime/types/shared/src/scheme/shared-extensions/custom-extensions.d.ts +30 -36
  40. package/runtime/types/shared/src/scheme/shared-extensions/extension.d.ts +40 -40
  41. package/runtime/types/shared/src/scheme/shared-extensions/index.d.ts +1 -0
  42. package/runtime/types/shared/src/scheme/shared-extensions/resolve.d.ts +15 -24
  43. package/runtime/types/shared/src/scheme/shared-extensions/search.d.ts +10 -10
  44. package/runtime/types/shared/src/scheme/shared-extensions/workspace-stack.d.ts +44 -0
@@ -21,7 +21,7 @@ Declare **exactly one** mechanism.
21
21
 
22
22
  | Mechanism | Config | Runtime behavior |
23
23
  |---|---|---|
24
- | `dedupe` (seen-set) | `item => id` (or field path); or `{ by, stateKey='seen', max=500 }` | Keeps a bounded id set under `stateKey`; emits items whose id is new. Covers new-by-id + stateless-newest (head-only `fetch`). |
24
+ | `dedupe` (seen-set) | `item => id` (or field path); or `{ by, stateKey='seen', max=500 }` | Keeps the last `max` ids it has seen under `stateKey`, oldest first, and forgets the oldest when full (an id still in the feed counts as just seen); emits items whose id is new. Covers new-by-id + stateless-newest (head-only `fetch`). |
25
25
  | `watermark` (marker) | `{ by, stateKey='watermark', sortedDesc? }` — `by` = field path or `(item,{params})=>value` | Stores newest marker, emits items past it, advances. `sortedDesc:true` stops at the first non-newer item — **only for a strictly newest-first feed**, see below. Covers new-by-date + new-or-updated. |
26
26
  | `poll` (escape hatch) | fn (above) | Full control; author owns `state` shape. Covers overlap-window+dedup, lag-held cursor, consuming/offset feeds. |
27
27
 
@@ -29,7 +29,7 @@ Declare **exactly one** mechanism.
29
29
 
30
30
  | Phase | `dedupe` | `watermark` | `poll` |
31
31
  |---|---|---|---|
32
- | start (no state) | `null → { seen:{…} }` \| `[]` (seed) | `null → { <marker> }` \| `[]` (seed) | `null → seeded` \| `[]` (seed yourself) |
32
+ | start (no state) | `null → { seen:[…] }` \| `[]` (seed) | `null → { <marker> }` \| `[]` (seed) | `null → seeded` \| `[]` (seed yourself) |
33
33
  | learningMode | `null → null` \| everything `fetch` returned | `null → null` \| everything `fetch` returned | **no handling** — whatever you return |
34
34
  | timer | `{seen} → {seen+new}` \| `[new]` | `{marker} → {advanced}` \| `[past marker]` | yours → yours \| your delta |
35
35
 
package/dist/cli.js CHANGED
@@ -4185,10 +4185,10 @@ var require_package = __commonJS({
4185
4185
  "package.json"(exports2, module2) {
4186
4186
  module2.exports = {
4187
4187
  name: "@flowrunner/cli",
4188
+ version: "0.1.5",
4188
4189
  publishConfig: {
4189
4190
  access: "public"
4190
4191
  },
4191
- version: "0.1.4",
4192
4192
  engines: {
4193
4193
  node: ">=20"
4194
4194
  },
@@ -7765,17 +7765,24 @@ var DedupeMechanism = class extends FetchingMechanism {
7765
7765
  delta(items, state) {
7766
7766
  const currentIds = items.map(this.#by).map((id) => `${id}`);
7767
7767
  if (!state?.[this.#stateKey]) {
7768
- return { events: [], state: { [this.#stateKey]: this.#buildSeen(currentIds) } };
7768
+ return { events: [], state: { [this.#stateKey]: this.#buildSeen([], currentIds) } };
7769
7769
  }
7770
- const seen = state[this.#stateKey];
7771
- const events = items.filter((item) => !seen[`${this.#by(item)}`]);
7772
- return { events, state: { [this.#stateKey]: this.#buildSeen([...Object.keys(seen), ...currentIds]) } };
7770
+ const seen = toSeenList(state[this.#stateKey]);
7771
+ const seenSet = new Set(seen);
7772
+ const events = items.filter((_item, index) => !seenSet.has(currentIds[index]));
7773
+ return { events, state: { [this.#stateKey]: this.#buildSeen(seen, currentIds) } };
7773
7774
  }
7774
- // Bounded id → 1 map, keeping the most-recent `max` ids (dedup, last occurrence wins).
7775
- #buildSeen(ids) {
7776
- return [...new Set(ids)].slice(-this.#max).reduce((acc, id) => ({ ...acc, [id]: 1 }), {});
7775
+ // Bounded id list, oldest first, keeping the most-recent `max` ids. An id fetched again moves to the end,
7776
+ // so an item that is still in the feed is never the one evicted. It is a list, not an `{ id: 1 }` map: a
7777
+ // map orders integer-like keys numerically, which evicted the SMALLEST id instead of the oldest one.
7778
+ #buildSeen(seen, currentIds) {
7779
+ const fetched = new Set(currentIds);
7780
+ return [...seen.filter((id) => !fetched.has(id)), ...fetched].slice(-this.#max);
7777
7781
  }
7778
7782
  };
7783
+ var toSeenList = (value) => {
7784
+ return Array.isArray(value) ? value.map((id) => `${id}`) : Object.keys(value);
7785
+ };
7779
7786
  var isNewer = (value, marker) => value > marker;
7780
7787
  var WatermarkMechanism = class extends FetchingMechanism {
7781
7788
  constructor(fetch2, config) {