Skip to content

Commit

Permalink
Merge pull request #204 from rimbu-org/feature/api-improvements
Browse files Browse the repository at this point in the history
Feature/api improvements
  • Loading branch information
vitoke authored Jan 26, 2024
2 parents f9885be + 3e392e5 commit 1074987
Show file tree
Hide file tree
Showing 301 changed files with 12,760 additions and 8,051 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
# Defaults to the user or organization that owns the workflow file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: 'yarn'
- uses: webfactory/ssh-agent@v0.7.0
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-canary-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git credentials
Expand All @@ -16,9 +16,9 @@ jobs:
- name: Attach to main branch
run: git checkout main && git pull
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
# Defaults to the user or organization that owns the workflow file
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-graduate-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git credentials
Expand All @@ -16,9 +16,9 @@ jobs:
- name: Attach to main branch
run: git checkout main && git pull
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
# Defaults to the user or organization that owns the workflow file
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git credentials
Expand All @@ -16,9 +16,9 @@ jobs:
- name: Attach to main branch
run: git checkout main && git pull
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
# Defaults to the user or organization that owns the workflow file
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ yarn-error.log
lerna-debug.log

**/.DS_Store

.nx
2 changes: 1 addition & 1 deletion config/tsconfig.common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"module": "Node16",
"moduleResolution": "node16",
"verbatimModuleSyntax": true,
"lib": ["esnext"],
"lib": ["ESNext"],
"importHelpers": true,
"sourceMap": true,
"strict": true,
Expand Down
4 changes: 2 additions & 2 deletions deno_dist/actor/main/actor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OptLazy, type Reducer } from '../../common/mod.ts';
import { OptLazy } from '../../common/mod.ts';
import type { Reducer } from '../../stream/mod.ts';

import type { ActionBase } from './internal.ts';

/**
*
*/
Expand Down
18 changes: 10 additions & 8 deletions deno_dist/actor/main/generate-uuid.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
declare global {
export const self: any;
export const crypto: any;
}

interface Context {
crypto?: { randomUUID?: () => string };
performance?: { now?: () => number };
}

/**
* Internal function to generate a UUID.
*/
export function generateUUID(): string {
const context = self;
if (undefined !== context?.crypto?.randomUUID) {
return crypto.randomUUID();
export function generateUUID(context: Context = self): string {
if (typeof context?.crypto?.randomUUID === 'function') {
return context.crypto.randomUUID();
}

// Public Domain/MIT
let d = new Date().getTime(); //Timestamp
let d2 =
(typeof performance !== 'undefined' &&
performance.now &&
performance.now() * 1000) ||
(typeof context?.performance?.now === 'function' &&
context.performance.now() * 1000) ||
0; //Time in microseconds since page-load or 0 if unsupported
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
let r = Math.random() * 16; //random number between 0 and 16
Expand Down
26 changes: 15 additions & 11 deletions deno_dist/actor/main/lookup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Reducer, type OptLazy } from '../../common/mod.ts';
import { OptLazy } from '../../common/mod.ts';
import { Reducer } from '../../stream/mod.ts';

import type { ActionBase } from './internal.ts';

Expand Down Expand Up @@ -49,18 +50,21 @@ export namespace Lookup {
): Reducer<ActionBase, S> {
const { actions, fallback } = lookup;

return Reducer.createOutput(initState, (state, action) => {
if (undefined !== actions && action.tag in actions) {
const lookupValue = actions[action.tag];
return Reducer.createOutput(
() => OptLazy(initState),
(state, action) => {
if (undefined !== actions && action.tag in actions) {
const lookupValue = actions[action.tag];

return applyLookupValue(state, action, lookupValue);
}
return applyLookupValue(state, action, lookupValue);
}

if (undefined !== fallback) {
return applyFallback(state, action, fallback);
}
if (undefined !== fallback) {
return applyFallback(state, action, fallback);
}

return state;
});
return state;
}
);
}
}
2 changes: 1 addition & 1 deletion deno_dist/actor/main/slice-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { OptLazy } from '../../common/mod.ts';
import { type OptLazy } from '../../common/mod.ts';

import { Lookup, type ActionBase, type Slice } from './internal.ts';

Expand Down
4 changes: 2 additions & 2 deletions deno_dist/actor/main/slice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Reducer } from '../../common/mod.ts';
import { Reducer } from '../../stream/mod.ts';

import { Action, SliceConfig, type Actor } from './internal.ts';
import type { Tail } from './utils.ts';
Expand Down Expand Up @@ -83,7 +83,7 @@ export namespace Slice {
}

return {
reducer: Reducer.combineObj(reducers),
reducer: Reducer.combine(reducers) as any,
actions,
};
}
Expand Down
50 changes: 0 additions & 50 deletions deno_dist/actor/stream/index.ts

This file was deleted.

Loading

0 comments on commit 1074987

Please sign in to comment.