Skip to content

Commit 0cb70d7

Browse files
committed
Fix: Export types correctly
1 parent f27a4c0 commit 0cb70d7

File tree

8 files changed

+439
-349
lines changed

8 files changed

+439
-349
lines changed

docs/classes/Trustmark.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
[**@contentauth/c2pa-node**](../README.md)
2+
3+
***
4+
5+
[@contentauth/c2pa-node](../README.md) / Trustmark
6+
7+
# Class: Trustmark
8+
9+
Defined in: [Trustmark.ts:16](https://github.com/contentauth/c2pa-node-v2/blob/ae7c427cf2b9840789081c5691308c39243fcd1c/js-src/Trustmark.ts#L16)
10+
11+
## Implements
12+
13+
- `Trustmark`
14+
15+
## Methods
16+
17+
### decode()
18+
19+
> **decode**(`image`): `Promise`\<`string`\>
20+
21+
Defined in: [Trustmark.ts:37](https://github.com/contentauth/c2pa-node-v2/blob/ae7c427cf2b9840789081c5691308c39243fcd1c/js-src/Trustmark.ts#L37)
22+
23+
Decode a watermark from an image.
24+
25+
#### Parameters
26+
27+
##### image
28+
29+
`Buffer`
30+
31+
image to extract the watermark from (must be in a supported image format like JPEG, PNG, etc.)
32+
33+
#### Returns
34+
35+
`Promise`\<`string`\>
36+
37+
#### Implementation of
38+
39+
`neon.Trustmark.decode`
40+
41+
***
42+
43+
### encode()
44+
45+
> **encode**(`image`, `strength`, `watermark?`): `Promise`\<`Buffer`\<`ArrayBufferLike`\>\>
46+
47+
Defined in: [Trustmark.ts:24](https://github.com/contentauth/c2pa-node-v2/blob/ae7c427cf2b9840789081c5691308c39243fcd1c/js-src/Trustmark.ts#L24)
48+
49+
Encode a watermark into an image.
50+
51+
#### Parameters
52+
53+
##### image
54+
55+
`Buffer`
56+
57+
image to be watermarked
58+
59+
##### strength
60+
61+
`number`
62+
63+
number between 0 and 1 indicating how strongly the watermark should be applied
64+
65+
##### watermark?
66+
67+
`string`
68+
69+
optional bitstring to be encoded, automatically generated if not provided
70+
71+
#### Returns
72+
73+
`Promise`\<`Buffer`\<`ArrayBufferLike`\>\>
74+
75+
raw pixel data in RGB8 format (width * height * 3 bytes)
76+
77+
#### Implementation of
78+
79+
`neon.Trustmark.encode`
80+
81+
***
82+
83+
### newTrustmark()
84+
85+
> `static` **newTrustmark**(`config`): `Promise`\<`Trustmark`\>
86+
87+
Defined in: [Trustmark.ts:19](https://github.com/contentauth/c2pa-node-v2/blob/ae7c427cf2b9840789081c5691308c39243fcd1c/js-src/Trustmark.ts#L19)
88+
89+
#### Parameters
90+
91+
##### config
92+
93+
`TrustmarkConfig`
94+
95+
#### Returns
96+
97+
`Promise`\<`Trustmark`\>

eslint.config.js

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,71 @@ const tseslint = require('@typescript-eslint/eslint-plugin');
33
const tsparser = require('@typescript-eslint/parser');
44

55
module.exports = [
6-
js.configs.recommended,
7-
{
8-
files: ['**/*.ts', '**/*.tsx'],
9-
languageOptions: {
10-
parser: tsparser,
11-
parserOptions: {
12-
ecmaVersion: 'latest',
13-
sourceType: 'module',
14-
project: './tsconfig.json',
15-
},
16-
globals: {
17-
console: 'readonly',
18-
process: 'readonly',
19-
Buffer: 'readonly',
20-
__dirname: 'readonly',
21-
__filename: 'readonly',
22-
global: 'readonly',
23-
module: 'readonly',
24-
require: 'readonly',
25-
exports: 'readonly',
26-
},
27-
},
28-
plugins: {
29-
'@typescript-eslint': tseslint,
30-
},
31-
rules: {
32-
...tseslint.configs.recommended.rules,
33-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
34-
'@typescript-eslint/explicit-function-return-type': 'off',
35-
'@typescript-eslint/explicit-module-boundary-types': 'off',
36-
'@typescript-eslint/no-explicit-any': 'warn',
37-
'@typescript-eslint/no-non-null-assertion': 'warn',
38-
'prefer-const': 'error',
39-
'no-var': 'error',
40-
'no-console': 'warn',
41-
},
42-
},
43-
{
44-
files: ['**/*.spec.ts', '**/*.test.ts'],
45-
languageOptions: {
46-
globals: {
47-
describe: 'readonly',
48-
it: 'readonly',
49-
test: 'readonly',
50-
expect: 'readonly',
51-
beforeEach: 'readonly',
52-
afterEach: 'readonly',
53-
beforeAll: 'readonly',
54-
afterAll: 'readonly',
55-
jest: 'readonly',
56-
},
57-
},
58-
rules: {
59-
'@typescript-eslint/no-explicit-any': 'off',
60-
'no-console': 'off',
61-
},
62-
},
63-
{
64-
ignores: [
65-
'dist/',
66-
'node_modules/',
67-
'*.js',
68-
'*.d.ts',
69-
'*.config.js',
70-
'*.config.mjs',
71-
],
72-
},
73-
];
6+
js.configs.recommended,
7+
{
8+
files: ['**/*.ts', '**/*.tsx'],
9+
languageOptions: {
10+
parser: tsparser,
11+
parserOptions: {
12+
ecmaVersion: 'latest',
13+
sourceType: 'module',
14+
project: './tsconfig.json',
15+
},
16+
globals: {
17+
console: 'readonly',
18+
process: 'readonly',
19+
Buffer: 'readonly',
20+
__dirname: 'readonly',
21+
__filename: 'readonly',
22+
global: 'readonly',
23+
module: 'readonly',
24+
require: 'readonly',
25+
exports: 'readonly',
26+
},
27+
},
28+
plugins: {
29+
'@typescript-eslint': tseslint,
30+
},
31+
rules: {
32+
...tseslint.configs.recommended.rules,
33+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
34+
'@typescript-eslint/explicit-function-return-type': 'off',
35+
'@typescript-eslint/explicit-module-boundary-types': 'off',
36+
'@typescript-eslint/no-explicit-any': 'warn',
37+
'@typescript-eslint/no-non-null-assertion': 'warn',
38+
'prefer-const': 'error',
39+
'no-var': 'error',
40+
'no-console': 'warn',
41+
},
42+
},
43+
{
44+
files: ['**/*.spec.ts', '**/*.test.ts'],
45+
languageOptions: {
46+
globals: {
47+
describe: 'readonly',
48+
it: 'readonly',
49+
test: 'readonly',
50+
expect: 'readonly',
51+
beforeEach: 'readonly',
52+
afterEach: 'readonly',
53+
beforeAll: 'readonly',
54+
afterAll: 'readonly',
55+
jest: 'readonly',
56+
},
57+
},
58+
rules: {
59+
'@typescript-eslint/no-explicit-any': 'off',
60+
'no-console': 'off',
61+
},
62+
},
63+
{
64+
ignores: [
65+
'dist/',
66+
'node_modules/',
67+
'*.js',
68+
'**/*.d.ts',
69+
'*.config.js',
70+
'*.config.mjs',
71+
],
72+
},
73+
];

js-src/Trustmark.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import path from "path";
2121
import * as fs from "fs-extra";
2222
import sharp from "sharp";
2323

24-
const tempDir = path.join(__dirname, "tmp");
24+
const tempDir = path.join(__dirname, "..", "tmp");
2525

2626
// Helper function to convert raw RGB pixel data to JPEG format
2727
async function rawRgbToJpeg(

js-src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
// specific language governing permissions and limitations under
1212
// each license.
1313

14-
export * from 'index.node';
15-
export { Builder } from './Builder';
16-
export { Reader } from './Reader';
17-
export { LocalSigner, CallbackSigner } from './Signer';
14+
export * from "index.node";
15+
export { Builder } from "./Builder";
16+
export { Reader } from "./Reader";
17+
export { LocalSigner, CallbackSigner } from "./Signer";
1818
export {
1919
IdentityAssertionBuilder,
2020
IdentityAssertionSigner,
21-
} from './IdentityAssertion';
22-
export { Trustmark } from './Trustmark';
21+
} from "./IdentityAssertion";
22+
export { Trustmark } from "./Trustmark";

package.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
"version": "0.1.1",
88
"description": "Node.js bindings for C2PA",
99
"main": "dist/index.js",
10-
"types": "dist/js-src/index.d.ts",
10+
"types": "dist/types/index.d.ts",
1111
"files": [
12-
"dist/js-src",
13-
"dist/src",
14-
"dist/Cargo.toml",
15-
"dist/Cargo.lock"
12+
"dist"
1613
],
1714
"engines": {
1815
"node": ">=18.20.2"
@@ -23,7 +20,7 @@
2320
"build:docs": "typedoc --plugin typedoc-plugin-markdown --readme none --out docs js-src/index.ts",
2421
"build:rust": "pnpm run build:rust-debug --release",
2522
"build:rust-debug": "cargo build --message-format=json-render-diagnostics > cargo.log",
26-
"build:ts": "tsc -b && cpy index.node dist",
23+
"build:ts": "tsc -b && cpy index.node dist && cpy --flat js-src/types.d.ts dist/types",
2724
"changeset:publish": "changeset publish",
2825
"ci": "run-s build:rust-debug build:ts test",
2926
"clean": "rimraf dist generated target",
@@ -41,25 +38,25 @@
4138
"license": "MIT",
4239
"devDependencies": {
4340
"@changesets/cli": "^2.29.5",
44-
"@eslint/js": "^9.0.0",
41+
"@eslint/js": "^9.33.0",
4542
"@neon-rs/cli": "0.1.82",
4643
"@types/debug": "^4.1.12",
4744
"@types/fs-extra": "^11.0.4",
4845
"@types/jest": "^29.5.14",
49-
"@types/node": "^22.10.1",
50-
"@typescript-eslint/eslint-plugin": "^8.0.0",
51-
"@typescript-eslint/parser": "^8.0.0",
46+
"@types/node": "^22.17.1",
47+
"@typescript-eslint/eslint-plugin": "^8.39.1",
48+
"@typescript-eslint/parser": "^8.39.1",
5249
"cpy-cli": "^5.0.0",
53-
"eslint": "^9.32.0",
54-
"fs-extra": "^11.3.0",
50+
"eslint": "^9.33.0",
51+
"fs-extra": "^11.3.1",
5552
"jest": "^29.7.0",
5653
"npm-run-all": "^4.1.5",
5754
"rimraf": "^6.0.1",
5855
"sharp": "^0.34.3",
59-
"ts-jest": "^29.2.5",
60-
"typedoc": "^0.28.9",
61-
"typedoc-plugin-markdown": "^4.8.0",
62-
"typescript": "^5.7.2"
56+
"ts-jest": "^29.4.1",
57+
"typedoc": "^0.28.10",
58+
"typedoc-plugin-markdown": "^4.8.1",
59+
"typescript": "^5.9.2"
6360
},
6461
"keywords": [
6562
"c2pa"
@@ -69,7 +66,7 @@
6966
},
7067
"homepage": "https://github.com/contentauth/c2pa-node-v2#readme",
7168
"dependencies": {
72-
"debug": "^4.4.0"
69+
"debug": "^4.4.1"
7370
},
7471
"packageManager": "[email protected]"
7572
}

0 commit comments

Comments
 (0)