MCPcopy
hub / github.com/Effect-TS/effect / fromGlob

Function fromGlob

packages/sql/src/Migrator.ts:298–313  ·  view source on GitHub ↗
(
  migrations: Record<string, () => Promise<any>>
)

Source from the content-addressed store, hash-verified

296 * @category loaders
297 */
298export const fromGlob = (
299 migrations: Record<string, () => Promise<any>>
300): Loader =>
301 pipe(
302 Object.keys(migrations),
303 Arr.filterMap((_) => Option.fromNullable(_.match(/^(?:.*\/)?(\d+)_([^.]+)\.(js|ts)$/))),
304 Arr.map(
305 ([key, id, name]): ResolvedMigration => [
306 Number(id),
307 name,
308 Effect.promise(() => migrations[key]())
309 ]
310 ),
311 Arr.sort(migrationOrder),
312 Effect.succeed
313 )
314
315/**
316 * @since 1.0.0

Callers

nothing calls this directly

Calls 4

NumberInterface · 0.85
keysMethod · 0.80
mapMethod · 0.65
pipeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…