awaitly 1.34.0 → 2.0.0
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/dist/{duration.d.ts → di-BDlT7InM.d.cts} +15 -1
- package/dist/{duration.d.cts → di-BbFFfO8y.d.ts} +15 -1
- package/dist/errors-DtXvrCiO.d.cts +708 -0
- package/dist/errors-DtXvrCiO.d.ts +708 -0
- package/dist/index.cjs +4594 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1970 -141
- package/dist/index.d.ts +1970 -141
- package/dist/index.js +4398 -1
- package/dist/index.js.map +1 -1
- package/dist/result.cjs +641 -1
- package/dist/result.cjs.map +1 -1
- package/dist/result.d.cts +35 -5
- package/dist/result.d.ts +35 -5
- package/dist/result.js +561 -1
- package/dist/result.js.map +1 -1
- package/dist/testing.cjs +4202 -8
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +2 -6
- package/dist/testing.d.ts +2 -6
- package/dist/testing.js +4154 -8
- package/dist/testing.js.map +1 -1
- package/dist/{run-entry-D2MmJFj9.d.cts → types-B8NfNRGX.d.ts} +1152 -1499
- package/dist/{run-entry-Dduz-is2.d.ts → types-BZ2f4MRR.d.cts} +1152 -1499
- package/dist/workflow.cjs +7096 -6
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +3346 -22
- package/dist/workflow.d.ts +3346 -22
- package/dist/workflow.js +6929 -6
- package/dist/workflow.js.map +1 -1
- package/package.json +13 -178
- package/dist/adapters.cjs +0 -7
- package/dist/adapters.cjs.map +0 -1
- package/dist/adapters.d.cts +0 -179
- package/dist/adapters.d.ts +0 -179
- package/dist/adapters.js +0 -7
- package/dist/adapters.js.map +0 -1
- package/dist/batch.cjs +0 -7
- package/dist/batch.cjs.map +0 -1
- package/dist/batch.d.cts +0 -200
- package/dist/batch.d.ts +0 -200
- package/dist/batch.js +0 -7
- package/dist/batch.js.map +0 -1
- package/dist/bind-deps.cjs +0 -2
- package/dist/bind-deps.cjs.map +0 -1
- package/dist/bind-deps.d.cts +0 -28
- package/dist/bind-deps.d.ts +0 -28
- package/dist/bind-deps.js +0 -2
- package/dist/bind-deps.js.map +0 -1
- package/dist/cache.cjs +0 -2
- package/dist/cache.cjs.map +0 -1
- package/dist/cache.d.cts +0 -269
- package/dist/cache.d.ts +0 -269
- package/dist/cache.js +0 -2
- package/dist/cache.js.map +0 -1
- package/dist/circuit-breaker.cjs +0 -7
- package/dist/circuit-breaker.cjs.map +0 -1
- package/dist/circuit-breaker.d.cts +0 -211
- package/dist/circuit-breaker.d.ts +0 -211
- package/dist/circuit-breaker.js +0 -7
- package/dist/circuit-breaker.js.map +0 -1
- package/dist/conditional.cjs +0 -2
- package/dist/conditional.cjs.map +0 -1
- package/dist/conditional.d.cts +0 -252
- package/dist/conditional.d.ts +0 -252
- package/dist/conditional.js +0 -2
- package/dist/conditional.js.map +0 -1
- package/dist/core.cjs +0 -7
- package/dist/core.cjs.map +0 -1
- package/dist/core.d.cts +0 -5
- package/dist/core.d.ts +0 -5
- package/dist/core.js +0 -7
- package/dist/core.js.map +0 -1
- package/dist/di-COl5oFnR.d.cts +0 -15
- package/dist/di-CyDj_JyZ.d.ts +0 -15
- package/dist/diagnostics.cjs +0 -8
- package/dist/diagnostics.cjs.map +0 -1
- package/dist/diagnostics.d.cts +0 -68
- package/dist/diagnostics.d.ts +0 -68
- package/dist/diagnostics.js +0 -8
- package/dist/diagnostics.js.map +0 -1
- package/dist/durable.cjs +0 -11
- package/dist/durable.cjs.map +0 -1
- package/dist/durable.d.cts +0 -9
- package/dist/durable.d.ts +0 -9
- package/dist/durable.js +0 -11
- package/dist/durable.js.map +0 -1
- package/dist/duration.cjs +0 -2
- package/dist/duration.cjs.map +0 -1
- package/dist/duration.js +0 -2
- package/dist/duration.js.map +0 -1
- package/dist/engine.cjs +0 -11
- package/dist/engine.cjs.map +0 -1
- package/dist/engine.d.cts +0 -115
- package/dist/engine.d.ts +0 -115
- package/dist/engine.js +0 -11
- package/dist/engine.js.map +0 -1
- package/dist/errors.cjs +0 -2
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -361
- package/dist/errors.d.ts +0 -361
- package/dist/errors.js +0 -2
- package/dist/errors.js.map +0 -1
- package/dist/fetch.cjs +0 -7
- package/dist/fetch.cjs.map +0 -1
- package/dist/fetch.d.cts +0 -86
- package/dist/fetch.d.ts +0 -86
- package/dist/fetch.js +0 -7
- package/dist/fetch.js.map +0 -1
- package/dist/flow.cjs +0 -7
- package/dist/flow.cjs.map +0 -1
- package/dist/flow.d.cts +0 -163
- package/dist/flow.d.ts +0 -163
- package/dist/flow.js +0 -7
- package/dist/flow.js.map +0 -1
- package/dist/functional.cjs +0 -2
- package/dist/functional.cjs.map +0 -1
- package/dist/functional.d.cts +0 -444
- package/dist/functional.d.ts +0 -444
- package/dist/functional.js +0 -2
- package/dist/functional.js.map +0 -1
- package/dist/guards-BodHXLzX.d.cts +0 -72
- package/dist/guards-CeWoQ8fn.d.ts +0 -72
- package/dist/hitl-BPE_1UiM.d.cts +0 -468
- package/dist/hitl-byp570uC.d.ts +0 -468
- package/dist/hitl.cjs +0 -7
- package/dist/hitl.cjs.map +0 -1
- package/dist/hitl.d.cts +0 -442
- package/dist/hitl.d.ts +0 -442
- package/dist/hitl.js +0 -7
- package/dist/hitl.js.map +0 -1
- package/dist/index-BYT3amEz.d.ts +0 -417
- package/dist/index-C_ak66jy.d.cts +0 -417
- package/dist/match-entry-DjI2bLpD.d.cts +0 -209
- package/dist/match-entry-DjI2bLpD.d.ts +0 -209
- package/dist/match.cjs +0 -2
- package/dist/match.cjs.map +0 -1
- package/dist/match.d.cts +0 -1
- package/dist/match.d.ts +0 -1
- package/dist/match.js +0 -2
- package/dist/match.js.map +0 -1
- package/dist/otel.cjs +0 -2
- package/dist/otel.cjs.map +0 -1
- package/dist/otel.d.cts +0 -188
- package/dist/otel.d.ts +0 -188
- package/dist/otel.js +0 -2
- package/dist/otel.js.map +0 -1
- package/dist/persistence-entry-DOMx3woy.d.ts +0 -822
- package/dist/persistence-entry-ymCA4iDu.d.cts +0 -822
- package/dist/persistence.cjs +0 -2
- package/dist/persistence.cjs.map +0 -1
- package/dist/persistence.d.cts +0 -7
- package/dist/persistence.d.ts +0 -7
- package/dist/persistence.js +0 -2
- package/dist/persistence.js.map +0 -1
- package/dist/policies.cjs +0 -2
- package/dist/policies.cjs.map +0 -1
- package/dist/policies.d.cts +0 -379
- package/dist/policies.d.ts +0 -379
- package/dist/policies.js +0 -2
- package/dist/policies.js.map +0 -1
- package/dist/ratelimit.cjs +0 -7
- package/dist/ratelimit.cjs.map +0 -1
- package/dist/ratelimit.d.cts +0 -458
- package/dist/ratelimit.d.ts +0 -458
- package/dist/ratelimit.js +0 -7
- package/dist/ratelimit.js.map +0 -1
- package/dist/reliability.cjs +0 -11
- package/dist/reliability.cjs.map +0 -1
- package/dist/reliability.d.cts +0 -11
- package/dist/reliability.d.ts +0 -11
- package/dist/reliability.js +0 -11
- package/dist/reliability.js.map +0 -1
- package/dist/resolver.cjs +0 -7
- package/dist/resolver.cjs.map +0 -1
- package/dist/resolver.d.cts +0 -68
- package/dist/resolver.d.ts +0 -68
- package/dist/resolver.js +0 -7
- package/dist/resolver.js.map +0 -1
- package/dist/resource.cjs +0 -7
- package/dist/resource.cjs.map +0 -1
- package/dist/resource.d.cts +0 -174
- package/dist/resource.d.ts +0 -174
- package/dist/resource.js +0 -7
- package/dist/resource.js.map +0 -1
- package/dist/result/retry.cjs +0 -2
- package/dist/result/retry.cjs.map +0 -1
- package/dist/result/retry.d.cts +0 -70
- package/dist/result/retry.d.ts +0 -70
- package/dist/result/retry.js +0 -2
- package/dist/result/retry.js.map +0 -1
- package/dist/retry.cjs +0 -2
- package/dist/retry.cjs.map +0 -1
- package/dist/retry.d.cts +0 -388
- package/dist/retry.d.ts +0 -388
- package/dist/retry.js +0 -2
- package/dist/retry.js.map +0 -1
- package/dist/run.cjs +0 -7
- package/dist/run.cjs.map +0 -1
- package/dist/run.d.cts +0 -4
- package/dist/run.d.ts +0 -4
- package/dist/run.js +0 -7
- package/dist/run.js.map +0 -1
- package/dist/saga.cjs +0 -11
- package/dist/saga.cjs.map +0 -1
- package/dist/saga.d.cts +0 -164
- package/dist/saga.d.ts +0 -164
- package/dist/saga.js +0 -11
- package/dist/saga.js.map +0 -1
- package/dist/singleflight.cjs +0 -2
- package/dist/singleflight.cjs.map +0 -1
- package/dist/singleflight.d.cts +0 -145
- package/dist/singleflight.d.ts +0 -145
- package/dist/singleflight.js +0 -2
- package/dist/singleflight.js.map +0 -1
- package/dist/slugs.cjs +0 -2
- package/dist/slugs.cjs.map +0 -1
- package/dist/slugs.d.cts +0 -67
- package/dist/slugs.d.ts +0 -67
- package/dist/slugs.js +0 -2
- package/dist/slugs.js.map +0 -1
- package/dist/streaming.cjs +0 -9
- package/dist/streaming.cjs.map +0 -1
- package/dist/streaming.d.cts +0 -596
- package/dist/streaming.d.ts +0 -596
- package/dist/streaming.js +0 -9
- package/dist/streaming.js.map +0 -1
- package/dist/tagged-error.cjs +0 -2
- package/dist/tagged-error.cjs.map +0 -1
- package/dist/tagged-error.d.cts +0 -275
- package/dist/tagged-error.d.ts +0 -275
- package/dist/tagged-error.js +0 -2
- package/dist/tagged-error.js.map +0 -1
- package/dist/types-DQmzO9f4.d.ts +0 -323
- package/dist/types-qBUOYi-4.d.cts +0 -323
- package/dist/webhook.cjs +0 -7
- package/dist/webhook.cjs.map +0 -1
- package/dist/webhook.d.cts +0 -499
- package/dist/webhook.d.ts +0 -499
- package/dist/webhook.js +0 -7
- package/dist/webhook.js.map +0 -1
package/dist/singleflight.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},A=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of y(e))!p.call(t,s)&&s!==r&&g(t,s,{get:()=>e[s],enumerable:!(n=f(e,s))||n.enumerable});return t};var C=t=>A(g({},"__esModule",{value:!0}),t);var E={};h(E,{createSingleflightGroup:()=>a,singleflight:()=>o});module.exports=C(E);function o(t,e){let r=new Map,n=e.ttl?new Map:null;return async(...s)=>{let i=e.key(...s);if(n){let l=n.get(i);if(l&&l.expiresAt>Date.now())return l.result;l&&n.delete(i)}let c=r.get(i);if(c)return c;let u=t(...s).then(l=>(n&&e.ttl&&l.ok&&n.set(i,{result:l,expiresAt:Date.now()+e.ttl}),l)).finally(()=>{r.delete(i)});return r.set(i,u),u}}function a(){let t=new Map;return{execute:async(e,r)=>{let n=t.get(e);if(n)return n;let s=r().then(i=>i).finally(()=>{t.delete(e)});return t.set(e,s),s},isInflight:e=>t.has(e),size:()=>t.size,clear:()=>t.clear()}}0&&(module.exports={createSingleflightGroup,singleflight});
|
|
2
|
-
//# sourceMappingURL=singleflight.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/singleflight-entry.ts","../src/singleflight.ts"],"sourcesContent":["/**\n * awaitly/singleflight\n *\n * Request coalescing - dedupe concurrent identical requests.\n * Multiple concurrent calls with the same key share one in-flight request.\n *\n * @example\n * ```typescript\n * import { singleflight } from 'awaitly/singleflight';\n * import { ok, type AsyncResult } from 'awaitly';\n *\n * const fetchUser = async (id: string): AsyncResult<User, 'NOT_FOUND'> =>\n * id !== '0' ? ok({ id, name: `User ${id}` }) : err('NOT_FOUND');\n *\n * const fetchUserOnce = singleflight(fetchUser, {\n * key: (id) => `user:${id}`,\n * });\n *\n * // All concurrent calls share one request\n * const [user1, user2] = await Promise.all([\n * fetchUserOnce('1'),\n * fetchUserOnce('1'), // Same key - shares request\n * ]);\n * ```\n */\n\nexport {\n singleflight,\n createSingleflightGroup,\n type SingleflightOptions,\n} from \"./singleflight\";\n","/**\n * awaitly/singleflight\n *\n * Request coalescing - dedupe concurrent identical requests.\n * Multiple concurrent calls with the same key share one in-flight request.\n *\n * @example\n * ```typescript\n * import { singleflight } from 'awaitly/singleflight';\n *\n * const fetchUserOnce = singleflight(\n * (id: string) => fetchUser(id),\n * { key: (id) => `user:${id}` }\n * );\n *\n * // All concurrent calls share one request\n * const [user1, user2] = await Promise.all([\n * fetchUserOnce('1'),\n * fetchUserOnce('1'), // Same key - shares request\n * ]);\n * ```\n */\n\nimport { type Result, type AsyncResult } from \"./core\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\n/**\n * Options for the singleflight wrapper.\n */\nexport type SingleflightOptions<Args extends unknown[]> = {\n /**\n * Extract cache key from arguments.\n * Calls with the same key will share one in-flight request.\n */\n key: (...args: Args) => string;\n\n /**\n * Optional TTL in milliseconds to cache successful results.\n * After TTL expires, next call will trigger a fresh request.\n * @default 0 (no caching after completion - only dedupes in-flight requests)\n */\n ttl?: number;\n};\n\n/**\n * Internal cache entry for TTL-based caching.\n */\ninterface CacheEntry<T, E, C> {\n result: Result<T, E, C>;\n expiresAt: number;\n}\n\n// =============================================================================\n// Implementation\n// =============================================================================\n\n/**\n * Create a singleflight-wrapped function.\n * Concurrent calls with the same key share one in-flight request.\n *\n * ## How It Works\n *\n * 1. First caller with a key starts the operation\n * 2. Subsequent callers with the same key get the same Promise\n * 3. When operation completes, all callers receive the same Result\n * 4. Key is removed from in-flight tracking (unless TTL is set)\n *\n * ## Use Cases\n *\n * - **Prevent thundering herd**: Multiple requests for the same user\n * - **API deduplication**: Avoid duplicate network calls\n * - **Expensive operations**: Share computation across callers\n *\n * @param operation - The async operation that returns an AsyncResult\n * @param options - Configuration with key extraction function\n * @returns A wrapped function that deduplicates concurrent calls\n *\n * @example\n * ```typescript\n * import { singleflight } from 'awaitly/singleflight';\n * import { ok, err, type AsyncResult } from 'awaitly';\n *\n * const fetchUser = async (id: string): AsyncResult<User, 'NOT_FOUND'> =>\n * id !== '0' ? ok({ id, name: `User ${id}` }) : err('NOT_FOUND');\n *\n * const fetchUserOnce = singleflight(fetchUser, {\n * key: (id) => `user:${id}`,\n * });\n *\n * // Concurrent calls share one request\n * const [a, b, c] = await Promise.all([\n * fetchUserOnce('1'), // Triggers fetch\n * fetchUserOnce('1'), // Joins existing fetch\n * fetchUserOnce('2'), // Different key - new fetch\n * ]);\n * ```\n *\n * @example\n * ```typescript\n * // With TTL for result caching\n * const fetchUserCached = singleflight(fetchUser, {\n * key: (id) => `user:${id}`,\n * ttl: 5000, // Cache successful results for 5 seconds\n * });\n *\n * const user1 = await fetchUserCached('1'); // Fetches\n * const user2 = await fetchUserCached('1'); // Returns cached (within TTL)\n * // After 5 seconds...\n * const user3 = await fetchUserCached('1'); // Fetches again\n * ```\n */\nexport function singleflight<Args extends unknown[], T, E, C = unknown>(\n operation: (...args: Args) => AsyncResult<T, E, C>,\n options: SingleflightOptions<Args>\n): (...args: Args) => AsyncResult<T, E, C> {\n // In-flight requests by key\n const inflight = new Map<string, Promise<Result<T, E, C>>>();\n\n // Cached results by key (only if TTL is set)\n const cache = options.ttl ? new Map<string, CacheEntry<T, E, C>>() : null;\n\n return async (...args: Args): AsyncResult<T, E, C> => {\n const key = options.key(...args);\n\n // Check TTL cache first (if enabled)\n if (cache) {\n const cached = cache.get(key);\n if (cached && cached.expiresAt > Date.now()) {\n return cached.result;\n }\n // Expired - remove from cache\n if (cached) {\n cache.delete(key);\n }\n }\n\n // Check for existing in-flight request\n const existing = inflight.get(key);\n if (existing) {\n return existing;\n }\n\n // Start new request\n // Use .finally() to ensure cleanup happens even if operation throws\n const promise = operation(...args)\n .then((result) => {\n // Cache successful results if TTL is set\n if (cache && options.ttl && result.ok) {\n cache.set(key, {\n result,\n expiresAt: Date.now() + options.ttl,\n });\n }\n return result;\n })\n .finally(() => {\n // Always remove from in-flight tracking, success or failure\n inflight.delete(key);\n });\n\n inflight.set(key, promise);\n return promise;\n };\n}\n\n/**\n * Create a singleflight group with manual key management.\n * More flexible but lower-level API than the `singleflight` wrapper.\n *\n * @returns A group object with execute, isInflight, and clear methods\n *\n * @example\n * ```typescript\n * import { createSingleflightGroup } from 'awaitly/singleflight';\n *\n * const group = createSingleflightGroup<User, 'NOT_FOUND'>();\n *\n * // Execute with manual key\n * const user1 = await group.execute('user:1', () => fetchUser('1'));\n * const user2 = await group.execute('user:1', () => fetchUser('1')); // Shares request\n *\n * // Check if request is in-flight\n * if (group.isInflight('user:1')) {\n * console.log('Request pending');\n * }\n *\n * // Clear all in-flight requests\n * group.clear();\n * ```\n */\nexport function createSingleflightGroup<T, E, C = unknown>(): {\n /**\n * Execute or join an in-flight request for the given key.\n */\n execute: (\n key: string,\n operation: () => AsyncResult<T, E, C>\n ) => AsyncResult<T, E, C>;\n\n /**\n * Check if a request is currently in-flight for the key.\n */\n isInflight: (key: string) => boolean;\n\n /**\n * Get the number of in-flight requests.\n */\n size: () => number;\n\n /**\n * Clear all in-flight tracking (does not cancel operations).\n */\n clear: () => void;\n} {\n const inflight = new Map<string, Promise<Result<T, E, C>>>();\n\n return {\n execute: async (\n key: string,\n operation: () => AsyncResult<T, E, C>\n ): AsyncResult<T, E, C> => {\n // Return existing in-flight promise if present\n const existing = inflight.get(key);\n if (existing) {\n return existing;\n }\n\n // Start new request\n // Use .finally() to ensure cleanup happens even if operation throws\n const promise = operation()\n .then((result) => result)\n .finally(() => {\n inflight.delete(key);\n });\n\n inflight.set(key, promise);\n return promise;\n },\n\n isInflight: (key: string) => inflight.has(key),\n\n size: () => inflight.size,\n\n clear: () => inflight.clear(),\n };\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,iBAAAC,IAAA,eAAAC,EAAAJ,GCkHO,SAASK,EACdC,EACAC,EACyC,CAEzC,IAAMC,EAAW,IAAI,IAGfC,EAAQF,EAAQ,IAAM,IAAI,IAAqC,KAErE,MAAO,UAAUG,IAAqC,CACpD,IAAMC,EAAMJ,EAAQ,IAAI,GAAGG,CAAI,EAG/B,GAAID,EAAO,CACT,IAAMG,EAASH,EAAM,IAAIE,CAAG,EAC5B,GAAIC,GAAUA,EAAO,UAAY,KAAK,IAAI,EACxC,OAAOA,EAAO,OAGZA,GACFH,EAAM,OAAOE,CAAG,CAEpB,CAGA,IAAME,EAAWL,EAAS,IAAIG,CAAG,EACjC,GAAIE,EACF,OAAOA,EAKT,IAAMC,EAAUR,EAAU,GAAGI,CAAI,EAC9B,KAAMK,IAEDN,GAASF,EAAQ,KAAOQ,EAAO,IACjCN,EAAM,IAAIE,EAAK,CACb,OAAAI,EACA,UAAW,KAAK,IAAI,EAAIR,EAAQ,GAClC,CAAC,EAEIQ,EACR,EACA,QAAQ,IAAM,CAEbP,EAAS,OAAOG,CAAG,CACrB,CAAC,EAEH,OAAAH,EAAS,IAAIG,EAAKG,CAAO,EAClBA,CACT,CACF,CA2BO,SAASE,GAuBd,CACA,IAAMR,EAAW,IAAI,IAErB,MAAO,CACL,QAAS,MACPG,EACAL,IACyB,CAEzB,IAAMO,EAAWL,EAAS,IAAIG,CAAG,EACjC,GAAIE,EACF,OAAOA,EAKT,IAAMC,EAAUR,EAAU,EACvB,KAAMS,GAAWA,CAAM,EACvB,QAAQ,IAAM,CACbP,EAAS,OAAOG,CAAG,CACrB,CAAC,EAEH,OAAAH,EAAS,IAAIG,EAAKG,CAAO,EAClBA,CACT,EAEA,WAAaH,GAAgBH,EAAS,IAAIG,CAAG,EAE7C,KAAM,IAAMH,EAAS,KAErB,MAAO,IAAMA,EAAS,MAAM,CAC9B,CACF","names":["singleflight_entry_exports","__export","createSingleflightGroup","singleflight","__toCommonJS","singleflight","operation","options","inflight","cache","args","key","cached","existing","promise","result","createSingleflightGroup"]}
|
package/dist/singleflight.d.cts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { c as AsyncResult } from './run-entry-D2MmJFj9.cjs';
|
|
2
|
-
import './errors.cjs';
|
|
3
|
-
import './tagged-error.cjs';
|
|
4
|
-
import './slugs.cjs';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* awaitly/singleflight
|
|
8
|
-
*
|
|
9
|
-
* Request coalescing - dedupe concurrent identical requests.
|
|
10
|
-
* Multiple concurrent calls with the same key share one in-flight request.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { singleflight } from 'awaitly/singleflight';
|
|
15
|
-
*
|
|
16
|
-
* const fetchUserOnce = singleflight(
|
|
17
|
-
* (id: string) => fetchUser(id),
|
|
18
|
-
* { key: (id) => `user:${id}` }
|
|
19
|
-
* );
|
|
20
|
-
*
|
|
21
|
-
* // All concurrent calls share one request
|
|
22
|
-
* const [user1, user2] = await Promise.all([
|
|
23
|
-
* fetchUserOnce('1'),
|
|
24
|
-
* fetchUserOnce('1'), // Same key - shares request
|
|
25
|
-
* ]);
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Options for the singleflight wrapper.
|
|
31
|
-
*/
|
|
32
|
-
type SingleflightOptions<Args extends unknown[]> = {
|
|
33
|
-
/**
|
|
34
|
-
* Extract cache key from arguments.
|
|
35
|
-
* Calls with the same key will share one in-flight request.
|
|
36
|
-
*/
|
|
37
|
-
key: (...args: Args) => string;
|
|
38
|
-
/**
|
|
39
|
-
* Optional TTL in milliseconds to cache successful results.
|
|
40
|
-
* After TTL expires, next call will trigger a fresh request.
|
|
41
|
-
* @default 0 (no caching after completion - only dedupes in-flight requests)
|
|
42
|
-
*/
|
|
43
|
-
ttl?: number;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Create a singleflight-wrapped function.
|
|
47
|
-
* Concurrent calls with the same key share one in-flight request.
|
|
48
|
-
*
|
|
49
|
-
* ## How It Works
|
|
50
|
-
*
|
|
51
|
-
* 1. First caller with a key starts the operation
|
|
52
|
-
* 2. Subsequent callers with the same key get the same Promise
|
|
53
|
-
* 3. When operation completes, all callers receive the same Result
|
|
54
|
-
* 4. Key is removed from in-flight tracking (unless TTL is set)
|
|
55
|
-
*
|
|
56
|
-
* ## Use Cases
|
|
57
|
-
*
|
|
58
|
-
* - **Prevent thundering herd**: Multiple requests for the same user
|
|
59
|
-
* - **API deduplication**: Avoid duplicate network calls
|
|
60
|
-
* - **Expensive operations**: Share computation across callers
|
|
61
|
-
*
|
|
62
|
-
* @param operation - The async operation that returns an AsyncResult
|
|
63
|
-
* @param options - Configuration with key extraction function
|
|
64
|
-
* @returns A wrapped function that deduplicates concurrent calls
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* import { singleflight } from 'awaitly/singleflight';
|
|
69
|
-
* import { ok, err, type AsyncResult } from 'awaitly';
|
|
70
|
-
*
|
|
71
|
-
* const fetchUser = async (id: string): AsyncResult<User, 'NOT_FOUND'> =>
|
|
72
|
-
* id !== '0' ? ok({ id, name: `User ${id}` }) : err('NOT_FOUND');
|
|
73
|
-
*
|
|
74
|
-
* const fetchUserOnce = singleflight(fetchUser, {
|
|
75
|
-
* key: (id) => `user:${id}`,
|
|
76
|
-
* });
|
|
77
|
-
*
|
|
78
|
-
* // Concurrent calls share one request
|
|
79
|
-
* const [a, b, c] = await Promise.all([
|
|
80
|
-
* fetchUserOnce('1'), // Triggers fetch
|
|
81
|
-
* fetchUserOnce('1'), // Joins existing fetch
|
|
82
|
-
* fetchUserOnce('2'), // Different key - new fetch
|
|
83
|
-
* ]);
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* // With TTL for result caching
|
|
89
|
-
* const fetchUserCached = singleflight(fetchUser, {
|
|
90
|
-
* key: (id) => `user:${id}`,
|
|
91
|
-
* ttl: 5000, // Cache successful results for 5 seconds
|
|
92
|
-
* });
|
|
93
|
-
*
|
|
94
|
-
* const user1 = await fetchUserCached('1'); // Fetches
|
|
95
|
-
* const user2 = await fetchUserCached('1'); // Returns cached (within TTL)
|
|
96
|
-
* // After 5 seconds...
|
|
97
|
-
* const user3 = await fetchUserCached('1'); // Fetches again
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
declare function singleflight<Args extends unknown[], T, E, C = unknown>(operation: (...args: Args) => AsyncResult<T, E, C>, options: SingleflightOptions<Args>): (...args: Args) => AsyncResult<T, E, C>;
|
|
101
|
-
/**
|
|
102
|
-
* Create a singleflight group with manual key management.
|
|
103
|
-
* More flexible but lower-level API than the `singleflight` wrapper.
|
|
104
|
-
*
|
|
105
|
-
* @returns A group object with execute, isInflight, and clear methods
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```typescript
|
|
109
|
-
* import { createSingleflightGroup } from 'awaitly/singleflight';
|
|
110
|
-
*
|
|
111
|
-
* const group = createSingleflightGroup<User, 'NOT_FOUND'>();
|
|
112
|
-
*
|
|
113
|
-
* // Execute with manual key
|
|
114
|
-
* const user1 = await group.execute('user:1', () => fetchUser('1'));
|
|
115
|
-
* const user2 = await group.execute('user:1', () => fetchUser('1')); // Shares request
|
|
116
|
-
*
|
|
117
|
-
* // Check if request is in-flight
|
|
118
|
-
* if (group.isInflight('user:1')) {
|
|
119
|
-
* console.log('Request pending');
|
|
120
|
-
* }
|
|
121
|
-
*
|
|
122
|
-
* // Clear all in-flight requests
|
|
123
|
-
* group.clear();
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
declare function createSingleflightGroup<T, E, C = unknown>(): {
|
|
127
|
-
/**
|
|
128
|
-
* Execute or join an in-flight request for the given key.
|
|
129
|
-
*/
|
|
130
|
-
execute: (key: string, operation: () => AsyncResult<T, E, C>) => AsyncResult<T, E, C>;
|
|
131
|
-
/**
|
|
132
|
-
* Check if a request is currently in-flight for the key.
|
|
133
|
-
*/
|
|
134
|
-
isInflight: (key: string) => boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Get the number of in-flight requests.
|
|
137
|
-
*/
|
|
138
|
-
size: () => number;
|
|
139
|
-
/**
|
|
140
|
-
* Clear all in-flight tracking (does not cancel operations).
|
|
141
|
-
*/
|
|
142
|
-
clear: () => void;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export { type SingleflightOptions, createSingleflightGroup, singleflight };
|
package/dist/singleflight.d.ts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { c as AsyncResult } from './run-entry-Dduz-is2.js';
|
|
2
|
-
import './errors.js';
|
|
3
|
-
import './tagged-error.js';
|
|
4
|
-
import './slugs.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* awaitly/singleflight
|
|
8
|
-
*
|
|
9
|
-
* Request coalescing - dedupe concurrent identical requests.
|
|
10
|
-
* Multiple concurrent calls with the same key share one in-flight request.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { singleflight } from 'awaitly/singleflight';
|
|
15
|
-
*
|
|
16
|
-
* const fetchUserOnce = singleflight(
|
|
17
|
-
* (id: string) => fetchUser(id),
|
|
18
|
-
* { key: (id) => `user:${id}` }
|
|
19
|
-
* );
|
|
20
|
-
*
|
|
21
|
-
* // All concurrent calls share one request
|
|
22
|
-
* const [user1, user2] = await Promise.all([
|
|
23
|
-
* fetchUserOnce('1'),
|
|
24
|
-
* fetchUserOnce('1'), // Same key - shares request
|
|
25
|
-
* ]);
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Options for the singleflight wrapper.
|
|
31
|
-
*/
|
|
32
|
-
type SingleflightOptions<Args extends unknown[]> = {
|
|
33
|
-
/**
|
|
34
|
-
* Extract cache key from arguments.
|
|
35
|
-
* Calls with the same key will share one in-flight request.
|
|
36
|
-
*/
|
|
37
|
-
key: (...args: Args) => string;
|
|
38
|
-
/**
|
|
39
|
-
* Optional TTL in milliseconds to cache successful results.
|
|
40
|
-
* After TTL expires, next call will trigger a fresh request.
|
|
41
|
-
* @default 0 (no caching after completion - only dedupes in-flight requests)
|
|
42
|
-
*/
|
|
43
|
-
ttl?: number;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Create a singleflight-wrapped function.
|
|
47
|
-
* Concurrent calls with the same key share one in-flight request.
|
|
48
|
-
*
|
|
49
|
-
* ## How It Works
|
|
50
|
-
*
|
|
51
|
-
* 1. First caller with a key starts the operation
|
|
52
|
-
* 2. Subsequent callers with the same key get the same Promise
|
|
53
|
-
* 3. When operation completes, all callers receive the same Result
|
|
54
|
-
* 4. Key is removed from in-flight tracking (unless TTL is set)
|
|
55
|
-
*
|
|
56
|
-
* ## Use Cases
|
|
57
|
-
*
|
|
58
|
-
* - **Prevent thundering herd**: Multiple requests for the same user
|
|
59
|
-
* - **API deduplication**: Avoid duplicate network calls
|
|
60
|
-
* - **Expensive operations**: Share computation across callers
|
|
61
|
-
*
|
|
62
|
-
* @param operation - The async operation that returns an AsyncResult
|
|
63
|
-
* @param options - Configuration with key extraction function
|
|
64
|
-
* @returns A wrapped function that deduplicates concurrent calls
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* import { singleflight } from 'awaitly/singleflight';
|
|
69
|
-
* import { ok, err, type AsyncResult } from 'awaitly';
|
|
70
|
-
*
|
|
71
|
-
* const fetchUser = async (id: string): AsyncResult<User, 'NOT_FOUND'> =>
|
|
72
|
-
* id !== '0' ? ok({ id, name: `User ${id}` }) : err('NOT_FOUND');
|
|
73
|
-
*
|
|
74
|
-
* const fetchUserOnce = singleflight(fetchUser, {
|
|
75
|
-
* key: (id) => `user:${id}`,
|
|
76
|
-
* });
|
|
77
|
-
*
|
|
78
|
-
* // Concurrent calls share one request
|
|
79
|
-
* const [a, b, c] = await Promise.all([
|
|
80
|
-
* fetchUserOnce('1'), // Triggers fetch
|
|
81
|
-
* fetchUserOnce('1'), // Joins existing fetch
|
|
82
|
-
* fetchUserOnce('2'), // Different key - new fetch
|
|
83
|
-
* ]);
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* // With TTL for result caching
|
|
89
|
-
* const fetchUserCached = singleflight(fetchUser, {
|
|
90
|
-
* key: (id) => `user:${id}`,
|
|
91
|
-
* ttl: 5000, // Cache successful results for 5 seconds
|
|
92
|
-
* });
|
|
93
|
-
*
|
|
94
|
-
* const user1 = await fetchUserCached('1'); // Fetches
|
|
95
|
-
* const user2 = await fetchUserCached('1'); // Returns cached (within TTL)
|
|
96
|
-
* // After 5 seconds...
|
|
97
|
-
* const user3 = await fetchUserCached('1'); // Fetches again
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
declare function singleflight<Args extends unknown[], T, E, C = unknown>(operation: (...args: Args) => AsyncResult<T, E, C>, options: SingleflightOptions<Args>): (...args: Args) => AsyncResult<T, E, C>;
|
|
101
|
-
/**
|
|
102
|
-
* Create a singleflight group with manual key management.
|
|
103
|
-
* More flexible but lower-level API than the `singleflight` wrapper.
|
|
104
|
-
*
|
|
105
|
-
* @returns A group object with execute, isInflight, and clear methods
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```typescript
|
|
109
|
-
* import { createSingleflightGroup } from 'awaitly/singleflight';
|
|
110
|
-
*
|
|
111
|
-
* const group = createSingleflightGroup<User, 'NOT_FOUND'>();
|
|
112
|
-
*
|
|
113
|
-
* // Execute with manual key
|
|
114
|
-
* const user1 = await group.execute('user:1', () => fetchUser('1'));
|
|
115
|
-
* const user2 = await group.execute('user:1', () => fetchUser('1')); // Shares request
|
|
116
|
-
*
|
|
117
|
-
* // Check if request is in-flight
|
|
118
|
-
* if (group.isInflight('user:1')) {
|
|
119
|
-
* console.log('Request pending');
|
|
120
|
-
* }
|
|
121
|
-
*
|
|
122
|
-
* // Clear all in-flight requests
|
|
123
|
-
* group.clear();
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
declare function createSingleflightGroup<T, E, C = unknown>(): {
|
|
127
|
-
/**
|
|
128
|
-
* Execute or join an in-flight request for the given key.
|
|
129
|
-
*/
|
|
130
|
-
execute: (key: string, operation: () => AsyncResult<T, E, C>) => AsyncResult<T, E, C>;
|
|
131
|
-
/**
|
|
132
|
-
* Check if a request is currently in-flight for the key.
|
|
133
|
-
*/
|
|
134
|
-
isInflight: (key: string) => boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Get the number of in-flight requests.
|
|
137
|
-
*/
|
|
138
|
-
size: () => number;
|
|
139
|
-
/**
|
|
140
|
-
* Clear all in-flight tracking (does not cancel operations).
|
|
141
|
-
*/
|
|
142
|
-
clear: () => void;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export { type SingleflightOptions, createSingleflightGroup, singleflight };
|
package/dist/singleflight.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function u(t,e){let i=new Map,n=e.ttl?new Map:null;return async(...l)=>{let s=e.key(...l);if(n){let r=n.get(s);if(r&&r.expiresAt>Date.now())return r.result;r&&n.delete(s)}let g=i.get(s);if(g)return g;let c=t(...l).then(r=>(n&&e.ttl&&r.ok&&n.set(s,{result:r,expiresAt:Date.now()+e.ttl}),r)).finally(()=>{i.delete(s)});return i.set(s,c),c}}function o(){let t=new Map;return{execute:async(e,i)=>{let n=t.get(e);if(n)return n;let l=i().then(s=>s).finally(()=>{t.delete(e)});return t.set(e,l),l},isInflight:e=>t.has(e),size:()=>t.size,clear:()=>t.clear()}}export{o as createSingleflightGroup,u as singleflight};
|
|
2
|
-
//# sourceMappingURL=singleflight.js.map
|
package/dist/singleflight.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/singleflight.ts"],"sourcesContent":["/**\n * awaitly/singleflight\n *\n * Request coalescing - dedupe concurrent identical requests.\n * Multiple concurrent calls with the same key share one in-flight request.\n *\n * @example\n * ```typescript\n * import { singleflight } from 'awaitly/singleflight';\n *\n * const fetchUserOnce = singleflight(\n * (id: string) => fetchUser(id),\n * { key: (id) => `user:${id}` }\n * );\n *\n * // All concurrent calls share one request\n * const [user1, user2] = await Promise.all([\n * fetchUserOnce('1'),\n * fetchUserOnce('1'), // Same key - shares request\n * ]);\n * ```\n */\n\nimport { type Result, type AsyncResult } from \"./core\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\n/**\n * Options for the singleflight wrapper.\n */\nexport type SingleflightOptions<Args extends unknown[]> = {\n /**\n * Extract cache key from arguments.\n * Calls with the same key will share one in-flight request.\n */\n key: (...args: Args) => string;\n\n /**\n * Optional TTL in milliseconds to cache successful results.\n * After TTL expires, next call will trigger a fresh request.\n * @default 0 (no caching after completion - only dedupes in-flight requests)\n */\n ttl?: number;\n};\n\n/**\n * Internal cache entry for TTL-based caching.\n */\ninterface CacheEntry<T, E, C> {\n result: Result<T, E, C>;\n expiresAt: number;\n}\n\n// =============================================================================\n// Implementation\n// =============================================================================\n\n/**\n * Create a singleflight-wrapped function.\n * Concurrent calls with the same key share one in-flight request.\n *\n * ## How It Works\n *\n * 1. First caller with a key starts the operation\n * 2. Subsequent callers with the same key get the same Promise\n * 3. When operation completes, all callers receive the same Result\n * 4. Key is removed from in-flight tracking (unless TTL is set)\n *\n * ## Use Cases\n *\n * - **Prevent thundering herd**: Multiple requests for the same user\n * - **API deduplication**: Avoid duplicate network calls\n * - **Expensive operations**: Share computation across callers\n *\n * @param operation - The async operation that returns an AsyncResult\n * @param options - Configuration with key extraction function\n * @returns A wrapped function that deduplicates concurrent calls\n *\n * @example\n * ```typescript\n * import { singleflight } from 'awaitly/singleflight';\n * import { ok, err, type AsyncResult } from 'awaitly';\n *\n * const fetchUser = async (id: string): AsyncResult<User, 'NOT_FOUND'> =>\n * id !== '0' ? ok({ id, name: `User ${id}` }) : err('NOT_FOUND');\n *\n * const fetchUserOnce = singleflight(fetchUser, {\n * key: (id) => `user:${id}`,\n * });\n *\n * // Concurrent calls share one request\n * const [a, b, c] = await Promise.all([\n * fetchUserOnce('1'), // Triggers fetch\n * fetchUserOnce('1'), // Joins existing fetch\n * fetchUserOnce('2'), // Different key - new fetch\n * ]);\n * ```\n *\n * @example\n * ```typescript\n * // With TTL for result caching\n * const fetchUserCached = singleflight(fetchUser, {\n * key: (id) => `user:${id}`,\n * ttl: 5000, // Cache successful results for 5 seconds\n * });\n *\n * const user1 = await fetchUserCached('1'); // Fetches\n * const user2 = await fetchUserCached('1'); // Returns cached (within TTL)\n * // After 5 seconds...\n * const user3 = await fetchUserCached('1'); // Fetches again\n * ```\n */\nexport function singleflight<Args extends unknown[], T, E, C = unknown>(\n operation: (...args: Args) => AsyncResult<T, E, C>,\n options: SingleflightOptions<Args>\n): (...args: Args) => AsyncResult<T, E, C> {\n // In-flight requests by key\n const inflight = new Map<string, Promise<Result<T, E, C>>>();\n\n // Cached results by key (only if TTL is set)\n const cache = options.ttl ? new Map<string, CacheEntry<T, E, C>>() : null;\n\n return async (...args: Args): AsyncResult<T, E, C> => {\n const key = options.key(...args);\n\n // Check TTL cache first (if enabled)\n if (cache) {\n const cached = cache.get(key);\n if (cached && cached.expiresAt > Date.now()) {\n return cached.result;\n }\n // Expired - remove from cache\n if (cached) {\n cache.delete(key);\n }\n }\n\n // Check for existing in-flight request\n const existing = inflight.get(key);\n if (existing) {\n return existing;\n }\n\n // Start new request\n // Use .finally() to ensure cleanup happens even if operation throws\n const promise = operation(...args)\n .then((result) => {\n // Cache successful results if TTL is set\n if (cache && options.ttl && result.ok) {\n cache.set(key, {\n result,\n expiresAt: Date.now() + options.ttl,\n });\n }\n return result;\n })\n .finally(() => {\n // Always remove from in-flight tracking, success or failure\n inflight.delete(key);\n });\n\n inflight.set(key, promise);\n return promise;\n };\n}\n\n/**\n * Create a singleflight group with manual key management.\n * More flexible but lower-level API than the `singleflight` wrapper.\n *\n * @returns A group object with execute, isInflight, and clear methods\n *\n * @example\n * ```typescript\n * import { createSingleflightGroup } from 'awaitly/singleflight';\n *\n * const group = createSingleflightGroup<User, 'NOT_FOUND'>();\n *\n * // Execute with manual key\n * const user1 = await group.execute('user:1', () => fetchUser('1'));\n * const user2 = await group.execute('user:1', () => fetchUser('1')); // Shares request\n *\n * // Check if request is in-flight\n * if (group.isInflight('user:1')) {\n * console.log('Request pending');\n * }\n *\n * // Clear all in-flight requests\n * group.clear();\n * ```\n */\nexport function createSingleflightGroup<T, E, C = unknown>(): {\n /**\n * Execute or join an in-flight request for the given key.\n */\n execute: (\n key: string,\n operation: () => AsyncResult<T, E, C>\n ) => AsyncResult<T, E, C>;\n\n /**\n * Check if a request is currently in-flight for the key.\n */\n isInflight: (key: string) => boolean;\n\n /**\n * Get the number of in-flight requests.\n */\n size: () => number;\n\n /**\n * Clear all in-flight tracking (does not cancel operations).\n */\n clear: () => void;\n} {\n const inflight = new Map<string, Promise<Result<T, E, C>>>();\n\n return {\n execute: async (\n key: string,\n operation: () => AsyncResult<T, E, C>\n ): AsyncResult<T, E, C> => {\n // Return existing in-flight promise if present\n const existing = inflight.get(key);\n if (existing) {\n return existing;\n }\n\n // Start new request\n // Use .finally() to ensure cleanup happens even if operation throws\n const promise = operation()\n .then((result) => result)\n .finally(() => {\n inflight.delete(key);\n });\n\n inflight.set(key, promise);\n return promise;\n },\n\n isInflight: (key: string) => inflight.has(key),\n\n size: () => inflight.size,\n\n clear: () => inflight.clear(),\n };\n}\n"],"mappings":"AAkHO,SAASA,EACdC,EACAC,EACyC,CAEzC,IAAMC,EAAW,IAAI,IAGfC,EAAQF,EAAQ,IAAM,IAAI,IAAqC,KAErE,MAAO,UAAUG,IAAqC,CACpD,IAAMC,EAAMJ,EAAQ,IAAI,GAAGG,CAAI,EAG/B,GAAID,EAAO,CACT,IAAMG,EAASH,EAAM,IAAIE,CAAG,EAC5B,GAAIC,GAAUA,EAAO,UAAY,KAAK,IAAI,EACxC,OAAOA,EAAO,OAGZA,GACFH,EAAM,OAAOE,CAAG,CAEpB,CAGA,IAAME,EAAWL,EAAS,IAAIG,CAAG,EACjC,GAAIE,EACF,OAAOA,EAKT,IAAMC,EAAUR,EAAU,GAAGI,CAAI,EAC9B,KAAMK,IAEDN,GAASF,EAAQ,KAAOQ,EAAO,IACjCN,EAAM,IAAIE,EAAK,CACb,OAAAI,EACA,UAAW,KAAK,IAAI,EAAIR,EAAQ,GAClC,CAAC,EAEIQ,EACR,EACA,QAAQ,IAAM,CAEbP,EAAS,OAAOG,CAAG,CACrB,CAAC,EAEH,OAAAH,EAAS,IAAIG,EAAKG,CAAO,EAClBA,CACT,CACF,CA2BO,SAASE,GAuBd,CACA,IAAMR,EAAW,IAAI,IAErB,MAAO,CACL,QAAS,MACPG,EACAL,IACyB,CAEzB,IAAMO,EAAWL,EAAS,IAAIG,CAAG,EACjC,GAAIE,EACF,OAAOA,EAKT,IAAMC,EAAUR,EAAU,EACvB,KAAMS,GAAWA,CAAM,EACvB,QAAQ,IAAM,CACbP,EAAS,OAAOG,CAAG,CACrB,CAAC,EAEH,OAAAH,EAAS,IAAIG,EAAKG,CAAO,EAClBA,CACT,EAEA,WAAaH,GAAgBH,EAAS,IAAIG,CAAG,EAE7C,KAAM,IAAMH,EAAS,KAErB,MAAO,IAAMA,EAAS,MAAM,CAC9B,CACF","names":["singleflight","operation","options","inflight","cache","args","key","cached","existing","promise","result","createSingleflightGroup"]}
|
package/dist/slugs.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var c=(e,r)=>{for(var o in r)n(e,o,{get:r[o],enumerable:!0})},p=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of u(r))!s.call(e,t)&&t!==o&&n(e,t,{get:()=>r[t],enumerable:!(a=l(r,t))||a.enumerable});return e};var m=e=>p(n({},"__esModule",{value:!0}),e);var d={};c(d,{ALL_SLUGS:()=>f,AWAITLY_SLUGS:()=>i,isAwaitlySlug:()=>g,slugCategory:()=>w,slugDocsUrl:()=>y});module.exports=m(d);var i={"step-require-id":"step-require-id","step-no-immediate-execution":"step-no-immediate-execution","step-require-thunk-for-key":"step-require-thunk-for-key","step-no-bare-await":"step-no-bare-await","step-no-try-catch-wrap":"step-no-try-catch-wrap","step-stable-cache-keys":"step-stable-cache-keys","workflow-no-floating":"workflow-no-floating","workflow-options-position":"workflow-options-position","workflow-callback-shape":"workflow-callback-shape","workflow-no-callable-form":"workflow-no-callable-form","workflow-no-dynamic-import":"workflow-no-dynamic-import","result-no-floating":"result-no-floating","result-require-handling":"result-require-handling","result-no-double-wrap":"result-no-double-wrap","result-no-manual-propagation":"result-no-manual-propagation","result-no-direct-ok-err":"result-no-direct-ok-err","error-check-unexpected-first":"error-check-unexpected-first","error-access-cause":"error-access-cause","error-normalize":"error-normalize","error-no-throw-in-deps":"error-no-throw-in-deps","concurrency-no-promise-all":"concurrency-no-promise-all","concurrency-no-promise-race":"concurrency-no-promise-race","concurrency-no-promise-allsettled":"concurrency-no-promise-allsettled","runtime-step-timeout":"runtime-step-timeout","runtime-step-aborted":"runtime-step-aborted","runtime-retry-exhausted":"runtime-retry-exhausted","runtime-rate-limit":"runtime-rate-limit","runtime-circuit-open":"runtime-circuit-open","runtime-unexpected":"runtime-unexpected","runtime-resolver-not-found":"runtime-resolver-not-found","runtime-saga-compensation":"runtime-saga-compensation"};function w(e){return e.split("-")[0]}function y(e){return`https://jagreehal.github.io/awaitly/rules/#${e}`}function g(e){return Object.prototype.hasOwnProperty.call(i,e)}var f=Object.keys(i);0&&(module.exports={ALL_SLUGS,AWAITLY_SLUGS,isAwaitlySlug,slugCategory,slugDocsUrl});
|
|
2
|
-
//# sourceMappingURL=slugs.cjs.map
|
package/dist/slugs.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/slugs.ts"],"sourcesContent":["/**\n * awaitly/slugs\n *\n * Source-of-truth slug namespace. Every concept that surfaces as a runtime\n * error, lint rule, static-analyzer diagnostic, visualizer event, or skill rule\n * has exactly one canonical kebab-case slug here.\n *\n * Slugs are public API. Renames are a major version bump. Adds are non-breaking.\n *\n * Categories:\n * - step-* step() discipline\n * - workflow-* createWorkflow / run / runWithState shape\n * - result-* Result usage\n * - error-* Boundary handling\n * - concurrency-* step.all/map/race vs Promise.*\n * - runtime-* Failures only observable at runtime\n */\n\nexport const AWAITLY_SLUGS = {\n // --- step-* ---\n \"step-require-id\": \"step-require-id\",\n \"step-no-immediate-execution\": \"step-no-immediate-execution\",\n \"step-require-thunk-for-key\": \"step-require-thunk-for-key\",\n \"step-no-bare-await\": \"step-no-bare-await\",\n \"step-no-try-catch-wrap\": \"step-no-try-catch-wrap\",\n \"step-stable-cache-keys\": \"step-stable-cache-keys\",\n\n // --- workflow-* ---\n \"workflow-no-floating\": \"workflow-no-floating\",\n \"workflow-options-position\": \"workflow-options-position\",\n \"workflow-callback-shape\": \"workflow-callback-shape\",\n \"workflow-no-callable-form\": \"workflow-no-callable-form\",\n \"workflow-no-dynamic-import\": \"workflow-no-dynamic-import\",\n\n // --- result-* ---\n \"result-no-floating\": \"result-no-floating\",\n \"result-require-handling\": \"result-require-handling\",\n \"result-no-double-wrap\": \"result-no-double-wrap\",\n \"result-no-manual-propagation\": \"result-no-manual-propagation\",\n \"result-no-direct-ok-err\": \"result-no-direct-ok-err\",\n\n // --- error-* ---\n \"error-check-unexpected-first\": \"error-check-unexpected-first\",\n \"error-access-cause\": \"error-access-cause\",\n \"error-normalize\": \"error-normalize\",\n \"error-no-throw-in-deps\": \"error-no-throw-in-deps\",\n\n // --- concurrency-* ---\n \"concurrency-no-promise-all\": \"concurrency-no-promise-all\",\n \"concurrency-no-promise-race\": \"concurrency-no-promise-race\",\n \"concurrency-no-promise-allsettled\": \"concurrency-no-promise-allsettled\",\n\n // --- runtime-* ---\n \"runtime-step-timeout\": \"runtime-step-timeout\",\n \"runtime-step-aborted\": \"runtime-step-aborted\",\n \"runtime-retry-exhausted\": \"runtime-retry-exhausted\",\n \"runtime-rate-limit\": \"runtime-rate-limit\",\n \"runtime-circuit-open\": \"runtime-circuit-open\",\n \"runtime-unexpected\": \"runtime-unexpected\",\n \"runtime-resolver-not-found\": \"runtime-resolver-not-found\",\n \"runtime-saga-compensation\": \"runtime-saga-compensation\",\n} as const;\n\n/** All canonical awaitly slugs as a string-literal union. */\nexport type AwaitlySlug = keyof typeof AWAITLY_SLUGS;\n\n/** Categories derived from slug prefixes. */\nexport type AwaitlySlugCategory =\n | \"step\"\n | \"workflow\"\n | \"result\"\n | \"error\"\n | \"concurrency\"\n | \"runtime\";\n\n/** Returns the category (prefix) of a slug. */\nexport function slugCategory(slug: AwaitlySlug): AwaitlySlugCategory {\n return slug.split(\"-\")[0] as AwaitlySlugCategory;\n}\n\n/**\n * Returns the canonical docs URL for a slug. Resolves to the matching\n * anchored section on the consolidated rule index page.\n */\nexport function slugDocsUrl(slug: AwaitlySlug): string {\n return `https://jagreehal.github.io/awaitly/rules/#${slug}`;\n}\n\n/** Type guard: is a string a known awaitly slug? */\nexport function isAwaitlySlug(value: string): value is AwaitlySlug {\n return Object.prototype.hasOwnProperty.call(AWAITLY_SLUGS, value);\n}\n\n/** All slugs as an array. */\n// Object.keys returns string[] — cast is safe because AWAITLY_SLUGS is `as const`\n// and the module's keys are never mutated.\nexport const ALL_SLUGS: readonly AwaitlySlug[] = Object.keys(\n AWAITLY_SLUGS\n) as AwaitlySlug[];\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,EAAA,kBAAAC,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAP,GAkBO,IAAMG,EAAgB,CAE3B,kBAAmB,kBACnB,8BAA+B,8BAC/B,6BAA8B,6BAC9B,qBAAsB,qBACtB,yBAA0B,yBAC1B,yBAA0B,yBAG1B,uBAAwB,uBACxB,4BAA6B,4BAC7B,0BAA2B,0BAC3B,4BAA6B,4BAC7B,6BAA8B,6BAG9B,qBAAsB,qBACtB,0BAA2B,0BAC3B,wBAAyB,wBACzB,+BAAgC,+BAChC,0BAA2B,0BAG3B,+BAAgC,+BAChC,qBAAsB,qBACtB,kBAAmB,kBACnB,yBAA0B,yBAG1B,6BAA8B,6BAC9B,8BAA+B,8BAC/B,oCAAqC,oCAGrC,uBAAwB,uBACxB,uBAAwB,uBACxB,0BAA2B,0BAC3B,qBAAsB,qBACtB,uBAAwB,uBACxB,qBAAsB,qBACtB,6BAA8B,6BAC9B,4BAA6B,2BAC/B,EAeO,SAASE,EAAaG,EAAwC,CACnE,OAAOA,EAAK,MAAM,GAAG,EAAE,CAAC,CAC1B,CAMO,SAASF,EAAYE,EAA2B,CACrD,MAAO,8CAA8CA,CAAI,EAC3D,CAGO,SAASJ,EAAcK,EAAqC,CACjE,OAAO,OAAO,UAAU,eAAe,KAAKN,EAAeM,CAAK,CAClE,CAKO,IAAMP,EAAoC,OAAO,KACtDC,CACF","names":["slugs_exports","__export","ALL_SLUGS","AWAITLY_SLUGS","isAwaitlySlug","slugCategory","slugDocsUrl","__toCommonJS","slug","value"]}
|
package/dist/slugs.d.cts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* awaitly/slugs
|
|
3
|
-
*
|
|
4
|
-
* Source-of-truth slug namespace. Every concept that surfaces as a runtime
|
|
5
|
-
* error, lint rule, static-analyzer diagnostic, visualizer event, or skill rule
|
|
6
|
-
* has exactly one canonical kebab-case slug here.
|
|
7
|
-
*
|
|
8
|
-
* Slugs are public API. Renames are a major version bump. Adds are non-breaking.
|
|
9
|
-
*
|
|
10
|
-
* Categories:
|
|
11
|
-
* - step-* step() discipline
|
|
12
|
-
* - workflow-* createWorkflow / run / runWithState shape
|
|
13
|
-
* - result-* Result usage
|
|
14
|
-
* - error-* Boundary handling
|
|
15
|
-
* - concurrency-* step.all/map/race vs Promise.*
|
|
16
|
-
* - runtime-* Failures only observable at runtime
|
|
17
|
-
*/
|
|
18
|
-
declare const AWAITLY_SLUGS: {
|
|
19
|
-
readonly "step-require-id": "step-require-id";
|
|
20
|
-
readonly "step-no-immediate-execution": "step-no-immediate-execution";
|
|
21
|
-
readonly "step-require-thunk-for-key": "step-require-thunk-for-key";
|
|
22
|
-
readonly "step-no-bare-await": "step-no-bare-await";
|
|
23
|
-
readonly "step-no-try-catch-wrap": "step-no-try-catch-wrap";
|
|
24
|
-
readonly "step-stable-cache-keys": "step-stable-cache-keys";
|
|
25
|
-
readonly "workflow-no-floating": "workflow-no-floating";
|
|
26
|
-
readonly "workflow-options-position": "workflow-options-position";
|
|
27
|
-
readonly "workflow-callback-shape": "workflow-callback-shape";
|
|
28
|
-
readonly "workflow-no-callable-form": "workflow-no-callable-form";
|
|
29
|
-
readonly "workflow-no-dynamic-import": "workflow-no-dynamic-import";
|
|
30
|
-
readonly "result-no-floating": "result-no-floating";
|
|
31
|
-
readonly "result-require-handling": "result-require-handling";
|
|
32
|
-
readonly "result-no-double-wrap": "result-no-double-wrap";
|
|
33
|
-
readonly "result-no-manual-propagation": "result-no-manual-propagation";
|
|
34
|
-
readonly "result-no-direct-ok-err": "result-no-direct-ok-err";
|
|
35
|
-
readonly "error-check-unexpected-first": "error-check-unexpected-first";
|
|
36
|
-
readonly "error-access-cause": "error-access-cause";
|
|
37
|
-
readonly "error-normalize": "error-normalize";
|
|
38
|
-
readonly "error-no-throw-in-deps": "error-no-throw-in-deps";
|
|
39
|
-
readonly "concurrency-no-promise-all": "concurrency-no-promise-all";
|
|
40
|
-
readonly "concurrency-no-promise-race": "concurrency-no-promise-race";
|
|
41
|
-
readonly "concurrency-no-promise-allsettled": "concurrency-no-promise-allsettled";
|
|
42
|
-
readonly "runtime-step-timeout": "runtime-step-timeout";
|
|
43
|
-
readonly "runtime-step-aborted": "runtime-step-aborted";
|
|
44
|
-
readonly "runtime-retry-exhausted": "runtime-retry-exhausted";
|
|
45
|
-
readonly "runtime-rate-limit": "runtime-rate-limit";
|
|
46
|
-
readonly "runtime-circuit-open": "runtime-circuit-open";
|
|
47
|
-
readonly "runtime-unexpected": "runtime-unexpected";
|
|
48
|
-
readonly "runtime-resolver-not-found": "runtime-resolver-not-found";
|
|
49
|
-
readonly "runtime-saga-compensation": "runtime-saga-compensation";
|
|
50
|
-
};
|
|
51
|
-
/** All canonical awaitly slugs as a string-literal union. */
|
|
52
|
-
type AwaitlySlug = keyof typeof AWAITLY_SLUGS;
|
|
53
|
-
/** Categories derived from slug prefixes. */
|
|
54
|
-
type AwaitlySlugCategory = "step" | "workflow" | "result" | "error" | "concurrency" | "runtime";
|
|
55
|
-
/** Returns the category (prefix) of a slug. */
|
|
56
|
-
declare function slugCategory(slug: AwaitlySlug): AwaitlySlugCategory;
|
|
57
|
-
/**
|
|
58
|
-
* Returns the canonical docs URL for a slug. Resolves to the matching
|
|
59
|
-
* anchored section on the consolidated rule index page.
|
|
60
|
-
*/
|
|
61
|
-
declare function slugDocsUrl(slug: AwaitlySlug): string;
|
|
62
|
-
/** Type guard: is a string a known awaitly slug? */
|
|
63
|
-
declare function isAwaitlySlug(value: string): value is AwaitlySlug;
|
|
64
|
-
/** All slugs as an array. */
|
|
65
|
-
declare const ALL_SLUGS: readonly AwaitlySlug[];
|
|
66
|
-
|
|
67
|
-
export { ALL_SLUGS, AWAITLY_SLUGS, type AwaitlySlug, type AwaitlySlugCategory, isAwaitlySlug, slugCategory, slugDocsUrl };
|
package/dist/slugs.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* awaitly/slugs
|
|
3
|
-
*
|
|
4
|
-
* Source-of-truth slug namespace. Every concept that surfaces as a runtime
|
|
5
|
-
* error, lint rule, static-analyzer diagnostic, visualizer event, or skill rule
|
|
6
|
-
* has exactly one canonical kebab-case slug here.
|
|
7
|
-
*
|
|
8
|
-
* Slugs are public API. Renames are a major version bump. Adds are non-breaking.
|
|
9
|
-
*
|
|
10
|
-
* Categories:
|
|
11
|
-
* - step-* step() discipline
|
|
12
|
-
* - workflow-* createWorkflow / run / runWithState shape
|
|
13
|
-
* - result-* Result usage
|
|
14
|
-
* - error-* Boundary handling
|
|
15
|
-
* - concurrency-* step.all/map/race vs Promise.*
|
|
16
|
-
* - runtime-* Failures only observable at runtime
|
|
17
|
-
*/
|
|
18
|
-
declare const AWAITLY_SLUGS: {
|
|
19
|
-
readonly "step-require-id": "step-require-id";
|
|
20
|
-
readonly "step-no-immediate-execution": "step-no-immediate-execution";
|
|
21
|
-
readonly "step-require-thunk-for-key": "step-require-thunk-for-key";
|
|
22
|
-
readonly "step-no-bare-await": "step-no-bare-await";
|
|
23
|
-
readonly "step-no-try-catch-wrap": "step-no-try-catch-wrap";
|
|
24
|
-
readonly "step-stable-cache-keys": "step-stable-cache-keys";
|
|
25
|
-
readonly "workflow-no-floating": "workflow-no-floating";
|
|
26
|
-
readonly "workflow-options-position": "workflow-options-position";
|
|
27
|
-
readonly "workflow-callback-shape": "workflow-callback-shape";
|
|
28
|
-
readonly "workflow-no-callable-form": "workflow-no-callable-form";
|
|
29
|
-
readonly "workflow-no-dynamic-import": "workflow-no-dynamic-import";
|
|
30
|
-
readonly "result-no-floating": "result-no-floating";
|
|
31
|
-
readonly "result-require-handling": "result-require-handling";
|
|
32
|
-
readonly "result-no-double-wrap": "result-no-double-wrap";
|
|
33
|
-
readonly "result-no-manual-propagation": "result-no-manual-propagation";
|
|
34
|
-
readonly "result-no-direct-ok-err": "result-no-direct-ok-err";
|
|
35
|
-
readonly "error-check-unexpected-first": "error-check-unexpected-first";
|
|
36
|
-
readonly "error-access-cause": "error-access-cause";
|
|
37
|
-
readonly "error-normalize": "error-normalize";
|
|
38
|
-
readonly "error-no-throw-in-deps": "error-no-throw-in-deps";
|
|
39
|
-
readonly "concurrency-no-promise-all": "concurrency-no-promise-all";
|
|
40
|
-
readonly "concurrency-no-promise-race": "concurrency-no-promise-race";
|
|
41
|
-
readonly "concurrency-no-promise-allsettled": "concurrency-no-promise-allsettled";
|
|
42
|
-
readonly "runtime-step-timeout": "runtime-step-timeout";
|
|
43
|
-
readonly "runtime-step-aborted": "runtime-step-aborted";
|
|
44
|
-
readonly "runtime-retry-exhausted": "runtime-retry-exhausted";
|
|
45
|
-
readonly "runtime-rate-limit": "runtime-rate-limit";
|
|
46
|
-
readonly "runtime-circuit-open": "runtime-circuit-open";
|
|
47
|
-
readonly "runtime-unexpected": "runtime-unexpected";
|
|
48
|
-
readonly "runtime-resolver-not-found": "runtime-resolver-not-found";
|
|
49
|
-
readonly "runtime-saga-compensation": "runtime-saga-compensation";
|
|
50
|
-
};
|
|
51
|
-
/** All canonical awaitly slugs as a string-literal union. */
|
|
52
|
-
type AwaitlySlug = keyof typeof AWAITLY_SLUGS;
|
|
53
|
-
/** Categories derived from slug prefixes. */
|
|
54
|
-
type AwaitlySlugCategory = "step" | "workflow" | "result" | "error" | "concurrency" | "runtime";
|
|
55
|
-
/** Returns the category (prefix) of a slug. */
|
|
56
|
-
declare function slugCategory(slug: AwaitlySlug): AwaitlySlugCategory;
|
|
57
|
-
/**
|
|
58
|
-
* Returns the canonical docs URL for a slug. Resolves to the matching
|
|
59
|
-
* anchored section on the consolidated rule index page.
|
|
60
|
-
*/
|
|
61
|
-
declare function slugDocsUrl(slug: AwaitlySlug): string;
|
|
62
|
-
/** Type guard: is a string a known awaitly slug? */
|
|
63
|
-
declare function isAwaitlySlug(value: string): value is AwaitlySlug;
|
|
64
|
-
/** All slugs as an array. */
|
|
65
|
-
declare const ALL_SLUGS: readonly AwaitlySlug[];
|
|
66
|
-
|
|
67
|
-
export { ALL_SLUGS, AWAITLY_SLUGS, type AwaitlySlug, type AwaitlySlugCategory, isAwaitlySlug, slugCategory, slugDocsUrl };
|
package/dist/slugs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var r={"step-require-id":"step-require-id","step-no-immediate-execution":"step-no-immediate-execution","step-require-thunk-for-key":"step-require-thunk-for-key","step-no-bare-await":"step-no-bare-await","step-no-try-catch-wrap":"step-no-try-catch-wrap","step-stable-cache-keys":"step-stable-cache-keys","workflow-no-floating":"workflow-no-floating","workflow-options-position":"workflow-options-position","workflow-callback-shape":"workflow-callback-shape","workflow-no-callable-form":"workflow-no-callable-form","workflow-no-dynamic-import":"workflow-no-dynamic-import","result-no-floating":"result-no-floating","result-require-handling":"result-require-handling","result-no-double-wrap":"result-no-double-wrap","result-no-manual-propagation":"result-no-manual-propagation","result-no-direct-ok-err":"result-no-direct-ok-err","error-check-unexpected-first":"error-check-unexpected-first","error-access-cause":"error-access-cause","error-normalize":"error-normalize","error-no-throw-in-deps":"error-no-throw-in-deps","concurrency-no-promise-all":"concurrency-no-promise-all","concurrency-no-promise-race":"concurrency-no-promise-race","concurrency-no-promise-allsettled":"concurrency-no-promise-allsettled","runtime-step-timeout":"runtime-step-timeout","runtime-step-aborted":"runtime-step-aborted","runtime-retry-exhausted":"runtime-retry-exhausted","runtime-rate-limit":"runtime-rate-limit","runtime-circuit-open":"runtime-circuit-open","runtime-unexpected":"runtime-unexpected","runtime-resolver-not-found":"runtime-resolver-not-found","runtime-saga-compensation":"runtime-saga-compensation"};function t(e){return e.split("-")[0]}function o(e){return`https://jagreehal.github.io/awaitly/rules/#${e}`}function n(e){return Object.prototype.hasOwnProperty.call(r,e)}var i=Object.keys(r);export{i as ALL_SLUGS,r as AWAITLY_SLUGS,n as isAwaitlySlug,t as slugCategory,o as slugDocsUrl};
|
|
2
|
-
//# sourceMappingURL=slugs.js.map
|
package/dist/slugs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/slugs.ts"],"sourcesContent":["/**\n * awaitly/slugs\n *\n * Source-of-truth slug namespace. Every concept that surfaces as a runtime\n * error, lint rule, static-analyzer diagnostic, visualizer event, or skill rule\n * has exactly one canonical kebab-case slug here.\n *\n * Slugs are public API. Renames are a major version bump. Adds are non-breaking.\n *\n * Categories:\n * - step-* step() discipline\n * - workflow-* createWorkflow / run / runWithState shape\n * - result-* Result usage\n * - error-* Boundary handling\n * - concurrency-* step.all/map/race vs Promise.*\n * - runtime-* Failures only observable at runtime\n */\n\nexport const AWAITLY_SLUGS = {\n // --- step-* ---\n \"step-require-id\": \"step-require-id\",\n \"step-no-immediate-execution\": \"step-no-immediate-execution\",\n \"step-require-thunk-for-key\": \"step-require-thunk-for-key\",\n \"step-no-bare-await\": \"step-no-bare-await\",\n \"step-no-try-catch-wrap\": \"step-no-try-catch-wrap\",\n \"step-stable-cache-keys\": \"step-stable-cache-keys\",\n\n // --- workflow-* ---\n \"workflow-no-floating\": \"workflow-no-floating\",\n \"workflow-options-position\": \"workflow-options-position\",\n \"workflow-callback-shape\": \"workflow-callback-shape\",\n \"workflow-no-callable-form\": \"workflow-no-callable-form\",\n \"workflow-no-dynamic-import\": \"workflow-no-dynamic-import\",\n\n // --- result-* ---\n \"result-no-floating\": \"result-no-floating\",\n \"result-require-handling\": \"result-require-handling\",\n \"result-no-double-wrap\": \"result-no-double-wrap\",\n \"result-no-manual-propagation\": \"result-no-manual-propagation\",\n \"result-no-direct-ok-err\": \"result-no-direct-ok-err\",\n\n // --- error-* ---\n \"error-check-unexpected-first\": \"error-check-unexpected-first\",\n \"error-access-cause\": \"error-access-cause\",\n \"error-normalize\": \"error-normalize\",\n \"error-no-throw-in-deps\": \"error-no-throw-in-deps\",\n\n // --- concurrency-* ---\n \"concurrency-no-promise-all\": \"concurrency-no-promise-all\",\n \"concurrency-no-promise-race\": \"concurrency-no-promise-race\",\n \"concurrency-no-promise-allsettled\": \"concurrency-no-promise-allsettled\",\n\n // --- runtime-* ---\n \"runtime-step-timeout\": \"runtime-step-timeout\",\n \"runtime-step-aborted\": \"runtime-step-aborted\",\n \"runtime-retry-exhausted\": \"runtime-retry-exhausted\",\n \"runtime-rate-limit\": \"runtime-rate-limit\",\n \"runtime-circuit-open\": \"runtime-circuit-open\",\n \"runtime-unexpected\": \"runtime-unexpected\",\n \"runtime-resolver-not-found\": \"runtime-resolver-not-found\",\n \"runtime-saga-compensation\": \"runtime-saga-compensation\",\n} as const;\n\n/** All canonical awaitly slugs as a string-literal union. */\nexport type AwaitlySlug = keyof typeof AWAITLY_SLUGS;\n\n/** Categories derived from slug prefixes. */\nexport type AwaitlySlugCategory =\n | \"step\"\n | \"workflow\"\n | \"result\"\n | \"error\"\n | \"concurrency\"\n | \"runtime\";\n\n/** Returns the category (prefix) of a slug. */\nexport function slugCategory(slug: AwaitlySlug): AwaitlySlugCategory {\n return slug.split(\"-\")[0] as AwaitlySlugCategory;\n}\n\n/**\n * Returns the canonical docs URL for a slug. Resolves to the matching\n * anchored section on the consolidated rule index page.\n */\nexport function slugDocsUrl(slug: AwaitlySlug): string {\n return `https://jagreehal.github.io/awaitly/rules/#${slug}`;\n}\n\n/** Type guard: is a string a known awaitly slug? */\nexport function isAwaitlySlug(value: string): value is AwaitlySlug {\n return Object.prototype.hasOwnProperty.call(AWAITLY_SLUGS, value);\n}\n\n/** All slugs as an array. */\n// Object.keys returns string[] — cast is safe because AWAITLY_SLUGS is `as const`\n// and the module's keys are never mutated.\nexport const ALL_SLUGS: readonly AwaitlySlug[] = Object.keys(\n AWAITLY_SLUGS\n) as AwaitlySlug[];\n"],"mappings":"AAkBO,IAAMA,EAAgB,CAE3B,kBAAmB,kBACnB,8BAA+B,8BAC/B,6BAA8B,6BAC9B,qBAAsB,qBACtB,yBAA0B,yBAC1B,yBAA0B,yBAG1B,uBAAwB,uBACxB,4BAA6B,4BAC7B,0BAA2B,0BAC3B,4BAA6B,4BAC7B,6BAA8B,6BAG9B,qBAAsB,qBACtB,0BAA2B,0BAC3B,wBAAyB,wBACzB,+BAAgC,+BAChC,0BAA2B,0BAG3B,+BAAgC,+BAChC,qBAAsB,qBACtB,kBAAmB,kBACnB,yBAA0B,yBAG1B,6BAA8B,6BAC9B,8BAA+B,8BAC/B,oCAAqC,oCAGrC,uBAAwB,uBACxB,uBAAwB,uBACxB,0BAA2B,0BAC3B,qBAAsB,qBACtB,uBAAwB,uBACxB,qBAAsB,qBACtB,6BAA8B,6BAC9B,4BAA6B,2BAC/B,EAeO,SAASC,EAAaC,EAAwC,CACnE,OAAOA,EAAK,MAAM,GAAG,EAAE,CAAC,CAC1B,CAMO,SAASC,EAAYD,EAA2B,CACrD,MAAO,8CAA8CA,CAAI,EAC3D,CAGO,SAASE,EAAcC,EAAqC,CACjE,OAAO,OAAO,UAAU,eAAe,KAAKL,EAAeK,CAAK,CAClE,CAKO,IAAMC,EAAoC,OAAO,KACtDN,CACF","names":["AWAITLY_SLUGS","slugCategory","slug","slugDocsUrl","isAwaitlySlug","value","ALL_SLUGS"]}
|