switched back to commonjs rather than esm
This commit is contained in:
parent
756fd240f5
commit
58c5f5dc4e
|
@ -1,6 +1,6 @@
|
|||
import {Delta, DeltaFilter} from '../src/delta.js';
|
||||
import {Lossless} from '../src/lossless.js';
|
||||
import {RhizomeNode} from '../src/node.js';
|
||||
import {Delta, DeltaFilter} from '../src/delta';
|
||||
import {Lossless} from '../src/lossless';
|
||||
import {RhizomeNode} from '../src/node';
|
||||
|
||||
describe('Lossless', () => {
|
||||
const node = new RhizomeNode();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import Debug from 'debug';
|
||||
import {Delta, PointerTarget} from "../src/delta.js";
|
||||
import {lastValueFromDeltas} from "../src/last-write-wins.js";
|
||||
import {Lossless, LosslessViewOne} from "../src/lossless.js";
|
||||
import {Lossy, valueFromCollapsedDelta} from "../src/lossy.js";
|
||||
import {RhizomeNode} from "../src/node.js";
|
||||
import {Delta, PointerTarget} from "../src/delta";
|
||||
import {lastValueFromDeltas} from "../src/last-write-wins";
|
||||
import {Lossless, LosslessViewOne} from "../src/lossless";
|
||||
import {Lossy, valueFromCollapsedDelta} from "../src/lossy";
|
||||
import {RhizomeNode} from "../src/node";
|
||||
const debug = Debug('test:lossy');
|
||||
|
||||
type Role = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {parseAddressList, PeerAddress} from '../src/peers.js';
|
||||
import {parseAddressList, PeerAddress} from '../src/peers';
|
||||
|
||||
describe('PeerAddress', () => {
|
||||
it('toString()', () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {App} from "../../util/app.js";
|
||||
import {App} from "../../util/app";
|
||||
|
||||
describe('Run', () => {
|
||||
let app: App;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Debug from 'debug';
|
||||
import {App} from '../../util/app.js';
|
||||
import {App} from '../../util/app';
|
||||
const debug = Debug('test:two');
|
||||
|
||||
describe('Run', () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Debug from 'debug';
|
||||
import {Collection} from "../src/collection.js";
|
||||
import {Entity} from "../src/entity.js";
|
||||
import {RhizomeNode} from "../src/node.js";
|
||||
import {Collection} from "../src/collection";
|
||||
import {Entity} from "../src/entity";
|
||||
import {RhizomeNode} from "../src/node";
|
||||
const debug = Debug('example-app');
|
||||
|
||||
// As an app we want to be able to write and read data.
|
||||
|
|
14
package.json
14
package.json
|
@ -19,22 +19,8 @@
|
|||
],
|
||||
"testMatch": [
|
||||
"**/__tests__/**/*"
|
||||
],
|
||||
"transform": {
|
||||
"^.+\\.ts$": [
|
||||
"ts-jest",
|
||||
{
|
||||
"useESM": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"extensionsToTreatAsEsm": [
|
||||
".ts"
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"^(\\.{1,2}/.*)\\.js$": "$1"
|
||||
}
|
||||
},
|
||||
"author": "Taliesin (Ladd) <ladd@dgov.io>",
|
||||
"license": "Unlicense",
|
||||
"dependencies": {
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
import Debug from 'debug';
|
||||
import {randomUUID} from "node:crypto";
|
||||
import EventEmitter from "node:events";
|
||||
import {Delta} from "./delta.js";
|
||||
import {Entity, EntityProperties} from "./entity.js";
|
||||
import {LastWriteWins, ResolvedViewOne} from './last-write-wins.js';
|
||||
import {RhizomeNode} from "./node.js";
|
||||
import {DomainEntityID} from "./types.js";
|
||||
import {Delta} from "./delta";
|
||||
import {Entity, EntityProperties} from "./entity";
|
||||
import {LastWriteWins, ResolvedViewOne} from './last-write-wins';
|
||||
import {RhizomeNode} from "./node";
|
||||
import {DomainEntityID} from "./types";
|
||||
const debug = Debug('rz:collection');
|
||||
|
||||
export class Collection {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {randomUUID} from "crypto";
|
||||
import microtime from 'microtime';
|
||||
import {CreatorID, HostID, Timestamp, TransactionID} from "./types.js";
|
||||
import {PeerAddress} from "./peers.js";
|
||||
import {CreatorID, HostID, Timestamp, TransactionID} from "./types";
|
||||
import {PeerAddress} from "./peers";
|
||||
|
||||
export type DeltaID = string;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Debug from 'debug';
|
||||
import EventEmitter from 'node:events';
|
||||
import objectHash from 'object-hash';
|
||||
import {Delta, DeltaNetworkImage} from './delta.js';
|
||||
import {RhizomeNode} from './node.js';
|
||||
import {Delta, DeltaNetworkImage} from './delta';
|
||||
import {RhizomeNode} from './node';
|
||||
const debug = Debug('rz:deltas');
|
||||
|
||||
enum Decision {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
// - As typescript interfaces?
|
||||
// - As typescript classes?
|
||||
|
||||
import {Collection} from "./collection.js";
|
||||
import {PropertyTypes} from "./types.js";
|
||||
import {Collection} from "./collection";
|
||||
import {PropertyTypes} from "./types";
|
||||
|
||||
export type EntityProperties = {
|
||||
[key: string]: PropertyTypes;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { add_operation, apply } from 'json-logic-js';
|
||||
import { Delta } from '../delta.js';
|
||||
import { Delta } from '../delta';
|
||||
|
||||
type DeltaContext = Delta & {
|
||||
creatorAddress: string;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { FilterExpr } from "../types.js";
|
||||
import { FilterExpr } from "../types";
|
||||
// import { map } from 'radash';
|
||||
|
||||
// A creator as seen by a host
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import express, {Router} from "express";
|
||||
import {Collection} from "../collection.js";
|
||||
import {Delta} from "../delta.js";
|
||||
import {RhizomeNode} from "../node.js";
|
||||
import {Collection} from "../collection";
|
||||
import {Delta} from "../delta";
|
||||
import {RhizomeNode} from "../node";
|
||||
|
||||
export class HttpApi {
|
||||
router = Router();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import express, {Router} from "express";
|
||||
import {RhizomeNode} from "../node.js";
|
||||
import {htmlDocFromMarkdown, MDFiles} from "../util/md-files.js";
|
||||
import {RhizomeNode} from "../node";
|
||||
import {htmlDocFromMarkdown, MDFiles} from "../util/md-files";
|
||||
|
||||
export class HttpHtml {
|
||||
router = Router();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import Debug from "debug";
|
||||
import express from "express";
|
||||
import {Server} from "http";
|
||||
import {RhizomeNode} from "../node.js";
|
||||
import {HttpApi} from "./api.js";
|
||||
import {HttpHtml} from "./html.js";
|
||||
import {RhizomeNode} from "../node";
|
||||
import {HttpApi} from "./api";
|
||||
import {HttpHtml} from "./html";
|
||||
const debug = Debug('rz:http-api');
|
||||
|
||||
export class HttpServer {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// import Debug from 'debug';
|
||||
import {EntityProperties} from "./entity.js";
|
||||
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless.js";
|
||||
import {Lossy, valueFromCollapsedDelta} from './lossy.js';
|
||||
import {DomainEntityID, PropertyID, PropertyTypes, Timestamp, ViewMany} from "./types.js";
|
||||
import {EntityProperties} from "./entity";
|
||||
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless";
|
||||
import {Lossy, valueFromCollapsedDelta} from './lossy';
|
||||
import {DomainEntityID, PropertyID, PropertyTypes, Timestamp, ViewMany} from "./types";
|
||||
// const debug = Debug('rz:lossy:last-write-wins');
|
||||
|
||||
type TimestampedProperty = {
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
import Debug from 'debug';
|
||||
import EventEmitter from 'events';
|
||||
import {Delta, DeltaFilter, DeltaID, DeltaNetworkImage} from './delta.js';
|
||||
import {RhizomeNode} from './node.js';
|
||||
import {Transactions} from './transactions.js';
|
||||
import {DomainEntityID, PropertyID, PropertyTypes, TransactionID, ViewMany} from "./types.js";
|
||||
import {Delta, DeltaFilter, DeltaID, DeltaNetworkImage} from './delta';
|
||||
import {RhizomeNode} from './node';
|
||||
import {Transactions} from './transactions';
|
||||
import {DomainEntityID, PropertyID, PropertyTypes, TransactionID, ViewMany} from "./types";
|
||||
const debug = Debug('rz:lossless');
|
||||
|
||||
export type CollapsedPointer = {[key: PropertyID]: PropertyTypes};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
// into various possible "lossy" views that combine or exclude some information.
|
||||
|
||||
import Debug from 'debug';
|
||||
import {DeltaFilter, DeltaID} from "./delta.js";
|
||||
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless.js";
|
||||
import {DomainEntityID} from "./types.js";
|
||||
import {DeltaFilter, DeltaID} from "./delta";
|
||||
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless";
|
||||
import {DomainEntityID} from "./types";
|
||||
const debug = Debug('rz:lossy');
|
||||
|
||||
export type Initializer<Accumulator> = (v: LosslessViewOne) => Accumulator;
|
||||
|
|
14
src/node.ts
14
src/node.ts
|
@ -1,11 +1,11 @@
|
|||
import Debug from 'debug';
|
||||
import {CREATOR, HTTP_API_ADDR, HTTP_API_ENABLE, HTTP_API_PORT, PEER_ID, PUBLISH_BIND_ADDR, PUBLISH_BIND_HOST, PUBLISH_BIND_PORT, REQUEST_BIND_ADDR, REQUEST_BIND_HOST, REQUEST_BIND_PORT, SEED_PEERS} from './config.js';
|
||||
import {DeltaStream} from './deltas.js';
|
||||
import {HttpServer} from './http/index.js';
|
||||
import {Lossless} from './lossless.js';
|
||||
import {parseAddressList, PeerAddress, Peers} from './peers.js';
|
||||
import {PubSub} from './pub-sub.js';
|
||||
import {RequestReply} from './request-reply.js';
|
||||
import {CREATOR, HTTP_API_ADDR, HTTP_API_ENABLE, HTTP_API_PORT, PEER_ID, PUBLISH_BIND_ADDR, PUBLISH_BIND_HOST, PUBLISH_BIND_PORT, REQUEST_BIND_ADDR, REQUEST_BIND_HOST, REQUEST_BIND_PORT, SEED_PEERS} from './config';
|
||||
import {DeltaStream} from './deltas';
|
||||
import {HttpServer} from './http/index';
|
||||
import {Lossless} from './lossless';
|
||||
import {parseAddressList, PeerAddress, Peers} from './peers';
|
||||
import {PubSub} from './pub-sub';
|
||||
import {RequestReply} from './request-reply';
|
||||
const debug = Debug('rz:rhizome-node');
|
||||
|
||||
export type RhizomeNodeConfig = {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import Debug from 'debug';
|
||||
import {Message} from 'zeromq';
|
||||
import {Delta} from "./delta.js";
|
||||
import {RhizomeNode} from "./node.js";
|
||||
import {Subscription} from './pub-sub.js';
|
||||
import {PeerRequest, RequestSocket, ResponseSocket} from "./request-reply.js";
|
||||
import {Delta} from "./delta";
|
||||
import {RhizomeNode} from "./node";
|
||||
import {Subscription} from './pub-sub';
|
||||
import {PeerRequest, RequestSocket, ResponseSocket} from "./request-reply";
|
||||
const debug = Debug('rz:peers');
|
||||
|
||||
export class PeerAddress {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Debug from 'debug';
|
||||
import {Publisher, Subscriber} from 'zeromq';
|
||||
import {RhizomeNode} from './node.js';
|
||||
import {PeerAddress} from './peers.js';
|
||||
import {RhizomeNode} from './node';
|
||||
import {PeerAddress} from './peers';
|
||||
const debug = Debug('rz:pub-sub');
|
||||
|
||||
export type SubscribedMessageHandler = (sender: PeerAddress, msg: string) => void;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Debug from 'debug';
|
||||
import {EventEmitter} from 'node:events';
|
||||
import {Message, Reply, Request} from 'zeromq';
|
||||
import {RhizomeNode} from './node.js';
|
||||
import {PeerAddress, RequestMethods} from './peers.js';
|
||||
import {RhizomeNode} from './node';
|
||||
import {PeerAddress, RequestMethods} from './peers';
|
||||
const debug = Debug('rz:request-reply');
|
||||
|
||||
export type PeerRequest = {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Level } from 'level';
|
||||
import { LEVEL_DB_DIR } from './config.js';
|
||||
import { LEVEL_DB_DIR } from './config';
|
||||
import path from 'path';
|
||||
|
||||
function newStore(name: string): Level {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Debug from "debug";
|
||||
import EventEmitter from "events";
|
||||
import {Delta, DeltaID} from "./delta.js";
|
||||
import {Lossless} from "./lossless.js";
|
||||
import {DomainEntityID, TransactionID} from "./types.js";
|
||||
import {Delta, DeltaID} from "./delta";
|
||||
import {Lossless} from "./lossless";
|
||||
import {DomainEntityID, TransactionID} from "./types";
|
||||
const debug = Debug('rz:transactions');
|
||||
|
||||
function getDeltaTransactionId(delta: Delta): TransactionID | undefined {
|
||||
|
|
|
@ -2,7 +2,7 @@ import Debug from "debug";
|
|||
import {FSWatcher, readdirSync, readFileSync, watch} from "fs";
|
||||
import path, {join} from "path";
|
||||
import showdown from "showdown";
|
||||
import {RhizomeNode} from "../node.js";
|
||||
import {RhizomeNode} from "../node";
|
||||
const {Converter} = showdown;
|
||||
const debug = Debug('rz:md-files');
|
||||
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"target": "ES6",
|
||||
"module": "CommonJS",
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "bundler",
|
||||
"moduleResolution": "Node",
|
||||
"sourceMap": false,
|
||||
"isolatedModules": true,
|
||||
/* "allowImportingTsExtensions": true, */
|
||||
/* "noEmit": true, */
|
||||
"baseUrl": ".",
|
||||
"outDir": "dist",
|
||||
"lib": ["ESNext"],
|
||||
"types": ["node", "jest"],
|
||||
"importsNotUsedAsValues": "remove",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
|
@ -24,10 +19,5 @@
|
|||
"scratch/**/*",
|
||||
"__tests__/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"tsc-alias": {
|
||||
"resolveFullPaths": true
|
||||
}
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Collection} from "../src/collection.js";
|
||||
import {RhizomeNode, RhizomeNodeConfig} from "../src/node.js";
|
||||
import {Collection} from "../src/collection";
|
||||
import {RhizomeNode, RhizomeNodeConfig} from "../src/node";
|
||||
|
||||
const start = 5000;
|
||||
const range = 5000;
|
||||
|
|
Loading…
Reference in New Issue