@deliverart/sdk-js-authentication 0.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -2
- package/dist/index.js +1 -2
- package/package.json +9 -22
- package/.changeset/config.json +0 -11
- package/.github/workflows/workflow.yml +0 -47
- package/.prettierrc +0 -7
- package/CHANGELOG.md +0 -13
- package/README.md +0 -3
- package/eslint.config.js +0 -37
- package/src/errors.ts +0 -6
- package/src/index.ts +0 -3
- package/src/plugin.ts +0 -38
- package/src/types.ts +0 -12
- package/tsconfig.json +0 -15
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,43 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deliverart/sdk-js-authentication",
|
|
3
3
|
"description": "Authentication module for DeliverArt SDK",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"tsup": {
|
|
9
|
+
"tsconfig": "./tsconfig.json"
|
|
10
|
+
},
|
|
8
11
|
"exports": {
|
|
9
12
|
".": {
|
|
10
13
|
"import": "./dist/index.js",
|
|
11
14
|
"require": "./dist/index.cjs"
|
|
12
15
|
}
|
|
13
16
|
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
14
20
|
"dependencies": {
|
|
15
|
-
"@deliverart/sdk-js-core": "
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@changesets/cli": "^2.29.4",
|
|
19
|
-
"@eslint/js": "9.28.0",
|
|
20
|
-
"@types/node": "22.15.30",
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "8.33.1",
|
|
22
|
-
"@typescript-eslint/parser": "8.33.1",
|
|
23
|
-
"eslint": "9.28.0",
|
|
24
|
-
"eslint-config-prettier": "10.1.5",
|
|
25
|
-
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
26
|
-
"prettier": "3.5.3",
|
|
27
|
-
"tsup": "8.5.0",
|
|
28
|
-
"typescript": "5.8.3"
|
|
21
|
+
"@deliverart/sdk-js-core": "1.1.1"
|
|
29
22
|
},
|
|
30
23
|
"publishConfig": {
|
|
31
24
|
"access": "public"
|
|
32
25
|
},
|
|
33
26
|
"scripts": {
|
|
34
27
|
"build": "tsup src/index.ts --dts --format esm,cjs",
|
|
35
|
-
"dev": "tsup src/index.ts --dts --watch"
|
|
36
|
-
"lint": "eslint .",
|
|
37
|
-
"lint:fix": "eslint . --fix",
|
|
38
|
-
"prettier": "prettier --check .",
|
|
39
|
-
"prettier:fix": "prettier --write .",
|
|
40
|
-
"version": "@changesets/cli version",
|
|
41
|
-
"release": "@changesets/cli publish"
|
|
28
|
+
"dev": "tsup src/index.ts --dts --watch"
|
|
42
29
|
}
|
|
43
30
|
}
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "restricted",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: write
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
release:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- uses: pnpm/action-setup@v2
|
|
18
|
-
with:
|
|
19
|
-
version: 8
|
|
20
|
-
|
|
21
|
-
- uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: '20'
|
|
24
|
-
registry-url: 'https://registry.npmjs.org'
|
|
25
|
-
always-auth: true
|
|
26
|
-
env:
|
|
27
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
28
|
-
|
|
29
|
-
- name: Install deps
|
|
30
|
-
run: pnpm install
|
|
31
|
-
|
|
32
|
-
- name: Build
|
|
33
|
-
run: pnpm build
|
|
34
|
-
|
|
35
|
-
- name: Create version and changelog
|
|
36
|
-
run: pnpx @changesets/cli version
|
|
37
|
-
|
|
38
|
-
- name: Publish to NPM
|
|
39
|
-
run: pnpx @changesets/cli publish
|
|
40
|
-
env:
|
|
41
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
42
|
-
|
|
43
|
-
- name: Push updated versions and changelogs
|
|
44
|
-
uses: EndBug/add-and-commit@v9
|
|
45
|
-
with:
|
|
46
|
-
message: 'chore(release): version bump'
|
|
47
|
-
add: '.'
|
package/.prettierrc
DELETED
package/CHANGELOG.md
DELETED
package/README.md
DELETED
package/eslint.config.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// eslint.config.js per @typescript-eslint v8
|
|
3
|
-
import js from '@eslint/js'
|
|
4
|
-
import prettier from 'eslint-config-prettier'
|
|
5
|
-
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort'
|
|
6
|
-
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
7
|
-
import tsParser from '@typescript-eslint/parser'
|
|
8
|
-
|
|
9
|
-
export default [
|
|
10
|
-
js.configs.recommended,
|
|
11
|
-
{
|
|
12
|
-
files: ['**/*.ts'],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
parser: tsParser,
|
|
15
|
-
globals: {
|
|
16
|
-
process: 'readonly',
|
|
17
|
-
},
|
|
18
|
-
parserOptions: {
|
|
19
|
-
project: ['./tsconfig.json'],
|
|
20
|
-
tsconfigRootDir: process.cwd(),
|
|
21
|
-
sourceType: 'module',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
plugins: {
|
|
25
|
-
'@typescript-eslint': tsPlugin,
|
|
26
|
-
'simple-import-sort': simpleImportSortPlugin,
|
|
27
|
-
},
|
|
28
|
-
rules: {
|
|
29
|
-
'simple-import-sort/imports': 'error',
|
|
30
|
-
'simple-import-sort/exports': 'error',
|
|
31
|
-
'@typescript-eslint/no-unused-vars': 'warn',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
prettier,
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
export const ignores = ['dist', 'node_modules']
|
package/src/errors.ts
DELETED
package/src/index.ts
DELETED
package/src/plugin.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type ApiClient, type ApiClientPlugin } from '@deliverart/sdk-js-core'
|
|
2
|
-
|
|
3
|
-
import { AuthenticationError } from './errors'
|
|
4
|
-
import { type AuthenticationConfig, type AuthenticationExtension } from './types'
|
|
5
|
-
|
|
6
|
-
export class AuthenticationPlugin implements ApiClientPlugin<AuthenticationExtension> {
|
|
7
|
-
private readonly config: AuthenticationConfig
|
|
8
|
-
private enabled = true
|
|
9
|
-
|
|
10
|
-
constructor(config: AuthenticationConfig) {
|
|
11
|
-
this.config = config
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
setup(client: ApiClient): AuthenticationExtension {
|
|
15
|
-
client.http.interceptors.request.use(async config => {
|
|
16
|
-
if (!this.enabled) {
|
|
17
|
-
return config
|
|
18
|
-
}
|
|
19
|
-
const token = await this.config.getAccessToken()
|
|
20
|
-
if (!token) {
|
|
21
|
-
throw new AuthenticationError('No access token found. Please authenticate first.')
|
|
22
|
-
}
|
|
23
|
-
config.headers.Authorization = `Bearer ${token}`
|
|
24
|
-
return config
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
authentication: {
|
|
29
|
-
enable: () => {
|
|
30
|
-
this.enabled = true
|
|
31
|
-
},
|
|
32
|
-
disable: () => {
|
|
33
|
-
this.enabled = false
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ApiExtension } from '@deliverart/sdk-js-core'
|
|
2
|
-
|
|
3
|
-
export interface AuthenticationConfig {
|
|
4
|
-
getAccessToken: () => Promise<string | null>
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface AuthenticationExtension extends ApiExtension {
|
|
8
|
-
authentication: {
|
|
9
|
-
enable: () => void
|
|
10
|
-
disable: () => void
|
|
11
|
-
}
|
|
12
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "Node",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"forceConsistentCasingInFileNames": true,
|
|
8
|
-
"strict": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"outDir": "dist",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"declarationMap": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src"]
|
|
15
|
-
}
|