@bessemer/cornerstone 0.5.47 → 0.5.49

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/async.js CHANGED
@@ -45,7 +45,7 @@ var execute = (runnable) => {
45
45
  };
46
46
  var sleep = (duration) => {
47
47
  return new Promise((resolve) => {
48
- setTimeout(resolve, Durations.inMilliseconds(duration));
48
+ setTimeout(resolve, Durations.toMilliseconds(duration));
49
49
  });
50
50
  };
51
51
  export {
package/dist/async.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/async.ts"],"sourcesContent":["import { Duration } from '@bessemer/cornerstone/duration'\nimport { Durations, Objects } from '@bessemer/cornerstone'\n\nexport type PendingValue = {\n isSuccess: false\n isError: false\n isLoading: false\n isFetching: boolean\n data: undefined\n}\n\nexport type LoadingValue = {\n isSuccess: false\n isError: false\n isLoading: true\n isFetching: boolean\n data: undefined\n}\n\nexport type ErrorValue = {\n isSuccess: false\n isError: true\n isLoading: false\n isFetching: boolean\n data: unknown\n}\n\nexport type FetchingValueSuccess<T> = {\n isSuccess: true\n isError: false\n isLoading: false\n isFetching: true\n data: T\n}\n\nexport type FetchingValueError = {\n isSuccess: false\n isError: true\n isLoading: false\n isFetching: true\n data: unknown\n}\n\nexport type SettledValue<T> = {\n isSuccess: true\n isError: false\n isLoading: false\n isFetching: false\n data: T\n}\n\nexport type AsyncValue<T> = PendingValue | LoadingValue | ErrorValue | FetchingValueSuccess<T> | FetchingValueError | SettledValue<T>\n\nexport const isSettled = <T>(value: AsyncValue<T>): value is SettledValue<T> => {\n return value.isSuccess && !value.isError && !value.isLoading && !value.isFetching\n}\n\nexport const loading = (): LoadingValue => ({ isSuccess: false, isError: false, isLoading: true, isFetching: true, data: undefined })\n\nexport const fetching = <T>(data: T): FetchingValueSuccess<T> => ({\n isSuccess: true,\n isError: false,\n isLoading: false,\n isFetching: true,\n data,\n})\n\nexport const settled = <T>(data: T): SettledValue<T> => ({ isSuccess: true, isError: false, isLoading: false, isFetching: false, data })\n\nexport const error = (error: unknown): ErrorValue => ({ isSuccess: false, isError: true, isLoading: false, isFetching: false, data: error })\n\nexport const handle = <T, N>(\n value: AsyncValue<T | null>,\n handlers: { loading: () => N; error: (error: unknown) => N; absent: () => N; success: (data: T) => N }\n): N => {\n if (value.isLoading || (value.isError && value.isFetching)) {\n return handlers.loading()\n }\n if (value.isError) {\n return handlers.error(value.data)\n }\n if (Objects.isNil(value.data)) {\n return handlers.absent()\n }\n\n return handlers.success(value.data)\n}\n\nexport const map = <T, N>(value: AsyncValue<T>, mapper: (value: T) => N): AsyncValue<N> => {\n if (!value.isSuccess) {\n return value\n }\n\n return { ...value, data: mapper(value.data) }\n}\n\nexport const execute = <T>(runnable: () => Promise<T>): Promise<T> => {\n return new Promise(async (resolve, reject) => {\n setTimeout(async () => {\n try {\n const value = await runnable()\n resolve(value)\n } catch (e) {\n reject(e)\n }\n }, 0)\n })\n}\n\nexport const sleep = (duration: Duration): Promise<void> => {\n return new Promise((resolve) => {\n setTimeout(resolve, Durations.inMilliseconds(duration))\n })\n}\n"],"mappings":";AACA,SAAS,WAAW,eAAe;AAoD5B,IAAM,YAAY,CAAI,UAAmD;AAC9E,SAAO,MAAM,aAAa,CAAC,MAAM,WAAW,CAAC,MAAM,aAAa,CAAC,MAAM;AACzE;AAEO,IAAM,UAAU,OAAqB,EAAE,WAAW,OAAO,SAAS,OAAO,WAAW,MAAM,YAAY,MAAM,MAAM,OAAU;AAE5H,IAAM,WAAW,CAAI,UAAsC;AAAA,EAChE,WAAW;AAAA,EACX,SAAS;AAAA,EACT,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AACF;AAEO,IAAM,UAAU,CAAI,UAA8B,EAAE,WAAW,MAAM,SAAS,OAAO,WAAW,OAAO,YAAY,OAAO,KAAK;AAE/H,IAAM,QAAQ,CAACA,YAAgC,EAAE,WAAW,OAAO,SAAS,MAAM,WAAW,OAAO,YAAY,OAAO,MAAMA,OAAM;AAEnI,IAAM,SAAS,CACpB,OACA,aACM;AACN,MAAI,MAAM,aAAc,MAAM,WAAW,MAAM,YAAa;AAC1D,WAAO,SAAS,QAAQ;AAAA,EAC1B;AACA,MAAI,MAAM,SAAS;AACjB,WAAO,SAAS,MAAM,MAAM,IAAI;AAAA,EAClC;AACA,MAAI,QAAQ,MAAM,MAAM,IAAI,GAAG;AAC7B,WAAO,SAAS,OAAO;AAAA,EACzB;AAEA,SAAO,SAAS,QAAQ,MAAM,IAAI;AACpC;AAEO,IAAM,MAAM,CAAO,OAAsB,WAA2C;AACzF,MAAI,CAAC,MAAM,WAAW;AACpB,WAAO;AAAA,EACT;AAEA,SAAO,EAAE,GAAG,OAAO,MAAM,OAAO,MAAM,IAAI,EAAE;AAC9C;AAEO,IAAM,UAAU,CAAI,aAA2C;AACpE,SAAO,IAAI,QAAQ,OAAO,SAAS,WAAW;AAC5C,eAAW,YAAY;AACrB,UAAI;AACF,cAAM,QAAQ,MAAM,SAAS;AAC7B,gBAAQ,KAAK;AAAA,MACf,SAAS,GAAG;AACV,eAAO,CAAC;AAAA,MACV;AAAA,IACF,GAAG,CAAC;AAAA,EACN,CAAC;AACH;AAEO,IAAM,QAAQ,CAAC,aAAsC;AAC1D,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,eAAW,SAAS,UAAU,eAAe,QAAQ,CAAC;AAAA,EACxD,CAAC;AACH;","names":["error"]}
1
+ {"version":3,"sources":["../src/async.ts"],"sourcesContent":["import { Duration } from '@bessemer/cornerstone/duration'\nimport { Durations, Objects } from '@bessemer/cornerstone'\n\nexport type PendingValue = {\n isSuccess: false\n isError: false\n isLoading: false\n isFetching: boolean\n data: undefined\n}\n\nexport type LoadingValue = {\n isSuccess: false\n isError: false\n isLoading: true\n isFetching: boolean\n data: undefined\n}\n\nexport type ErrorValue = {\n isSuccess: false\n isError: true\n isLoading: false\n isFetching: boolean\n data: unknown\n}\n\nexport type FetchingValueSuccess<T> = {\n isSuccess: true\n isError: false\n isLoading: false\n isFetching: true\n data: T\n}\n\nexport type FetchingValueError = {\n isSuccess: false\n isError: true\n isLoading: false\n isFetching: true\n data: unknown\n}\n\nexport type SettledValue<T> = {\n isSuccess: true\n isError: false\n isLoading: false\n isFetching: false\n data: T\n}\n\nexport type AsyncValue<T> = PendingValue | LoadingValue | ErrorValue | FetchingValueSuccess<T> | FetchingValueError | SettledValue<T>\n\nexport const isSettled = <T>(value: AsyncValue<T>): value is SettledValue<T> => {\n return value.isSuccess && !value.isError && !value.isLoading && !value.isFetching\n}\n\nexport const loading = (): LoadingValue => ({ isSuccess: false, isError: false, isLoading: true, isFetching: true, data: undefined })\n\nexport const fetching = <T>(data: T): FetchingValueSuccess<T> => ({\n isSuccess: true,\n isError: false,\n isLoading: false,\n isFetching: true,\n data,\n})\n\nexport const settled = <T>(data: T): SettledValue<T> => ({ isSuccess: true, isError: false, isLoading: false, isFetching: false, data })\n\nexport const error = (error: unknown): ErrorValue => ({ isSuccess: false, isError: true, isLoading: false, isFetching: false, data: error })\n\nexport const handle = <T, N>(\n value: AsyncValue<T | null>,\n handlers: { loading: () => N; error: (error: unknown) => N; absent: () => N; success: (data: T) => N }\n): N => {\n if (value.isLoading || (value.isError && value.isFetching)) {\n return handlers.loading()\n }\n if (value.isError) {\n return handlers.error(value.data)\n }\n if (Objects.isNil(value.data)) {\n return handlers.absent()\n }\n\n return handlers.success(value.data)\n}\n\nexport const map = <T, N>(value: AsyncValue<T>, mapper: (value: T) => N): AsyncValue<N> => {\n if (!value.isSuccess) {\n return value\n }\n\n return { ...value, data: mapper(value.data) }\n}\n\nexport const execute = <T>(runnable: () => Promise<T>): Promise<T> => {\n return new Promise(async (resolve, reject) => {\n setTimeout(async () => {\n try {\n const value = await runnable()\n resolve(value)\n } catch (e) {\n reject(e)\n }\n }, 0)\n })\n}\n\nexport const sleep = (duration: Duration): Promise<void> => {\n return new Promise((resolve) => {\n setTimeout(resolve, Durations.toMilliseconds(duration))\n })\n}\n"],"mappings":";AACA,SA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AC;AAAA,EACN,CAAC;AACH;AAEO,IAAM,QAAQ,CAAC,aAAsC;AAC1D,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,eAAW,SAAS,UAAU,eAAe,QAAQ,CAAC;AAAA,EACxD,CAAC;AACH;","names":["error"]}
package/dist/cache.js CHANGED
@@ -80,14 +80,14 @@ var CacheEntry;
80
80
  CacheEntry2.applyProps = (originalEntry, props) => {
81
81
  let liveTimestamp = originalEntry.liveTimestamp;
82
82
  if (!Objects.isNil(props.timeToLive)) {
83
- const limit = Dates.addMilliseconds(Dates.now(), Durations.inMilliseconds(props.timeToLive));
83
+ const limit = Dates.addMilliseconds(Dates.now(), Durations.toMilliseconds(props.timeToLive));
84
84
  if (Dates.isBefore(limit, liveTimestamp ?? limit)) {
85
85
  liveTimestamp = limit;
86
86
  }
87
87
  }
88
88
  let staleTimestamp = originalEntry.staleTimestamp;
89
89
  if (!Objects.isNil(props.timeToStale)) {
90
- const limit = Dates.addMilliseconds(Dates.now(), Durations.inMilliseconds(props.timeToStale));
90
+ const limit = Dates.addMilliseconds(Dates.now(), Durations.toMilliseconds(props.timeToStale));
91
91
  if (Dates.isBefore(limit, staleTimestamp ?? limit)) {
92
92
  staleTimestamp = limit;
93
93
  }
package/dist/cache.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cache.ts"],"sourcesContent":["import { AbstractLocalKeyValueStore, AbstractRemoteKeyValueStore, LocalKeyValueStore, RemoteKeyValueStore } from '@bessemer/cornerstone/store'\nimport { Arrays, Dates, Durations, Objects, Strings, Zod } from '@bessemer/cornerstone'\nimport { Duration } from '@bessemer/cornerstone/duration'\nimport { ResourceKey, ResourceNamespace } from '@bessemer/cornerstone/resource'\nimport { AbstractApplicationContext } from '@bessemer/cornerstone/context'\nimport { NominalType } from '@bessemer/cornerstone/types'\nimport { Entry } from '@bessemer/cornerstone/entry'\nimport { GlobPattern } from '@bessemer/cornerstone/glob'\nimport { Arrayable } from 'type-fest'\nimport { ZodType } from 'zod'\n\n// JOHN should this even be in cornerstone? especially consider the config types down at the bottom\n\nexport type CacheProps = {\n maxSize: number | null\n timeToLive: Duration\n timeToStale: Duration | null\n}\n\nexport type CacheOptions = Partial<CacheProps>\n\nexport namespace CacheProps {\n const DefaultCacheProps = {\n maxSize: 50000,\n timeToLive: Durations.OneDay,\n timeToStale: Durations.OneHour,\n }\n\n export const buildCacheProps = (options?: CacheOptions): CacheProps => {\n options = options ?? {}\n\n const props = Objects.deepMerge(DefaultCacheProps, options)\n\n if (props.maxSize === null && props.timeToLive === null) {\n throw new Error('Invalid cache configuration, both maxSize and timeToLive are null')\n }\n\n return props\n }\n}\n\nexport namespace CacheKey {\n // We use a hardcoded UUID to represent a unique token value that serves as a flag to disable caching\n const DisableCacheToken = 'f6822c1a-d527-4c65-b9dd-ddc24620b684'\n\n export const disableCaching = (): ResourceNamespace => {\n return DisableCacheToken\n }\n\n export const isDisabled = (key: ResourceNamespace): boolean => {\n return Strings.contains(key, DisableCacheToken)\n }\n}\n\nexport type CacheSector = {\n globs: Array<GlobPattern>\n}\n\nexport namespace CacheSector {\n export const of = (globs: Arrayable<GlobPattern>) => {\n return { globs: Arrays.toArray(globs) }\n }\n\n export const namespace = (namespace: ResourceNamespace, sector: CacheSector): CacheSector => {\n return { globs: ResourceKey.namespaceAll(namespace, sector.globs) }\n }\n}\n\nexport type CacheName = NominalType<string, 'CacheName'>\nexport const CacheNameSchema: ZodType<CacheName> = Zod.string()\n\nexport interface AbstractCache<T> {\n name: CacheName\n}\n\nexport interface Cache<T> extends AbstractCache<T> {\n fetchValue(namespace: ResourceNamespace, key: ResourceKey, fetch: () => Promise<T>): Promise<T>\n\n fetchValues(\n namespace: ResourceNamespace,\n keys: Array<ResourceKey>,\n fetch: (keys: Array<ResourceKey>) => Promise<Array<Entry<T>>>\n ): Promise<Array<Entry<T>>>\n\n writeValue(namespace: ResourceNamespace, key: ResourceKey, value: T | undefined): Promise<void>\n\n writeValues(namespace: ResourceNamespace, entries: Array<Entry<T | undefined>>): Promise<void>\n\n evictAll(sector: CacheSector): Promise<void>\n}\n\nexport interface CacheProvider<T> extends RemoteKeyValueStore<CacheEntry<T>> {\n type: CacheProviderType\n\n evictAll(sector: CacheSector): Promise<void>\n}\n\nexport abstract class AbstractCacheProvider<T> extends AbstractRemoteKeyValueStore<CacheEntry<T>> implements CacheProvider<T> {\n abstract type: CacheProviderType\n\n abstract evictAll(sector: CacheSector): Promise<void>\n}\n\nexport interface LocalCache<T> extends AbstractCache<T> {\n getValue(namespace: ResourceNamespace, key: ResourceKey, fetch: () => T): T\n\n getValues(namespace: ResourceNamespace, keys: Array<ResourceKey>, fetch: (keys: Array<ResourceKey>) => Array<Entry<T>>): Array<Entry<T>>\n\n setValue(namespace: ResourceNamespace, key: ResourceKey, value: T | undefined): void\n\n setValues(namespace: ResourceNamespace, entries: Array<Entry<T | undefined>>): void\n\n removeAll(sector: CacheSector): void\n}\n\nexport interface LocalCacheProvider<T> extends LocalKeyValueStore<CacheEntry<T>>, CacheProvider<T> {\n removeAll(sector: CacheSector): void\n}\n\nexport abstract class AbstractLocalCacheProvider<T> extends AbstractLocalKeyValueStore<CacheEntry<T>> implements LocalCacheProvider<T> {\n abstract type: CacheProviderType\n\n abstract removeAll(sector: CacheSector): void\n\n async evictAll(sector: CacheSector): Promise<void> {\n this.removeAll(sector)\n }\n}\n\nexport type CacheEntry<T> = {\n value: T\n liveTimestamp: Date | null\n staleTimestamp: Date | null\n}\n\nexport namespace CacheEntry {\n export const isActive = <T>(entry: CacheEntry<T>): boolean => {\n if (isDead(entry) || isStale(entry)) {\n return false\n }\n\n return true\n }\n\n export const isDead = <T>(entry: CacheEntry<T> | undefined): boolean => {\n if (Objects.isNil(entry)) {\n return true\n }\n\n if (Objects.isNil(entry.liveTimestamp)) {\n return false\n }\n\n return Dates.isBefore(entry.liveTimestamp, Dates.now())\n }\n\n export const isAlive = <T>(entry: CacheEntry<T> | undefined): boolean => !isDead(entry)\n\n export const isStale = <T>(entry: CacheEntry<T>): boolean => {\n if (Objects.isNil(entry.staleTimestamp)) {\n return false\n }\n\n return Dates.isBefore(entry.staleTimestamp, Dates.now())\n }\n\n export const of = <T>(value: T) => {\n const entry: CacheEntry<T> = {\n value,\n liveTimestamp: null,\n staleTimestamp: null,\n }\n\n return entry\n }\n\n // JOHN do we want to enforce some kind of minimum liveness threshold?\n export const applyProps = <T>(originalEntry: CacheEntry<T>, props: CacheProps): CacheEntry<T> => {\n let liveTimestamp: Date | null = originalEntry.liveTimestamp\n if (!Objects.isNil(props.timeToLive)) {\n const limit = Dates.addMilliseconds(Dates.now(), Durations.inMilliseconds(props.timeToLive))\n if (Dates.isBefore(limit, liveTimestamp ?? limit)) {\n liveTimestamp = limit\n }\n }\n\n let staleTimestamp: Date | null = originalEntry.staleTimestamp\n if (!Objects.isNil(props.timeToStale)) {\n const limit = Dates.addMilliseconds(Dates.now(), Durations.inMilliseconds(props.timeToStale))\n if (Dates.isBefore(limit, staleTimestamp ?? limit)) {\n staleTimestamp = limit\n }\n }\n\n const limitedEntry: CacheEntry<T> = {\n value: originalEntry.value,\n liveTimestamp,\n staleTimestamp,\n }\n\n return limitedEntry\n }\n}\n\nexport type CacheConfigurationOptions = CacheConfigurationSection & {\n local: CacheConfigurationSection\n}\n\nexport type CacheConfigurationSection = {\n defaults: CacheDefinition\n\n /**\n * These options map from cache name key to configuration. They are a way for the tenant to override the configurations\n * for specific caches from the cache configuration here.\n */\n caches?: Record<string, Partial<CacheDefinition>>\n}\n\nexport type CacheDefinition = {\n options?: CacheOptions\n providers: Array<CacheProviderConfiguration>\n}\n\nexport type CacheProviderType = NominalType<string, 'CacheProviderType'>\nexport type CacheProviderConfiguration = CacheOptions & {\n type: CacheProviderType\n}\n\nexport type CacheConfiguration = CacheConfigurationSection & {\n local: CacheConfigurationSection\n}\n\nexport type CacheProviderRegistry<ContextType extends AbstractApplicationContext> = {\n type: CacheProviderType\n construct: <T>(props: CacheProps, context: ContextType) => CacheProvider<T>\n}\n"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AAG;AAClD,yBAAiB;AAAA,MACnB;AAAA,IACF;AAEA,UAAM,eAA8B;AAAA,MAClC,OAAO,cAAc;AAAA,MACrB;AAAA,MACA;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,GAlEe;","names":["CacheProps","CacheKey","CacheSector","namespace","CacheEntry"]}
1
+ {"version":3,"sources":["../src/cache.ts"],"sourcesContent":["import { AbstractLocalKeyValueStore, AbstractRemoteKeyValueStore, LocalKeyValueStore, RemoteKeyValueStore } from '@bessemer/cornerstone/store'\nimport { Arrays, Dates, Durations, Objects, Strings, Zod } from '@bessemer/cornerstone'\nimport { Duration } from '@bessemer/cornerstone/duration'\nimport { ResourceKey, ResourceNamespace } from '@bessemer/cornerstone/resource'\nimport { AbstractApplicationContext } from '@bessemer/cornerstone/context'\nimport { NominalType } from '@bessemer/cornerstone/types'\nimport { Entry } from '@bessemer/cornerstone/entry'\nimport { GlobPattern } from '@bessemer/cornerstone/glob'\nimport { Arrayable } from 'type-fest'\nimport { ZodType } from 'zod'\n\n// JOHN should this even be in cornerstone? especially consider the config types down at the bottom\n\nexport type CacheProps = {\n maxSize: number | null\n timeToLive: Duration\n timeToStale: Duration | null\n}\n\nexport type CacheOptions = Partial<CacheProps>\n\nexport namespace CacheProps {\n const DefaultCacheProps = {\n maxSize: 50000,\n timeToLive: Durations.OneDay,\n timeToStale: Durations.OneHour,\n }\n\n export const buildCacheProps = (options?: CacheOptions): CacheProps => {\n options = options ?? {}\n\n const props = Objects.deepMerge(DefaultCacheProps, options)\n\n if (props.maxSize === null && props.timeToLive === null) {\n throw new Error('Invalid cache configuration, both maxSize and timeToLive are null')\n }\n\n return props\n }\n}\n\nexport namespace CacheKey {\n // We use a hardcoded UUID to represent a unique token value that serves as a flag to disable caching\n const DisableCacheToken = 'f6822c1a-d527-4c65-b9dd-ddc24620b684'\n\n export const disableCaching = (): ResourceNamespace => {\n return DisableCacheToken\n }\n\n export const isDisabled = (key: ResourceNamespace): boolean => {\n return Strings.contains(key, DisableCacheToken)\n }\n}\n\nexport type CacheSector = {\n globs: Array<GlobPattern>\n}\n\nexport namespace CacheSector {\n export const of = (globs: Arrayable<GlobPattern>) => {\n return { globs: Arrays.toArray(globs) }\n }\n\n export const namespace = (namespace: ResourceNamespace, sector: CacheSector): CacheSector => {\n return { globs: ResourceKey.namespaceAll(namespace, sector.globs) }\n }\n}\n\nexport type CacheName = NominalType<string, 'CacheName'>\nexport const CacheNameSchema: ZodType<CacheName> = Zod.string()\n\nexport interface AbstractCache<T> {\n name: CacheName\n}\n\nexport interface Cache<T> extends AbstractCache<T> {\n fetchValue(namespace: ResourceNamespace, key: ResourceKey, fetch: () => Promise<T>): Promise<T>\n\n fetchValues(\n namespace: ResourceNamespace,\n keys: Array<ResourceKey>,\n fetch: (keys: Array<ResourceKey>) => Promise<Array<Entry<T>>>\n ): Promise<Array<Entry<T>>>\n\n writeValue(namespace: ResourceNamespace, key: ResourceKey, value: T | undefined): Promise<void>\n\n writeValues(namespace: ResourceNamespace, entries: Array<Entry<T | undefined>>): Promise<void>\n\n evictAll(sector: CacheSector): Promise<void>\n}\n\nexport interface CacheProvider<T> extends RemoteKeyValueStore<CacheEntry<T>> {\n type: CacheProviderType\n\n evictAll(sector: CacheSector): Promise<void>\n}\n\nexport abstract class AbstractCacheProvider<T> extends AbstractRemoteKeyValueStore<CacheEntry<T>> implements CacheProvider<T> {\n abstract type: CacheProviderType\n\n abstract evictAll(sector: CacheSector): Promise<void>\n}\n\nexport interface LocalCache<T> extends AbstractCache<T> {\n getValue(namespace: ResourceNamespace, key: ResourceKey, fetch: () => T): T\n\n getValues(namespace: ResourceNamespace, keys: Array<ResourceKey>, fetch: (keys: Array<ResourceKey>) => Array<Entry<T>>): Array<Entry<T>>\n\n setValue(namespace: ResourceNamespace, key: ResourceKey, value: T | undefined): void\n\n setValues(namespace: ResourceNamespace, entries: Array<Entry<T | undefined>>): void\n\n removeAll(sector: CacheSector): void\n}\n\nexport interface LocalCacheProvider<T> extends LocalKeyValueStore<CacheEntry<T>>, CacheProvider<T> {\n removeAll(sector: CacheSector): void\n}\n\nexport abstract class AbstractLocalCacheProvider<T> extends AbstractLocalKeyValueStore<CacheEntry<T>> implements LocalCacheProvider<T> {\n abstract type: CacheProviderType\n\n abstract removeAll(sector: CacheSector): void\n\n async evictAll(sector: CacheSector): Promise<void> {\n this.removeAll(sector)\n }\n}\n\nexport type CacheEntry<T> = {\n value: T\n liveTimestamp: Date | null\n staleTimestamp: Date | null\n}\n\nexport namespace CacheEntry {\n export const isActive = <T>(entry: CacheEntry<T>): boolean => {\n if (isDead(entry) || isStale(entry)) {\n return false\n }\n\n return true\n }\n\n export const isDead = <T>(entry: CacheEntry<T> | undefined): boolean => {\n if (Objects.isNil(entry)) {\n return true\n }\n\n if (Objects.isNil(entry.liveTimestamp)) {\n return false\n }\n\n return Dates.isBefore(entry.liveTimestamp, Dates.now())\n }\n\n export const isAlive = <T>(entry: CacheEntry<T> | undefined): boolean => !isDead(entry)\n\n export const isStale = <T>(entry: CacheEntry<T>): boolean => {\n if (Objects.isNil(entry.staleTimestamp)) {\n return false\n }\n\n return Dates.isBefore(entry.staleTimestamp, Dates.now())\n }\n\n export const of = <T>(value: T) => {\n const entry: CacheEntry<T> = {\n value,\n liveTimestamp: null,\n staleTimestamp: null,\n }\n\n return entry\n }\n\n // JOHN do we want to enforce some kind of minimum liveness threshold?\n export const applyProps = <T>(originalEntry: CacheEntry<T>, props: CacheProps): CacheEntry<T> => {\n let liveTimestamp: Date | null = originalEntry.liveTimestamp\n if (!Objects.isNil(props.timeToLive)) {\n const limit = Dates.addMilliseconds(Dates.now(), Durations.toMilliseconds(props.timeToLive))\n if (Dates.isBefore(limit, liveTimestamp ?? limit)) {\n liveTimestamp = limit\n }\n }\n\n let staleTimestamp: Date | null = originalEntry.staleTimestamp\n if (!Objects.isNil(props.timeToStale)) {\n const limit = Dates.addMilliseconds(Dates.now(), Durations.toMilliseconds(props.timeToStale))\n if (Dates.isBefore(limit, staleTimestamp ?? limit)) {\n staleTimestamp = limit\n }\n }\n\n const limitedEntry: CacheEntry<T> = {\n value: originalEntry.value,\n liveTimestamp,\n staleTimestamp,\n }\n\n return limitedEntry\n }\n}\n\nexport type CacheConfigurationOptions = CacheConfigurationSection & {\n local: CacheConfigurationSection\n}\n\nexport type CacheConfigurationSection = {\n defaults: CacheDefinition\n\n /**\n * These options map from cache name key to configuration. They are a way for the tenant to override the configurations\n * for specific caches from the cache configuration here.\n */\n caches?: Record<string, Partial<CacheDefinition>>\n}\n\nexport type CacheDefinition = {\n options?: CacheOptions\n providers: Array<CacheProviderConfiguration>\n}\n\nexport type CacheProviderType = NominalType<string, 'CacheProviderType'>\nexport type CacheProviderConfiguration = CacheOptions & {\n type: CacheProviderType\n}\n\nexport type CacheConfiguration = CacheConfigurationSection & {\n local: CacheConfigurationSection\n}\n\nexport type CacheProviderRegistry<ContextType extends AbstractApplicationContext> = {\n type: CacheProviderType\n construct: <T>(props: CacheProps, context: ContextType) => CacheProvider<T>\n}\n"],"mappings":";AAAA,SAAS,4BAA4B,mCAA4E;AACjH,SAAS,QAAQ,OAAO,WAAW,SAAS,SAAS,WAAW;AAEhE,SAAS,mBAAsC;AAkBxC,IAAU;AAAA,CAAV,CAAUA,gBAAV;AACL,QAAM,oBAAoB;AAAA,IACxB,SAAS;AAAA,IACT,YAAY,UAAU;AAAA,IACtB,aAAa,UAAU;AAAA,EACzB;AAEO,EAAMA,YAAA,kBAAkB,CAAC,YAAuC;AACrE,cAAU,WAAW,CAAC;AAEtB,UAAM,QAAQ,QAAQ,UAAU,mBAAmB,OAAO;AAE1D,QAAI,MAAM,YAAY,QAAQ,MAAM,eAAe,MAAM;AACvD,YAAM,IAAI,MAAM,mEAAmE;AAAA,IACrF;AAEA,WAAO;AAAA,EACT;AAAA,GAjBe;AAoBV,IAAU;AAAA,CAAV,CAAUC,cAAV;AAEL,QAAM,oBAAoB;AAEnB,EAAMA,UAAA,iBAAiB,MAAyB;AACrD,WAAO;AAAA,EACT;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AA,KAAK,CAAI,UAAa;AACjC,UAAM,QAAuB;AAAA,MAC3B;AAAA,MACA,eAAe;AAAA,MACf,gBAAgB;AAAA,IAClB;AAEA,WAAO;AAAA,EACT;AAGO,EAAMA,YAAA,aAAa,CAAI,eAA8B,UAAqC;AAC/F,QAAI,gBAA6B,cAAc;AAC/C,QAAI,CAAC,QAAQ,MAAM,MAAM,UAAU,GAAG;AACpC,YAAM,QAAQ,MAAM,gBAAgB,MAAM,IAAI,GAAG,UAAU,eAAe,MAAM,UAAU,CAAC;AAC3F,UAAI,MAAM,SAAS,OAAO,iBAAiB,KAAK,GAAG;AACjD,wBAAgB;AAAA,MAClB;AAAA,IACF;AAEA,QAAI,iBAA8B,cAAc;AAChD,QAAI,CAAC,QAAQ,MAAM,MAAM,WAAW,GAAG;AACrC,YAAM,QAAQ,MAAM,gBAAgB,MAAM,IAAI,GAAG,UAAU,eAAe,MAAM,WAAW,CAAC;AAC5F,UAAI,MAAM,SAAS,OAAO,kBAAkB,KAAK,GAAG;AAClD,yBAAiB;AAAA,MACnB;AAAA,IACF;AAEA,UAAM,eAA8B;AAAA,MAClC,OAAO,cAAc;AAAA,MACrB;AAAA,MACA;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,GAlEe;","names":["CacheProps","CacheKey","CacheSector","namespace","CacheEntry"]}
@@ -2,12 +2,18 @@ import { TaggedType } from '@bessemer/cornerstone/types';
2
2
  import { ZodType } from 'zod';
3
3
  export type DataSize = TaggedType<number, 'DataSize'>;
4
4
  export declare const DataSizeSchema: ZodType<DataSize>;
5
- export declare const ofBytes: (value: number) => DataSize;
6
- export declare const inBytes: (byte: DataSize) => number;
7
- export declare const ofKilobytes: (value: number) => DataSize;
8
- export declare const inKilobytes: (byte: DataSize) => number;
9
- export declare const ofMegabytes: (value: number) => DataSize;
10
- export declare const inMegabytes: (byte: DataSize) => number;
11
- export declare const ofGigabytes: (value: number) => DataSize;
12
- export declare const inGigabytes: (byte: DataSize) => number;
5
+ export declare const fromBytes: (value: number) => DataSize;
6
+ export declare const toBytes: (byte: DataSize) => number;
7
+ export declare const fromKilobytes: (value: number) => DataSize;
8
+ export declare const toKilobytes: (byte: DataSize) => number;
9
+ export declare const fromMegabytes: (value: number) => DataSize;
10
+ export declare const toMegabytes: (byte: DataSize) => number;
11
+ export declare const fromGigabytes: (value: number) => DataSize;
12
+ export declare const toGigabytes: (byte: DataSize) => number;
13
+ export declare const fromKibibytes: (value: number) => DataSize;
14
+ export declare const toKibibytes: (byte: DataSize) => number;
15
+ export declare const fromMebibytes: (value: number) => DataSize;
16
+ export declare const toMebibytes: (byte: DataSize) => number;
17
+ export declare const fromGibibytes: (value: number) => DataSize;
18
+ export declare const toGibibytes: (byte: DataSize) => number;
13
19
  //# sourceMappingURL=data-size.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-size.d.ts","sourceRoot":"","sources":["../src/data-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAY,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAElC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AACrD,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAuB,CAAA;AAEpE,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,KAAG,QAEvC,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,QAAQ,KAAG,MAExC,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,QAE3C,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,QAAQ,KAAG,MAE5C,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,QAE3C,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,QAAQ,KAAG,MAE5C,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,QAE3C,CAAA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data-size.js CHANGED
@@ -1,39 +1,63 @@
1
1
  // src/data-size.ts
2
2
  import Zod from "zod";
3
3
  var DataSizeSchema = Zod.number();
4
- var ofBytes = (value) => {
4
+ var fromBytes = (value) => {
5
5
  return value;
6
6
  };
7
- var inBytes = (byte) => {
7
+ var toBytes = (byte) => {
8
8
  return byte;
9
9
  };
10
- var ofKilobytes = (value) => {
11
- return ofBytes(value * 1e3);
10
+ var fromKilobytes = (value) => {
11
+ return fromBytes(value * 1e3);
12
12
  };
13
- var inKilobytes = (byte) => {
14
- return inBytes(byte) / 1e3;
13
+ var toKilobytes = (byte) => {
14
+ return toBytes(byte) / 1e3;
15
15
  };
16
- var ofMegabytes = (value) => {
17
- return ofKilobytes(value * 1e3);
16
+ var fromMegabytes = (value) => {
17
+ return fromKilobytes(value * 1e3);
18
18
  };
19
- var inMegabytes = (byte) => {
20
- return inKilobytes(byte) / 1e3;
19
+ var toMegabytes = (byte) => {
20
+ return toKilobytes(byte) / 1e3;
21
21
  };
22
- var ofGigabytes = (value) => {
23
- return ofMegabytes(value * 1e3);
22
+ var fromGigabytes = (value) => {
23
+ return fromMegabytes(value * 1e3);
24
24
  };
25
- var inGigabytes = (byte) => {
26
- return inMegabytes(byte) / 1e3;
25
+ var toGigabytes = (byte) => {
26
+ return toMegabytes(byte) / 1e3;
27
+ };
28
+ var fromKibibytes = (value) => {
29
+ return fromBytes(value * 1024);
30
+ };
31
+ var toKibibytes = (byte) => {
32
+ return toBytes(byte) / 1024;
33
+ };
34
+ var fromMebibytes = (value) => {
35
+ return fromKibibytes(value * 1024);
36
+ };
37
+ var toMebibytes = (byte) => {
38
+ return toKibibytes(byte) / 1024;
39
+ };
40
+ var fromGibibytes = (value) => {
41
+ return fromMebibytes(value * 1024);
42
+ };
43
+ var toGibibytes = (byte) => {
44
+ return toMebibytes(byte) / 1024;
27
45
  };
28
46
  export {
29
47
  DataSizeSchema,
30
- inBytes,
31
- inGigabytes,
32
- inKilobytes,
33
- inMegabytes,
34
- ofBytes,
35
- ofGigabytes,
36
- ofKilobytes,
37
- ofMegabytes
48
+ fromBytes,
49
+ fromGibibytes,
50
+ fromGigabytes,
51
+ fromKibibytes,
52
+ fromKilobytes,
53
+ fromMebibytes,
54
+ fromMegabytes,
55
+ toBytes,
56
+ toGibibytes,
57
+ toGigabytes,
58
+ toKibibytes,
59
+ toKilobytes,
60
+ toMebibytes,
61
+ toMegabytes
38
62
  };
39
63
  //# sourceMappingURL=data-size.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data-size.ts"],"sourcesContent":["import { TaggedType } from '@bessemer/cornerstone/types'\nimport Zod, { ZodType } from 'zod'\n\nexport type DataSize = TaggedType<number, 'DataSize'>\nexport const DataSizeSchema: ZodType<DataSize> = Zod.number() as any\n\nexport const ofBytes = (value: number): DataSize => {\n return value as DataSize\n}\n\nexport const inBytes = (byte: DataSize): number => {\n return byte\n}\n\nexport const ofKilobytes = (value: number): DataSize => {\n return ofBytes(value * 1000)\n}\n\nexport const inKilobytes = (byte: DataSize): number => {\n return inBytes(byte) / 1000\n}\n\nexport const ofMegabytes = (value: number): DataSize => {\n return ofKilobytes(value * 1000)\n}\n\nexport const inMegabytes = (byte: DataSize): number => {\n return inKilobytes(byte) / 1000\n}\n\nexport const ofGigabytes = (value: number): DataSize => {\n return ofMegabytes(value * 1000)\n}\n\nexport const inGigabytes = (byte: DataSize): number => {\n return inMegabytes(byte) / 1000\n}\n"],"mappings":";AACA,OAAO,SAAsB;AAGtB,IAAM,iBAAoC,IAAI,OAAO;AAErD,IAAM,UAAU,CAAC,UAA4B;AAClD,SAAO;AACT;AAEO,IAAM,UAAU,CAAC,SAA2B;AACjD,SAAO;AACT;AAEO,IAAM,cAAc,CAAC,UAA4B;AACtD,SAAO,QAAQ,QAAQ,GAAI;AAC7B;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,QAAQ,IAAI,IAAI;AACzB;AAEO,IAAM,cAAc,CAAC,UAA4B;AACtD,SAAO,YAAY,QAAQ,GAAI;AACjC;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,YAAY,IAAI,IAAI;AAC7B;AAEO,IAAM,cAAc,CAAC,UAA4B;AACtD,SAAO,YAAY,QAAQ,GAAI;AACjC;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,YAAY,IAAI,IAAI;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../src/data-size.ts"],"sourcesContent":["import { TaggedType } from '@bessemer/cornerstone/types'\nimport Zod, { ZodType } from 'zod'\n\nexport type DataSize = TaggedType<number, 'DataSize'>\nexport const DataSizeSchema: ZodType<DataSize> = Zod.number() as any\n\nexport const fromBytes = (value: number): DataSize => {\n return value as DataSize\n}\n\nexport const toBytes = (byte: DataSize): number => {\n return byte\n}\n\n// === SI (Decimal) Units ===\nexport const fromKilobytes = (value: number): DataSize => {\n return fromBytes(value * 1000)\n}\n\nexport const toKilobytes = (byte: DataSize): number => {\n return toBytes(byte) / 1000\n}\n\nexport const fromMegabytes = (value: number): DataSize => {\n return fromKilobytes(value * 1000)\n}\n\nexport const toMegabytes = (byte: DataSize): number => {\n return toKilobytes(byte) / 1000\n}\n\nexport const fromGigabytes = (value: number): DataSize => {\n return fromMegabytes(value * 1000)\n}\n\nexport const toGigabytes = (byte: DataSize): number => {\n return toMegabytes(byte) / 1000\n}\n\n// === IEC (Binary) Units ===\nexport const fromKibibytes = (value: number): DataSize => {\n return fromBytes(value * 1024)\n}\n\nexport const toKibibytes = (byte: DataSize): number => {\n return toBytes(byte) / 1024\n}\n\nexport const fromMebibytes = (value: number): DataSize => {\n return fromKibibytes(value * 1024)\n}\n\nexport const toMebibytes = (byte: DataSize): number => {\n return toKibibytes(byte) / 1024\n}\n\nexport const fromGibibytes = (value: number): DataSize => {\n return fromMebibytes(value * 1024)\n}\n\nexport const toGibibytes = (byte: DataSize): number => {\n return toMebibytes(byte) / 1024\n}\n"],"mappings":";AACA,OAAO,SAAsB;AAGtB,IAAM,iBAAoC,IAAI,OAAO;AAErD,IAAM,YAAY,CAAC,UAA4B;AACpD,SAAO;AACT;AAEO,IAAM,UAAU,CAAC,SAA2B;AACjD,SAAO;AACT;AAGO,IAAM,gBAAgB,CAAC,UAA4B;AACxD,SAAO,UAAU,QAAQ,GAAI;AAC/B;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,QAAQ,IAAI,IAAI;AACzB;AAEO,IAAM,gBAAgB,CAAC,UAA4B;AACxD,SAAO,cAAc,QAAQ,GAAI;AACnC;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,YAAY,IAAI,IAAI;AAC7B;AAEO,IAAM,gBAAgB,CAAC,UAA4B;AACxD,SAAO,cAAc,QAAQ,GAAI;AACnC;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,YAAY,IAAI,IAAI;AAC7B;AAGO,IAAM,gBAAgB,CAAC,UAA4B;AACxD,SAAO,UAAU,QAAQ,IAAI;AAC/B;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,QAAQ,IAAI,IAAI;AACzB;AAEO,IAAM,gBAAgB,CAAC,UAA4B;AACxD,SAAO,cAAc,QAAQ,IAAI;AACnC;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,YAAY,IAAI,IAAI;AAC7B;AAEO,IAAM,gBAAgB,CAAC,UAA4B;AACxD,SAAO,cAAc,QAAQ,IAAI;AACnC;AAEO,IAAM,cAAc,CAAC,SAA2B;AACrD,SAAO,YAAY,IAAI,IAAI;AAC7B;","names":[]}
package/dist/date.js CHANGED
@@ -33,7 +33,7 @@ var addMilliseconds = _addMilliseconds;
33
33
  var addHours = _addHours;
34
34
  var isBefore = _isBefore;
35
35
  var isAfter = _isAfter;
36
- var addDuration = (date, duration) => addMilliseconds(date, Durations.inMilliseconds(duration));
36
+ var addDuration = (date, duration) => addMilliseconds(date, Durations.toMilliseconds(duration));
37
37
  export {
38
38
  addDuration,
39
39
  addHours,
package/dist/date.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/date.ts"],"sourcesContent":["import { addHours as _addHours, addMilliseconds as _addMilliseconds, isAfter as _isAfter, isBefore as _isBefore, parseISO } from 'date-fns'\nimport { isDate as _isDate } from 'lodash-es'\nimport { Duration } from '@bessemer/cornerstone/duration'\nimport { Durations } from '@bessemer/cornerstone'\nimport Zod from 'zod'\n\nexport const buildSchema = (fieldName: string) => {\n return Zod.union([\n Zod.string({\n required_error: `${fieldName} is required`,\n })\n .trim()\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?)?$/,\n `${fieldName} is an invalid Date. Use YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS.sssZ`\n ),\n Zod.date({\n required_error: `${fieldName} is required`,\n }),\n ]).transform((isoString) => {\n const date = new Date(isoString)\n // Additional check to ensure the parsed date is valid\n if (isNaN(date.getTime())) {\n throw new Error('Invalid date')\n }\n return date\n })\n}\n\nexport const isDate = _isDate\n\nexport const now = (): Date => {\n return new Date()\n}\n\nexport const of = (dateString: string): Date => {\n return parseISO(dateString)\n}\n\nexport const addMilliseconds = _addMilliseconds\nexport const addHours = _addHours\nexport const isBefore = _isBefore\nexport const isAfter = _isAfter\n\nexport const addDuration = (date: Date, duration: Duration): Date => addMilliseconds(date, Durations.inMilliseconds(duration))\n"],"mappings":";AAAA,SAAS,YAAY,WAAW,mBAAmB,kBAAkB,WAAW,UAAU,YAAY,WAAW,gBAAgB;AACjI,SAAS,UAAU,eAAe;AAElC,SAAS,iBAAiB;AAC1B,OAAO,SAAS;AAET,IAAM,cAAc,CAAC,cAAsB;AAChD,SAAO,IAAI,MAAM;AAAA,IACf,IAAI,OAAO;AAAA,MACT,gBAAgB,GAAG,SAAS;AAAA,IAC9B,CAAC,EACE,KAAK,EACL;AAAA,MACC;AAAA,MACA,GAAG,SAAS;AAAA,IACd;AAAA,IACF,IAAI,KAAK;AAAA,MACP,gBAAgB,GAAG,SAAS;AAAA,IAC9B,CAAC;AAAA,EACH,CAAC,EAAE,UAAU,CAAC,cAAc;AAC1B,UAAM,OAAO,IAAI,KAAK,SAAS;AAE/B,QAAI,MAAM,KAAK,QAAQ,CAAC,GAAG;AACzB,YAAM,IAAI,MAAM,cAAc;AAAA,IAChC;AACA,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,SAAS;AAEf,IAAM,MAAM,MAAY;AAC7B,SAAO,oBAAI,KAAK;AAClB;AAEO,IAAM,KAAK,CAAC,eAA6B;AAC9C,SAAO,SAAS,UAAU;AAC5B;AAEO,IAAM,kBAAkB;AACxB,IAAM,WAAW;AACjB,IAAM,WAAW;AACjB,IAAM,UAAU;AAEhB,IAAM,cAAc,CAAC,MAAY,aAA6B,gBAAgB,MAAM,UAAU,eAAe,QAAQ,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/date.ts"],"sourcesContent":["import { addHours as _addHours, addMilliseconds as _addMilliseconds, isAfter as _isAfter, isBefore as _isBefore, parseISO } from 'date-fns'\nimport { isDate as _isDate } from 'lodash-es'\nimport { Duration } from '@bessemer/cornerstone/duration'\nimport { Durations } from '@bessemer/cornerstone'\nimport Zod from 'zod'\n\nexport const buildSchema = (fieldName: string) => {\n return Zod.union([\n Zod.string({\n required_error: `${fieldName} is required`,\n })\n .trim()\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?)?$/,\n `${fieldName} is an invalid Date. Use YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS.sssZ`\n ),\n Zod.date({\n required_error: `${fieldName} is required`,\n }),\n ]).transform((isoString) => {\n const date = new Date(isoString)\n // Additional check to ensure the parsed date is valid\n if (isNaN(date.getTime())) {\n throw new Error('Invalid date')\n }\n return date\n })\n}\n\nexport const isDate = _isDate\n\nexport const now = (): Date => {\n return new Date()\n}\n\nexport const of = (dateString: string): Date => {\n return parseISO(dateString)\n}\n\nexport const addMilliseconds = _addMilliseconds\nexport const addHours = _addHours\nexport const isBefore = _isBefore\nexport const isAfter = _isAfter\n\nexport const addDuration = (date: Date, duration: Duration): Date => addMilliseconds(date, Durations.toMilliseconds(duration))\n"],"mappings":";AAAA,SAAS,YAAY,WAAW,mBAAmB,kBAAkB,WAAW,UAAU,YAAY,WAAW,gBAAgB;AACjI,SAAS,UAAU,eAAe;AAElC,SAAS,iBAAiB;AAC1B,OAAO,SAAS;AAET,IAAM,cAAc,CAAC,cAAsB;AAChD,SAAO,IAAI,MAAM;AAAA,IACf,IAAI,OAAO;AAAA,MACT,gBAAgB,GAAG,SAAS;AAAA,IAC9B,CAAC,EACE,KAAK,EACL;AAAA,MACC;AAAA,MACA,GAAG,SAAS;AAAA,IACd;AAAA,IACF,IAAI,KAAK;AAAA,MACP,gBAAgB,GAAG,SAAS;AAAA,IAC9B,CAAC;AAAA,EACH,CAAC,EAAE,UAAU,CAAC,cAAc;AAC1B,UAAM,OAAO,IAAI,KAAK,SAAS;AAE/B,QAAI,MAAM,KAAK,QAAQ,CAAC,GAAG;AACzB,YAAM,IAAI,MAAM,cAAc;AAAA,IAChC;AACA,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,SAAS;AAEf,IAAM,MAAM,MAAY;AAC7B,SAAO,oBAAI,KAAK;AAClB;AAEO,IAAM,KAAK,CAAC,eAA6B;AAC9C,SAAO,SAAS,UAAU;AAC5B;AAEO,IAAM,kBAAkB;AACxB,IAAM,WAAW;AACjB,IAAM,WAAW;AACjB,IAAM,UAAU;AAEhB,IAAM,cAAc,CAAC,MAAY,aAA6B,gBAAgB,MAAM,UAAU,eAAe,QAAQ,CAAC;","names":[]}
@@ -2,16 +2,16 @@ import { TaggedType } from '@bessemer/cornerstone/types';
2
2
  import { ZodType } from 'zod';
3
3
  export type Duration = TaggedType<number, 'Duration'>;
4
4
  export declare const DurationSchema: ZodType<Duration>;
5
- export declare const ofMilliseconds: (value: number) => Duration;
6
- export declare const inMilliseconds: (duration: Duration) => number;
7
- export declare const ofSeconds: (value: number) => Duration;
8
- export declare const inSeconds: (duration: Duration) => number;
9
- export declare const ofMinutes: (value: number) => Duration;
10
- export declare const inMinutes: (duration: Duration) => number;
11
- export declare const ofHours: (value: number) => Duration;
12
- export declare const inHours: (duration: Duration) => number;
13
- export declare const ofDays: (value: number) => Duration;
14
- export declare const inDays: (duration: Duration) => number;
5
+ export declare const fromMilliseconds: (value: number) => Duration;
6
+ export declare const toMilliseconds: (duration: Duration) => number;
7
+ export declare const fromSeconds: (value: number) => Duration;
8
+ export declare const toSeconds: (duration: Duration) => number;
9
+ export declare const fromMinutes: (value: number) => Duration;
10
+ export declare const toMinutes: (duration: Duration) => number;
11
+ export declare const fromHours: (value: number) => Duration;
12
+ export declare const toHours: (duration: Duration) => number;
13
+ export declare const fromDays: (value: number) => Duration;
14
+ export declare const toDays: (duration: Duration) => number;
15
15
  export declare const Zero: Duration;
16
16
  export declare const OneDay: Duration;
17
17
  export declare const OneHour: Duration;
@@ -1 +1 @@
1
- {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../src/duration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAY,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAElC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AACrD,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAuB,CAAA;AAEpE,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,QAE9C,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,UAAU,QAAQ,KAAG,MAEnD,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,QAEzC,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,UAAU,QAAQ,KAAG,MAE9C,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,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C,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,KAAG,QAExC,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,UAAU,QAAQ,KAAG,MAE3C,CAAA;AAED,eAAO,MAAM,IAAI,UAAsB,CAAA;AACvC,eAAO,MAAM,MAAM,UAAc,CAAA;AACjC,eAAO,MAAM,OAAO,UAAe,CAAA"}
package/dist/duration.js CHANGED
@@ -1,53 +1,53 @@
1
1
  // src/duration.ts
2
2
  import Zod from "zod";
3
3
  var DurationSchema = Zod.number();
4
- var ofMilliseconds = (value) => {
4
+ var fromMilliseconds = (value) => {
5
5
  return value;
6
6
  };
7
- var inMilliseconds = (duration) => {
7
+ var toMilliseconds = (duration) => {
8
8
  return duration;
9
9
  };
10
- var ofSeconds = (value) => {
11
- return ofMilliseconds(value * 1e3);
10
+ var fromSeconds = (value) => {
11
+ return fromMilliseconds(value * 1e3);
12
12
  };
13
- var inSeconds = (duration) => {
14
- return inMilliseconds(duration) / 1e3;
13
+ var toSeconds = (duration) => {
14
+ return toMilliseconds(duration) / 1e3;
15
15
  };
16
- var ofMinutes = (value) => {
17
- return ofSeconds(value * 60);
16
+ var fromMinutes = (value) => {
17
+ return fromSeconds(value * 60);
18
18
  };
19
- var inMinutes = (duration) => {
20
- return inSeconds(duration) / 60;
19
+ var toMinutes = (duration) => {
20
+ return toSeconds(duration) / 60;
21
21
  };
22
- var ofHours = (value) => {
23
- return ofMinutes(value * 60);
22
+ var fromHours = (value) => {
23
+ return fromMinutes(value * 60);
24
24
  };
25
- var inHours = (duration) => {
26
- return inMinutes(duration) / 60;
25
+ var toHours = (duration) => {
26
+ return toMinutes(duration) / 60;
27
27
  };
28
- var ofDays = (value) => {
29
- return ofHours(value * 24);
28
+ var fromDays = (value) => {
29
+ return fromHours(value * 24);
30
30
  };
31
- var inDays = (duration) => {
32
- return inHours(duration) / 24;
31
+ var toDays = (duration) => {
32
+ return toHours(duration) / 24;
33
33
  };
34
- var Zero = ofMilliseconds(0);
35
- var OneDay = ofDays(1);
36
- var OneHour = ofHours(1);
34
+ var Zero = fromMilliseconds(0);
35
+ var OneDay = fromDays(1);
36
+ var OneHour = fromHours(1);
37
37
  export {
38
38
  DurationSchema,
39
39
  OneDay,
40
40
  OneHour,
41
41
  Zero,
42
- inDays,
43
- inHours,
44
- inMilliseconds,
45
- inMinutes,
46
- inSeconds,
47
- ofDays,
48
- ofHours,
49
- ofMilliseconds,
50
- ofMinutes,
51
- ofSeconds
42
+ fromDays,
43
+ fromHours,
44
+ fromMilliseconds,
45
+ fromMinutes,
46
+ fromSeconds,
47
+ toDays,
48
+ toHours,
49
+ toMilliseconds,
50
+ toMinutes,
51
+ toSeconds
52
52
  };
53
53
  //# sourceMappingURL=duration.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/duration.ts"],"sourcesContent":["import { TaggedType } from '@bessemer/cornerstone/types'\nimport Zod, { ZodType } from 'zod'\n\nexport type Duration = TaggedType<number, 'Duration'>\nexport const DurationSchema: ZodType<Duration> = Zod.number() as any\n\nexport const ofMilliseconds = (value: number): Duration => {\n return value as Duration\n}\n\nexport const inMilliseconds = (duration: Duration): number => {\n return duration\n}\n\nexport const ofSeconds = (value: number): Duration => {\n return ofMilliseconds(value * 1000)\n}\n\nexport const inSeconds = (duration: Duration): number => {\n return inMilliseconds(duration) / 1000\n}\n\nexport const ofMinutes = (value: number): Duration => {\n return ofSeconds(value * 60)\n}\n\nexport const inMinutes = (duration: Duration): number => {\n return inSeconds(duration) / 60\n}\n\nexport const ofHours = (value: number): Duration => {\n return ofMinutes(value * 60)\n}\n\nexport const inHours = (duration: Duration): number => {\n return inMinutes(duration) / 60\n}\n\nexport const ofDays = (value: number): Duration => {\n return ofHours(value * 24)\n}\n\nexport const inDays = (duration: Duration): number => {\n return inHours(duration) / 24\n}\n\nexport const Zero = ofMilliseconds(0)\nexport const OneDay = ofDays(1)\nexport const OneHour = ofHours(1)\n"],"mappings":";AACA,OAAO,SAAsB;AAGtB,IAAM,iBAAoC,IAAI,OAAO;AAErD,IAAM,iBAAiB,CAAC,UAA4B;AACzD,SAAO;AACT;AAEO,IAAM,iBAAiB,CAAC,aAA+B;AAC5D,SAAO;AACT;AAEO,IAAM,YAAY,CAAC,UAA4B;AACpD,SAAO,eAAe,QAAQ,GAAI;AACpC;AAEO,IAAM,YAAY,CAAC,aAA+B;AACvD,SAAO,eAAe,QAAQ,IAAI;AACpC;AAEO,IAAM,YAAY,CAAC,UAA4B;AACpD,SAAO,UAAU,QAAQ,EAAE;AAC7B;AAEO,IAAM,YAAY,CAAC,aAA+B;AACvD,SAAO,UAAU,QAAQ,IAAI;AAC/B;AAEO,IAAM,UAAU,CAAC,UAA4B;AAClD,SAAO,UAAU,QAAQ,EAAE;AAC7B;AAEO,IAAM,UAAU,CAAC,aAA+B;AACrD,SAAO,UAAU,QAAQ,IAAI;AAC/B;AAEO,IAAM,SAAS,CAAC,UAA4B;AACjD,SAAO,QAAQ,QAAQ,EAAE;AAC3B;AAEO,IAAM,SAAS,CAAC,aAA+B;AACpD,SAAO,QAAQ,QAAQ,IAAI;AAC7B;AAEO,IAAM,OAAO,eAAe,CAAC;AAC7B,IAAM,SAAS,OAAO,CAAC;AACvB,IAAM,UAAU,QAAQ,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/duration.ts"],"sourcesContent":["import { TaggedType } from '@bessemer/cornerstone/types'\nimport Zod, { ZodType } from 'zod'\n\nexport type Duration = TaggedType<number, 'Duration'>\nexport const DurationSchema: ZodType<Duration> = Zod.number() as any\n\nexport const fromMilliseconds = (value: number): Duration => {\n return value as Duration\n}\n\nexport const toMilliseconds = (duration: Duration): number => {\n return duration\n}\n\nexport const fromSeconds = (value: number): Duration => {\n return fromMilliseconds(value * 1000)\n}\n\nexport const toSeconds = (duration: Duration): number => {\n return toMilliseconds(duration) / 1000\n}\n\nexport const fromMinutes = (value: number): Duration => {\n return fromSeconds(value * 60)\n}\n\nexport const toMinutes = (duration: Duration): number => {\n return toSeconds(duration) / 60\n}\n\nexport const fromHours = (value: number): Duration => {\n return fromMinutes(value * 60)\n}\n\nexport const toHours = (duration: Duration): number => {\n return toMinutes(duration) / 60\n}\n\nexport const fromDays = (value: number): Duration => {\n return fromHours(value * 24)\n}\n\nexport const toDays = (duration: Duration): number => {\n return toHours(duration) / 24\n}\n\nexport const Zero = fromMilliseconds(0)\nexport const OneDay = fromDays(1)\nexport const OneHour = fromHours(1)\n"],"mappings":";AACA,OAAO,SAAsB;AAGtB,IAAM,iBAAoC,IAAI,OAAO;AAErD,IAAM,mBAAmB,CAAC,UAA4B;AAC3D,SAAO;AACT;AAEO,IAAM,iBAAiB,CAAC,aAA+B;AAC5D,SAAO;AACT;AAEO,IAAM,cAAc,CAAC,UAA4B;AACtD,SAAO,iBAAiB,QAAQ,GAAI;AACtC;AAEO,IAAM,YAAY,CAAC,aAA+B;AACvD,SAAO,eAAe,QAAQ,IAAI;AACpC;AAEO,IAAM,cAAc,CAAC,UAA4B;AACtD,SAAO,YAAY,QAAQ,EAAE;AAC/B;AAEO,IAAM,YAAY,CAAC,aAA+B;AACvD,SAAO,UAAU,QAAQ,IAAI;AAC/B;AAEO,IAAM,YAAY,CAAC,UAA4B;AACpD,SAAO,YAAY,QAAQ,EAAE;AAC/B;AAEO,IAAM,UAAU,CAAC,aAA+B;AACrD,SAAO,UAAU,QAAQ,IAAI;AAC/B;AAEO,IAAM,WAAW,CAAC,UAA4B;AACnD,SAAO,UAAU,QAAQ,EAAE;AAC7B;AAEO,IAAM,SAAS,CAAC,aAA+B;AACpD,SAAO,QAAQ,QAAQ,IAAI;AAC7B;AAEO,IAAM,OAAO,iBAAiB,CAAC;AAC/B,IAAM,SAAS,SAAS,CAAC;AACzB,IAAM,UAAU,UAAU,CAAC;","names":[]}
package/dist/index.d.ts CHANGED
@@ -41,5 +41,6 @@ import * as Misc from '@bessemer/cornerstone/misc';
41
41
  import * as Json from '@bessemer/cornerstone/json';
42
42
  import * as AspectRatios from '@bessemer/cornerstone/aspect-ratio';
43
43
  import * as DataSizes from '@bessemer/cornerstone/data-size';
44
- export { Objects, Functions, Arrays, Strings, Async, Maths, Sets, Dates, Comparators, Equalitors, Durations, Uris, Urls, Loggers, Errors, ErrorEvents, Preconditions, Uuids, Ulids, Entries, Hashes, Crypto, Globs, Ranges, Zod, Tags, Promises, References, Signatures, Eithers, Results, Lazy, Patches, Content, Combinables, Properties, RichTexts, Retry, Stores, Misc, Json, AspectRatios, DataSizes, };
44
+ import * as MimeTypes from '@bessemer/cornerstone/mime-type';
45
+ export { Objects, Functions, Arrays, Strings, Async, Maths, Sets, Dates, Comparators, Equalitors, Durations, Uris, Urls, Loggers, Errors, ErrorEvents, Preconditions, Uuids, Ulids, Entries, Hashes, Crypto, Globs, Ranges, Zod, Tags, Promises, References, Signatures, Eithers, Results, Lazy, Patches, Content, Combinables, Properties, RichTexts, Retry, Stores, Misc, Json, AspectRatios, DataSizes, MimeTypes, };
45
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAA;AACrD,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,KAAK,MAAM,6BAA6B,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAA;AACnD,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,kCAAkC,CAAA;AAC/D,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,SAAS,MAAM,gCAAgC,CAAA;AAC3D,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAA;AACjD,OAAO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D,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAA;AAClD,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAA;AAClD,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAClE,OAAO,KAAK,SAAS,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,SAAS,MAAM,iCAAiC,CAAA;AAE5D,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,WAAW,EACX,aAAa,EACb,KAAK,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACN,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,IAAI,EACJ,OAAO,EACP,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,SAAS,GACV,CAAA"}
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ import * as Misc from "@bessemer/cornerstone/misc";
42
42
  import * as Json from "@bessemer/cornerstone/json";
43
43
  import * as AspectRatios from "@bessemer/cornerstone/aspect-ratio";
44
44
  import * as DataSizes from "@bessemer/cornerstone/data-size";
45
+ import * as MimeTypes from "@bessemer/cornerstone/mime-type";
45
46
  export {
46
47
  Arrays,
47
48
  AspectRatios,
@@ -65,6 +66,7 @@ export {
65
66
  Lazy,
66
67
  Loggers,
67
68
  Maths,
69
+ MimeTypes,
68
70
  Misc,
69
71
  Objects,
70
72
  Patches,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Objects from '@bessemer/cornerstone/object'\nimport * as Functions from '@bessemer/cornerstone/function'\nimport * as Arrays from '@bessemer/cornerstone/array'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport * as Async from '@bessemer/cornerstone/async'\nimport * as Maths from '@bessemer/cornerstone/math'\nimport * as Sets from '@bessemer/cornerstone/set'\nimport * as Dates from '@bessemer/cornerstone/date'\nimport * as Comparators from '@bessemer/cornerstone/comparator'\nimport * as Equalitors from '@bessemer/cornerstone/equalitor'\nimport * as Durations from '@bessemer/cornerstone/duration'\nimport * as Uris from '@bessemer/cornerstone/uri'\nimport * as Urls from '@bessemer/cornerstone/url'\nimport * as Loggers from '@bessemer/cornerstone/logger'\nimport * as Errors from '@bessemer/cornerstone/error'\nimport * as ErrorEvents from '@bessemer/cornerstone/error-event'\nimport * as Preconditions from '@bessemer/cornerstone/precondition'\nimport * as Uuids from '@bessemer/cornerstone/uuid'\nimport * as Ulids from '@bessemer/cornerstone/ulid'\nimport * as Entries from '@bessemer/cornerstone/entry'\nimport * as Hashes from '@bessemer/cornerstone/hash'\nimport * as Crypto from '@bessemer/cornerstone/crypto'\nimport * as Globs from '@bessemer/cornerstone/glob'\nimport * as Ranges from '@bessemer/cornerstone/range'\n\nimport * as Zod from '@bessemer/cornerstone/zod'\nimport * as Tags from '@bessemer/cornerstone/tag'\nimport * as Promises from '@bessemer/cornerstone/promise'\nimport * as References from '@bessemer/cornerstone/reference'\nimport * as Signatures from '@bessemer/cornerstone/signature'\nimport * as Eithers from '@bessemer/cornerstone/either'\nimport * as Results from '@bessemer/cornerstone/result'\nimport * as Lazy from '@bessemer/cornerstone/lazy'\nimport * as Patches from '@bessemer/cornerstone/patch'\nimport * as Content from '@bessemer/cornerstone/content'\nimport * as Combinables from '@bessemer/cornerstone/combinable'\nimport * as Properties from '@bessemer/cornerstone/property'\nimport * as RichTexts from '@bessemer/cornerstone/rich-text'\nimport * as Retry from '@bessemer/cornerstone/retry'\nimport * as Stores from '@bessemer/cornerstone/store'\nimport * as Misc from '@bessemer/cornerstone/misc'\nimport * as Json from '@bessemer/cornerstone/json'\nimport * as AspectRatios from '@bessemer/cornerstone/aspect-ratio'\nimport * as DataSizes from '@bessemer/cornerstone/data-size'\n\nexport {\n Objects,\n Functions,\n Arrays,\n Strings,\n Async,\n Maths,\n Sets,\n Dates,\n Comparators,\n Equalitors,\n Durations,\n Uris,\n Urls,\n Loggers,\n Errors,\n ErrorEvents,\n Preconditions,\n Uuids,\n Ulids,\n Entries,\n Hashes,\n Crypto,\n Globs,\n Ranges,\n Zod,\n Tags,\n Promises,\n References,\n Signatures,\n Eithers,\n Results,\n Lazy,\n Patches,\n Content,\n Combinables,\n Properties,\n RichTexts,\n Retry,\n Stores,\n Misc,\n Json,\n AspectRatios,\n DataSizes,\n}\n"],"mappings":";AAAA,YAAY,aAAa;AACzB,YAAY,eAAe;AAC3B,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,WAAW;AACvB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,eAAe;AAC3B,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,iBAAiB;AAC7B,YAAY,mBAAmB;AAC/B,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,YAAY;AACxB,YAAY,WAAW;AACvB,YAAY,YAAY;AAExB,YAAY,SAAS;AACrB,YAAY,UAAU;AACtB,YAAY,cAAc;AAC1B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,eAAe;AAC3B,YAAY,WAAW;AACvB,YAAY,YAAY;AACxB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,kBAAkB;AAC9B,YAAY,eAAe;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as Objects from '@bessemer/cornerstone/object'\nimport * as Functions from '@bessemer/cornerstone/function'\nimport * as Arrays from '@bessemer/cornerstone/array'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport * as Async from '@bessemer/cornerstone/async'\nimport * as Maths from '@bessemer/cornerstone/math'\nimport * as Sets from '@bessemer/cornerstone/set'\nimport * as Dates from '@bessemer/cornerstone/date'\nimport * as Comparators from '@bessemer/cornerstone/comparator'\nimport * as Equalitors from '@bessemer/cornerstone/equalitor'\nimport * as Durations from '@bessemer/cornerstone/duration'\nimport * as Uris from '@bessemer/cornerstone/uri'\nimport * as Urls from '@bessemer/cornerstone/url'\nimport * as Loggers from '@bessemer/cornerstone/logger'\nimport * as Errors from '@bessemer/cornerstone/error'\nimport * as ErrorEvents from '@bessemer/cornerstone/error-event'\nimport * as Preconditions from '@bessemer/cornerstone/precondition'\nimport * as Uuids from '@bessemer/cornerstone/uuid'\nimport * as Ulids from '@bessemer/cornerstone/ulid'\nimport * as Entries from '@bessemer/cornerstone/entry'\nimport * as Hashes from '@bessemer/cornerstone/hash'\nimport * as Crypto from '@bessemer/cornerstone/crypto'\nimport * as Globs from '@bessemer/cornerstone/glob'\nimport * as Ranges from '@bessemer/cornerstone/range'\n\nimport * as Zod from '@bessemer/cornerstone/zod'\nimport * as Tags from '@bessemer/cornerstone/tag'\nimport * as Promises from '@bessemer/cornerstone/promise'\nimport * as References from '@bessemer/cornerstone/reference'\nimport * as Signatures from '@bessemer/cornerstone/signature'\nimport * as Eithers from '@bessemer/cornerstone/either'\nimport * as Results from '@bessemer/cornerstone/result'\nimport * as Lazy from '@bessemer/cornerstone/lazy'\nimport * as Patches from '@bessemer/cornerstone/patch'\nimport * as Content from '@bessemer/cornerstone/content'\nimport * as Combinables from '@bessemer/cornerstone/combinable'\nimport * as Properties from '@bessemer/cornerstone/property'\nimport * as RichTexts from '@bessemer/cornerstone/rich-text'\nimport * as Retry from '@bessemer/cornerstone/retry'\nimport * as Stores from '@bessemer/cornerstone/store'\nimport * as Misc from '@bessemer/cornerstone/misc'\nimport * as Json from '@bessemer/cornerstone/json'\nimport * as AspectRatios from '@bessemer/cornerstone/aspect-ratio'\nimport * as DataSizes from '@bessemer/cornerstone/data-size'\nimport * as MimeTypes from '@bessemer/cornerstone/mime-type'\n\nexport {\n Objects,\n Functions,\n Arrays,\n Strings,\n Async,\n Maths,\n Sets,\n Dates,\n Comparators,\n Equalitors,\n Durations,\n Uris,\n Urls,\n Loggers,\n Errors,\n ErrorEvents,\n Preconditions,\n Uuids,\n Ulids,\n Entries,\n Hashes,\n Crypto,\n Globs,\n Ranges,\n Zod,\n Tags,\n Promises,\n References,\n Signatures,\n Eithers,\n Results,\n Lazy,\n Patches,\n Content,\n Combinables,\n Properties,\n RichTexts,\n Retry,\n Stores,\n Misc,\n Json,\n AspectRatios,\n DataSizes,\n MimeTypes,\n}\n"],"mappings":";AAAA,YAAY,aAAa;AACzB,YAAY,eAAe;AAC3B,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,WAAW;AACvB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,eAAe;AAC3B,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,iBAAiB;AAC7B,YAAY,mBAAmB;AAC/B,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,YAAY;AACxB,YAAY,WAAW;AACvB,YAAY,YAAY;AAExB,YAAY,SAAS;AACrB,YAAY,UAAU;AACtB,YAAY,cAAc;AAC1B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,UAAU;AACtB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,iBAAiB;AAC7B,YAAY,gBAAgB;AAC5B,YAAY,eAAe;AAC3B,YAAY,WAAW;AACvB,YAAY,YAAY;AACxB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,kBAAkB;AAC9B,YAAY,eAAe;AAC3B,YAAY,eAAe;","names":[]}
@@ -0,0 +1,37 @@
1
+ import { TaggedType } from '@bessemer/cornerstone/types';
2
+ import { ZodType } from 'zod';
3
+ export type MimeType = TaggedType<string, 'MimeType'>;
4
+ export declare const MimeTypeSchema: ZodType<MimeType>;
5
+ export declare const of: (mimeType: string) => MimeType;
6
+ export declare const fromString: (mimeType: string) => MimeType;
7
+ export declare const Jpeg: MimeType;
8
+ export declare const Png: MimeType;
9
+ export declare const Gif: MimeType;
10
+ export declare const Webp: MimeType;
11
+ export declare const Svg: MimeType;
12
+ export declare const Ico: MimeType;
13
+ export declare const Avif: MimeType;
14
+ export declare const Mp4: MimeType;
15
+ export declare const Webm: MimeType;
16
+ export declare const OggVideo: MimeType;
17
+ export declare const Mp3: MimeType;
18
+ export declare const OggAudio: MimeType;
19
+ export declare const Wav: MimeType;
20
+ export declare const Pdf: MimeType;
21
+ export declare const Json: MimeType;
22
+ export declare const Csv: MimeType;
23
+ export declare const PlainText: MimeType;
24
+ export declare const Html: MimeType;
25
+ export declare const Xml: MimeType;
26
+ export declare const Woff: MimeType;
27
+ export declare const Woff2: MimeType;
28
+ export declare const Ttf: MimeType;
29
+ export declare const Otf: MimeType;
30
+ export declare const Zip: MimeType;
31
+ export declare const Gzip: MimeType;
32
+ export declare const Tar: MimeType;
33
+ export declare const Brotli: MimeType;
34
+ export declare const FormData: MimeType;
35
+ export declare const Javascript: MimeType;
36
+ export declare const OctetStream: MimeType;
37
+ //# sourceMappingURL=mime-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime-type.d.ts","sourceRoot":"","sources":["../src/mime-type.ts"],"names":[],"mappings":"AAAA,O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M,GAAG,UAAwB,CAAA;AACxC,eAAO,MAAM,IAAI,UAAyB,CAAA;AAC1C,eAAO,MAAM,GAAG,UAA0B,CAAA;AAC1C,eAAO,MAAM,MAAM,UAA6B,CAAA;AAGhD,eAAO,MAAM,QAAQ,UAA4B,CAAA;AACjD,eAAO,MAAM,UAAU,UAA+B,CAAA;AACtD,eAAO,MAAM,WAAW,UAAiC,CAAA"}
@@ -0,0 +1,75 @@
1
+ // src/mime-type.ts
2
+ import Zod from "zod";
3
+ var MimeTypeSchema = Zod.string().regex(/^[\w-]+\/[\w.+-]+$/, "Invalid MIME type format");
4
+ var of = (mimeType) => {
5
+ return mimeType;
6
+ };
7
+ var fromString = (mimeType) => {
8
+ return MimeTypeSchema.parse(mimeType);
9
+ };
10
+ var Jpeg = of("image/jpeg");
11
+ var Png = of("image/png");
12
+ var Gif = of("image/gif");
13
+ var Webp = of("image/webp");
14
+ var Svg = of("image/svg+xml");
15
+ var Ico = of("image/x-icon");
16
+ var Avif = of("image/avif");
17
+ var Mp4 = of("video/mp4");
18
+ var Webm = of("video/webm");
19
+ var OggVideo = of("video/ogg");
20
+ var Mp3 = of("audio/mpeg");
21
+ var OggAudio = of("audio/ogg");
22
+ var Wav = of("audio/wav");
23
+ var Pdf = of("application/pdf");
24
+ var Json = of("application/json");
25
+ var Csv = of("text/csv");
26
+ var PlainText = of("text/plain");
27
+ var Html = of("text/html");
28
+ var Xml = of("application/xml");
29
+ var Woff = of("font/woff");
30
+ var Woff2 = of("font/woff2");
31
+ var Ttf = of("font/ttf");
32
+ var Otf = of("font/otf");
33
+ var Zip = of("application/zip");
34
+ var Gzip = of("application/gzip");
35
+ var Tar = of("application/x-tar");
36
+ var Brotli = of("application/x-brotli");
37
+ var FormData = of("multipart/form-data");
38
+ var Javascript = of("application/javascript");
39
+ var OctetStream = of("application/octet-stream");
40
+ export {
41
+ Avif,
42
+ Brotli,
43
+ Csv,
44
+ FormData,
45
+ Gif,
46
+ Gzip,
47
+ Html,
48
+ Ico,
49
+ Javascript,
50
+ Jpeg,
51
+ Json,
52
+ MimeTypeSchema,
53
+ Mp3,
54
+ Mp4,
55
+ OctetStream,
56
+ OggAudio,
57
+ OggVideo,
58
+ Otf,
59
+ Pdf,
60
+ PlainText,
61
+ Png,
62
+ Svg,
63
+ Tar,
64
+ Ttf,
65
+ Wav,
66
+ Webm,
67
+ Webp,
68
+ Woff,
69
+ Woff2,
70
+ Xml,
71
+ Zip,
72
+ fromString,
73
+ of
74
+ };
75
+ //# sourceMappingURL=mime-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mime-type.ts"],"sourcesContent":["import { TaggedType } from '@bessemer/cornerstone/types'\nimport Zod, { ZodType } from 'zod'\n\nexport type MimeType = TaggedType<string, 'MimeType'>\nexport const MimeTypeSchema: ZodType<MimeType> = Zod.string().regex(/^[\\w-]+\\/[\\w.+-]+$/, 'Invalid MIME type format') as any\n\nexport const of = (mimeType: string): MimeType => {\n return mimeType as MimeType\n}\n\nexport const fromString = (mimeType: string): MimeType => {\n return MimeTypeSchema.parse(mimeType)\n}\n\n// Images\nexport const Jpeg = of('image/jpeg')\nexport const Png = of('image/png')\nexport const Gif = of('image/gif')\nexport const Webp = of('image/webp')\nexport const Svg = of('image/svg+xml')\nexport const Ico = of('image/x-icon')\nexport const Avif = of('image/avif')\n\n// Video\nexport const Mp4 = of('video/mp4')\nexport const Webm = of('video/webm')\nexport const OggVideo = of('video/ogg')\n\n// Audio\nexport const Mp3 = of('audio/mpeg')\nexport const OggAudio = of('audio/ogg')\nexport const Wav = of('audio/wav')\n\n// Documents\nexport const Pdf = of('application/pdf')\nexport const Json = of('application/json')\nexport const Csv = of('text/csv')\nexport const PlainText = of('text/plain')\nexport const Html = of('text/html')\nexport const Xml = of('application/xml')\n\n// Fonts\nexport const Woff = of('font/woff')\nexport const Woff2 = of('font/woff2')\nexport const Ttf = of('font/ttf')\nexport const Otf = of('font/otf')\n\n// Zip\nexport const Zip = of('application/zip')\nexport const Gzip = of('application/gzip')\nexport const Tar = of('application/x-tar')\nexport const Brotli = of('application/x-brotli')\n\n// Misc\nexport const FormData = of('multipart/form-data')\nexport const Javascript = of('application/javascript')\nexport const OctetStream = of('application/octet-stream')\n"],"mappings":";AACA,OAAO,SAAsB;AAGtB,IAAM,iBAAoC,IAAI,OAAO,EAAE,MAAM,sBAAsB,0BAA0B;AAE7G,IAAM,KAAK,CAAC,aAA+B;AAChD,SAAO;AACT;AAEO,IAAM,aAAa,CAAC,aAA+B;AACxD,SAAO,eAAe,MAAM,QAAQ;AACtC;AAGO,IAAM,OAAO,GAAG,YAAY;AAC5B,IAAM,MAAM,GAAG,WAAW;AAC1B,IAAM,MAAM,GAAG,WAAW;AAC1B,IAAM,OAAO,GAAG,YAAY;AAC5B,IAAM,MAAM,GAAG,eAAe;AAC9B,IAAM,MAAM,GAAG,cAAc;AAC7B,IAAM,OAAO,GAAG,YAAY;AAG5B,IAAM,MAAM,GAAG,WAAW;AAC1B,IAAM,OAAO,GAAG,YAAY;AAC5B,IAAM,WAAW,GAAG,WAAW;AAG/B,IAAM,MAAM,GAAG,YAAY;AAC3B,IAAM,WAAW,GAAG,WAAW;AAC/B,IAAM,MAAM,GAAG,WAAW;AAG1B,IAAM,MAAM,GAAG,iBAAiB;AAChC,IAAM,OAAO,GAAG,kBAAkB;AAClC,IAAM,MAAM,GAAG,UAAU;AACzB,IAAM,YAAY,GAAG,YAAY;AACjC,IAAM,OAAO,GAAG,WAAW;AAC3B,IAAM,MAAM,GAAG,iBAAiB;AAGhC,IAAM,OAAO,GAAG,WAAW;AAC3B,IAAM,QAAQ,GAAG,YAAY;AAC7B,IAAM,MAAM,GAAG,UAAU;AACzB,IAAM,MAAM,GAAG,UAAU;AAGzB,IAAM,MAAM,GAAG,iBAAiB;AAChC,IAAM,OAAO,GAAG,kBAAkB;AAClC,IAAM,MAAM,GAAG,mBAAmB;AAClC,IAAM,SAAS,GAAG,sBAAsB;AAGxC,IAAM,WAAW,GAAG,qBAAqB;AACzC,IAAM,aAAa,GAAG,wBAAwB;AAC9C,IAAM,cAAc,GAAG,0BAA0B;","names":[]}
package/dist/retry.js CHANGED
@@ -6,7 +6,7 @@ var None = {
6
6
  };
7
7
  var DefaultRetryProps = {
8
8
  attempts: 3,
9
- delay: Durations.ofMilliseconds(500)
9
+ delay: Durations.fromMilliseconds(500)
10
10
  };
11
11
  var initialize = (initialOptions) => {
12
12
  const props = Objects.deepMerge(DefaultRetryProps, initialOptions);
@@ -20,9 +20,9 @@ var retry = async (state) => {
20
20
  if (state.attempt >= state.props.attempts - 1) {
21
21
  return void 0;
22
22
  }
23
- const delayMs = Durations.inMilliseconds(state.props.delay);
23
+ const delayMs = Durations.toMilliseconds(state.props.delay);
24
24
  const maxJitterMs = delayMs * 0.3;
25
- await Async.sleep(Durations.ofMilliseconds(delayMs + Maths.random(0, maxJitterMs)));
25
+ await Async.sleep(Durations.fromMilliseconds(delayMs + Maths.random(0, maxJitterMs)));
26
26
  return {
27
27
  props: state.props,
28
28
  attempt: state.attempt + 1
package/dist/retry.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/retry.ts"],"sourcesContent":["import { Duration } from '@bessemer/cornerstone/duration'\nimport { Async, Durations, Maths, Objects, Preconditions, Results } from '@bessemer/cornerstone'\nimport { AsyncResult, Result } from '@bessemer/cornerstone/result'\nimport { PartialDeep } from 'type-fest'\n\nexport type RetryProps = {\n attempts: number\n delay: Duration\n}\n\nexport type RetryOptions = PartialDeep<RetryProps>\n\nexport const None: RetryProps = {\n attempts: 0,\n delay: Durations.Zero,\n}\n\nexport const DefaultRetryProps: RetryProps = {\n attempts: 3,\n delay: Durations.ofMilliseconds(500),\n}\n\nexport type RetryState = {\n attempt: number\n props: RetryProps\n}\n\nexport const initialize = (initialOptions?: RetryOptions): RetryState => {\n const props = Objects.deepMerge(DefaultRetryProps, initialOptions)\n Preconditions.isTrue(props.attempts >= 0, () => 'usingRetry attempts must be >= 0')\n\n return {\n attempt: 0,\n props,\n }\n}\n\nexport const retry = async (state: RetryState): Promise<RetryState | undefined> => {\n if (state.attempt >= state.props.attempts - 1) {\n return undefined\n }\n\n const delayMs = Durations.inMilliseconds(state.props.delay)\n const maxJitterMs = delayMs * 0.3 // We calculate max jitter as 30% of the delay\n await Async.sleep(Durations.ofMilliseconds(delayMs + Maths.random(0, maxJitterMs)))\n\n return {\n props: state.props,\n attempt: state.attempt + 1,\n }\n}\n\nexport const usingRetry = async <T>(runnable: () => Promise<Result<T>>, initialOptions?: RetryOptions): AsyncResult<T> => {\n let retryState: RetryState | undefined = initialize(initialOptions)\n let previousResult: Result<T> = Results.failure()\n\n do {\n // JOHN Should this be a try/catch? it was causing debugging problems\n const result = await runnable()\n previousResult = result\n\n if (result.isSuccess) {\n return result\n }\n\n retryState = await retry(retryState)\n } while (!Objects.isUndefined(retryState))\n\n return previousResult\n}\n"],"mappings":";AACA,SAAS,OAAO,WAAW,OAAO,SAAS,eAAe,eAAe;AAWlE,IAAM,OAAmB;AAAA,EAC9B,UAAU;AAAA,EACV,OAAO,UAAU;AACnB;AAEO,IAAM,oBAAgC;AAAA,EAC3C,UAAU;AAAA,EACV,OAAO,UAAU,eAAe,GAAG;AACrC;AAOO,IAAM,aAAa,CAAC,mBAA8C;AACvE,QAAM,QAAQ,QAAQ,UAAU,mBAAmB,cAAc;AACjE,gBAAc,OAAO,MAAM,YAAY,GAAG,MAAM,kCAAkC;AAElF,SAAO;AAAA,IACL,SAAS;AAAA,IACT;AAAA,EACF;AACF;AAEO,IAAM,QAAQ,OAAO,UAAuD;AACjF,MAAI,MAAM,WAAW,MAAM,MAAM,WAAW,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,UAAU,eAAe,MAAM,MAAM,KAAK;AAC1D,QAAM,cAAc,UAAU;AAC9B,QAAM,MAAM,MAAM,UAAU,eAAe,UAAU,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC;AAElF,SAAO;AAAA,IACL,OAAO,MAAM;AAAA,IACb,SAAS,MAAM,UAAU;AAAA,EAC3B;AACF;AAEO,IAAM,aAAa,OAAU,UAAoC,mBAAkD;AACxH,MAAI,aAAqC,WAAW,cAAc;AAClE,MAAI,iBAA4B,QAAQ,QAAQ;AAEhD,KAAG;AAED,UAAM,SAAS,MAAM,SAAS;AAC9B,qBAAiB;AAEjB,QAAI,OAAO,WAAW;AACpB,aAAO;AAAA,IACT;AAEA,iBAAa,MAAM,MAAM,UAAU;AAAA,EACrC,SAAS,CAAC,QAAQ,YAAY,UAAU;AAExC,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/retry.ts"],"sourcesContent":["import { Duration } from '@bessemer/cornerstone/duration'\nimport { Async, Durations, Maths, Objects, Preconditions, Results } from '@bessemer/cornerstone'\nimport { AsyncResult, Result } from '@bessemer/cornerstone/result'\nimport { PartialDeep } from 'type-fest'\n\nexport type RetryProps = {\n attempts: number\n delay: Duration\n}\n\nexport type RetryOptions = PartialDeep<RetryProps>\n\nexport const None: RetryProps = {\n attempts: 0,\n delay: Durations.Zero,\n}\n\nexport const DefaultRetryProps: RetryProps = {\n attempts: 3,\n delay: Durations.fromMilliseconds(500),\n}\n\nexport type RetryState = {\n attempt: number\n props: RetryProps\n}\n\nexport const initialize = (initialOptions?: RetryOptions): RetryState => {\n const props = Objects.deepMerge(DefaultRetryProps, initialOptions)\n Preconditions.isTrue(props.attempts >= 0, () => 'usingRetry attempts must be >= 0')\n\n return {\n attempt: 0,\n props,\n }\n}\n\nexport const retry = async (state: RetryState): Promise<RetryState | undefined> => {\n if (state.attempt >= state.props.attempts - 1) {\n return undefined\n }\n\n const delayMs = Durations.toMilliseconds(state.props.delay)\n const maxJitterMs = delayMs * 0.3 // We calculate max jitter as 30% of the delay\n await Async.sleep(Durations.fromMilliseconds(delayMs + Maths.random(0, maxJitterMs)))\n\n return {\n props: state.props,\n attempt: state.attempt + 1,\n }\n}\n\nexport const usingRetry = async <T>(runnable: () => Promise<Result<T>>, initialOptions?: RetryOptions): AsyncResult<T> => {\n let retryState: RetryState | undefined = initialize(initialOptions)\n let previousResult: Result<T> = Results.failure()\n\n do {\n // JOHN Should this be a try/catch? it was causing debugging problems\n const result = await runnable()\n previousResult = result\n\n if (result.isSuccess) {\n return result\n }\n\n retryState = await retry(retryState)\n } while (!Objects.isUndefined(retryState))\n\n return previousResult\n}\n"],"mappings":";AACA,SAAS,OAAO,WAAW,OAAO,SAAS,eAAe,eAAe;AAWlE,IAAM,OAAmB;AAAA,EAC9B,UAAU;AAAA,EACV,OAAO,UAAU;AACnB;AAEO,IAAM,oBAAgC;AAAA,EAC3C,UAAU;AAAA,EACV,OAAO,UAAU,iBAAiB,GAAG;AACvC;AAOO,IAAM,aAAa,CAAC,mBAA8C;AACvE,QAAM,QAAQ,QAAQ,UAAU,mBAAmB,cAAc;AACjE,gBAAc,OAAO,MAAM,YAAY,GAAG,MAAM,kCAAkC;AAElF,SAAO;AAAA,IACL,SAAS;AAAA,IACT;AAAA,EACF;AACF;AAEO,IAAM,QAAQ,OAAO,UAAuD;AACjF,MAAI,MAAM,WAAW,MAAM,MAAM,WAAW,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,UAAU,eAAe,MAAM,MAAM,KAAK;AAC1D,QAAM,cAAc,UAAU;AAC9B,QAAM,MAAM,MAAM,UAAU,iBAAiB,UAAU,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC;AAEpF,SAAO;AAAA,IACL,OAAO,MAAM;AAAA,IACb,SAAS,MAAM,UAAU;AAAA,EAC3B;AACF;AAEO,IAAM,aAAa,OAAU,UAAoC,mBAAkD;AACxH,MAAI,aAAqC,WAAW,cAAc;AAClE,MAAI,iBAA4B,QAAQ,QAAQ;AAEhD,KAAG;AAED,UAAM,SAAS,MAAM,SAAS;AAC9B,qBAAiB;AAEjB,QAAI,OAAO,WAAW;AACpB,aAAO;AAAA,IACT;AAEA,iBAAa,MAAM,MAAM,UAAU;AAAA,EACrC,SAAS,CAAC,QAAQ,YAAY,UAAU;AAExC,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bessemer/cornerstone",
3
3
  "type": "module",
4
- "version": "0.5.47",
4
+ "version": "0.5.49",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "sideEffects": false,