{"_id":"@alis-build/utils","_rev":"9-90046065f242e0a7290c4a7863a28aef","name":"@alis-build/utils","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.3":{"name":"@alis-build/utils","version":"0.0.3","license":"APACHE-2.0","_id":"@alis-build/utils@0.0.3","maintainers":[{"name":"newtonnthiga","email":"newton@alisx.com"},{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"}],"homepage":"https://github.com/alis-exchange/ts-alis-build#readme","bugs":{"url":"https://github.com/alis-exchange/ts-alis-build/issues"},"dist":{"shasum":"fd3b00f04314906d0250d0c789120ed9595d295e","tarball":"https://registry.npmjs.org/@alis-build/utils/-/utils-0.0.3.tgz","fileCount":44,"integrity":"sha512-O9/7UlFnc8kvlCv+tJUPrI3eM0MClGxZosEl4v54g6a6UYUNJW4mT1mruLosl8tavvpCRY7pF/XtsIDx6nYAjg==","signatures":[{"sig":"MEUCIEnfsGF5xACjM8hL3mb/ZwYb82QaOAHj5kPttmR4y6VIAiEApPNFsXwskRnRM06aDvScf97OVlnG2OpZiSkWGmmot1M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92006},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"fb2c316e95d628b0e536025df8c37b491838e2d1","scripts":{"test":"node test_runner.js"},"_npmUser":{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"},"repository":{"url":"git+https://github.com/alis-exchange/ts-alis-build.git","type":"git"},"_npmVersion":"10.8.2","description":"A collection of common utilities used at Alis Exchange.","directories":{},"_nodeVersion":"20.17.0","dependencies":{"@alis-build/google-common-protos":"latest"},"_hasShrinkwrap":false,"devDependencies":{"picocolors":"^1.0.0","@types/node":"^18.11.9","@deno/shim-deno":"~0.16.1"},"peerDependencies":{"google-protobuf":"latest"},"_npmOperationalInternal":{"tmp":"tmp/utils_0.0.3_1728991300352_0.8034546042077253","host":"s3://npm-registry-packages"}},"0.0.4":{"name":"@alis-build/utils","version":"0.0.4","license":"APACHE-2.0","_id":"@alis-build/utils@0.0.4","maintainers":[{"name":"newtonnthiga","email":"newton@alisx.com"},{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"}],"homepage":"https://github.com/alis-exchange/ts-alis-build#readme","bugs":{"url":"https://github.com/alis-exchange/ts-alis-build/issues"},"dist":{"shasum":"af40e35dbc07b558a4928f7b1559e5487aef3874","tarball":"https://registry.npmjs.org/@alis-build/utils/-/utils-0.0.4.tgz","fileCount":44,"integrity":"sha512-ZkdgJdGrKpD2zQmQOuBoDNcRDS8OBs4/h2xaHSb6MtNycj98x4EqpeDcqhhTOaB42RI+NaJxxXZsC2HMFB5PTg==","signatures":[{"sig":"MEQCIHFKH7AsmMWfQ1JASiDrxwkqzQAjyOrKF0PiN1StPr7VAiAgfe8zaFOnEAEijnfMcS+Li0pO3KBd83bkjSQh2k1Jzg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":93820},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"92124dc41798bdb9b58846e8e5710701112afee8","scripts":{"test":"node test_runner.js"},"_npmUser":{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"},"repository":{"url":"git+https://github.com/alis-exchange/ts-alis-build.git","type":"git"},"_npmVersion":"10.8.2","description":"A collection of common utilities used at Alis Exchange.","directories":{},"_nodeVersion":"20.17.0","dependencies":{"@alis-build/google-common-protos":"latest"},"_hasShrinkwrap":false,"devDependencies":{"picocolors":"^1.0.0","@types/node":"^18.11.9","@deno/shim-deno":"~0.16.1"},"peerDependencies":{"google-protobuf":"latest"},"_npmOperationalInternal":{"tmp":"tmp/utils_0.0.4_1728994508023_0.05744831161985564","host":"s3://npm-registry-packages"}},"0.0.5":{"name":"@alis-build/utils","version":"0.0.5","license":"APACHE-2.0","_id":"@alis-build/utils@0.0.5","maintainers":[{"name":"newtonnthiga","email":"newton@alisx.com"},{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"}],"homepage":"https://github.com/alis-exchange/ts-alis-build#readme","bugs":{"url":"https://github.com/alis-exchange/ts-alis-build/issues"},"dist":{"shasum":"5e02a08b1fe55721382c0470140f18256edc9fff","tarball":"https://registry.npmjs.org/@alis-build/utils/-/utils-0.0.5.tgz","fileCount":50,"integrity":"sha512-TshfVH8ApB6m0Qayod76SpMiK5S5bJS3pUvV7ayjXZm+8mSALMfV66NFRzNwz4hkvplZXNZs3Eet3Rd8IT7J8w==","signatures":[{"sig":"MEYCIQDB0kemMsTJWSjORlBi8xu/1Iz3+CDfActOOV1LNFE0UgIhAJYnqrd3H05S5QYCFrhQr5WLbTXqcmoTWa3Kuioj/xCz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":112403},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"1719cf8a928fa3feef7279a02613c08d9a0c54f5","scripts":{"test":"node test_runner.js"},"_npmUser":{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"},"repository":{"url":"git+https://github.com/alis-exchange/ts-alis-build.git","type":"git"},"_npmVersion":"10.8.2","description":"A collection of common utilities used at Alis Exchange.","directories":{},"_nodeVersion":"20.18.0","dependencies":{"@alis-build/google-common-protos":"latest"},"_hasShrinkwrap":false,"devDependencies":{"picocolors":"^1.0.0","@types/node":"^18.11.9","@deno/shim-deno":"~0.16.1"},"peerDependencies":{"google-protobuf":"latest"},"_npmOperationalInternal":{"tmp":"tmp/utils_0.0.5_1729674088030_0.6884926138971741","host":"s3://npm-registry-packages"}},"0.0.6":{"name":"@alis-build/utils","version":"0.0.6","license":"APACHE-2.0","_id":"@alis-build/utils@0.0.6","maintainers":[{"name":"newtonnthiga","email":"newton@alisx.com"},{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"}],"homepage":"https://github.com/alis-exchange/ts-alis-build#readme","bugs":{"url":"https://github.com/alis-exchange/ts-alis-build/issues"},"dist":{"shasum":"7eeaf76e903df3430c5897da0ec79a13a3018bab","tarball":"https://registry.npmjs.org/@alis-build/utils/-/utils-0.0.6.tgz","fileCount":34,"integrity":"sha512-hjwFwAcXo0kCpj2vWZK0qW/MqJPtZ0Ll6QAcqJmNu+en72tzrZEmxx2hMc3wAkPQP3grH4x8VfU6GTPwo/zKgA==","signatures":[{"sig":"MEUCIQCAKG2NA7KPh1x844HjN9YZdfUmhkCNOR412YgjsFHpiQIgZrLmnQSj8wKFpcn7AUiwNWtfmq2TGMyLwVZGPyCDnlE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":85947},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"3c2e70c6182c23ccb5c07071187277f4e7b0aef2","scripts":{"test":"node test_runner.js"},"_npmUser":{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"},"repository":{"url":"git+https://github.com/alis-exchange/ts-alis-build.git","type":"git"},"_npmVersion":"10.8.2","description":"A collection of common utilities used at Alis Exchange.","directories":{},"_nodeVersion":"20.19.1","dependencies":{"@alis-build/google-common-protos":"latest"},"_hasShrinkwrap":false,"devDependencies":{"picocolors":"^1.0.0","@types/node":"^20.9.0","@deno/shim-deno":"~0.18.0"},"peerDependencies":{"google-protobuf":"latest"},"_npmOperationalInternal":{"tmp":"tmp/utils_0.0.6_1746689318885_0.8854228388294461","host":"s3://npm-registry-packages-npm-production"}},"0.0.7":{"name":"@alis-build/utils","version":"0.0.7","license":"APACHE-2.0","_id":"@alis-build/utils@0.0.7","maintainers":[{"name":"newtonnthiga","email":"newton@alisx.com"},{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"}],"homepage":"https://github.com/alis-exchange/ts-alis-build#readme","bugs":{"url":"https://github.com/alis-exchange/ts-alis-build/issues"},"dist":{"shasum":"4107e25c8f34b76129f9305b8cd600ac559ce5f5","tarball":"https://registry.npmjs.org/@alis-build/utils/-/utils-0.0.7.tgz","fileCount":30,"integrity":"sha512-eFbL6uuYtB92hSsIgHEJ6IcGghRXx7Q44gK+X1zEa/5IfbWDqHKK3XJOgCDEpebxWztNNOmE13TpNV8MWIHtLg==","signatures":[{"sig":"MEUCIBNQfv7bMrlxmRKaeSmU3SXuNAm4HRYliIYUZCkkqpglAiEA6E0YR6N3V0CKp64XOk7QNbSJDUtr5awNlyQdHVwBtVE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":87659},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"f87a83460b5d9c854b337ed23873b425a0a5fbb3","scripts":{"test":"node test_runner.js"},"_npmUser":{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"},"repository":{"url":"git+https://github.com/alis-exchange/ts-alis-build.git","type":"git"},"_npmVersion":"10.8.2","description":"A collection of common utilities used at Alis Exchange.","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@alis-build/google-common-protos":"latest"},"_hasShrinkwrap":false,"devDependencies":{"picocolors":"^1.0.0","@types/node":"^20.9.0","@deno/shim-deno":"~0.18.0"},"peerDependencies":{"google-protobuf":"latest"},"_npmOperationalInternal":{"tmp":"tmp/utils_0.0.7_1754324805659_0.22978609286873075","host":"s3://npm-registry-packages-npm-production"}},"0.0.9":{"name":"@alis-build/utils","version":"0.0.9","license":"APACHE-2.0","_id":"@alis-build/utils@0.0.9","maintainers":[{"name":"newtonnthiga","email":"newton@alisx.com"},{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"}],"homepage":"https://github.com/alis-exchange/ts-alis-build#readme","bugs":{"url":"https://github.com/alis-exchange/ts-alis-build/issues"},"dist":{"shasum":"9036bebac73ea9f26d9f98debf254b3f9f92221c","tarball":"https://registry.npmjs.org/@alis-build/utils/-/utils-0.0.9.tgz","fileCount":34,"integrity":"sha512-lfAhAVsuM9SFRiQotlpLhbaaf+32YyVe5IiTYTTKaQIKXa7rV3UVumm3VQqeqJaGjQt1r8pAQDUzTxzZ1vjPcA==","signatures":[{"sig":"MEUCIQDSxMXBnrcP5T42tip9Tck2qZjKWpGMILd8OH6Mp0c+PQIgZBZzSsRO3FxZl807oRSdwpKIpd7GdSoHxTeCZrbNq74=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":124154},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"9bdcc618a0163558bc75d9930106b400833d79ba","_npmUser":{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"},"repository":{"url":"git+https://github.com/alis-exchange/ts-alis-build.git","type":"git"},"_npmVersion":"10.8.2","description":"A collection of common utilities used at Alis Exchange.","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@alis-build/google-common-protos":"latest"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.9.0"},"peerDependencies":{"google-protobuf":"latest"},"_npmOperationalInternal":{"tmp":"tmp/utils_0.0.9_1755862702482_0.4495969226059491","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@alis-build/utils","version":"0.1.0","license":"APACHE-2.0","_id":"@alis-build/utils@0.1.0","maintainers":[{"name":"newtonnthiga","email":"newton@alisx.com"},{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"}],"homepage":"https://github.com/alis-exchange/ts-alis-build#readme","bugs":{"url":"https://github.com/alis-exchange/ts-alis-build/issues"},"dist":{"shasum":"bc6872b846be9333b5b73d7b5efd12694bf7cda1","tarball":"https://registry.npmjs.org/@alis-build/utils/-/utils-0.1.0.tgz","fileCount":34,"integrity":"sha512-iPSm4fJKkIUht+0s4+ccLuO3VzCaToDVqE6Q3qelh+2RVUvleLarJHhFZontEUvHWBMsulgYB6V+zHxMLrr8vQ==","signatures":[{"sig":"MEUCIFCW5I9/cElK2dT85eYhhK3QjyPQPKYCP8lmG35s4HsyAiEA0qV5GN1lGV+9R7I9Wi1o+7/49a5F365YYetzLP4MjU0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":124360},"main":"./script/mod.js","types":"./script/mod.d.ts","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"gitHead":"34b8f25df4ef5be6ab70b0607de764c3bcd36f87","_npmUser":{"name":"daniel-alis-build","email":"daniel.van.niekerk@alisx.com"},"repository":{"url":"git+https://github.com/alis-exchange/ts-alis-build.git","type":"git"},"_npmVersion":"10.8.2","description":"A collection of common utilities used at Alis Exchange.","directories":{},"_nodeVersion":"20.19.6","dependencies":{"@alis-build/google-common-protos":"latest"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.9.0"},"peerDependencies":{"google-protobuf":"latest"},"_npmOperationalInternal":{"tmp":"tmp/utils_0.1.0_1765276673763_0.26943107271719313","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2024-10-15T11:21:40.235Z","modified":"2026-06-22T14:52:18.214Z","0.0.3":"2024-10-15T11:21:40.564Z","0.0.4":"2024-10-15T12:15:08.270Z","0.0.5":"2024-10-23T09:01:28.222Z","0.0.6":"2025-05-08T07:28:39.058Z","0.0.7":"2025-08-04T16:26:45.841Z","0.0.9":"2025-08-22T11:38:22.649Z","0.1.0":"2025-12-09T10:37:54.028Z"},"bugs":{"url":"https://github.com/alis-exchange/ts-alis-build/issues"},"license":"APACHE-2.0","homepage":"https://github.com/alis-exchange/ts-alis-build#readme","repository":{"url":"git+https://github.com/alis-exchange/ts-alis-build.git","type":"git"},"description":"A collection of common utilities used at Alis Exchange.","maintainers":[{"email":"newton@alisx.com","name":"newtonnthiga"},{"email":"jan@alisx.com","name":"jankrynauw"},{"email":"daniel.van.niekerk@alisx.com","name":"daniel-alis-build"},{"email":"ruan@alisx.com","name":"hi_ruan"}],"readme":"# ts-alis-build\n\nAlis Build utils for Javascript/Typescript\n\n## Installation\n\n```bash\nnpm install @alis-build/utils\n```\n\n## Usage\n\n```typescript\nimport { money, strings, time, duration, enums, promises } from \"@alis-build/utils\";\n```\n\n### Time\n\n1. `encodeTimestamp` - Converts a `Date` object to a `google.protobuf.Timestamp` object.\n```typescript\ntime.encodeTimestamp(new Date())\n```\n\n2. `encodeDate` - Converts a `Date` object to a `google.type.Date` object.\n\n```typescript\ntime.encodeDate(new Date())\n```\n\n3. `formatDistance` - Formats the distance between two dates.\n\n```typescript\ntime.formatDistance(new Date(), new Date(), true)\n```\n\nAlso accepts `google.protobuf.Timestamp` and `google.type.Date` objects.\n\n4. `parse` - Parses a `google.protobuf.Timestamp` or `google.type.Date` object to a `Date` object.\n\n```typescript\nconst timestamp = new Timestamp();\ntimestamp.setSeconds(1634294400);\ntimestamp.setNanos(0);\ntime.parse(timestamp)\n```\n\n### Money\n\n1. `encode` - Converts a number to a `google.type.Money` object.\n\n```typescript\nmoney.encode(\"USD\", 100.20)\n```\n\n2. `format` - Formats a `google.type.Money` object to a string.\n\n```typescript\nmoney.format(money.encode(\"USD\", 100.20))\n```\n\n1. `parse` - Parses a `google.type.Money` object to a number.\n\n```typescript\nconst moneyObj = new Money();\nmoneyObj.setCurrencyCode(\"USD\");\nmoneyObj.setUnits(100);\nmoneyObj.setNanos(200000000);\nmoney.parse(moneyObj)\n```\n\n### Duration\n\n1. `Duration` - Custom Duration class to handle duration calculations.\n\n```typescript\nconst duration = new duration.Duration({ hours: 1, minutes: 30, seconds: 30 });\n```\n\n2. `encode` - Converts a `Duration` to a `google.protobuf.Duration` object.\n\n```typescript\nconst duration = new duration.Duration({ hours: 1, minutes: 30, seconds: 30 });\n\nduration.encode()\n```\n\n1. `parse` - Parses a `google.protobuf.Duration` object to a `Duration`.\n\n```typescript\nconst durationObj = new Duration();\ndurationObj.setSeconds(5400);\n\nduration.parse(durationObj)\n```\n\n\n### Strings\n\n1. `snakeCaseToCamelCase`\n2. `camelCaseToSnakeCase`\n3. `snakeCaseToKebabCase`\n4. `kebabCaseToSnakeCase`\n5. `camelCaseToKebabCase`\n6. `kebabCaseToCamelCase`\n7. `snakeCaseToPascalCase`\n8. `pascalCaseToSnakeCase`\n9. `kebabCaseToPascalCase`\n10. `pascalCaseToKebabCase`\n11. `camelCaseToPascalCase`\n12. `pascalCaseToCamelCase`\n13. `toTitleCase`\n14. `toConstantCase`\n\n### Enums\n\n1. `getAllEnumKeys` - Returns all enum keys from a given enum.\n\n```typescript\nimport { getAllEnumKeys } from \"@alis-build/utils/enums\";\n\nenum MyEnum {\n  FIRST = 1,\n  SECOND = 2,\n  THIRD = 3,\n}\n\nconst allEnumKeys = getAllEnumKeys(MyEnum);\n\nconsole.log(allEnumKeys); // [\"FIRST\", \"SECOND\", \"THIRD\"]\n```\n\n2. `getAllEnumValues` - Returns all enum values from a given enum.\n\n```typescript\nimport { getAllEnumValues } from \"@alis-build/utils/enums\";\n\nenum MyEnum {\n  FIRST = 1,\n  SECOND = 2,\n  THIRD = 3,\n}\n\nconst allEnumValues = getAllEnumValues(MyEnum);\n\nconsole.log(allEnumValues); // [1, 2, 3]\n```\n\n3. `getAllEnumEntries` - Returns all enum entries (key-value pairs) from a given enum.\n\n```typescript\nimport { getAllEnumEntries } from \"@alis-build/utils/enums\";\n\nenum MyEnum {\n  FIRST = 1,\n  SECOND = 2,\n  THIRD = 3,\n}\n\nconst allEnumEntries = getAllEnumEntries(MyEnum);\n\nconsole.log(allEnumEntries); // [[\"FIRST\", 1], [\"SECOND\", 2], [\"THIRD\", 3]]\n```\n\n4. `getEnumKeyByValue` - Returns the enum key for a given value.\n\n```typescript\nimport { getEnumKeyByValue } from \"@alis-build/utils/enums\";\n\nenum MyEnum {\n  FIRST = 1,\n  SECOND = 2,\n  THIRD = 3,\n}\n\nconst enumKey = getEnumKeyByValue(MyEnum, 2);\nconsole.log(enumKey); // \"SECOND\"\n```\n\n5. `getEnumValueByKey` - Returns the enum value for a given key.\n\n```typescript\nimport { getEnumValueByKey } from \"@alis-build/utils/enums\";\n\nenum MyEnum {\n  FIRST = 1,\n  SECOND = 2,\n  THIRD = 3,\n}\n\nconst enumValue = getEnumValueByKey(MyEnum, \"SECOND\");\n\nconsole.log(enumValue); // 2\n```\n\n### Promises\n\n1. `Deferred` - Deferred represents a promise that can be resolved or rejected externally. Unlike a regular Promise where the resolution logic must be provided at construction time, a Deferred allows you to create a promise and control its settlement from outside.\n\n```typescript\nimport { Deferred, DeferredState } from \"@alis-build/utils/promises\";\n\nconst deferred = new Deferred<string>();\n\n// The promise can be awaited elsewhere\nasync function waitForResult() {\n  const result = await deferred.promise;\n  console.log('Got result:', result);\n}\n\n// And resolved from anywhere\nsetTimeout(() => {\n  deferred.resolve('Hello, World!');\n}, 1000);\n```\n\nTimeout support:\n\n```typescript\nconst deferred = new Deferred<string>();\n\n// Reject after 5 seconds with default error\ndeferred.setTimeout(5000);\n\n// Or with custom timeout error\ndeferred.setTimeout(5000, new Error('Operation timed out'));\n\n// The timeout is cleared if resolved before it expires\ndeferred.resolve('Completed in time!');\n```\n\nCancellation support:\n\n```typescript\nconst deferred = new Deferred<string>();\n\n// Register cancellation callbacks\ndeferred.onCancel(() => {\n  console.log('Deferred was cancelled');\n  // Cleanup resources\n});\n\n// Cancel with optional reason\ndeferred.cancel('User cancelled the operation');\n```\n\nState inspection:\n\n```typescript\nconst deferred = new Deferred<string>();\n\nconsole.log(deferred.isPending);   // true\nconsole.log(deferred.isSettled);   // false\n\ndeferred.resolve('done');\n\nconsole.log(deferred.isResolved);  // true\nconsole.log(deferred.isSettled);   // true\nconsole.log(deferred.value);       // 'done'\nconsole.log(deferred.duration);    // Time in ms from creation to settlement\n```\n\n2. `RetryableDeferred` - RetryableDeferred extends `Deferred` to add automatic retry capabilities for operations that may fail transiently.\n\n```typescript\nimport { RetryableDeferred } from \"@alis-build/utils/promises\";\n\n// Will retry up to 3 times with 1 second delay between attempts\nconst deferred = new RetryableDeferred(\n  somePromise(),\n  3,     // maxAttempts\n  1000   // retryDelay in ms\n);\n\ntry {\n  const data = await deferred.promise;\n  console.log('Success after', deferred.attemptCount, 'attempts');\n} catch (error) {\n  console.log('Failed after', deferred.attemptCount, 'attempts');\n}\n```","readmeFilename":"README.md"}