open-index/open-npm huggingface dataset:
npm package: @mobiuscode/wave-collapse
Description: A simple wave collapse algorithm
Author: MobiusCode
Latest version: 1.0.2

# Wave Collapse

A simple wave collapse algorithm implementation that is used to populate a grid of a defined size with tiles 
that have certain connection rules. This is useful for generating a random pattern that follows certain rules.

Wavefunction Collapse and how it works: https://robertheaton.com/2018/12/17/wavefunction-collapse-algorithm/ 

## How-to use?

First you have to define the tiles that make up your grid. For example:

```js
const myTiles = [
    new Tile(0, new Map())
];
```

The map here contains the "connectors" that the tile is compatible with. Normally you want to define an `enum` to
specify what kind of connectors you want to have:

```js
const ConnectorType = Object.freeze({
    SINGLE_LINE: 0,
    // ...
});
```

So, for example, if we have three tiles that look like this:

        ┌──────┐  ┌──────┐  ┌───┬──┐
        │      │  │      │  │   │  │
        │      │  ├──────┤  ├───┘  │
        │      │  │      │  │      │
        └──────┘  └──────┘  └──────┘
    id   0         1         2

They would be defined like this:

```js
const myTiles = [
    // no connections possible from this tile, so this tile can only
    // connect to some other tile that also has no connection pointing
    // to its neighbor
    new Tile(0, new Map()),
    
    // has one connection to the left, and one to the right, each
    // as the single line connector type
    new Tile(1, new Map(
        [Direction.LEFT, new Set([ConnectorType.SINGLE_LINE])],
        [Direction.RIGHT, new Set([ConnectorType.SINGLE_LINE])],
    )),
    
    // has one connection to the left, and one pointing upwards, each
    // as the single line connector type
    new Tile(1, new Map(
        [Direction.LEFT, new Set([ConnectorType.SINGLE_LINE])],
        [Direction.UP, new Set([ConnectorType.SINGLE_LINE])],
    )),    
];
```

Now you can use the wave collapse algorithm to get a solution like this:

```js
// for a consistent result you can initialize the random number generator with
// a fixed seed. Comment this out in case you want a new solution everytime you
// run the script
random.use(12345);

// create all rotation variants of my tiles (note that this generates rotation
// variants even for when it is not really required, like with tile 0
const myTilesRotated = generateRotatedTiles(myTiles);

// create a 10x10 grid of our possible tiles (all variants are possible in all grid positions, a.k.a. superposition)
const grid = generateGrid(myTilesRotated, 10, 10);

// tries to find a solution and returns that solution if found (otherwise null is returned)
const solution = collapseWave(grid);

if (solution !== null) {
    console.log("solution found")
    console.log(gridToString(solution))
} else {
    console.log("no solution found :(")
}
```
npm package: @mobiuspace/node-auth0
Description: ```bash yarn add @mobiuspace/node-auth0 ```
Author: jaskang
Latest version: 2.1.2

### 安装

```bash
yarn add @mobiuspace/node-auth0
```

### createServer(options: IServerOptions): Express

创建一个 node 服务，返回 Express 实例

#### IServerOptions

- appName: string - 应用名称
- staticDir: string - 静态资源目录
- auth0?: - auth0 权限配置
  - domain: string
  - audience: string
  - issuer: string
- }
- apiList: IApiScopeType[] - 接口转发配置

#### IApiScopeType 定义

```typescript
interface IApiType {
  path: string
  permissions: string[]
  scope: string
  target: [string, string]
  mockTarget?: string
}
interface IApiScopeType {
  scope: string
  target: [string, string]
  mockTarget?: string
  apis: IApiType[]
}
```

### example

#### 带 auth0 鉴权

```typescirpt
const path = require('path')
const { createServer } = require('@mobiuspace/node-auth0')
const config = require('./configs')

const server = createServer({
  appName: config.appName,
  staticDir: path.join(__dirname, 'public'), // 这里是打包之后的目录，后续在做优化
  auth0: {
    domain: config.auth0.domain,
    audience: config.auth0.audience,
    issuer: config.auth0.issuer
  },
  apiList: config.apiList
})
const port = process.env.PORT || 3040
server.listen(port, () => {
  console.log('Express server started on http://localhost:' + port)
})

```

#### 不带 auth0 鉴权

```typescirpt
const path = require('path')
const { createServer } = require('@mobiuspace/node-auth0')
const config = require('./configs')

const server = createServer({
  appName: config.appName,
  staticDir: path.join(__dirname, 'public'),
  apiList: config.apiList
  // 不用传 auth0
})
const port = process.env.PORT || 3000
server.listen(port, () => {
  console.log('Express server started on http://localhost:' + port)
})
```

### 中间件

导出中间件结合 Webpack DevServer 在开发阶段实现鉴权, mock, 调用内网接口等能力

- jwtCheck({ domain, audience, issuer }): RequestHandler

- ApiProxy(apiList: IApiScopeType[], mockHandler?: IMockHandlerType): RequestHandler

####

```javascript
// setupProxy.js
const { jwtCheck, ApiProxy } = require('@mobiuspace/node-auth0')
const config = require('./configs')

module.exports = function (app) {
  console.log(JSON.stringify(process.env))
  app.use(
    '/api',
    jwtCheck(config.auth0),
    ApiProxy(config.apiList, (path) => {
      delete require.cache[require.resolve('./mock')] // 清除掉node require 缓存，用来解决每次修改mock需要重启的问题
      const mockData = require('./mock')
      return mockData[path] || null
    })
  )
}
```
npm package: @mobiuspace/react-components
Description: <p align="left">
Author: jaskang
Latest version: 0.2.9

# @mobiuspace/react-components

<p align="left">

<a href="http://gitlab.mobiuspace.net/mobiuspace/fe-team/react-components/commits/master"><img src="http://gitlab.mobiuspace.net/mobiuspace/fe-team/react-components/badges/master/pipeline.svg"/></a>

<a href="http://gitlab.mobiuspace.net/mobiuspace/fe-team/react-components/commits/master"><img src="http://gitlab.mobiuspace.net/mobiuspace/fe-team/react-components/badges/master/coverage.svg"/></a>

<a href="https://www.npmjs.com/package/@mobiuspace/react-components"><img src="https://badgen.net/npm/v/@mobiuspace/react-components?color=green"/></a>

</p>