nvent 0.5.15 → 1.0.0-alpha.2

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 (149) hide show
  1. package/dist/module.d.mts +181 -8
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1257 -1196
  4. package/dist/runtime/app/composables/useFunctionCall.d.ts +17 -0
  5. package/dist/runtime/app/composables/useFunctionCall.js +25 -0
  6. package/dist/runtime/app/composables/useNventStream.d.ts +23 -0
  7. package/dist/runtime/app/composables/useNventStream.js +58 -0
  8. package/dist/runtime/nitro/plugins/00.iii-lifecycle.d.ts +19 -0
  9. package/dist/runtime/nitro/plugins/00.iii-lifecycle.js +62 -0
  10. package/dist/runtime/nitro/plugins/01.iii-worker.d.ts +15 -0
  11. package/dist/runtime/nitro/plugins/01.iii-worker.js +91 -0
  12. package/dist/runtime/nitro/routes/stream-proxy.d.ts +17 -0
  13. package/dist/runtime/nitro/routes/stream-proxy.js +45 -0
  14. package/dist/runtime/nitro/utils/console.d.ts +32 -0
  15. package/dist/runtime/nitro/utils/console.js +95 -0
  16. package/dist/runtime/nitro/utils/defineFunction.d.ts +378 -3
  17. package/dist/runtime/nitro/utils/defineFunction.js +224 -4
  18. package/dist/runtime/nitro/utils/engine.d.ts +25 -0
  19. package/dist/runtime/nitro/utils/engine.js +130 -0
  20. package/dist/runtime/nitro/utils/nventDir.d.ts +1 -0
  21. package/dist/runtime/nitro/utils/nventDir.js +20 -0
  22. package/dist/runtime/nitro/utils/useIii.d.ts +23 -0
  23. package/dist/runtime/nitro/utils/useIii.js +14 -0
  24. package/dist/runtime/nitro/utils/workers/node.d.ts +24 -0
  25. package/dist/runtime/nitro/utils/workers/node.js +57 -0
  26. package/dist/runtime/nitro/utils/workers/python.d.ts +67 -0
  27. package/dist/runtime/nitro/utils/workers/python.js +220 -0
  28. package/dist/runtime/python/nvent.py +208 -0
  29. package/dist/runtime/python/worker_runtime.py +659 -0
  30. package/dist/runtime/virtual.d.ts +17 -0
  31. package/dist/types.d.mts +5 -1
  32. package/package.json +11 -14
  33. package/dist/runtime/adapters/base/index.d.ts +0 -6
  34. package/dist/runtime/adapters/base/index.js +0 -1
  35. package/dist/runtime/adapters/base/store-validator.d.ts +0 -48
  36. package/dist/runtime/adapters/base/store-validator.js +0 -147
  37. package/dist/runtime/adapters/builtin/file-queue.d.ts +0 -67
  38. package/dist/runtime/adapters/builtin/file-queue.js +0 -499
  39. package/dist/runtime/adapters/builtin/file-store.d.ts +0 -32
  40. package/dist/runtime/adapters/builtin/file-store.js +0 -206
  41. package/dist/runtime/adapters/builtin/file-stream.d.ts +0 -39
  42. package/dist/runtime/adapters/builtin/file-stream.js +0 -56
  43. package/dist/runtime/adapters/builtin/index.d.ts +0 -10
  44. package/dist/runtime/adapters/builtin/index.js +0 -5
  45. package/dist/runtime/adapters/builtin/memory-queue.d.ts +0 -52
  46. package/dist/runtime/adapters/builtin/memory-queue.js +0 -243
  47. package/dist/runtime/adapters/builtin/memory-store.d.ts +0 -69
  48. package/dist/runtime/adapters/builtin/memory-store.js +0 -357
  49. package/dist/runtime/adapters/builtin/memory-stream.d.ts +0 -21
  50. package/dist/runtime/adapters/builtin/memory-stream.js +0 -56
  51. package/dist/runtime/adapters/factory.d.ts +0 -31
  52. package/dist/runtime/adapters/factory.js +0 -135
  53. package/dist/runtime/adapters/index.d.ts +0 -8
  54. package/dist/runtime/adapters/index.js +0 -3
  55. package/dist/runtime/adapters/interfaces/index.d.ts +0 -11
  56. package/dist/runtime/adapters/interfaces/index.js +0 -3
  57. package/dist/runtime/adapters/interfaces/queue.d.ts +0 -155
  58. package/dist/runtime/adapters/interfaces/queue.js +0 -0
  59. package/dist/runtime/adapters/interfaces/store.d.ts +0 -299
  60. package/dist/runtime/adapters/interfaces/store.js +0 -0
  61. package/dist/runtime/adapters/interfaces/stream.d.ts +0 -62
  62. package/dist/runtime/adapters/interfaces/stream.js +0 -0
  63. package/dist/runtime/adapters/registry.d.ts +0 -85
  64. package/dist/runtime/adapters/registry.js +0 -161
  65. package/dist/runtime/config/index.d.ts +0 -23
  66. package/dist/runtime/config/index.js +0 -200
  67. package/dist/runtime/config/types.d.ts +0 -439
  68. package/dist/runtime/config/types.js +0 -0
  69. package/dist/runtime/events/eventBus.d.ts +0 -20
  70. package/dist/runtime/events/eventBus.js +0 -35
  71. package/dist/runtime/events/types.d.ts +0 -144
  72. package/dist/runtime/events/types.js +0 -0
  73. package/dist/runtime/events/utils/scheduleTrigger.d.ts +0 -8
  74. package/dist/runtime/events/utils/scheduleTrigger.js +0 -71
  75. package/dist/runtime/events/utils/stallDetector.d.ts +0 -83
  76. package/dist/runtime/events/utils/stallDetector.js +0 -318
  77. package/dist/runtime/events/utils/triggerRuntime.d.ts +0 -58
  78. package/dist/runtime/events/utils/triggerRuntime.js +0 -212
  79. package/dist/runtime/events/wiring/flowWiring.d.ts +0 -34
  80. package/dist/runtime/events/wiring/flowWiring.js +0 -1258
  81. package/dist/runtime/events/wiring/registry.d.ts +0 -19
  82. package/dist/runtime/events/wiring/registry.js +0 -43
  83. package/dist/runtime/events/wiring/stateWiring.d.ts +0 -37
  84. package/dist/runtime/events/wiring/stateWiring.js +0 -92
  85. package/dist/runtime/events/wiring/streamWiring.d.ts +0 -36
  86. package/dist/runtime/events/wiring/streamWiring.js +0 -156
  87. package/dist/runtime/events/wiring/triggerWiring.d.ts +0 -21
  88. package/dist/runtime/events/wiring/triggerWiring.js +0 -422
  89. package/dist/runtime/nitro/plugins/00.adapters.d.ts +0 -14
  90. package/dist/runtime/nitro/plugins/00.adapters.js +0 -73
  91. package/dist/runtime/nitro/plugins/01.ws-lifecycle.d.ts +0 -5
  92. package/dist/runtime/nitro/plugins/01.ws-lifecycle.js +0 -69
  93. package/dist/runtime/nitro/plugins/02.workers.d.ts +0 -2
  94. package/dist/runtime/nitro/plugins/02.workers.js +0 -92
  95. package/dist/runtime/nitro/plugins/03.triggers.d.ts +0 -12
  96. package/dist/runtime/nitro/plugins/03.triggers.js +0 -55
  97. package/dist/runtime/nitro/routes/webhook.await.d.ts +0 -23
  98. package/dist/runtime/nitro/routes/webhook.await.js +0 -112
  99. package/dist/runtime/nitro/routes/webhook.trigger.d.ts +0 -86
  100. package/dist/runtime/nitro/routes/webhook.trigger.js +0 -73
  101. package/dist/runtime/nitro/utils/adapters.d.ts +0 -66
  102. package/dist/runtime/nitro/utils/adapters.js +0 -51
  103. package/dist/runtime/nitro/utils/awaitPatterns/event.d.ts +0 -15
  104. package/dist/runtime/nitro/utils/awaitPatterns/event.js +0 -128
  105. package/dist/runtime/nitro/utils/awaitPatterns/index.d.ts +0 -28
  106. package/dist/runtime/nitro/utils/awaitPatterns/index.js +0 -55
  107. package/dist/runtime/nitro/utils/awaitPatterns/schedule.d.ts +0 -16
  108. package/dist/runtime/nitro/utils/awaitPatterns/schedule.js +0 -83
  109. package/dist/runtime/nitro/utils/awaitPatterns/time.d.ts +0 -15
  110. package/dist/runtime/nitro/utils/awaitPatterns/time.js +0 -71
  111. package/dist/runtime/nitro/utils/awaitPatterns/webhook.d.ts +0 -15
  112. package/dist/runtime/nitro/utils/awaitPatterns/webhook.js +0 -128
  113. package/dist/runtime/nitro/utils/defineFunctionConfig.d.ts +0 -378
  114. package/dist/runtime/nitro/utils/defineFunctionConfig.js +0 -3
  115. package/dist/runtime/nitro/utils/defineHooks.d.ts +0 -95
  116. package/dist/runtime/nitro/utils/defineHooks.js +0 -9
  117. package/dist/runtime/nitro/utils/registerAdapter.d.ts +0 -59
  118. package/dist/runtime/nitro/utils/registerAdapter.js +0 -13
  119. package/dist/runtime/nitro/utils/useAwait.d.ts +0 -83
  120. package/dist/runtime/nitro/utils/useAwait.js +0 -169
  121. package/dist/runtime/nitro/utils/useEventManager.d.ts +0 -15
  122. package/dist/runtime/nitro/utils/useEventManager.js +0 -26
  123. package/dist/runtime/nitro/utils/useFlow.d.ts +0 -66
  124. package/dist/runtime/nitro/utils/useFlow.js +0 -310
  125. package/dist/runtime/nitro/utils/useHookRegistry.d.ts +0 -40
  126. package/dist/runtime/nitro/utils/useHookRegistry.js +0 -25
  127. package/dist/runtime/nitro/utils/useNventLogger.d.ts +0 -42
  128. package/dist/runtime/nitro/utils/useNventLogger.js +0 -54
  129. package/dist/runtime/nitro/utils/useRunContext.d.ts +0 -6
  130. package/dist/runtime/nitro/utils/useRunContext.js +0 -102
  131. package/dist/runtime/nitro/utils/useStreamTopics.d.ts +0 -83
  132. package/dist/runtime/nitro/utils/useStreamTopics.js +0 -94
  133. package/dist/runtime/nitro/utils/useTrigger.d.ts +0 -150
  134. package/dist/runtime/nitro/utils/useTrigger.js +0 -311
  135. package/dist/runtime/nitro/utils/wsPeerManager.d.ts +0 -44
  136. package/dist/runtime/nitro/utils/wsPeerManager.js +0 -32
  137. package/dist/runtime/scheduler/index.d.ts +0 -33
  138. package/dist/runtime/scheduler/index.js +0 -42
  139. package/dist/runtime/scheduler/scheduler.d.ts +0 -132
  140. package/dist/runtime/scheduler/scheduler.js +0 -799
  141. package/dist/runtime/scheduler/types.d.ts +0 -122
  142. package/dist/runtime/scheduler/types.js +0 -0
  143. package/dist/runtime/worker/node/runner.d.ts +0 -95
  144. package/dist/runtime/worker/node/runner.js +0 -272
  145. package/dist/runtime/worker/python/get_config.py +0 -64
  146. package/dist/runtime/worker/system/awaitHandlers.d.ts +0 -27
  147. package/dist/runtime/worker/system/awaitHandlers.js +0 -230
  148. package/dist/runtime/worker/system/index.d.ts +0 -24
  149. package/dist/runtime/worker/system/index.js +0 -39
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nvent",
3
- "version": "0.5.15",
3
+ "version": "1.0.0-alpha.2",
4
4
  "description": "Event-driven workflows for Nuxt",
5
5
  "repository": "DevJoghurt/nvent",
6
6
  "license": "MIT",
@@ -22,24 +22,21 @@
22
22
  "prepack": "pnpm build"
23
23
  },
24
24
  "dependencies": {
25
- "@nuxt/kit": "4.2.2",
25
+ "@nuxt/kit": "4.4.2",
26
26
  "chokidar": "^5.0.0",
27
- "cron": "^4.4.0",
28
- "cron-parser": "^5.4.0",
29
- "defu": "^6.1.4",
30
- "fastq": "^1.19.1",
31
- "globby": "16.0.0",
32
- "magicast": "^0.5.1",
33
- "nuxt": "4.2.2",
27
+ "confbox": "^0.2.4",
28
+ "globby": "16.1.1",
29
+ "iii-sdk": "^0.9.0",
30
+ "knitwork": "^1.3.0",
31
+ "nuxt": "4.4.2",
34
32
  "pathe": "^2.0.3",
35
- "perfect-debounce": "^2.0.0",
36
- "zod": "^4.1.13"
33
+ "perfect-debounce": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
36
  "@nuxt/module-builder": "^1.0.2",
40
- "@nuxt/schema": "4.2.2",
41
- "@types/node": "^25.0.0",
37
+ "@nuxt/schema": "4.4.2",
38
+ "@types/node": "^25.5.0",
42
39
  "typescript": "latest",
43
- "vitest": "^4.0.15"
40
+ "vitest": "^4.1.0"
44
41
  }
45
42
  }
@@ -1,6 +0,0 @@
1
- /**
2
- * Adapter base utilities
3
- * Exported for use by external adapter packages
4
- */
5
- export { StoreValidator, createStoreValidator } from './store-validator.js';
6
- export type { StoreValidatorOptions } from './store-validator.js';
@@ -1 +0,0 @@
1
- export { StoreValidator, createStoreValidator } from "./store-validator.js";
@@ -1,48 +0,0 @@
1
- /**
2
- * Store Adapter Validation
3
- *
4
- * Centralized validation logic for index updates to ensure correct usage
5
- * across all store adapter implementations.
6
- */
7
- export interface StoreValidatorOptions {
8
- /** Adapter name for error messages */
9
- adapterName: string;
10
- /** Enable counter misuse warnings (default: true in development) */
11
- warnCounters?: boolean;
12
- /** Throw errors on validation failures (default: true) */
13
- throwOnError?: boolean;
14
- }
15
- export declare class StoreValidator {
16
- private readonly adapterName;
17
- private readonly warnCounters;
18
- private readonly throwOnError;
19
- constructor(options: StoreValidatorOptions);
20
- /**
21
- * Validate index update payload
22
- * Throws error if dot notation keys are detected (except 'version')
23
- * Recursively checks all nested objects
24
- */
25
- validateUpdatePayload(payload: Record<string, any>, method: string): void;
26
- /**
27
- * Recursively check for dot notation in object keys
28
- */
29
- private checkDotNotationKeys;
30
- /**
31
- * Build a nested object suggestion from a dot notation key
32
- */
33
- private buildNestedObjectSuggestion;
34
- /**
35
- * Detect potential counter misuse
36
- * Logs warnings when numeric fields that look like counters are updated
37
- * via update() instead of increment()
38
- */
39
- private detectCounterMisuse;
40
- /**
41
- * Check if a field looks like a counter that should use increment()
42
- */
43
- private isCounterField;
44
- }
45
- /**
46
- * Factory function to create a validator for an adapter
47
- */
48
- export declare function createStoreValidator(adapterName: string, options?: Partial<StoreValidatorOptions>): StoreValidator;
@@ -1,147 +0,0 @@
1
- export class StoreValidator {
2
- adapterName;
3
- warnCounters;
4
- throwOnError;
5
- constructor(options) {
6
- this.adapterName = options.adapterName;
7
- this.warnCounters = options.warnCounters ?? process.env.NODE_ENV === "development";
8
- this.throwOnError = options.throwOnError ?? true;
9
- }
10
- /**
11
- * Validate index update payload
12
- * Throws error if dot notation keys are detected (except 'version')
13
- * Recursively checks all nested objects
14
- */
15
- validateUpdatePayload(payload, method) {
16
- this.checkDotNotationKeys(payload, method, []);
17
- if (this.warnCounters) {
18
- this.detectCounterMisuse(payload, method);
19
- }
20
- }
21
- /**
22
- * Recursively check for dot notation in object keys
23
- */
24
- checkDotNotationKeys(obj, method, path) {
25
- for (const key of Object.keys(obj)) {
26
- const currentPath = [...path, key];
27
- if (key.includes(".") && key !== "version") {
28
- const fullPath = currentPath.join(".");
29
- const suggestion = this.buildNestedObjectSuggestion(key);
30
- const message = [
31
- `[${this.adapterName}] Invalid update payload in ${method}:`,
32
- `Dot notation key "${key}" detected at path "${fullPath}".`,
33
- `Keys should not contain dots. Split "${key}" into nested objects: ${suggestion}`
34
- ].join("\n");
35
- console.error(message);
36
- if (this.throwOnError) {
37
- throw new Error(
38
- `Invalid index update: dot notation keys not supported. Key "${key}" at path "${fullPath}" contains dots.`
39
- );
40
- }
41
- }
42
- const value = obj[key];
43
- if (value && typeof value === "object" && !Array.isArray(value)) {
44
- this.checkDotNotationKeys(value, method, currentPath);
45
- }
46
- }
47
- }
48
- /**
49
- * Build a nested object suggestion from a dot notation key
50
- */
51
- buildNestedObjectSuggestion(dotKey) {
52
- const parts = dotKey.split(".");
53
- let suggestion = "{ ";
54
- for (let i = 0; i < parts.length - 1; i++) {
55
- suggestion += `${parts[i]}: { `;
56
- }
57
- suggestion += `${parts[parts.length - 1]}: value `;
58
- for (let i = 0; i < parts.length - 1; i++) {
59
- suggestion += "}";
60
- }
61
- suggestion += " }";
62
- return suggestion;
63
- }
64
- /**
65
- * Detect potential counter misuse
66
- * Logs warnings when numeric fields that look like counters are updated
67
- * via update() instead of increment()
68
- */
69
- detectCounterMisuse(payload, method) {
70
- const checkNested = (obj, path = []) => {
71
- for (const [key, value] of Object.entries(obj)) {
72
- const currentPath = [...path, key];
73
- if (this.isCounterField(key, value, currentPath)) {
74
- console.warn(
75
- `[${this.adapterName}] Potential counter misuse in ${method}:`,
76
- `Field "${currentPath.join(".")}" is numeric.`,
77
- `Consider using index.increment() for atomic updates instead of ${method}.`
78
- );
79
- }
80
- if (value && typeof value === "object" && !Array.isArray(value)) {
81
- checkNested(value, currentPath);
82
- }
83
- }
84
- };
85
- checkNested(payload);
86
- }
87
- /**
88
- * Check if a field looks like a counter that should use increment()
89
- */
90
- isCounterField(key, value, path) {
91
- if (typeof value !== "number") {
92
- return false;
93
- }
94
- if (path.includes("emittedEvents")) {
95
- return false;
96
- }
97
- const metadataFields = [
98
- "stepCount",
99
- // Total steps in flow (constant)
100
- "timeout",
101
- // Timeout duration
102
- "delay",
103
- // Delay duration
104
- "timestamp",
105
- // Timestamp values
106
- "score",
107
- // Score values
108
- "priority",
109
- // Priority values
110
- "version"
111
- // Version field
112
- ];
113
- if (metadataFields.includes(key)) {
114
- return false;
115
- }
116
- if (key.endsWith("At")) {
117
- return false;
118
- }
119
- const counterKeywords = [
120
- "count",
121
- "total",
122
- "running",
123
- "awaiting",
124
- "success",
125
- "failure",
126
- "cancel",
127
- "pending",
128
- "completed",
129
- "failed",
130
- "retries",
131
- "attempts"
132
- ];
133
- if (counterKeywords.some((keyword) => key.toLowerCase().includes(keyword))) {
134
- return true;
135
- }
136
- if (path.includes("stats")) {
137
- return true;
138
- }
139
- return false;
140
- }
141
- }
142
- export function createStoreValidator(adapterName, options) {
143
- return new StoreValidator({
144
- adapterName,
145
- ...options
146
- });
147
- }
@@ -1,67 +0,0 @@
1
- /**
2
- * File Queue Adapter
3
- *
4
- * File-based queue implementation for development/small deployments
5
- * - Uses fastq for job processing (same as memory adapter)
6
- * - Persists jobs to file system
7
- * - Survives restarts
8
- * - Single instance only (no distributed lock)
9
- *
10
- * Storage format:
11
- * - {dataDir}/{queueName}/jobs/{jobId}.json - Individual job files
12
- * - Jobs are loaded on init and kept in memory with fastq
13
- */
14
- import type { QueueAdapter, JobInput, Job, JobsQuery, ScheduleOptions, JobCounts, QueueEvent, WorkerHandler, WorkerOptions } from '../interfaces/queue.js';
15
- export interface FileQueueAdapterOptions {
16
- dataDir: string;
17
- maxQueueSize?: number;
18
- }
19
- export declare class FileQueueAdapter implements QueueAdapter {
20
- private jobs;
21
- private eventListeners;
22
- private workers;
23
- private scheduledJobs;
24
- private options;
25
- private initialized;
26
- constructor(options: FileQueueAdapterOptions);
27
- init(): Promise<void>;
28
- private loadJobsFromDisk;
29
- private persistJob;
30
- private deleteJobFile;
31
- enqueue(queueName: string, job: JobInput): Promise<string>;
32
- schedule(queueName: string, job: JobInput, opts?: ScheduleOptions): Promise<string>;
33
- getJob(_queueName: string, id: string): Promise<Job | null>;
34
- getJobs(queueName: string, query?: JobsQuery): Promise<Job[]>;
35
- on(queueName: string, event: QueueEvent, callback: (payload: any) => void): () => void;
36
- isPaused(queueName: string): Promise<boolean>;
37
- getJobCounts(queueName: string): Promise<JobCounts>;
38
- getScheduledJobs(queueName: string): Promise<Array<any>>;
39
- removeScheduledJob(scheduleId: string): Promise<boolean>;
40
- pause(queueName: string): Promise<void>;
41
- resume(queueName: string): Promise<void>;
42
- close(): Promise<void>;
43
- registerWorker(queueName: string, jobName: string, handler: WorkerHandler, opts?: WorkerOptions): void;
44
- /**
45
- * Start processing waiting jobs for a queue
46
- * Should be called after all handlers are registered
47
- */
48
- startProcessingQueue(queueName: string): void;
49
- private updateJobState;
50
- private emitEvent;
51
- /**
52
- * Clean up completed jobs based on removeOnComplete option
53
- * - true: delete immediately
54
- * - false/undefined: keep forever
55
- * - number: keep last N jobs, delete older ones
56
- */
57
- private cleanupCompletedJobs;
58
- /**
59
- * Clean up failed jobs based on removeOnFail option
60
- * - true: delete immediately
61
- * - false/undefined: keep forever
62
- * - number: keep last N jobs, delete older ones
63
- */
64
- private cleanupFailedJobs;
65
- private generateId;
66
- private scheduleCronJob;
67
- }