@omegup/msync 0.1.47 → 0.1.48

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/index.d.ts CHANGED
@@ -39,6 +39,7 @@ interface RawObj {
39
39
  type raw = readonly rawItem[] | RawObj;
40
40
  type StrKey<T> = string & keyof T;
41
41
  type Replace<R, V> = Omit<R, StrKey<V>> & V & O;
42
+ type ReplaceQ<R extends Q, VV, Q extends O> = Omit<R, StrKey<VV>> & Omit<VV, StrKey<Q>> & Q;
42
43
  type AsLiteral<T extends keyof any | boolean | N, V = NoUnion<T>> = T extends keyof any ? {} extends {
43
44
  [K in T]: 1;
44
45
  } ? never : V : V;
@@ -206,10 +207,10 @@ type BoolExpr<in D1, in D2, in Ctx = unknown> = {
206
207
 
207
208
  type ExactPart<T, F extends HKT<T[StrKey<T>]>> = MapOPart<T, MappedHKT<T, F>>;
208
209
  type ExactKeys<K extends string> = Exact<RORec<K, 1>, IdHKT>;
209
- type MapO<T, F extends HKT<StrKey<T>>> = MapOPart<T, F> & {
210
- readonly [P: string]: readonly [StrKey<T>, unknown];
210
+ type MapO<T, F extends HKT<K>, K extends StrKey<T> = StrKey<T>> = MapOPart<T, F, K> & {
211
+ readonly [P: string]: readonly [K, unknown];
211
212
  };
212
- type MapOPart<T, F extends HKT<StrKey<T>>, K extends keyof T = StrKey<T>> = {
213
+ type MapOPart<T, F extends HKT<K>, K extends keyof T = StrKey<T>> = {
213
214
  readonly [P in K]: readonly [P, App<F, P & string>];
214
215
  };
215
216
  type Exact<T, F extends HKT<T[StrKey<T>]>> = MapO<T, MappedHKT<T, F>>;
@@ -419,17 +420,17 @@ declare const $merge2: <T extends O, Out extends O = T, Ctx = unknown, In extend
419
420
 
420
421
  type GI$1<GG> = Exclude<GG, keyof TS>;
421
422
  type IdAndTsKeys = keyof (TS & ID);
422
- type V<VV, GG extends string> = Omit<VV, IdAndTsKeys | GI$1<GG>>;
423
+ type V$1<VV, GG extends string> = Omit<VV, IdAndTsKeys | GI$1<GG>>;
423
424
  type Prepare<Grp, GG extends string> = TS & ID & Rec<GI$1<GG>, Grp>;
424
425
  type Par<T> = {
425
426
  [P in keyof T]?: T[P] | null;
426
427
  };
427
- type Loose<Grp, VV, GG extends string> = Prepare<Grp, GG> & Par<V<VV, GG>>;
428
- type Strict<Grp, VV, GG extends string, EE> = Prepare<Grp, GG> & V<VV, GG> & Omit<EE, IdAndTsKeys | GI$1<GG> | keyof V<VV, GG>>;
429
- type V_Grp<VV, GG extends string, Grp> = Rec<GI$1<GG>, Grp> & V<VV, GG>;
430
- type Extra<EE, VV, GG extends string> = Omit<EE, IdAndTsKeys | GI$1<GG> | keyof V<VV, GG>>;
428
+ type Loose<Grp, VV, GG extends string> = Prepare<Grp, GG> & Par<V$1<VV, GG>>;
429
+ type Strict<Grp, VV, GG extends string, EE> = Prepare<Grp, GG> & V$1<VV, GG> & Omit<EE, IdAndTsKeys | GI$1<GG> | keyof V$1<VV, GG>>;
430
+ type V_Grp<VV, GG extends string, Grp> = Rec<GI$1<GG>, Grp> & V$1<VV, GG>;
431
+ type Extra<EE, VV, GG extends string> = Omit<EE, IdAndTsKeys | GI$1<GG> | keyof V$1<VV, GG>>;
431
432
  type OrReplace<T, V> = T | Replace<T, V>;
432
- type MergedInput<Out, VV, Grp, GG extends string, EE> = OrReplace<Replace<Replace<Out, V<VV, GG>>, Extra<EE, VV, GG>> & Model, TS & ID & V_Grp<VV, GG, Grp> & Extra<EE, VV, GG>>;
433
+ type MergedInput<Out, VV, Grp, GG extends string, EE> = OrReplace<Replace<Replace<Out, V$1<VV, GG>>, Extra<EE, VV, GG>> & Model, TS & ID & V_Grp<VV, GG, Grp> & Extra<EE, VV, GG>>;
433
434
 
434
435
  type Denied<GID = never> = keyof (TS & ID) | GID;
435
436
  type GI<GG> = Exclude<GG, keyof TS>;
@@ -465,14 +466,18 @@ type Updater<in R, in T, out V, in C = unknown> = {
465
466
  [Type]?(x: typeof Updater, r: R, t: T, c: C): V;
466
467
  readonly raw: <D extends O>(f: Field<D, R | N>) => readonly (readonly [string, rawItem])[];
467
468
  };
468
- interface UpdaterHKT<R, Old, V, C, K extends keyof Old = keyof Old, V2 extends V = V> extends HKT<StrKey<V>> {
469
- readonly out: Updater<R, Get<Old, I<StrKey<V>, this>, K>, V2[I<StrKey<V>, this>], C>;
469
+ interface UpdaterHKT<R, Old, V, C, K extends keyof Old = keyof Old, V2 extends V = V> extends UpdaterQHKT<R, Old, V2, StrKey<V>, C, K> {
470
+ }
471
+ interface UpdaterQHKT<R, Old, V, KV extends StrKey<V>, C, K extends keyof Old = keyof Old> extends HKT<KV> {
472
+ readonly out: Updater<R, Get<Old, I<KV, this>, K>, V[I<KV, this>], C>;
470
473
  }
471
474
  type Get<T, P extends string, K extends keyof T = never> = P extends K ? T[P] : P extends keyof T ? T[P] : undefined;
472
475
  declare const set: <V>() => <R, Old extends notArr, C = unknown, K extends keyof Old = never>(fields: MapO<V, UpdaterHKT<R, Old, V, C, K>>) => Updater<R, Old, O & Omit$1<Old, StrKey<V>> & V, C> & Updater<R, Arr<Old>, Arr<Omit$1<Old, StrKey<V>> & V>, C>;
473
476
  declare const to: <R, V, C = unknown, T = unknown>(expr: Expr<V, R, C>) => Updater<R, T, V, C>;
474
477
 
475
- declare const $set: <V extends O>() => <R extends O, C = unknown>(fields: MapO<V, UpdaterHKT<R, R, V, C>>) => DeltaStages<O, R, Replace<R, V>, C> & LinStages<O, R, Replace<R, V>, C>;
478
+ type V<VV, Q> = Exclude<StrKey<VV>, StrKey<Q>>;
479
+ type $Set<VV extends O, Q extends O> = <R extends Q, C = unknown>(fields: MapO<Omit<VV, StrKey<Q>>, UpdaterQHKT<R, R, VV, V<VV, Q>, C>, V<VV, Q>>) => DeltaStages<Q, R, Q & ReplaceQ<R, VV, Q>, C> & LinStages<Q, R, Q & ReplaceQ<R, VV, Q>, C>;
480
+ declare const $set: <VV extends O, Q extends O = O>() => $Set<VV, Q>;
476
481
  declare const $replaceWith: <T extends O, V extends O>(expr: Expr<V, T>) => DeltaStages<O, T, V> & LinStages<O, T, V>;
477
482
 
478
483
  type s$1 = string;
package/index.esm.js CHANGED
@@ -864,11 +864,17 @@ const $map1 = (ex, map) => $map0({ input: ex, as: 'item', expr: map(ctx()('item'
864
864
  const $map = (ex, map) => $map1(ex, i => map(i.expr()));
865
865
 
866
866
  const subUpdater = (a, f) => ({ raw: (g) => a.raw(g.with(f)) });
867
+ const rawSet = (fields) => (f) => {
868
+ return Object.entries(mapExactToObject0(fields, v => v)).flatMap(([k, v]) => v.raw(f).map(([l, v]) => [`.${k}${l}`, v]));
869
+ };
867
870
  const set = () => (fields) => ({
868
- raw: f => {
869
- return Object.entries(mapExactToObject0(fields, v => v)).flatMap(([k, v]) => v.raw(f).map(([l, v]) => [`.${k}${l}`, v]));
870
- },
871
+ raw: rawSet(fields),
871
872
  });
873
+ const setQ = () => {
874
+ return (fields) => ({
875
+ raw: rawSet(fields),
876
+ });
877
+ };
872
878
  const weaken = (updater) => ({ raw: f => updater.raw(f) });
873
879
  const to = (expr) => ({
874
880
  raw: f => [['', expr.raw(f).get()]],
@@ -1711,9 +1717,7 @@ const $setCore = (updater) => ({
1711
1717
  raw: $set1(updater),
1712
1718
  lin: $set_(updater),
1713
1719
  });
1714
- const $set = () => (fields) => {
1715
- return $setCore(set()(fields));
1716
- };
1720
+ const $set = () => (fields) => $setCore(setQ()(fields));
1717
1721
  const $replaceWith = (expr) => ({
1718
1722
  delta: $replaceWithDelta(expr),
1719
1723
  raw: $replaceWith1(expr),
package/index.js CHANGED
@@ -866,11 +866,17 @@ const $map1 = (ex, map) => $map0({ input: ex, as: 'item', expr: map(ctx()('item'
866
866
  const $map = (ex, map) => $map1(ex, i => map(i.expr()));
867
867
 
868
868
  const subUpdater = (a, f) => ({ raw: (g) => a.raw(g.with(f)) });
869
+ const rawSet = (fields) => (f) => {
870
+ return Object.entries(mapExactToObject0(fields, v => v)).flatMap(([k, v]) => v.raw(f).map(([l, v]) => [`.${k}${l}`, v]));
871
+ };
869
872
  const set = () => (fields) => ({
870
- raw: f => {
871
- return Object.entries(mapExactToObject0(fields, v => v)).flatMap(([k, v]) => v.raw(f).map(([l, v]) => [`.${k}${l}`, v]));
872
- },
873
+ raw: rawSet(fields),
873
874
  });
875
+ const setQ = () => {
876
+ return (fields) => ({
877
+ raw: rawSet(fields),
878
+ });
879
+ };
874
880
  const weaken = (updater) => ({ raw: f => updater.raw(f) });
875
881
  const to = (expr) => ({
876
882
  raw: f => [['', expr.raw(f).get()]],
@@ -1713,9 +1719,7 @@ const $setCore = (updater) => ({
1713
1719
  raw: $set1(updater),
1714
1720
  lin: $set_(updater),
1715
1721
  });
1716
- const $set = () => (fields) => {
1717
- return $setCore(set()(fields));
1718
- };
1722
+ const $set = () => (fields) => $setCore(setQ()(fields));
1719
1723
  const $replaceWith = (expr) => ({
1720
1724
  delta: $replaceWithDelta(expr),
1721
1725
  raw: $replaceWith1(expr),
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "module": "index.esm.js",
4
4
  "typings": "index.d.ts",
5
5
  "name": "@omegup/msync",
6
- "version": "0.1.47",
6
+ "version": "0.1.48",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",