@wovin/core 0.0.5 → 0.0.6

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.
Files changed (57) hide show
  1. package/dist/applog/applog-helpers.d.ts +4 -4
  2. package/dist/applog/applog-helpers.d.ts.map +1 -1
  3. package/dist/applog.min.js +1 -1
  4. package/dist/chunk-5Q6PAAMY.min.js +2 -0
  5. package/dist/chunk-5Q6PAAMY.min.js.map +1 -0
  6. package/dist/chunk-BR5DELY4.min.js +2 -0
  7. package/dist/chunk-BR5DELY4.min.js.map +1 -0
  8. package/dist/chunk-D6REGRIL.min.js +2 -0
  9. package/dist/chunk-D6REGRIL.min.js.map +1 -0
  10. package/dist/{chunk-FPUMKLJ4.min.js → chunk-IVEP7DZW.min.js} +21 -21
  11. package/dist/{chunk-FPUMKLJ4.min.js.map → chunk-IVEP7DZW.min.js.map} +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.min.js +1 -1
  14. package/dist/index.min.js.map +1 -1
  15. package/dist/mobx/mobx-utils.d.ts +6 -6
  16. package/dist/mobx/mobx-utils.d.ts.map +1 -1
  17. package/dist/pubsub/publication.d.ts +2 -2
  18. package/dist/pubsub/publication.d.ts.map +1 -1
  19. package/dist/pubsub.min.js +1 -1
  20. package/dist/query/basic.d.ts +19 -19
  21. package/dist/query/basic.d.ts.map +1 -1
  22. package/dist/query/divergences.d.ts +5 -5
  23. package/dist/query/divergences.d.ts.map +1 -1
  24. package/dist/query.min.js +1 -1
  25. package/dist/thread/basic.d.ts +36 -0
  26. package/dist/thread/basic.d.ts.map +1 -0
  27. package/dist/thread/filters.d.ts +38 -0
  28. package/dist/thread/filters.d.ts.map +1 -0
  29. package/dist/thread/mapped.d.ts +19 -0
  30. package/dist/thread/mapped.d.ts.map +1 -0
  31. package/dist/thread/writeable.d.ts +17 -0
  32. package/dist/thread/writeable.d.ts.map +1 -0
  33. package/dist/thread.d.ts +5 -0
  34. package/dist/thread.d.ts.map +1 -0
  35. package/dist/thread.min.js +2 -0
  36. package/dist/types/typescript-utils.d.ts +2 -2
  37. package/dist/types/typescript-utils.d.ts.map +1 -1
  38. package/dist/types.min.js +1 -1
  39. package/package.json +4 -4
  40. package/dist/chunk-3DTRPG63.min.js +0 -2
  41. package/dist/chunk-3DTRPG63.min.js.map +0 -1
  42. package/dist/chunk-MBXUXVXG.min.js +0 -2
  43. package/dist/chunk-MBXUXVXG.min.js.map +0 -1
  44. package/dist/chunk-PMJNK5VR.min.js +0 -2
  45. package/dist/chunk-PMJNK5VR.min.js.map +0 -1
  46. package/dist/stream/basic.d.ts +0 -36
  47. package/dist/stream/basic.d.ts.map +0 -1
  48. package/dist/stream/filters.d.ts +0 -38
  49. package/dist/stream/filters.d.ts.map +0 -1
  50. package/dist/stream/mapped.d.ts +0 -19
  51. package/dist/stream/mapped.d.ts.map +0 -1
  52. package/dist/stream/writeable.d.ts +0 -17
  53. package/dist/stream/writeable.d.ts.map +0 -1
  54. package/dist/stream.d.ts +0 -5
  55. package/dist/stream.d.ts.map +0 -1
  56. package/dist/stream.min.js +0 -2
  57. /package/dist/{stream.min.js.map → thread.min.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -3,6 +3,6 @@ export * from './applog';
3
3
  export * from './ipfs';
4
4
  export * from './pubsub';
5
5
  export * from './query';
6
- export * from './stream';
6
+ export * from './thread';
7
7
  export * from './types';
8
8
  //# sourceMappingURL=index.d.ts.map
package/dist/index.min.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-7IDQIMQO.min.js";import"./chunk-RPPZKO5L.min.js";import{a as Go,b as Ho,c as Io,d as Jo,e as Ko,f as Lo}from"./chunk-PMJNK5VR.min.js";import{a as Bo,b as Do,c as Eo,d as Fo}from"./chunk-J5PGGKKW.min.js";import{a as Mo,b as No,c as Oo}from"./chunk-MBXUXVXG.min.js";import{a as Po,b as Qo,c as Ro,d as So,e as Uo,f as Vo,g as Wo,h as Xo,i as Yo,j as Zo,k as _o,l as $o}from"./chunk-3DTRPG63.min.js";import{$ as W,A as l,Aa as Ao,B as q,C as u,D as y,E as z,F as A,G as B,H as D,I as E,J as F,K as G,L as H,M as I,N as J,O as K,P as L,Q as M,R as N,S as O,V as P,W as Q,X as R,Y as S,Z as U,_ as V,aa as X,ba as Y,ca as to,d as o,da as po,e as r,ea as xo,f as e,fa as fo,g as t,ga as mo,h as p,ha as no,i as x,ia as so,j as f,ja as co,k as m,ka as io,l as n,la as vo,m as s,ma as wo,n as c,na as Co,o as i,oa as To,p as v,pa as ao,q as w,qa as bo,r as C,ra as go,s as T,sa as ho,t as a,ta as jo,u as b,ua as ko,v as d,va as lo,w as g,wa as qo,x as h,xa as uo,y as j,ya as yo,z as k,za as zo}from"./chunk-FPUMKLJ4.min.js";import{l as Z,m as _,n as $,o as oo,p as ro,q as eo}from"./chunk-G3GOAFHU.min.js";var or=12345.78;export{V as AppLogTB,W as AppLogTBC,D as ApplogStream,po as ApplogStreamInMemory,Po as ApplogStreamTB,Yo as BOOL,Vo as Bool,S as CIDTB,_o as DefaultFalse,Zo as DefaultTrue,R as EntityID,Q as EntityID_LENGTH,F as MappedApplogStream,Xo as NUM,P as Nullable,Ro as Num,So as Obj,Uo as Opt,xo as QueryNode,fo as QueryNodes,Wo as STR,Qo as Str,U as URL,to as WriteableApplogStream,T as actualize,Lo as agentToShortHash,To as agentsOfStream,q as applogStreamComparer,x as areApplogsEqual,a as arrStats,g as arraysContainSameElements,O as assertOnlyCurrent,N as assertRaw,$o as checkParityTB,r as compareApplogsByTs,z as computedFnDeepCompare,l as computedStructuralComparer,j as createDebugName,k as createDebugNameObj,d as cyrb53hash,h as dateNowIso,Do as decodeCar,Bo as decodeCarToApplogs,$ as encodeApplog,_ as encodeApplogAndGetCid,Io as encodeApplogsAsCar,ro as encodeBlock,eo as encodeBlockOriginal,Ho as encodePubAsCar,ao as entityOverlap,bo as entityOverlapCount,vo as filterAndMap,X as getApplogTypeErrors,oo as getCidSync,m as getHashID,E as getLogsFromStream,L as getUntrackedFilterResults,J as getUntrackedPattern,lo as hasAg,M as hasFilter,uo as hasPv,qo as hasTs,Oo as includedIn,No as includes,B as isInitEvent,Jo as isPublication,c as isStaticPattern,Ko as isSubscription,t as isTsBefore,Y as isValidApplog,n as isVariable,o as isoDateStrCompare,Ao as joinStreams,Fo as makeCarBlob,Eo as makeCarOut,K as makeFilter,go as mapTo,w as matchPart,v as matchPartStatic,C as matchPattern,y as observableArrayMap,ko as prefixAt,jo as prefixAttrs,Z as prepareForPub,Go as preparePubForPush,A as prettifyStreamName,so as query,wo as queryAndMap,Mo as queryDivergencesByPrev,Co as queryEntity,u as queryNodesComparer,io as queryNot,co as queryStep,f as removeDuplicateAppLogs,i as resolveOrRemoveVariables,I as rollingAcc,G as rollingFilter,H as rollingMapper,e as sortApplogsByTs,ho as startsWith,b as tsNearlySame,p as uniqueEnFromAppLogs,s as variableNameWithoutQuestionmark,zo as withPv,yo as withTs,no as withoutDeleted,mo as withoutHistory,or as wovinCoreTest};
1
+ import"./chunk-7IDQIMQO.min.js";import"./chunk-RPPZKO5L.min.js";import{a as Go,b as Ho,c as Io,d as Jo,e as Ko,f as Lo}from"./chunk-D6REGRIL.min.js";import{a as Bo,b as Do,c as Eo,d as Fo}from"./chunk-J5PGGKKW.min.js";import{a as Mo,b as No,c as Oo}from"./chunk-5Q6PAAMY.min.js";import{a as Po,b as Qo,c as Ro,d as So,e as Uo,f as Vo,g as Wo,h as Xo,i as Yo,j as Zo,k as _o,l as $o}from"./chunk-BR5DELY4.min.js";import{$ as W,A as l,Aa as Ao,B as q,C as u,D as y,E as z,F as A,G as B,H as D,I as E,J as F,K as G,L as H,M as I,N as J,O as K,P as L,Q as M,R as N,S as O,V as P,W as Q,X as R,Y as S,Z as U,_ as V,aa as X,ba as Y,ca as to,d as o,da as po,e as r,ea as xo,f as e,fa as fo,g as t,ga as mo,h as p,ha as no,i as x,ia as so,j as f,ja as co,k as m,ka as io,l as n,la as vo,m as s,ma as wo,n as c,na as Co,o as i,oa as To,p as v,pa as ao,q as w,qa as bo,r as C,ra as go,s as T,sa as ho,t as a,ta as jo,u as b,ua as ko,v as d,va as lo,w as g,wa as qo,x as h,xa as uo,y as j,ya as yo,z as k,za as zo}from"./chunk-IVEP7DZW.min.js";import{l as Z,m as _,n as $,o as oo,p as ro,q as eo}from"./chunk-G3GOAFHU.min.js";var or=12345.78;export{V as AppLogTB,W as AppLogTBC,Yo as BOOL,Vo as Bool,S as CIDTB,_o as DefaultFalse,Zo as DefaultTrue,R as EntityID,Q as EntityID_LENGTH,F as MappedThread,Xo as NUM,P as Nullable,Ro as Num,So as Obj,Uo as Opt,xo as QueryNode,fo as QueryNodes,Wo as STR,Qo as Str,D as Thread,po as ThreadInMemory,Po as ThreadTB,U as URL,to as WriteableThread,T as actualize,Lo as agentToShortHash,To as agentsOfThread,q as applogThreadComparer,x as areApplogsEqual,a as arrStats,g as arraysContainSameElements,O as assertOnlyCurrent,N as assertRaw,$o as checkParityTB,r as compareApplogsByTs,z as computedFnDeepCompare,l as computedStructuralComparer,j as createDebugName,k as createDebugNameObj,d as cyrb53hash,h as dateNowIso,Do as decodeCar,Bo as decodeCarToApplogs,$ as encodeApplog,_ as encodeApplogAndGetCid,Io as encodeApplogsAsCar,ro as encodeBlock,eo as encodeBlockOriginal,Ho as encodePubAsCar,ao as entityOverlap,bo as entityOverlapCount,vo as filterAndMap,X as getApplogTypeErrors,oo as getCidSync,m as getHashID,E as getLogsFromThread,L as getUntrackedFilterResults,J as getUntrackedPattern,lo as hasAg,M as hasFilter,uo as hasPv,qo as hasTs,Oo as includedIn,No as includes,B as isInitEvent,Jo as isPublication,c as isStaticPattern,Ko as isSubscription,t as isTsBefore,Y as isValidApplog,n as isVariable,o as isoDateStrCompare,Ao as joinThreads,mo as lastWriteWins,Fo as makeCarBlob,Eo as makeCarOut,K as makeFilter,go as mapTo,w as matchPart,v as matchPartStatic,C as matchPattern,y as observableArrayMap,ko as prefixAt,jo as prefixAttrs,Z as prepareForPub,Go as preparePubForPush,A as prettifyThreadName,so as query,wo as queryAndMap,Mo as queryDivergencesByPrev,Co as queryEntity,u as queryNodesComparer,io as queryNot,co as queryStep,f as removeDuplicateAppLogs,i as resolveOrRemoveVariables,I as rollingAcc,G as rollingFilter,H as rollingMapper,e as sortApplogsByTs,ho as startsWith,b as tsNearlySame,p as uniqueEnFromAppLogs,s as variableNameWithoutQuestionmark,zo as withPv,yo as withTs,no as withoutDeleted,or as wovinCoreTest};
2
2
  //# sourceMappingURL=index.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export const wovinCoreTest = 12345.78\n\nexport * from './applog'\nexport * from './ipfs'\nexport * from './pubsub'\nexport * from './query'\nexport * from './stream'\nexport * from './types'\n// export * from './utils'\n"],"mappings":"2lCAAO,IAAMA,GAAgB","names":["wovinCoreTest"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export const wovinCoreTest = 12345.78\n\nexport * from './applog'\nexport * from './ipfs'\nexport * from './pubsub'\nexport * from './query'\nexport * from './thread'\nexport * from './types'\n// export * from './utils'\n"],"mappings":"2lCAAO,IAAMA,GAAgB","names":["wovinCoreTest"]}
@@ -2,17 +2,17 @@ import { comparer, IComputedValue, IObservableArray } from 'mobx';
2
2
  import { IComputedFnOptions } from 'mobx-utils/lib/computedFn';
3
3
  import { DatalogQueryPattern } from '../applog/datom-types';
4
4
  import { QueryNodes } from '../query/basic';
5
- import { ApplogStream } from '../stream';
6
- export declare const createDebugName: ({ caller, stream, pattern: args }: {
5
+ import { Thread } from '../thread';
6
+ export declare const createDebugName: ({ caller, thread, pattern: args }: {
7
7
  caller?: string;
8
- stream?: ApplogStream;
8
+ thread?: Thread;
9
9
  pattern?: DatalogQueryPattern | string;
10
10
  }) => string;
11
11
  export declare const createDebugNameObj: (args: Parameters<typeof createDebugName>[0]) => {
12
12
  readonly name: string;
13
13
  };
14
14
  export declare function computedStructuralComparer<T>(a: IComputedValue<T>, b: IComputedValue<T>): boolean;
15
- export declare function applogStreamComparer(a: ApplogStream, b: ApplogStream): boolean;
15
+ export declare function applogThreadComparer(a: Thread, b: Thread): boolean;
16
16
  export declare function queryNodesComparer(a: QueryNodes, b: QueryNodes): boolean;
17
17
  export declare function observableArrayMap<T>(fn: () => T[], { name, equals }?: {
18
18
  name?: string;
@@ -24,7 +24,7 @@ export declare function observableArrayMap<T>(fn: () => T[], { name, equals }?:
24
24
  * - allow dynamic/optional args
25
25
  * - not be so friggin complicated... DeepMap... closest... why?!
26
26
  *
27
- * // TODO: PR upstream
27
+ * // TODO: PR upthread
28
28
  *
29
29
  * computedFnDeepCompare takes a function with an arbitrary amount of arguments,
30
30
  * and memoizes the output of the function based on the arguments passed in.
@@ -63,5 +63,5 @@ export declare function computedFnDeepCompare<T extends (...args: any[]) => any>
63
63
  name?: string;
64
64
  argsDebugName?: (...args: Parameters<T>) => string;
65
65
  }) | boolean): T;
66
- export declare function prettifyStreamName(input: string): string;
66
+ export declare function prettifyThreadName(input: string): string;
67
67
  //# sourceMappingURL=mobx-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mobx-utils.d.ts","sourceRoot":"","sources":["../../src/mobx/mobx-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,QAAQ,EAKR,cAAc,EACd,gBAAgB,EAShB,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AA+BxC,eAAO,MAAM,eAAe;aAClB,MAAM;aACN,YAAY;cACX,mBAAmB,GAAG,MAAM;YAMtC,CAAA;AACD,eAAO,MAAM,kBAAkB,SAAU,WAAW,sBAAsB,CAAC,CAAC,CAAC,CAAC;;CAE7E,CAAA;AAED,wBAAgB,0BAA0B,C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
  import { Applog } from '../applog/datom-types';
2
- import { ApplogsOrStream, ApplogStream } from '../stream';
2
+ import { ApplogsOrThread, Thread } from '../thread';
3
3
  import { AppAgent, IPublication } from './pubsub-types';
4
- export declare function preparePubForPush(agent: AppAgent, appStream: ApplogStream, streamToPublish: ApplogsOrStream, publication: IPublication): Promise<Blob>;
4
+ export declare function preparePubForPush(agent: AppAgent, appThread: Thread, threadToPublish: ApplogsOrThread, publication: IPublication): Promise<Blob>;
5
5
  /**
6
6
  * @param applogs Encrypted or plain applogs
7
7
  * @returns Car file
@@ -1 +1 @@
1
- {"version":3,"file":"publication.d.ts","sourceRoot":"","sources":["../../src/pubsub/publication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAA6B,MAAM,uBAAuB,CAAA;AAIzE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAA;AAE5E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAWvD,wBAAsB,iBAAiB,CACtC,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,YAAY,EACvB,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,YAAY,iBA4EzB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CACnC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,MAAM,EAAE,EAClD,QAAQ,EAAE,SAAS,MAAM,EAAE,iBAqB3B;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,MAAM,EAAE,iBAQlD"}
1
+ {"version":3,"file":"publication.d.ts","sourceRoot":"","sources":["../../src/pubsub/publication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAA6B,MAAM,uBAAuB,CAAA;AAIzE,OAAO,EAAE,eAAe,EAAqB,MAAM,EAAE,MAAM,WAAW,CAAA;AAEtE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAWvD,wBAAsB,iBAAiB,CACtC,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,YAAY,iBA4EzB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CACnC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,MAAM,EAAE,EAClD,QAAQ,EAAE,SAAS,MAAM,EAAE,iBAqB3B;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,MAAM,EAAE,iBAQlD"}
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f}from"./chunk-PMJNK5VR.min.js";import"./chunk-J5PGGKKW.min.js";import"./chunk-FPUMKLJ4.min.js";import"./chunk-G3GOAFHU.min.js";export{f as agentToShortHash,c as encodeApplogsAsCar,b as encodePubAsCar,d as isPublication,e as isSubscription,a as preparePubForPush};
1
+ import{a,b,c,d,e,f}from"./chunk-D6REGRIL.min.js";import"./chunk-J5PGGKKW.min.js";import"./chunk-IVEP7DZW.min.js";import"./chunk-G3GOAFHU.min.js";export{f as agentToShortHash,c as encodeApplogsAsCar,b as encodePubAsCar,d as isPublication,e as isSubscription,a as preparePubForPush};
2
2
  //# sourceMappingURL=pubsub.min.js.map
@@ -1,12 +1,12 @@
1
1
  import { Applog, ApplogValue, DatalogQueryPattern, EntityID, SearchContext } from '../applog/datom-types';
2
- import { ApplogStream } from '../stream';
2
+ import { Thread } from '../thread';
3
3
  export declare class QueryNode {
4
- logsOfThisNode: ApplogStream;
4
+ logsOfThisNode: Thread;
5
5
  variables: SearchContext;
6
6
  prev: QueryNode | null;
7
- constructor(logsOfThisNode: ApplogStream, variables: SearchContext, prev?: QueryNode | null);
7
+ constructor(logsOfThisNode: Thread, variables: SearchContext, prev?: QueryNode | null);
8
8
  get record(): SearchContext;
9
- get allApplogs(): ApplogStream;
9
+ get allApplogs(): Thread;
10
10
  }
11
11
  export declare class QueryNodes {
12
12
  nodes: Array<QueryNode>;
@@ -16,31 +16,31 @@ export declare class QueryNodes {
16
16
  get untrackedSize(): number;
17
17
  get records(): SearchContext[];
18
18
  get applogSets(): (readonly Applog[])[];
19
- get applogStreams(): ApplogStream[];
20
- get allApplogs(): ApplogStream;
19
+ get applogThreads(): Thread[];
20
+ get allApplogs(): Thread;
21
21
  }
22
22
  /**
23
23
  * Keep only the latest logs for each en&at (= last write wins)
24
24
  */
25
- export declare const withoutHistory: (stream: ApplogStream, { inverseToOnlyReturnFirstLogs, tolerateAlreadyFiltered }?: {
25
+ export declare const lastWriteWins: (thread: Thread, { inverseToOnlyReturnFirstLogs, tolerateAlreadyFiltered }?: {
26
26
  inverseToOnlyReturnFirstLogs?: boolean;
27
27
  tolerateAlreadyFiltered?: boolean;
28
- }) => ApplogStream;
28
+ }) => Thread;
29
29
  /**
30
30
  * Remove all applogs for entities that have an applog: { at: `isDeleted`, val: true }
31
- * ! WARNING: If not based on withoutHistory, it will not respect un-deletions yet (isDeleted: false)
31
+ * ! WARNING: If not based on lastWriteWins, it will not respect un-deletions yet (isDeleted: false)
32
32
  */
33
- export declare const withoutDeleted: (stream: ApplogStream) => import("../stream").MappedApplogStream;
34
- export declare const query: (stream: ApplogStream, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], startVariables?: SearchContext, opts?: {
33
+ export declare const withoutDeleted: (thread: Thread) => import("../thread").MappedThread;
34
+ export declare const query: (thread: Thread, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], startVariables?: SearchContext, opts?: {
35
35
  debug?: boolean;
36
36
  }) => QueryNodes;
37
- export declare const queryStep: (stream: ApplogStream, nodeSet: QueryNodes | null, pattern: DatalogQueryPattern, opts?: {
37
+ export declare const queryStep: (thread: Thread, nodeSet: QueryNodes | null, pattern: DatalogQueryPattern, opts?: {
38
38
  debug?: boolean;
39
39
  }) => QueryNodes;
40
- export declare const queryNot: (stream: ApplogStream, startNodes: QueryNodes, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], opts?: {
40
+ export declare const queryNot: (thread: Thread, startNodes: QueryNodes, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], opts?: {
41
41
  debug?: boolean;
42
42
  }) => QueryNodes;
43
- export declare const filterAndMap: <R>(stream: ApplogStream, pattern: DatalogQueryPattern, mapper: keyof Applog | Partial<{
43
+ export declare const filterAndMap: <R>(thread: Thread, pattern: DatalogQueryPattern, mapper: keyof Applog | Partial<{
44
44
  cid: string;
45
45
  pv?: string;
46
46
  ts: string;
@@ -49,13 +49,13 @@ export declare const filterAndMap: <R>(stream: ApplogStream, pattern: DatalogQue
49
49
  at: string;
50
50
  vl: string;
51
51
  }> | ((applog: Applog) => R)) => import("mobx").IObservableArray<any>;
52
- export declare const queryAndMap: <R>(stream: ApplogStream, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], map: string | ((record: SearchContext) => R), variables?: SearchContext) => import("mobx").IObservableArray<any>;
53
- export declare const queryEntity: <R>(stream: ApplogStream, name: string, entityID: EntityID, attributes: string[]) => import("mobx").IComputedValue<{
52
+ export declare const queryAndMap: <R>(thread: Thread, patternOrPatterns: DatalogQueryPattern | DatalogQueryPattern[], map: string | ((record: SearchContext) => R), variables?: SearchContext) => import("mobx").IObservableArray<any>;
53
+ export declare const queryEntity: <R>(thread: Thread, name: string, entityID: EntityID, attributes: string[]) => import("mobx").IComputedValue<{
54
54
  [k: string]: ApplogValue;
55
55
  }>;
56
- export declare const agentsOfStream: <R>(stream: ApplogStream) => import("mobx").ObservableMap<string, number>;
57
- export declare const entityOverlap: (streamA: ApplogStream, streamB: ApplogStream) => import("mobx").IComputedValue<string[]>;
58
- export declare const entityOverlapCount: (streamA: ApplogStream, streamB: ApplogStream) => import("mobx").IComputedValue<number>;
56
+ export declare const agentsOfThread: <R>(thread: Thread) => import("mobx").ObservableMap<string, number>;
57
+ export declare const entityOverlap: (threadA: Thread, threadB: Thread) => import("mobx").IComputedValue<string[]>;
58
+ export declare const entityOverlapCount: (threadA: Thread, threadB: Thread) => import("mobx").IComputedValue<number>;
59
59
  export declare function mapTo(applogFieldMap: Partial<{
60
60
  [key in keyof Applog]: string;
61
61
  }>): (applog: any) => SearchContext;
@@ -1 +1 @@
1
- {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/query/basic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAgBzG,OAAO,EAAE,YAAY,EAAkC,MAAM,WAAW,CAAA;AAmBxE,qBAAa,SAAS;IAEb,cAAc,EAAE,YAAY;IAC5B,SAAS,EAAE,aAAa;IACxB,IAAI,EAAE,SAAS,GAAG,IAAI;gBAFtB,cAAc,EAAE,YAAY,EAC5B,SAAS,EAAE,aAAa,EACxB,IAAI,GAAE,SAAS,GAAG,IAAW;IAMrC,IAAI,MAAM,kBAET;IAED,IAAI,UAAU,iBAMb;CACD;AACD,qBAAa,UAAU;IAEd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;gBAAvB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAS/B,IAAI,IAAI,WAEP;IACD,IAAI,OAAO,YAEV;IACD,IAAI,aAAa,WAEhB;IAED,IAAI,OAAO,oBAEV;IACD,IAAI,UAAU,0BAEb;IACD,IAAI,aAAa,mBAEhB;IACD,IAAI,UAAU,iBAEb;CACD;AAMD;;GAEG;AACH,eAAO,MAAM,cAAc,WAClB,YAAY;mCAEY,OAAO;8BACZ,OAAO;kBAkFC,CAAA;AAEpC;;;GAGG;AACH,eAAO,MAAM,cAAc,WAClB,YAAY,2CAsBe,CAAA;AAoBpC,eAAO,MAAM,KAAK,WACT,YAAY,qBACD,mBAAmB,GAAG,mBAAmB,EAAE,mBAC9C,aAAa,SACvB;IAAE,KAAK,CAAC,EAAE,OAA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AChB,MAAM,WACL,mBAAmB;;;;;;;;eACsD,MAAM,gDAqBtD,CAAA;AAEnC,eAAO,MAAM,WAAW,cACf,MAAM,qBACK,mBAAmB,GAAG,mBAAmB,EAAE,0BACtC,aAAa,qBAC1B,aAAa,yCAqBU,CAAA;AAEnC,eAAO,MAAM,WAAW,cACf,MAAM,QACR,MAAM,YACF,QAAQ,cACN,MAAM,EAAE;;EAWqB,CAAA;AAE1C,eAAO,MAAM,cAAc,cAClB,MAAM,iDAsBb,CAAA;AAEF,eAAO,MAAM,aAAa,YAChB,MAAM,WACN,MAAM,4CASd,CAAA;AAEF,eAAO,MAAM,kBAAkB,YAA8D,MAAM,WAAW,MAAM,0CAElH,CAAA;AAMF,wBAAgB,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC;KAAG,GAAG,IAAI,MAAM,MAAM,GAAG,MAAM;CAAE,CAAC,kCAO/E;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,uBAErC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAE1D;AACD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAEpD"}
@@ -1,12 +1,12 @@
1
1
  import { Applog } from '../applog/datom-types';
2
- import { ApplogStream } from '../stream';
3
- import { ApplogStreamInMemory } from '../stream/writeable';
2
+ import { Thread } from '../thread';
3
+ import { ThreadInMemory } from '../thread/writeable';
4
4
  export interface DivergenceLeaf {
5
5
  log: Applog;
6
- stream: ApplogStream;
6
+ thread: Thread;
7
7
  }
8
- export declare const queryDivergencesByPrev: (sourceStream: ApplogStream) => import("mobx").IObservableArray<{
8
+ export declare const queryDivergencesByPrev: (sourceThread: Thread) => import("mobx").IObservableArray<{
9
9
  log: Applog;
10
- stream: ApplogStreamInMemory;
10
+ thread: ThreadInMemory;
11
11
  }>;
12
12
  //# sourceMappingURL=divergences.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"divergences.d.ts","sourceRoot":"","sources":["../../src/query/divergences.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAI1D,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,YAAY,CAAA;CACpB;AAED,eAAO,MAAM,sBAAsB,iBACpB,YAAY;;;EAqCQ,CAAA"}
1
+ {"version":3,"file":"divergences.d.ts","sourceRoot":"","sources":["../../src/query/divergences.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIpD,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,sBAAsB,iBACpB,MAAM;;;EAqCc,CAAA"}
package/dist/query.min.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as z,b as A,c as B}from"./chunk-MBXUXVXG.min.js";import{A as c,B as d,C as e,D as f,E as g,F as h,ea as i,fa as j,ga as k,ha as l,ia as m,ja as n,ka as o,la as p,ma as q,na as r,oa as s,pa as t,qa as u,ra as v,sa as w,ta as x,ua as y,y as a,z as b}from"./chunk-FPUMKLJ4.min.js";import"./chunk-G3GOAFHU.min.js";export{i as QueryNode,j as QueryNodes,s as agentsOfStream,d as applogStreamComparer,g as computedFnDeepCompare,c as computedStructuralComparer,a as createDebugName,b as createDebugNameObj,t as entityOverlap,u as entityOverlapCount,p as filterAndMap,B as includedIn,A as includes,v as mapTo,f as observableArrayMap,y as prefixAt,x as prefixAttrs,h as prettifyStreamName,m as query,q as queryAndMap,z as queryDivergencesByPrev,r as queryEntity,e as queryNodesComparer,o as queryNot,n as queryStep,w as startsWith,l as withoutDeleted,k as withoutHistory};
1
+ import{a as z,b as A,c as B}from"./chunk-5Q6PAAMY.min.js";import{A as c,B as d,C as e,D as f,E as g,F as h,ea as i,fa as j,ga as k,ha as l,ia as m,ja as n,ka as o,la as p,ma as q,na as r,oa as s,pa as t,qa as u,ra as v,sa as w,ta as x,ua as y,y as a,z as b}from"./chunk-IVEP7DZW.min.js";import"./chunk-G3GOAFHU.min.js";export{i as QueryNode,j as QueryNodes,s as agentsOfThread,d as applogThreadComparer,g as computedFnDeepCompare,c as computedStructuralComparer,a as createDebugName,b as createDebugNameObj,t as entityOverlap,u as entityOverlapCount,p as filterAndMap,B as includedIn,A as includes,k as lastWriteWins,v as mapTo,f as observableArrayMap,y as prefixAt,x as prefixAttrs,h as prettifyThreadName,m as query,q as queryAndMap,z as queryDivergencesByPrev,r as queryEntity,e as queryNodesComparer,o as queryNot,n as queryStep,w as startsWith,l as withoutDeleted};
2
2
  //# sourceMappingURL=query.min.js.map
@@ -0,0 +1,36 @@
1
+ import { type Applog, ApplogForInsert } from '../applog/datom-types';
2
+ export type ThreadEvent = {
3
+ added: readonly Applog[];
4
+ removed: readonly Applog[] | null;
5
+ } | {
6
+ init: readonly Applog[];
7
+ };
8
+ export declare function isInitEvent(event: ThreadEvent): event is {
9
+ init: readonly Applog[];
10
+ };
11
+ export type ApplogsOrThread = Thread | readonly Applog[];
12
+ export declare abstract class Thread {
13
+ protected _applogs: Applog[];
14
+ readonly name: string;
15
+ readonly filters: string[];
16
+ readonly parents: Thread[] | null;
17
+ protected _subscribers: ((event: ThreadEvent) => void)[];
18
+ constructor(parents: Thread | Thread[] | null, filters: string[], _applogs: Applog[], name: string);
19
+ abstract get readOnly(): boolean;
20
+ subscribe(callback: (event: ThreadEvent) => void): () => void;
21
+ unsubscribe(callback: (event: ThreadEvent) => void): void;
22
+ protected notifySubscribers(event: ThreadEvent): void;
23
+ get applogs(): readonly Applog[];
24
+ map<R>(fn: (applog: Applog) => R): R[];
25
+ get firstLog(): Applog;
26
+ get latestLog(): Applog;
27
+ hasApplog(applog: Applog, byRef: boolean): boolean;
28
+ hasApplogWithDiffTs(applog: ApplogForInsert): Applog;
29
+ get isEmpty(): boolean;
30
+ get size(): number;
31
+ get untrackedSize(): number;
32
+ get nameAndSizeUntracked(): string;
33
+ get prettyName(): string;
34
+ }
35
+ export declare const getLogsFromThread: (logsOrThread: ApplogsOrThread) => readonly Applog[];
36
+ //# sourceMappingURL=basic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/thread/basic.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,MAAM,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAKpE,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAA;AACvH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,IAAI;IAAE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAEpF;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;AAExD,8BAAsB,MAAM;IAQ1B,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM;IARtB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IACjC,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC,EAAE,CAAK;gBAG5D,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EACjC,OAAO,EAAE,MAAM,EAAE,EACP,QAAQ,EAAE,MAAM,EAAO,EACxB,IAAI,EAAE,MAAM;IAiBtB,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAA;IAEhC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI;IAKhD,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI;IAOlD,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAW;IAO9C,IAAI,OAAO,IAAI,SAAS,MAAM,EAAE,CAG/B;IAEM,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC;IAKvC,IAAI,QAAQ,WAEX;IACD,IAAI,SAAS,WAEZ;IACM,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAcxC,mBAAmB,CAAC,MAAM,EAAE,eAAe;IAUlD,IAAI,OAAO,YAEV;IACD,IAAI,IAAI,WAEP;IACD,IAAI,aAAa,WAEhB;IACD,IAAI,oBAAoB,WAEvB;IACD,IAAI,UAAU,WAEb;CACD;AAED,eAAO,MAAM,iBAAiB,iBAAkB,eAAe,sBAAyE,CAAA"}
@@ -0,0 +1,38 @@
1
+ import { IObservableArray, ObservableMap, ObservableSet } from 'mobx';
2
+ import { Applog, ApplogValue, DatalogQueryPattern } from '../applog/datom-types';
3
+ import { Thread, ThreadEvent } from './basic';
4
+ import { ApplogEventMapper, MappedThread } from './mapped';
5
+ export declare const rollingFilter: (thread: Thread, pattern: DatalogQueryPattern, opts?: {
6
+ name?: string;
7
+ extraFilterName?: string;
8
+ }) => MappedThread;
9
+ export declare const rollingMapper: (thread: Thread, eventMapper: ApplogEventMapper, opts?: {
10
+ name?: string;
11
+ extraFilterName?: string;
12
+ }) => MappedThread;
13
+ export declare const rollingAcc: <ACC extends IObservableArray<any> | ObservableMap<any, any> | ObservableSet<any>>(thread: Thread, acc: ACC, eventMapper: (event: ThreadEvent, acc: ACC) => void) => ACC;
14
+ export declare const getUntrackedPattern: (pattern: DatalogQueryPattern) => {
15
+ [k: string]: string | boolean | Number | import("../applog/datom-types").CidString | readonly import("../applog/datom-types").CidString[] | ((value: import("../applog/datom-types").CidString) => boolean) | readonly string[] | ((value: string) => boolean) | import("../applog/datom-types").AgentHash | readonly import("../applog/datom-types").AgentHash[] | ((value: import("../applog/datom-types").AgentHash) => boolean) | readonly ApplogValue[] | ((value: ApplogValue) => boolean);
16
+ };
17
+ export declare function makeFilter(pattern: DatalogQueryPattern): (logs: readonly Applog[]) => Applog[];
18
+ /**
19
+ * // ! think twice before using
20
+ */
21
+ export declare const getUntrackedFilterResults: (thread: Thread, pattern: DatalogQueryPattern, opts?: {
22
+ name?: string;
23
+ }) => Applog[];
24
+ export type ThreadWithFilter<T extends string> = Thread & {
25
+ filters: T[];
26
+ };
27
+ export declare function hasFilter<T extends string>(thread: Thread, filter: T): thread is ThreadWithFilter<T>;
28
+ export declare function assertRaw(thread: Thread): ThreadWithoutFilters;
29
+ export declare function assertOnlyCurrent(thread: Thread): Thread & {
30
+ filters: "lastWriteWins"[];
31
+ } & {
32
+ filters: "withoutDeleted"[];
33
+ };
34
+ export type ThreadOnlyCurrent = ThreadWithFilter<'lastWriteWins' | 'withoutDeleted'>;
35
+ export type ThreadWithoutFilters = Thread & {
36
+ filters: [];
37
+ };
38
+ //# sourceMappingURL=filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/thread/filters.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,gBAAgB,EAAc,aAAa,EAAE,aAAa,EAAiD,MAAM,MAAM,CAAA;AAGxI,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAkB,MAAM,uBAAuB,CAAA;AAEhG,OAAO,EAAe,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1D,O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,0 +1,19 @@
1
+ import { Applog } from '../applog/datom-types';
2
+ import { Thread, ThreadEvent } from './basic';
3
+ export type ApplogEventMapper = (this: MappedThread, event: ThreadEvent, sourceThread: Thread) => ThreadEvent;
4
+ export declare class MappedThread extends Thread {
5
+ readonly _initialLogs: readonly Applog[];
6
+ private _eventMapper;
7
+ readonly name: string;
8
+ private _parentSubscriptions;
9
+ constructor(parents: Thread | Thread[], filters: string[], _initialLogs: readonly Applog[], _eventMapper: ApplogEventMapper, name: string);
10
+ get readOnly(): boolean;
11
+ private subscribeToParent;
12
+ /**
13
+ * // HACK to trigger remap on pattern change in rollingFilter
14
+ * should not be used lightly
15
+ */
16
+ triggerRemap(): void;
17
+ protected onParentUpdate(thread: Thread, event: ThreadEvent): void;
18
+ }
19
+ //# sourceMappingURL=mapped.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapped.d.ts","sourceRoot":"","sources":["../../src/thread/mapped.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAe,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,KAAK,WAAW,CAAA;AAE7G,qBAAa,YAAa,SAAQ,MAAM;IAMtC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE;IACxC,OAAO,CAAC,YAAY;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAPtB,OAAO,CAAC,oBAAoB,CAAyD;gBAGpF,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,EAAE,MAAM,EAAE,EACR,YAAY,EAAE,SAAS,MAAM,EAAE,EAChC,YAAY,EAAE,iBAAiB,EAC9B,IAAI,EAAE,MAAM;IAkBtB,IAAI,QAAQ,YAGX;IAED,OAAO,CAAC,iBAAiB;IA0BzB;;;OAGG;IACH,YAAY;IAOZ,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;CA8B3D"}
@@ -0,0 +1,17 @@
1
+ import { type Applog, ApplogForInsert } from '../applog/datom-types';
2
+ import { Thread } from './basic';
3
+ export declare abstract class WriteableThread extends Thread {
4
+ constructor(parents: Thread | Thread[] | null, filters: string[], applogs: Applog[], name: string);
5
+ insert(appLogsToInsert: ApplogForInsert[]): Applog[];
6
+ get readOnly(): boolean;
7
+ protected abstract persist(logs: Applog[]): any;
8
+ }
9
+ export declare class ThreadInMemory extends WriteableThread {
10
+ readonly _readOnly: boolean;
11
+ static empty(name?: string): ThreadInMemory;
12
+ static fromArray(applogs: Applog[], name?: string, readOnly?: boolean): ThreadInMemory;
13
+ constructor(applogs: Applog[], filters: string[], name: string, _readOnly: boolean, parents?: Thread | Thread[] | null);
14
+ get readOnly(): boolean;
15
+ protected persist(logs: Applog[]): void;
16
+ }
17
+ //# sourceMappingURL=writeable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeable.d.ts","sourceRoot":"","sources":["../../src/thread/writeable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,MAAM,EAAE,eAAe,EAAsC,MAAM,uBAAuB,CAAA;AAExG,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIhC,8BAAsB,eAAgB,SAAQ,MAAM;gBAElD,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EACjC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EAAO,EACtB,IAAI,EAAE,MAAM;IASN,MAAM,CAAC,eAAe,EAAE,eAAe,EAAE;IAoChD,IAAI,QAAQ,YAEX;IAED,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE;CACzC;AACD,qBAAa,cAAe,SAAQ,eAAe;IAYjD,QAAQ,CAAC,SAAS,EAAE,OAAO;IAX5B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM;IAG1B,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,UAAQ;gBAKlE,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,EACH,SAAS,EAAE,OAAO,EAC3B,OAAO,GAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAW;IAUzC,IAAI,QAAQ,YAEX;IAED,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE;CAMhC"}
@@ -0,0 +1,5 @@
1
+ export * from './thread/basic';
2
+ export * from './thread/filters';
3
+ export * from './thread/mapped';
4
+ export * from './thread/writeable';
5
+ //# sourceMappingURL=thread.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../src/thread.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{G as a,H as b,I as c,J as d,K as e,L as f,M as g,N as h,O as i,P as j,Q as k,R as l,S as m,ca as n,da as o}from"./chunk-IVEP7DZW.min.js";import"./chunk-G3GOAFHU.min.js";export{d as MappedThread,b as Thread,o as ThreadInMemory,n as WriteableThread,m as assertOnlyCurrent,l as assertRaw,c as getLogsFromThread,j as getUntrackedFilterResults,h as getUntrackedPattern,k as hasFilter,a as isInitEvent,i as makeFilter,g as rollingAcc,e as rollingFilter,f as rollingMapper};
2
+ //# sourceMappingURL=thread.min.js.map
@@ -1,6 +1,6 @@
1
1
  import { Type as T } from '@sinclair/typebox';
2
- import { ApplogStream } from '../stream';
3
- export declare const ApplogStreamTB: import("@sinclair/typebox").TUnsafe<ApplogStream>;
2
+ import { Thread } from '../thread';
3
+ export declare const ThreadTB: import("@sinclair/typebox").TUnsafe<Thread>;
4
4
  declare const StringTB: (options?: import("@sinclair/typebox").StringOptions) => import("@sinclair/typebox").TString, OptionalTB: <T extends import("@sinclair/typebox").TSchema>(schema: T) => import("@sinclair/typebox").TOptional<T>, BooleanTB: (options?: import("@sinclair/typebox").SchemaOptions) => import("@sinclair/typebox").TBoolean, ObjectTB: <T extends import("@sinclair/typebox").TProperties>(properties: T, options?: import("@sinclair/typebox").ObjectOptions) => import("@sinclair/typebox").TObject<T>, NumberTB: (options?: import("@sinclair/typebox").NumericOptions<number>) => import("@sinclair/typebox").TNumber;
5
5
  export declare const Str: typeof StringTB;
6
6
  export declare const Num: typeof NumberTB;
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-utils.d.ts","sourceRoot":"","sources":["../../src/types/typescript-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,eAAO,MAAM,cAAc,mDAEvB,CAAA;AACJ,QAAA,MAAgB,QAAQ,gGAAY,UAAU,0GAAW,SAAS,iGAAU,QAAQ,qKAAU,QAAQ,uGAAM,CAAA;AAC5G,eAAO,MAAM,GAAG,EAAE,OAAO,QAA2B,CAAA;AACpD,eAAO,MAAM,GAAG,EAAE,OAAO,QAA2B,CAAA;AACpD,eAAO,MAAM,GAAG,EAAE,OAAO,QAA2B,CAAA;AACpD,eAAO,MAAM,GAAG,EAAE,OAAO,UAA+B,CAAA;AACxD,eAAO,MAAM,IAAI,EAAE,OAAO,SAA6B,CAAA;AAEvD,eAAO,MAAM,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,CAAS,CAAA;AACrD,eAAO,MAAM,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,CAAS,CAAA;AACrD,eAAO,MAAM,IAAI,EAAE,UA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C,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACrE,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC9E,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAExF,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,CAAA;AAE5D;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,CAAA;AAU9C,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS,SAAS,CAAC,GAAG,OAAO,EAAE,EAAE,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA;AAEtH,wBAAgB,aAAa,SAS5B;AAED,uEAAuE;AACvE,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,CAAA"}
package/dist/types.min.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-3DTRPG63.min.js";import"./chunk-FPUMKLJ4.min.js";import"./chunk-G3GOAFHU.min.js";export{a as ApplogStreamTB,i as BOOL,f as Bool,k as DefaultFalse,j as DefaultTrue,h as NUM,c as Num,d as Obj,e as Opt,g as STR,b as Str,l as checkParityTB};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-BR5DELY4.min.js";import"./chunk-IVEP7DZW.min.js";import"./chunk-G3GOAFHU.min.js";export{i as BOOL,f as Bool,k as DefaultFalse,j as DefaultTrue,h as NUM,c as Num,d as Obj,e as Opt,g as STR,b as Str,a as ThreadTB,l as checkParityTB};
2
2
  //# sourceMappingURL=types.min.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wovin/core",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rm -rf dist/ && concurrently \"pnpm build:code\" \"pnpm build:types\"",
@@ -38,9 +38,9 @@
38
38
  "import": "./dist/query.min.js",
39
39
  "types": "./dist/query.d.ts"
40
40
  },
41
- "./stream": {
42
- "import": "./dist/stream.min.js",
43
- "types": "./dist/stream.d.ts"
41
+ "./thread": {
42
+ "import": "./dist/thread.min.js",
43
+ "types": "./dist/thread.d.ts"
44
44
  },
45
45
  "./types": {
46
46
  "import": "./dist/types.min.js",
@@ -1,2 +0,0 @@
1
- import{H as T,T as y,U as l}from"./chunk-FPUMKLJ4.min.js";import{b as p}from"./chunk-G3GOAFHU.min.js";var e=p(y(),1),a=p(l(),1);var g=a.TypeSystem.Type("ApplogStream",(n,t)=>t instanceof T)(),{String:c,Optional:x,Boolean:f,Object:m,Number:u}=e.Type,o=c.bind(e.Type),r=u.bind(e.Type),b=m.bind(e.Type),O=x.bind(e.Type),B=f.bind(e.Type),S=o(),k=r(),P=B(),D=!0,N=!1;function j(){let n=o(),t=o(),s=r(),i=r();console.log({s1:n,s2:t,n1:s,n2:i})}export{g as a,o as b,r as c,b as d,O as e,B as f,S as g,k as h,P as i,D as j,N as k,j as l};
2
- //# sourceMappingURL=chunk-3DTRPG63.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types/typescript-utils.ts"],"sourcesContent":["import { Type as T } from '@sinclair/typebox'\nimport { TypeSystem } from '@sinclair/typebox/system'\nimport type { CID } from 'multiformats'\nimport { ApplogStream } from '../stream'\n\nexport const ApplogStreamTB = TypeSystem.Type<ApplogStream>('ApplogStream', (options, value) => {\n\treturn value instanceof ApplogStream\n})()\nconst { String: StringTB, Optional: OptionalTB, Boolean: BooleanTB, Object: ObjectTB, Number: NumberTB } = T\nexport const Str: typeof StringTB = StringTB.bind(T)\nexport const Num: typeof NumberTB = NumberTB.bind(T)\nexport const Obj: typeof ObjectTB = ObjectTB.bind(T)\nexport const Opt: typeof OptionalTB = OptionalTB.bind(T)\nexport const Bool: typeof BooleanTB = BooleanTB.bind(T)\n\nexport const STR: ReturnType<typeof T.String> = Str()\nexport const NUM: ReturnType<typeof T.Number> = Num()\nexport const BOOL: ReturnType<typeof T.Boolean> = Bool()\n\nexport type DefaultTrue = true | boolean\nexport const DefaultTrue: DefaultTrue = true\n\nexport type DefaultFalse = false | boolean\nexport const DefaultFalse: DefaultFalse = false\n\nexport type GenericObject = Record<string, any>\nexport type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>\nexport type PromiseType<T extends Promise<any>> = T extends Promise<infer U> ? U : never\n\nexport type CoerceToString<T> = T extends string ? T : never\n\n/**\n * Define nominal type of U based on type of T. Similar to Opaque types in Flow\n */\nexport type Tagged<T, Tag> = T & { tag?: Tag }\n\n// export interface Service {\n// \tendpoint?: URL\n// \ttoken: string\n// \trateLimiter?: RateLimiter\n// \tfetch?: typeof _fetch\n// }\n\n// https://stackoverflow.com/a/76276541\nexport type LastElementOf<T extends readonly unknown[]> = T extends readonly [...unknown[], infer Last] ? Last : never\n\nexport function checkParityTB() {\n\t/* Most examples are constantly calling Type.*() - needed to check if its really needed\n https://github.com/sinclairzx81/typebox/issues/587#issuecomment-1712457623\n */\n\tconst s1 = Str()\n\tconst s2 = Str()\n\tconst n1 = Num()\n\tconst n2 = Num()\n\tconsole.log({ s1, s2, n1, n2 })\n}\n\n/** solidjs Setter requires returning something, which I often don't */\nexport type GenericSetter<T> = (newValue: T) => void\n"],"mappings":"sGAAA,IAAAA,EAA0B,SAC1BC,EAA2B,SAIpB,IAAMC,EAAiB,aAAW,KAAmB,eAAgB,CAACC,EAASC,IAC9EA,aAAiBC,CACxB,EAAE,EACG,CAAE,OAAQC,EAAU,SAAUC,EAAY,QAASC,EAAW,OAAQC,EAAU,OAAQC,CAAS,EAAI,EAAAC,KAC9FC,EAAuBN,EAAS,KAAK,EAAAK,IAAC,EACtCE,EAAuBH,EAAS,KAAK,EAAAC,IAAC,EACtCG,EAAuBL,EAAS,KAAK,EAAAE,IAAC,EACtCI,EAAyBR,EAAW,KAAK,EAAAI,IAAC,EAC1CK,EAAyBR,EAAU,KAAK,EAAAG,IAAC,EAEzCM,EAAmCL,EAAI,EACvCM,EAAmCL,EAAI,EACvCM,EAAqCH,EAAK,EAG1CI,EAA2B,GAG3BC,EAA6B,GAwBnC,SAASC,GAAgB,CAI/B,IAAMC,EAAKX,EAAI,EACTY,EAAKZ,EAAI,EACTa,EAAKZ,EAAI,EACTa,EAAKb,EAAI,EACf,QAAQ,IAAI,CAAE,GAAAU,EAAI,GAAAC,EAAI,GAAAC,EAAI,GAAAC,CAAG,CAAC,CAC/B","names":["import_typebox","import_system","ApplogStreamTB","options","value","ApplogStream","StringTB","OptionalTB","BooleanTB","ObjectTB","NumberTB","T","Str","Num","Obj","Opt","Bool","STR","NUM","BOOL","DefaultTrue","DefaultFalse","checkParityTB","s1","s2","n1","n2"]}
@@ -1,2 +0,0 @@
1
- import{D as c,E as u,a as g,b as m,c as f,da as v,y as l}from"./chunk-FPUMKLJ4.min.js";import{c as a}from"./chunk-G3GOAFHU.min.js";var{WARN:y,LOG:B,DEBUG:d,VERBOSE:p,ERROR:q}=a.setup(a.INFO),L=u(function(e){d(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutHistory")&&y("queryDivergencesByPrev on stream withoutHistory",e);let s=c(()=>{let i=new Map,n=new Set;p("all applogs:",e.applogs);for(let r of e.applogs){let t;r.pv&&(t=r.pv&&i.get(r.pv.toString()),n.delete(r.pv.toString())),p("traversing log",{log:r,prevLogs:t,leafs:Array.from(n)}),i.set(r.cid,t?[...t,r]:[r]),n.add(r.cid)}return Array.from(n).map(r=>{let t=new v(i.get(r),e.filters,l({caller:"DivergenceLeaf",stream:e,pattern:`leaf: ${r}`}),!0,e);return{log:t.latestLog,stream:t}})},{name:l({caller:"queryDivergencesByPrev",stream:e})});return p.isDisabled||m(()=>p("[queryDivergencesByPrev] result:",f(s))),s},{equals:g.structural});function R(o){return e=>e?.includes?.(o)}function b(o){return e=>o?.includes?.(e)}export{L as a,R as b,b as c};
2
- //# sourceMappingURL=chunk-MBXUXVXG.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/query/divergences.ts","../src/query/matchers.ts"],"sourcesContent":["import { Logger } from 'besonders-logger'\nimport { autorun, comparer, toJS } from 'mobx'\nimport { Applog } from '../applog/datom-types'\nimport { computedFnDeepCompare, createDebugName, observableArrayMap } from '../mobx/mobx-utils'\nimport { ApplogStream } from '../stream'\nimport { ApplogStreamInMemory } from '../stream/writeable'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line no-unused-vars\n\nexport interface DivergenceLeaf {\n\tlog: Applog\n\tstream: ApplogStream\n}\n\nexport const queryDivergencesByPrev = computedFnDeepCompare(function queryConflictingByPrev(\n\tsourceStream: ApplogStream,\n) {\n\tDEBUG(`queryDivergencesByPrev<${sourceStream.nameAndSizeUntracked}>`)\n\tif (sourceStream.filters.includes('withoutHistory')) WARN(`queryDivergencesByPrev on stream withoutHistory`, sourceStream)\n\n\tconst divergences = observableArrayMap(() => {\n\t\tconst logsForNode = new Map<string, Applog[]>()\n\t\tconst leafs = new Set<string>()\n\t\tVERBOSE('all applogs:', sourceStream.applogs)\n\t\tfor (const log of sourceStream.applogs) {\n\t\t\tlet prevLogs\n\t\t\tif (log.pv) {\n\t\t\t\tprevLogs = log.pv && logsForNode.get(log.pv.toString())\n\t\t\t\tleafs.delete(log.pv.toString())\n\t\t\t}\n\t\t\tVERBOSE('traversing log', { log, prevLogs, leafs: Array.from(leafs) })\n\t\t\tlogsForNode.set(log.cid, prevLogs ? [...prevLogs, log] : [log])\n\t\t\tleafs.add(log.cid)\n\t\t}\n\t\treturn Array.from(leafs).map(leafID => {\n\t\t\t// TODO use MappedApplogStream?\n\t\t\tconst stream = new ApplogStreamInMemory(\n\t\t\t\tlogsForNode.get(leafID),\n\t\t\t\tsourceStream.filters,\n\t\t\t\tcreateDebugName({\n\t\t\t\t\tcaller: 'DivergenceLeaf',\n\t\t\t\t\tstream: sourceStream,\n\t\t\t\t\tpattern: `leaf: ${leafID}`,\n\t\t\t\t}),\n\t\t\t\ttrue,\n\t\t\t\tsourceStream,\n\t\t\t)\n\t\t\treturn ({ log: stream.latestLog, stream })\n\t\t})\n\t}, { name: createDebugName({ caller: 'queryDivergencesByPrev', stream: sourceStream }) })\n\tVERBOSE.isDisabled || autorun(() => VERBOSE(`[queryDivergencesByPrev] result:`, toJS(divergences)))\n\treturn divergences\n}, { equals: comparer.structural })\n","import { DatomPart } from '../applog/datom-types'\n\nexport function includes(str: string) {\n\treturn (vl: DatomPart) => vl?.includes?.(str)\n}\nexport function includedIn(arr: string[]) {\n\treturn (vl: DatomPart) => arr?.includes?.(vl)\n}\n"],"mappings":"mIAOA,GAAM,CAAE,KAAAA,EAAM,IAAAC,EAAK,MAAAC,EAAO,QAAAC,EAAS,MAAAC,CAAM,EAAIC,EAAO,MAAMA,EAAO,IAAI,EAOxDC,EAAyBC,EAAsB,SAC3DC,EACC,CACDN,EAAM,0BAA0BM,EAAa,oBAAoB,GAAG,EAChEA,EAAa,QAAQ,SAAS,gBAAgB,GAAGR,EAAK,kDAAmDQ,CAAY,EAEzH,IAAMC,EAAcC,EAAmB,IAAM,CAC5C,IAAMC,EAAc,IAAI,IAClBC,EAAQ,IAAI,IAClBT,EAAQ,eAAgBK,EAAa,OAAO,EAC5C,QAAWK,KAAOL,EAAa,QAAS,CACvC,IAAIM,EACAD,EAAI,KACPC,EAAWD,EAAI,IAAMF,EAAY,IAAIE,EAAI,GAAG,SAAS,CAAC,EACtDD,EAAM,OAAOC,EAAI,GAAG,SAAS,CAAC,GAE/BV,EAAQ,iBAAkB,CAAE,IAAAU,EAAK,SAAAC,EAAU,MAAO,MAAM,KAAKF,CAAK,CAAE,CAAC,EACrED,EAAY,IAAIE,EAAI,IAAKC,EAAW,CAAC,GAAGA,EAAUD,CAAG,EAAI,CAACA,CAAG,CAAC,EAC9DD,EAAM,IAAIC,EAAI,GAAG,CAClB,CACA,OAAO,MAAM,KAAKD,CAAK,EAAE,IAAIG,GAAU,CAEtC,IAAMC,EAAS,IAAIC,EAClBN,EAAY,IAAII,CAAM,EACtBP,EAAa,QACbU,EAAgB,CACf,OAAQ,iBACR,OAAQV,EACR,QAAS,SAASO,CAAM,EACzB,CAAC,EACD,GACAP,CACD,EACA,MAAQ,CAAE,IAAKQ,EAAO,UAAW,OAAAA,CAAO,CACzC,CAAC,CACF,EAAG,CAAE,KAAME,EAAgB,CAAE,OAAQ,yBAA0B,OAAQV,CAAa,CAAC,CAAE,CAAC,EACxF,OAAAL,EAAQ,YAAcgB,EAAQ,IAAMhB,EAAQ,mCAAoCiB,EAAKX,CAAW,CAAC,CAAC,EAC3FA,CACR,EAAG,CAAE,OAAQY,EAAS,UAAW,CAAC,EClD3B,SAASC,EAASC,EAAa,CACrC,OAAQC,GAAkBA,GAAI,WAAWD,CAAG,CAC7C,CACO,SAASE,EAAWC,EAAe,CACzC,OAAQF,GAAkBE,GAAK,WAAWF,CAAE,CAC7C","names":["WARN","LOG","DEBUG","VERBOSE","ERROR","Logger","queryDivergencesByPrev","computedFnDeepCompare","sourceStream","divergences","observableArrayMap","logsForNode","leafs","log","prevLogs","leafID","stream","ApplogStreamInMemory","createDebugName","autorun","toJS","comparer","includes","str","vl","includedIn","arr"]}
@@ -1,2 +0,0 @@
1
- import{d as f}from"./chunk-J5PGGKKW.min.js";import{I as w,K as D,ga as x,v as I}from"./chunk-FPUMKLJ4.min.js";import{c as m,l as C,q as c}from"./chunk-G3GOAFHU.min.js";var{WARN:H,LOG:W,DEBUG:i,VERBOSE:U,ERROR:h}=m.setup(m.DEBUG);async function M(t,n,e,p){let o=w(e),{sharedAgents:l,sharedKeyMap:d,sharedKey:s}=p??{},a=D(x(n),{en:t.ag,at:["agent/ecdh","agent/jwkd","agent/appAgent"]}).applogs;if(i("[preparePubForPush] agent logs:",a),!a.find(({at:r})=>r==="agent/appAgent"))throw h("[preparePubForPush] appStream missing agent/appAgent log");let u,y=async(r,P)=>{throw new Error("todo: enc")};i("[preparePubForPush] applogs ",o);let g;if(l){if(!s||!d)throw h("sharedAgents but no Keys/Map",{sharedAgents:l,sharedKeyMap:d,sharedKey:s});let r=[],P=[];for(let[A,S]of Array.from(d.entries()))P.push({ag:t.ag,en:A,at:"pub/sharedKey",vl:S});for(let A of o){U("[crypto] encrypting ",A);try{u=await y(A,s)}catch{}r.push(u)}g=r}else g=o;return K(t,g,a)}async function K(t,n,e){i("[encodePubAsCar] encoding",{agent:t,applogs:n,infoLogs:e});let{cids:p,encodedApplogs:o}=await b(e),{cids:l,encodedApplogs:d}=await b(n),s=await c({logs:p}),a=await c({logs:l}),u=await t.sign(s.bytes),y=await t.sign(a.bytes),g={info:s.cid,applogs:a.cid,infoSignature:u,applogsSignature:y};i("[encodePubAsCar] encoding root",{root:g,logCids:l,infoLogCids:p});let r=await c(g);return i("[encodePubAsCar] => root",{encodedRoot:r}),await f(r.cid,[r,s,a,...o,...d])}async function G(t){let{cids:n,encodedApplogs:e}=await b(t),o=await c({applogs:n});return i("[encodeApplogsAsCar] encoded root",{cids:n,encodedRoot:o}),await f(o.cid,[o,...e])}async function b(t){let n=t.map(o=>o instanceof Uint8Array?o:C(o)),e=await Promise.all(n.map(c));return i("[encodeApplogsAsIpld] encoded applogs",{encodedApplogs:e}),{cids:e.map(o=>{if(!o.cid)throw new h("[publish] no cid for encoded log:",o);return o.cid}),encodedApplogs:e}}function N(t){return t?.pk!==void 0&&t?.lastPush!==void 0}function V(t){return t?.lastPull!==void 0}function q(t){return I(t,31,7)}export{M as a,K as b,G as c,N as d,V as e,q as f};
2
- //# sourceMappingURL=chunk-PMJNK5VR.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/pubsub/publication.ts","../src/pubsub/pubsub-types.ts"],"sourcesContent":["import { Logger } from 'besonders-logger'\nimport { stringify } from 'safe-stable-stringify'\nimport { cyrb53hash } from '../applog/applog-utils'\nimport { Applog, ApplogForInsert, EntityID } from '../applog/datom-types'\nimport { makeCarBlob } from '../ipfs/car'\nimport { encodeBlockOriginal, prepareForPub } from '../ipfs/ipfs-utils'\nimport { withoutHistory } from './../query/basic'\nimport { ApplogsOrStream, ApplogStream, getLogsFromStream } from '../stream'\nimport { rollingFilter } from '../stream/filters'\nimport { AppAgent, IPublication } from './pubsub-types'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.DEBUG) // eslint-disable-line no-unused-vars\n\n// export const neverEncryptAttrs = [\n// \t'agent/jwkd',\n// \t'agent/appAgent',\n// \t'pub/encryptedFor',\n// \t'pub/sharedKey',\n// ]\n\nexport async function preparePubForPush(\n\tagent: AppAgent,\n\tappStream: ApplogStream,\n\tstreamToPublish: ApplogsOrStream,\n\tpublication: IPublication,\n) {\n\t// await initWasm()\n\t// const car_data = Wasm.make_car(applogs)\n\t// DEBUG('Car data:', car_data)\n\t// TODO prevent publish if there is no new info\n\tconst logsToPublish = getLogsFromStream(streamToPublish)\n\n\tconst { sharedAgents, sharedKeyMap, sharedKey } = publication ?? {}\n\t// TODO: publish all agents' info related to the logs we want to publish\n\tconst agentLogs = rollingFilter(withoutHistory(appStream), {\n\t\ten: agent.ag,\n\t\tat: ['agent/ecdh', 'agent/jwkd', 'agent/appAgent'],\n\t}).applogs\n\tDEBUG(`[preparePubForPush] agent logs:`, agentLogs)\n\tif (!agentLogs.find(({ at }) => at === 'agent/appAgent')) throw ERROR(`[preparePubForPush] appStream missing agent/appAgent log`)\n\tlet encPayload\n\tconst encryptAndTestDecrypt = async (applog: Applog, keyToUse: CryptoKey): Promise<Uint8Array> => {\n\t\tthrow new Error(`todo: enc`) // TODO: ENC\n\t\t// const eachLog = prepareForPub(applog) // without cid\n\t\t// const enc = new TextEncoder()\n\t\t// const stringified = stringify(eachLog)\n\t\t// const stringifiedEncodedAppLogPayload = enc.encode(stringified) // TODO: consider encodeToDagJson instead\n\t\t// VERBOSE('[odd]', { eachLog, stringified, stringifiedEncodedAppLogPayload })\n\n\t\t// try {\n\t\t// \tencPayload = await agent.crypto?.aes.encrypt(stringifiedEncodedAppLogPayload, keyToUse, SymmAlg.AES_GCM)\n\t\t// } catch (err) {\n\t\t// \tthrow ERROR('FAILED TO ENC payload length:', stringifiedEncodedAppLogPayload.length, { err })\n\t\t// }\n\n\t\t// const decrypted = await decryptWithAesSharedKey(encPayload, keyToUse, 'string')\n\n\t\t// VERBOSE('[odd] encrypted length:', stringifiedEncodedAppLogPayload.length, { encPayload, decrypted })\n\t\t// return encPayload\n\t}\n\tDEBUG('[preparePubForPush] applogs ', logsToPublish)\n\n\tlet maybeEncryptedApplogs: Uint8Array[] | readonly Applog[]\n\tif (sharedAgents) { // encrypt all Applogs\n\t\tif (!sharedKey || !sharedKeyMap) {\n\t\t\tthrow ERROR('sharedAgents but no Keys/Map', { sharedAgents, sharedKeyMap, sharedKey })\n\t\t}\n\t\tconst encryptedApplogs = [] as Uint8Array[]\n\t\tconst agentSharedKeyLogs = []\n\t\tfor (const [eachAgent, eachEncKey] of Array.from(sharedKeyMap.entries())) {\n\t\t\tagentSharedKeyLogs.push({\n\t\t\t\tag: agent.ag,\n\t\t\t\ten: eachAgent,\n\t\t\t\tat: 'pub/sharedKey',\n\t\t\t\tvl: eachEncKey, // these are encrypted with the derived key from the local agent private and remote agent public keys\n\t\t\t})\n\t\t}\n\t\t// const encryptedForLogs = await insertApplogs(agentSharedKeyLogs)\n\t\t// DEBUG(`[publish] adding agentSharedKeyLogs:`, encryptedForLogs)\n\n\t\t// TODO ensure that all needed keys are in\n\t\tfor (const eachLog of logsToPublish) {\n\t\t\tVERBOSE('[crypto] encrypting ', eachLog)\n\t\t\t// if (neverEncryptAttrs.includes(eachLog.at)) {\n\t\t\t// \tencryptedApplogs.push(/* prepareForPub( */ eachLog /* ) */) // ? this seemed to double the below one - @gotjoshua?\n\t\t\t// \t// continue\n\t\t\t// }\n\t\t\ttry {\n\t\t\t\tencPayload = await encryptAndTestDecrypt(eachLog, sharedKey)\n\t\t\t} catch (err) {\n\t\t\t\t// its already traced in encryptAndTestDecrypt\n\t\t\t\t// continue\n\t\t\t}\n\t\t\tencryptedApplogs.push(encPayload)\n\t\t}\n\t\tmaybeEncryptedApplogs = encryptedApplogs\n\t} else {\n\t\tmaybeEncryptedApplogs = logsToPublish // publish nonEncrypted\n\t}\n\treturn encodePubAsCar(agent, maybeEncryptedApplogs, agentLogs)\n}\n\n/**\n * @param applogs Encrypted or plain applogs\n * @returns Car file\n */\nexport async function encodePubAsCar(\n\tagent: AppAgent,\n\tapplogs: readonly Uint8Array[] | readonly Applog[],\n\tinfoLogs: readonly Applog[],\n) {\n\tDEBUG(`[encodePubAsCar] encoding`, { agent, applogs, infoLogs })\n\tconst { cids: infoLogCids, encodedApplogs: encodedInfoLogs } = await encodeApplogsAsIPLD(infoLogs)\n\tconst { cids: logCids, encodedApplogs } = await encodeApplogsAsIPLD(applogs)\n\t// We need to wrap the array to get a CID\n\tconst infoLogsWrap = await encodeBlockOriginal({ logs: infoLogCids })\n\tconst applogsWrap = await encodeBlockOriginal({ logs: logCids })\n\tconst infoSignature = await agent.sign(infoLogsWrap.bytes)\n\tconst applogsSignature = await agent.sign(applogsWrap.bytes)\n\tconst root = {\n\t\tinfo: infoLogsWrap.cid,\n\t\tapplogs: applogsWrap.cid,\n\t\tinfoSignature,\n\t\tapplogsSignature,\n\t}\n\tDEBUG('[encodePubAsCar] encoding root', { root, logCids, infoLogCids })\n\tconst encodedRoot = await encodeBlockOriginal(root)\n\tDEBUG('[encodePubAsCar] => root', { encodedRoot })\n\n\treturn await makeCarBlob(encodedRoot.cid, [encodedRoot, infoLogsWrap, applogsWrap, ...encodedInfoLogs, ...encodedApplogs]) // TODO: create CarBuilder\n}\n\n/**\n * @param applogs Encrypted or plain applogs\n * @returns Car file\n */\nexport async function encodeApplogsAsCar(\n\tapplogs: readonly Uint8Array[] | readonly Applog[],\n) {\n\tconst { cids, encodedApplogs } = await encodeApplogsAsIPLD(applogs)\n\tconst root = { applogs: cids }\n\tconst encodedRoot = await encodeBlockOriginal(root)\n\tDEBUG('[encodeApplogsAsCar] encoded root', { cids, encodedRoot })\n\n\treturn await makeCarBlob(encodedRoot.cid, [encodedRoot, ...encodedApplogs])\n}\n\nasync function encodeApplogsAsIPLD(applogs: readonly Applog[] | readonly Uint8Array[]) {\n\tconst preppedLogs = applogs.map(log => log instanceof Uint8Array ? log : prepareForPub(log as Applog))\n\tconst encodedApplogs = await Promise.all(preppedLogs.map(encodeBlockOriginal))\n\tDEBUG('[encodeApplogsAsIpld] encoded applogs', { encodedApplogs })\n\n\tconst cids = encodedApplogs.map(b => {\n\t\tif (!b.cid) throw new ERROR(`[publish] no cid for encoded log:`, b)\n\t\treturn b.cid\n\t})\n\treturn { cids, encodedApplogs }\n}\n","import { cyrb53hash } from './../applog/applog-utils'\nimport { AgentHash, AgentID } from '../applog/datom-types'\nimport { Tagged } from '../types'\n\ntype AgentString = Tagged<string, 'AgentString'>\ntype DIDString = Tagged<string, 'DID'>\nexport type { AgentHash, AgentString, DIDString }\n\nexport interface AppAgent {\n\tag: AgentHash\n\tagentString: AgentString\n\tdid: DIDString\n\n\tsign(data: Uint8Array): Promise<Uint8Array>\n}\n\nexport interface IPublication {\n\tid?: string // string hash of pub (used as unique id in IDB) `W3Name.create().toString()` starts with k51qzi5uqu5d\n\tcreatedAt: string // ISO timestamp of creation\n\tname: string // nick name for the pub\n\tisDeleted?: boolean\n\n\tpk: Uint8Array // exported privatekey - needed to create WritableName for publishing //TODO: store as non-extractable / encrypted?\n\n\tautopush: boolean\n\tlastPush: string | null\n\tlastCID?: string\n\tlatestLogTs?: string\n\n\tpublishedBy: string // local user appAgent\n\tselectors?: string[] // to be used as a filter for which applogs to pub\n\tencryptedFor?: string | null // short agentHash\n\tencryptedWith?: CryptoKey | null // AES-GCM derived key from ECDH keys (local private and remote public)\n\n\t// HACK WIP #39 - shared encryption\n\tsharedKey?: CryptoKey | null // AES-GCM derived key from ECDH keys (local private and ipns public)\n\tsharedAgents?: AgentID[] | null // array of string EntityIDs for the chosen agents (we need public jwkd atoms for each of them)\n\tsharedKeyMap?: Map<AgentID, string> | null // uses public key from each agent to derive an aes key that is used to encrypt and btoa the sharedKey that is actually used to encrypt and decrypt the applogs\n}\nexport interface ISubscription {\n\tid: string // string hash of pub (used as unique id in IDB) `W3Name.create().toString()` starts with k51qzi5uqu5d\n\tcreatedAt: string // ISO timestamp of creation\n\tname: string // nick name for the pub\n\tisDeleted: boolean\n\n\tlastPull?: string | null\n\tlastPullAttempt?: string | null\n\tautopull: boolean\n\tlastCID?: string\n\tpublishedBy?: string // remote publisher short agentHash\n\tencryptedFor?: string | undefined // short agentHash\n\tencryptedWith?: CryptoKey | undefined // AES-GCM derived key from ECDH keys (local private and remote public)\n}\nexport function isPublication(obj: any): obj is IPublication {\n\treturn obj?.pk !== undefined && obj?.lastPush !== undefined\n}\nexport function isSubscription(obj: any): obj is ISubscription {\n\treturn obj?.lastPull !== undefined\n}\n\nexport type TSubPub = IPublication | ISubscription\n\nexport function agentToShortHash(agentString: string) {\n\treturn cyrb53hash(agentString, 31, 7) as string\n}\n"],"mappings":"wKAWA,GAAM,CAAE,KAAAA,EAAM,IAAAC,EAAK,MAAAC,EAAO,QAAAC,EAAS,MAAAC,CAAM,EAAIC,EAAO,MAAMA,EAAO,KAAK,EAStE,eAAsBC,EACrBC,EACAC,EACAC,EACAC,EACC,CAKD,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,GAAI,CAACA,EAAE,IAAK,MAAM,IAAI/C,EAAM,oCAAqC+C,CAAC,EAClE,OAAOA,EAAE,GACV,CAAC,EACc,eAAAd,CAAe,CAC/B,CCxGO,SAASe,EAAcC,EAA+B,CAC5D,OAAOA,GAAK,KAAO,QAAaA,GAAK,WAAa,MACnD,CACO,SAASC,EAAeD,EAAgC,CAC9D,OAAOA,GAAK,WAAa,MAC1B,CAIO,SAASE,EAAiBC,EAAqB,CACrD,OAAOC,EAAWD,EAAa,GAAI,CAAC,CACrC","names":["WARN","LOG","DEBUG","VERBOSE","ERROR","Logger","preparePubForPush","agent","appStream","streamToPublish","publication","logsToPublish","getLogsFromStream","sharedAgents","sharedKeyMap","sharedKey","agentLogs","rollingFilter","withoutHistory","at","encPayload","encryptAndTestDecrypt","applog","keyToUse","maybeEncryptedApplogs","encryptedApplogs","agentSharedKeyLogs","eachAgent","eachEncKey","eachLog","encodePubAsCar","applogs","infoLogs","infoLogCids","encodedInfoLogs","encodeApplogsAsIPLD","logCids","encodedApplogs","infoLogsWrap","encodeBlockOriginal","applogsWrap","infoSignature","applogsSignature","root","encodedRoot","makeCarBlob","encodeApplogsAsCar","cids","preppedLogs","log","prepareForPub","b","isPublication","obj","isSubscription","agentToShortHash","agentString","cyrb53hash"]}
@@ -1,36 +0,0 @@
1
- import { type Applog, ApplogForInsert } from '../applog/datom-types';
2
- export type ApplogStreamEvent = {
3
- added: readonly Applog[];
4
- removed: readonly Applog[] | null;
5
- } | {
6
- init: readonly Applog[];
7
- };
8
- export declare function isInitEvent(event: ApplogStreamEvent): event is {
9
- init: readonly Applog[];
10
- };
11
- export type ApplogsOrStream = ApplogStream | readonly Applog[];
12
- export declare abstract class ApplogStream {
13
- protected _applogs: Applog[];
14
- readonly name: string;
15
- readonly filters: string[];
16
- readonly parents: ApplogStream[] | null;
17
- protected _subscribers: ((event: ApplogStreamEvent) => void)[];
18
- constructor(parents: ApplogStream | ApplogStream[] | null, filters: string[], _applogs: Applog[], name: string);
19
- abstract get readOnly(): boolean;
20
- subscribe(callback: (event: ApplogStreamEvent) => void): () => void;
21
- unsubscribe(callback: (event: ApplogStreamEvent) => void): void;
22
- protected notifySubscribers(event: ApplogStreamEvent): void;
23
- get applogs(): readonly Applog[];
24
- map<R>(fn: (applog: Applog) => R): R[];
25
- get firstLog(): Applog;
26
- get latestLog(): Applog;
27
- hasApplog(applog: Applog, byRef: boolean): boolean;
28
- hasApplogWithDiffTs(applog: ApplogForInsert): Applog;
29
- get isEmpty(): boolean;
30
- get size(): number;
31
- get untrackedSize(): number;
32
- get nameAndSizeUntracked(): string;
33
- get prettyName(): string;
34
- }
35
- export declare const getLogsFromStream: (logsOrStream: ApplogsOrStream) => readonly Applog[];
36
- //# sourceMappingURL=basic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/stream/basic.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,MAAM,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAKpE,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAA;AAC7H,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,KAAK,IAAI;IAAE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAE1F;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,SAAS,MAAM,EAAE,CAAA;AAE9D,8BAAsB,YAAY;IAQhC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM;IARtB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAAA;IACvC,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC,EAAE,CAAK;gBAGlE,OAAO,EAAE,YAAY,GAAG,YAAY,EAAE,GAAG,IAAI,EAC7C,OAAO,EAAE,MAAM,EAAE,EACP,QAAQ,EAAE,MAAM,EAAO,EACxB,IAAI,EAAE,MAAM;IAiBtB,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAA;IAEhC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI;IAKtD,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI;IAOxD,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,iBAAiB;IAOpD,IAAI,OAAO,IAAI,SAAS,MAAM,EAAE,CAG/B;IAEM,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC;IAKvC,IAAI,QAAQ,WAEX;IACD,IAAI,SAAS,WAEZ;IACM,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAcxC,mBAAmB,CAAC,MAAM,EAAE,eAAe;IAUlD,IAAI,OAAO,YAEV;IACD,IAAI,IAAI,WAEP;IACD,IAAI,aAAa,WAEhB;IACD,IAAI,oBAAoB,WAEvB;IACD,IAAI,UAAU,WAEb;CACD;AAED,eAAO,MAAM,iBAAiB,iBAAkB,eAAe,sBACY,CAAA"}
@@ -1,38 +0,0 @@
1
- import { IObservableArray, ObservableMap, ObservableSet } from 'mobx';
2
- import { Applog, ApplogValue, DatalogQueryPattern } from '../applog/datom-types';
3
- import { ApplogStream, ApplogStreamEvent } from './basic';
4
- import { ApplogEventMapper, MappedApplogStream } from './mapped';
5
- export declare const rollingFilter: (stream: ApplogStream, pattern: DatalogQueryPattern, opts?: {
6
- name?: string;
7
- extraFilterName?: string;
8
- }) => MappedApplogStream;
9
- export declare const rollingMapper: (stream: ApplogStream, eventMapper: ApplogEventMapper, opts?: {
10
- name?: string;
11
- extraFilterName?: string;
12
- }) => MappedApplogStream;
13
- export declare const rollingAcc: <ACC extends IObservableArray<any> | ObservableMap<any, any> | ObservableSet<any>>(stream: ApplogStream, acc: ACC, eventMapper: (event: ApplogStreamEvent, acc: ACC) => void) => ACC;
14
- export declare const getUntrackedPattern: (pattern: DatalogQueryPattern) => {
15
- [k: string]: string | boolean | Number | import("../applog/datom-types").CidString | readonly import("../applog/datom-types").CidString[] | ((value: import("../applog/datom-types").CidString) => boolean) | readonly string[] | ((value: string) => boolean) | import("../applog/datom-types").AgentHash | readonly import("../applog/datom-types").AgentHash[] | ((value: import("../applog/datom-types").AgentHash) => boolean) | readonly ApplogValue[] | ((value: ApplogValue) => boolean);
16
- };
17
- export declare function makeFilter(pattern: DatalogQueryPattern): (logs: readonly Applog[]) => Applog[];
18
- /**
19
- * // ! think twice before using
20
- */
21
- export declare const getUntrackedFilterResults: (stream: ApplogStream, pattern: DatalogQueryPattern, opts?: {
22
- name?: string;
23
- }) => Applog[];
24
- export type ApplogStreamWithFilter<T extends string> = ApplogStream & {
25
- filters: T[];
26
- };
27
- export declare function hasFilter<T extends string>(stream: ApplogStream, filter: T): stream is ApplogStreamWithFilter<T>;
28
- export declare function assertRaw(stream: ApplogStream): ApplogStreamWithoutFilters;
29
- export declare function assertOnlyCurrent(stream: ApplogStream): ApplogStream & {
30
- filters: "withoutHistory"[];
31
- } & {
32
- filters: "withoutDeleted"[];
33
- };
34
- export type ApplogStreamOnlyCurrent = ApplogStreamWithFilter<'withoutHistory' | 'withoutDeleted'>;
35
- export type ApplogStreamWithoutFilters = ApplogStream & {
36
- filters: [];
37
- };
38
- //# sourceMappingURL=filters.d.ts.map