@ironflow/core 0.1.0-test.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 (70) hide show
  1. package/README.md +60 -0
  2. package/dist/constants.d.ts +219 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +233 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/errors.d.ts +140 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +205 -0
  9. package/dist/errors.js.map +1 -0
  10. package/dist/gen/index.d.ts +7 -0
  11. package/dist/gen/index.d.ts.map +1 -0
  12. package/dist/gen/index.js +7 -0
  13. package/dist/gen/index.js.map +1 -0
  14. package/dist/gen/ironflow/v1/index.d.ts +13 -0
  15. package/dist/gen/ironflow/v1/index.d.ts.map +1 -0
  16. package/dist/gen/ironflow/v1/index.js +15 -0
  17. package/dist/gen/ironflow/v1/index.js.map +1 -0
  18. package/dist/gen/ironflow/v1/ironflow_connect.d.ts +209 -0
  19. package/dist/gen/ironflow/v1/ironflow_connect.d.ts.map +1 -0
  20. package/dist/gen/ironflow/v1/ironflow_connect.js +216 -0
  21. package/dist/gen/ironflow/v1/ironflow_connect.js.map +1 -0
  22. package/dist/gen/ironflow/v1/ironflow_pb.d.ts +814 -0
  23. package/dist/gen/ironflow/v1/ironflow_pb.d.ts.map +1 -0
  24. package/dist/gen/ironflow/v1/ironflow_pb.js +157 -0
  25. package/dist/gen/ironflow/v1/ironflow_pb.js.map +1 -0
  26. package/dist/gen/ironflow/v1/pubsub_connect.d.ts +104 -0
  27. package/dist/gen/ironflow/v1/pubsub_connect.d.ts.map +1 -0
  28. package/dist/gen/ironflow/v1/pubsub_connect.js +110 -0
  29. package/dist/gen/ironflow/v1/pubsub_connect.js.map +1 -0
  30. package/dist/gen/ironflow/v1/pubsub_pb.d.ts +814 -0
  31. package/dist/gen/ironflow/v1/pubsub_pb.d.ts.map +1 -0
  32. package/dist/gen/ironflow/v1/pubsub_pb.js +202 -0
  33. package/dist/gen/ironflow/v1/pubsub_pb.js.map +1 -0
  34. package/dist/gen/ironflow/v1/types_pb.d.ts +698 -0
  35. package/dist/gen/ironflow/v1/types_pb.d.ts.map +1 -0
  36. package/dist/gen/ironflow/v1/types_pb.js +217 -0
  37. package/dist/gen/ironflow/v1/types_pb.js.map +1 -0
  38. package/dist/gen/ironflow/v1/worker_connect.d.ts +20 -0
  39. package/dist/gen/ironflow/v1/worker_connect.d.ts.map +1 -0
  40. package/dist/gen/ironflow/v1/worker_connect.js +26 -0
  41. package/dist/gen/ironflow/v1/worker_connect.js.map +1 -0
  42. package/dist/gen/ironflow/v1/worker_pb.d.ts +685 -0
  43. package/dist/gen/ironflow/v1/worker_pb.d.ts.map +1 -0
  44. package/dist/gen/ironflow/v1/worker_pb.js +135 -0
  45. package/dist/gen/ironflow/v1/worker_pb.js.map +1 -0
  46. package/dist/index.d.ts +19 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +51 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/logger.d.ts +26 -0
  51. package/dist/logger.d.ts.map +1 -0
  52. package/dist/logger.js +78 -0
  53. package/dist/logger.js.map +1 -0
  54. package/dist/protocol.d.ts +250 -0
  55. package/dist/protocol.d.ts.map +1 -0
  56. package/dist/protocol.js +34 -0
  57. package/dist/protocol.js.map +1 -0
  58. package/dist/schemas.d.ts +394 -0
  59. package/dist/schemas.d.ts.map +1 -0
  60. package/dist/schemas.js +268 -0
  61. package/dist/schemas.js.map +1 -0
  62. package/dist/types.d.ts +577 -0
  63. package/dist/types.d.ts.map +1 -0
  64. package/dist/types.js +49 -0
  65. package/dist/types.js.map +1 -0
  66. package/dist/utils.d.ts +60 -0
  67. package/dist/utils.d.ts.map +1 -0
  68. package/dist/utils.js +109 -0
  69. package/dist/utils.js.map +1 -0
  70. package/package.json +78 -0
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Utility functions for Ironflow SDK
3
+ */
4
+ /**
5
+ * Parse a duration string into milliseconds.
6
+ *
7
+ * Supported formats:
8
+ * - "1s", "30s" - seconds
9
+ * - "1m", "30m" - minutes
10
+ * - "1h", "12h" - hours
11
+ * - "1d", "7d" - days
12
+ * - 1000 (number) - milliseconds
13
+ *
14
+ * @param duration - Duration string or number in milliseconds
15
+ * @returns Duration in milliseconds
16
+ * @throws Error if format is invalid
17
+ */
18
+ export declare function parseDuration(duration: string | number): number;
19
+ /**
20
+ * Calculate exponential backoff delay
21
+ *
22
+ * @param attempt - Current attempt number (1-based)
23
+ * @param initialDelay - Initial delay in milliseconds
24
+ * @param maxDelay - Maximum delay in milliseconds
25
+ * @param multiplier - Backoff multiplier (default: 2)
26
+ * @returns Delay in milliseconds
27
+ */
28
+ export declare function calculateBackoff(attempt: number, initialDelay: number, maxDelay: number, multiplier?: number): number;
29
+ /**
30
+ * Sleep for a given duration
31
+ *
32
+ * @param ms - Duration in milliseconds
33
+ */
34
+ export declare function sleep(ms: number): Promise<void>;
35
+ /**
36
+ * Create a deferred promise
37
+ */
38
+ export interface Deferred<T> {
39
+ promise: Promise<T>;
40
+ resolve: (value: T) => void;
41
+ reject: (error: Error) => void;
42
+ }
43
+ export declare function createDeferred<T>(): Deferred<T>;
44
+ /**
45
+ * Generate a unique ID
46
+ */
47
+ export declare function generateId(): string;
48
+ /**
49
+ * Safely parse JSON, returning undefined on error
50
+ */
51
+ export declare function safeJsonParse(data: string): unknown | undefined;
52
+ /**
53
+ * Type guard to check if a value is a non-null object
54
+ */
55
+ export declare function isObject(value: unknown): value is Record<string, unknown>;
56
+ /**
57
+ * Deep merge two objects
58
+ */
59
+ export declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
60
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAwB/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,UAAU,GAAE,MAAU,GACrB,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,cAAc,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAQ/C;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAInC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAM/D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GACjB,CAAC,CAkBH"}
package/dist/utils.js ADDED
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Utility functions for Ironflow SDK
3
+ */
4
+ /**
5
+ * Parse a duration string into milliseconds.
6
+ *
7
+ * Supported formats:
8
+ * - "1s", "30s" - seconds
9
+ * - "1m", "30m" - minutes
10
+ * - "1h", "12h" - hours
11
+ * - "1d", "7d" - days
12
+ * - 1000 (number) - milliseconds
13
+ *
14
+ * @param duration - Duration string or number in milliseconds
15
+ * @returns Duration in milliseconds
16
+ * @throws Error if format is invalid
17
+ */
18
+ export function parseDuration(duration) {
19
+ if (typeof duration === "number") {
20
+ return duration;
21
+ }
22
+ const match = duration.match(/^(\d+(?:\.\d+)?)(ms|s|m|h|d)$/);
23
+ if (!match) {
24
+ throw new Error(`Invalid duration format: "${duration}". Use format like "30s", "5m", "2h", "7d" or number of milliseconds.`);
25
+ }
26
+ const value = parseFloat(match[1]);
27
+ const unit = match[2];
28
+ const multipliers = {
29
+ ms: 1,
30
+ s: 1000,
31
+ m: 60 * 1000,
32
+ h: 60 * 60 * 1000,
33
+ d: 24 * 60 * 60 * 1000,
34
+ };
35
+ return Math.floor(value * multipliers[unit]);
36
+ }
37
+ /**
38
+ * Calculate exponential backoff delay
39
+ *
40
+ * @param attempt - Current attempt number (1-based)
41
+ * @param initialDelay - Initial delay in milliseconds
42
+ * @param maxDelay - Maximum delay in milliseconds
43
+ * @param multiplier - Backoff multiplier (default: 2)
44
+ * @returns Delay in milliseconds
45
+ */
46
+ export function calculateBackoff(attempt, initialDelay, maxDelay, multiplier = 2) {
47
+ const delay = initialDelay * Math.pow(multiplier, attempt - 1);
48
+ return Math.min(delay, maxDelay);
49
+ }
50
+ /**
51
+ * Sleep for a given duration
52
+ *
53
+ * @param ms - Duration in milliseconds
54
+ */
55
+ export function sleep(ms) {
56
+ return new Promise((resolve) => setTimeout(resolve, ms));
57
+ }
58
+ export function createDeferred() {
59
+ let resolve;
60
+ let reject;
61
+ const promise = new Promise((res, rej) => {
62
+ resolve = res;
63
+ reject = rej;
64
+ });
65
+ return { promise, resolve, reject };
66
+ }
67
+ /**
68
+ * Generate a unique ID
69
+ */
70
+ export function generateId() {
71
+ const timestamp = Date.now().toString(36);
72
+ const random = Math.random().toString(36).substring(2, 8);
73
+ return `${timestamp}-${random}`;
74
+ }
75
+ /**
76
+ * Safely parse JSON, returning undefined on error
77
+ */
78
+ export function safeJsonParse(data) {
79
+ try {
80
+ return JSON.parse(data);
81
+ }
82
+ catch {
83
+ return undefined;
84
+ }
85
+ }
86
+ /**
87
+ * Type guard to check if a value is a non-null object
88
+ */
89
+ export function isObject(value) {
90
+ return typeof value === "object" && value !== null && !Array.isArray(value);
91
+ }
92
+ /**
93
+ * Deep merge two objects
94
+ */
95
+ export function deepMerge(target, source) {
96
+ const result = { ...target };
97
+ for (const key of Object.keys(source)) {
98
+ const sourceValue = source[key];
99
+ const targetValue = result[key];
100
+ if (isObject(sourceValue) && isObject(targetValue)) {
101
+ result[key] = deepMerge(targetValue, sourceValue);
102
+ }
103
+ else if (sourceValue !== undefined) {
104
+ result[key] = sourceValue;
105
+ }
106
+ }
107
+ return result;
108
+ }
109
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,QAAyB;IACrD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,6BAA6B,QAAQ,uEAAuE,CAC7G,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;IAEvB,MAAM,WAAW,GAA2B;QAC1C,EAAE,EAAE,CAAC;QACL,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,EAAE,GAAG,IAAI;QACZ,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;QACjB,CAAC,E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AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CACvB,MAAS,EACT,MAAkB;IAElB,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAE7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAmB,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAEhC,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YACnD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CACrB,WAAsC,EACtC,WAAsC,CACzB,CAAC;QAClB,CAAC;aAAM,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YACrC,MAAM,CAAC,GAAG,CAAC,GAAG,WAAyB,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@ironflow/core",
3
+ "version": "0.1.0-test.2",
4
+ "description": "Core types, schemas, and protocol definitions for Ironflow SDK",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./schemas": {
14
+ "types": "./dist/schemas.d.ts",
15
+ "import": "./dist/schemas.js"
16
+ },
17
+ "./protocol": {
18
+ "types": "./dist/protocol.d.ts",
19
+ "import": "./dist/protocol.js"
20
+ },
21
+ "./gen": {
22
+ "types": "./dist/gen/index.d.ts",
23
+ "import": "./dist/gen/index.js"
24
+ }
25
+ },
26
+ "sideEffects": false,
27
+ "files": [
28
+ "dist",
29
+ "README.md"
30
+ ],
31
+ "dependencies": {
32
+ "@bufbuild/protobuf": "^2.5.1",
33
+ "@connectrpc/connect": "^2.1.1",
34
+ "zod": "^4.3.5"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^22.14.0",
38
+ "typescript": "^5.9.3",
39
+ "vitest": "^2.1.9"
40
+ },
41
+ "peerDependencies": {
42
+ "typescript": ">=5.0.0"
43
+ },
44
+ "peerDependenciesMeta": {
45
+ "typescript": {
46
+ "optional": true
47
+ }
48
+ },
49
+ "engines": {
50
+ "node": ">=20.0.0"
51
+ },
52
+ "keywords": [
53
+ "ironflow",
54
+ "workflow",
55
+ "serverless",
56
+ "types",
57
+ "schemas"
58
+ ],
59
+ "author": "Ironflow",
60
+ "license": "MIT",
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "https://github.com/ironflowapp/ironflow.git",
64
+ "directory": "sdk/js/core"
65
+ },
66
+ "publishConfig": {
67
+ "access": "restricted"
68
+ },
69
+ "scripts": {
70
+ "build": "tsc",
71
+ "dev": "tsc --watch",
72
+ "test": "vitest run",
73
+ "test:watch": "vitest",
74
+ "lint": "eslint src/",
75
+ "clean": "rm -rf dist",
76
+ "typecheck": "tsc --noEmit"
77
+ }
78
+ }