Skip to content

Commit b7ae161

Browse files
authored
Austin/patch documentation (#6)
* refactor: documentation * feat: set UserAgent version to 0.0.0-dev when developing
1 parent 626f7fe commit b7ae161

File tree

19 files changed

+123
-149
lines changed

19 files changed

+123
-149
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ Relates to #
7272

7373
---
7474

75-
**Reviewer Note**: Please ensure this PR follows our [Contributing Guidelines](../CONTRIBUTING.md) and meets all code review criteria.
75+
**Reviewer Note**: Please ensure this PR follows our [Contributing Guidelines](../docs/CONTRIBUTING.md) and meets all code review criteria.

.github/workflows/ci.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,56 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main ]
66
pull_request:
77
branches: [ main ]
88

99
jobs:
1010
lint-and-type-check:
1111
runs-on: ubuntu-latest
12-
12+
1313
steps:
1414
- uses: actions/checkout@v4
15-
15+
1616
- name: Use Node.js
1717
uses: actions/setup-node@v4
1818
with:
1919
node-version: '20.x'
2020
cache: 'npm'
21-
21+
2222
- name: Install dependencies
2323
run: npm ci
24-
24+
2525
- name: Run linting
2626
run: npm run lint
27-
27+
2828
- name: Run type checking
2929
run: npm run typecheck
3030

3131
unit-tests:
3232
runs-on: ubuntu-latest
3333
needs: lint-and-type-check
34-
34+
3535
strategy:
3636
matrix:
3737
node-version: [18.x, 20.x]
3838
os: [ubuntu-latest, windows-latest, macos-latest]
39-
39+
4040
steps:
4141
- uses: actions/checkout@v4
42-
42+
4343
- name: Use Node.js ${{ matrix.node-version }}
4444
uses: actions/setup-node@v4
4545
with:
4646
node-version: ${{ matrix.node-version }}
4747
cache: 'npm'
48-
48+
4949
- name: Install dependencies
5050
run: npm ci
51-
51+
5252
- name: Run unit tests with coverage
5353
run: npm test -- --coverage --testPathPatterns='^((?!integration).)*$'
54-
54+
5555
- name: Upload coverage to Codecov
5656
uses: codecov/codecov-action@v3
5757
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
@@ -64,25 +64,25 @@ jobs:
6464
build:
6565
runs-on: ubuntu-latest
6666
needs: [lint-and-type-check, unit-tests]
67-
67+
6868
steps:
6969
- uses: actions/checkout@v4
70-
70+
7171
- name: Use Node.js
7272
uses: actions/setup-node@v4
7373
with:
7474
node-version: '20.x'
7575
cache: 'npm'
76-
76+
7777
- name: Install dependencies
7878
run: npm ci
79-
79+
8080
- name: Build
8181
run: npm run build
82-
82+
8383
- name: Verify build outputs
8484
run: |
8585
ls -la dist/
8686
test -f dist/index.js
8787
test -f dist/index.cjs
88-
test -f dist/index.d.ts
88+
test -f dist/index.d.ts

.github/workflows/security.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Security Checks
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main ]
66
pull_request:
77
branches: [ main ]
88
schedule:
@@ -14,19 +14,19 @@ jobs:
1414
permissions:
1515
contents: read
1616
security-events: write
17-
17+
1818
steps:
1919
- uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 0
22-
22+
2323
- name: Run Gitleaks
2424
uses: gitleaks/gitleaks-action@v2
2525
env:
2626
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2727
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
2828
continue-on-error: true
29-
29+
3030
- name: Check for hardcoded secrets
3131
run: |
3232
echo "🔍 Scanning for hardcoded secrets..."
@@ -53,25 +53,25 @@ jobs:
5353
5454
dependency-check:
5555
runs-on: ubuntu-latest
56-
56+
5757
steps:
5858
- uses: actions/checkout@v4
59-
59+
6060
- name: Use Node.js
6161
uses: actions/setup-node@v4
6262
with:
6363
node-version: '20.x'
6464
cache: 'npm'
65-
65+
6666
- name: Install dependencies
6767
run: npm ci
68-
68+
6969
- name: Run npm audit
7070
run: |
7171
echo "🔍 Running npm audit..."
7272
npm audit --production --audit-level=moderate || echo "⚠️ Audit found issues but continuing..."
7373
continue-on-error: true
74-
74+
7575
- name: Run Snyk Security Scan
7676
uses: snyk/actions/node@master
7777
continue-on-error: true

README.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,12 @@ The documentation for Nutrient DWS TypeScript Client is also available on [Conte
5959

6060
## Quick Start
6161

62-
## Authentication
63-
64-
### Direct API Key
65-
66-
Provide your API key directly:
67-
6862
```typescript
6963
const client = new NutrientClient({
7064
apiKey: 'nutr_sk_your_secret_key'
7165
});
7266
```
7367

74-
### Token Provider
75-
76-
Use an async token provider to fetch tokens from a secure source:
77-
78-
```typescript
79-
const client = new NutrientClient({
80-
apiKey: async () => {
81-
const response = await fetch('/api/get-nutrient-token');
82-
const { token } = await response.json();
83-
return token;
84-
}
85-
});
86-
```
87-
8868
## Direct Methods
8969

9070
The client provides numerous methods for document processing:
@@ -103,7 +83,7 @@ const watermarkedDoc = await client.watermarkText('document.pdf', 'CONFIDENTIAL'
10383
const mergedPdf = await client.merge(['doc1.pdf', 'doc2.pdf', 'doc3.pdf']);
10484
```
10585

106-
For a complete list of available methods with examples, see the [Methods Documentation](./METHODS.md).
86+
For a complete list of available methods with examples, see the [Methods Documentation](docs/METHODS.md).
10787

10888

10989
## Workflow System
@@ -134,7 +114,7 @@ The workflow system follows a staged approach:
134114
3. Set output format
135115
4. Execute or perform a dry run
136116

137-
For detailed information about the workflow system, including examples and best practices, see the [Workflow Documentation](./WORKFLOW.md).
117+
For detailed information about the workflow system, including examples and best practices, see the [Workflow Documentation](docs/WORKFLOW.md).
138118

139119
## Error Handling
140120

@@ -201,7 +181,7 @@ Quick start for contributors:
201181
3. Use conventional commits for clear change history
202182
4. Include appropriate tests for new features
203183

204-
For detailed contribution guidelines, see the [Contributing Guide](./CONTRIBUTING.md).
184+
For detailed contribution guidelines, see the [Contributing Guide](docs/CONTRIBUTING.md).
205185

206186
## Project Structure
207187

context7.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"$schema": "https://context7.com/schema/context7.json",
33
"projectTitle": "Nutrient DWS TypeScript Client",
44
"description": "Node.js TypeScript client library for Nutrient Document Web Services (DWS) API.\n",
5-
"excludeFolders": ["src", "example", ".github"],
6-
"excludeFiles": ["CONTRIBUTING.md", "coverage-report.md", "METHODS.md", "README.md", "WORKFLOW.md"],
5+
"excludeFolders": ["src", "docs", "example", ".github"],
6+
"excludeFiles": ["README.md"],
77
"previousVersions": [
88
{
99
"tag": "v1.0.0",
1010
"title": "version 1.0.0"
1111
}
1212
]
13-
}
13+
}

CONTRIBUTING.md renamed to docs/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to Nutrient DWS TypeScript Client
22

3-
Thank you for your interest in contributing to the Nutrient DWS TypeScript Client! This document provides a quick overview of our development standards and practices. For more detailed information about the library itself, please refer to the [README](./README.md), [Methods Documentation](./METHODS.md), and [Workflow Documentation](./WORKFLOW.md).
3+
Thank you for your interest in contributing to the Nutrient DWS TypeScript Client! This document provides a quick overview of our development standards and practices. For more detailed information about the library itself, please refer to the [README](../README.md), [Methods Documentation](METHODS.md), and [Workflow Documentation](WORKFLOW.md).
44

55
## Development Standards
66

METHODS.md renamed to docs/METHODS.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,28 @@ Options:
1919
- `baseUrl` (optional): Custom API base URL (defaults to `https://api.nutrient.io`)
2020
- `timeout` (optional): Request timeout in milliseconds
2121

22+
#### Authentication
23+
24+
Provide your API key directly:
25+
26+
```typescript
27+
const client = new NutrientClient({
28+
apiKey: 'nutr_sk_your_secret_key'
29+
});
30+
```
31+
32+
Or use an async token provider to fetch tokens from a secure source:
33+
34+
```typescript
35+
const client = new NutrientClient({
36+
apiKey: async () => {
37+
const response = await fetch('/api/get-nutrient-token');
38+
const { token } = await response.json();
39+
return token;
40+
}
41+
});
42+
```
43+
2244
#### Account Methods
2345

2446
##### getAccountInfo()
File renamed without changes.

examples/.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Nutrient DWS Processor API Key
2-
NUTRIENT_API_KEY=your_api_key_here
2+
NUTRIENT_API_KEY=your_api_key_here
3+
NODE_ENV=development

examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ All processed files will be saved to the `output/` directory. You can examine th
9898
For more information about the Nutrient DWS TypeScript Client, refer to:
9999

100100
- [README.md](../README.md) - Main documentation
101-
- [METHODS.md](../METHODS.md) - Direct methods documentation
102-
- [WORKFLOW.md](../WORKFLOW.md) - Workflow system documentation
101+
- [METHODS.md](../docs/METHODS.md) - Direct methods documentation
102+
- [WORKFLOW.md](../docs/WORKFLOW.md) - Workflow system documentation

0 commit comments

Comments
 (0)