Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SP-11937, SP-11942 - update pacckage, builds, types of methods #69

Merged
merged 15 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dist/*
/lib/*
/example/*
!.*
17 changes: 0 additions & 17 deletions .eslintrc

This file was deleted.

11 changes: 11 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
extends: ['plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/no-explicit-any': ['warn'],
},
};
77 changes: 72 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,73 @@
wwwroot/*.js
node_modules
typings
dist
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

.DS_Store

# IDE
.idea
*.DS_Store
.vscode

# Project
.parcel-cache
dist
lib
.angular
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
npm run check-types
8 changes: 0 additions & 8 deletions .npmignore

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
tabWidth: 4,
};
5 changes: 5 additions & 0 deletions .terserrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"output": {
"comments": false
},
}
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,27 @@ npm install @regulaforensics/facesdk-webclient
Performing request:

```js
const face1 = fs.readFileSync('face1.jpg').buffer
const face2 = fs.readFileSync('face2.jpg').buffer
const face1 = fs.readFileSync('face1.jpg').buffer;
const face2 = fs.readFileSync('face2.jpg').buffer;

const sdk = new FaceSdk({basePath: "http://localhost:41101"})
const sdk = new FaceSdk({ basePath: 'http://localhost:41101' });

const response = await sdk.matchingApi.match({
images: [
{type: ImageSource.LIVE, data: face1, index: 1},
{type: ImageSource.DOCUMENT_RFID, data: face2, index: 2}
{ type: ImageSource.LIVE, data: face1, index: 1 },
{ type: ImageSource.DOCUMENT_RFID, data: face2, index: 2 }
]
})
});
```

Parsing results:
```js
for (const result of response.results) {
console.log(`pair(${result.firstIndex},${result.secondIndex}) similarity: ${result.similarity}`)
for (const result of response.results) {
console.log(`pair(${result.firstIndex},${result.secondIndex}) similarity: ${result.similarity}`)
}
```

You can find more detailed guide and run this sample in [example](./example/README.md) folder.
You can find more detailed guide and run this sample in [example](https://github.com/regulaforensics/FaceSDK-web-js-client/tree/master/example) folder.

## Compatibility

Expand All @@ -58,4 +58,4 @@ Module system
* ES6 module system

Definitions
* TypeScript's definitions should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
* TypeScript's definitions should be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package))
9 changes: 9 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ API_BASE_PATH="http://192.168.0.101:41101" node .

This sample generates next text output:
```text
-----------------------------------------------------------------
Diagnostic
-----------------------------------------------------------------
{
metadata: {
serverTime: '2023-10-20T11:57:46.509152',
ctx: { userIp: 'xxx.xx.xx.xx' }
}
}
-----------------------------------------------------------------
Compare Results
-----------------------------------------------------------------
Expand Down
76 changes: 76 additions & 0 deletions example/angular/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"face-sdk-web-client-angular-example": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "build",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "face-sdk-web-client-angular-example:build:production"
},
"development": {
"browserTarget": "face-sdk-web-client-angular-example:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "face-sdk-web-client:build"
}
}
}
}
},
"cli": {
"analytics": false
}
}
Loading
Loading