@deliverart/sdk-js-core 0.0.4
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/.changeset/config.json +11 -0
- package/.github/workflows/workflow.yml +47 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +19 -0
- package/README.md +3 -0
- package/dist/index.cjs +52 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +15 -0
- package/eslint.config.js +37 -0
- package/package.json +43 -0
- package/src/ApiClient.ts +16 -0
- package/src/index.ts +2 -0
- package/src/types.ts +8 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @deliverart/sdk-js-core
|
|
2
|
+
|
|
3
|
+
## 0.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b5f002a: fix: update package name
|
|
8
|
+
|
|
9
|
+
## 0.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e7475f6: fix: remove changeset default files
|
|
14
|
+
|
|
15
|
+
## 0.0.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 0f3205e: fix: trigger deploy
|
package/README.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
ApiClient: () => ApiClient
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
|
|
37
|
+
// src/ApiClient.ts
|
|
38
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
39
|
+
var ApiClient = class {
|
|
40
|
+
http;
|
|
41
|
+
constructor(config) {
|
|
42
|
+
this.http = import_axios.default.create({ baseURL: config.baseUrl });
|
|
43
|
+
}
|
|
44
|
+
use(plugin) {
|
|
45
|
+
const extension = plugin.setup(this);
|
|
46
|
+
return Object.assign(this, extension);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
ApiClient
|
|
52
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
type ApiExtension = Record<string, any>;
|
|
4
|
+
interface ApiClientPlugin<T extends ApiExtension = ApiExtension> {
|
|
5
|
+
setup(client: ApiClient<any>): T;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare class ApiClient<Extensions extends ApiExtension = {}> {
|
|
9
|
+
readonly http: AxiosInstance;
|
|
10
|
+
constructor(config: {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
});
|
|
13
|
+
use<T extends ApiExtension>(plugin: ApiClientPlugin<T>): ApiClient<Extensions & T>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { ApiClient, type ApiClientPlugin, type ApiExtension };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
type ApiExtension = Record<string, any>;
|
|
4
|
+
interface ApiClientPlugin<T extends ApiExtension = ApiExtension> {
|
|
5
|
+
setup(client: ApiClient<any>): T;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare class ApiClient<Extensions extends ApiExtension = {}> {
|
|
9
|
+
readonly http: AxiosInstance;
|
|
10
|
+
constructor(config: {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
});
|
|
13
|
+
use<T extends ApiExtension>(plugin: ApiClientPlugin<T>): ApiClient<Extensions & T>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { ApiClient, type ApiClientPlugin, type ApiExtension };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/ApiClient.ts
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
var ApiClient = class {
|
|
4
|
+
http;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.http = axios.create({ baseURL: config.baseUrl });
|
|
7
|
+
}
|
|
8
|
+
use(plugin) {
|
|
9
|
+
const extension = plugin.setup(this);
|
|
10
|
+
return Object.assign(this, extension);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
ApiClient
|
|
15
|
+
};
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
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/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deliverart/sdk-js-core",
|
|
3
|
+
"description": "Core SDK for DeliverArt, providing essential functionalities and utilities.",
|
|
4
|
+
"version": "0.0.4",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"axios": "1.9.0"
|
|
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"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"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"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/ApiClient.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import axios, { AxiosInstance } from 'axios'
|
|
2
|
+
|
|
3
|
+
import type { ApiClientPlugin, ApiExtension } from './types'
|
|
4
|
+
|
|
5
|
+
export class ApiClient<Extensions extends ApiExtension = {}> {
|
|
6
|
+
readonly http: AxiosInstance
|
|
7
|
+
|
|
8
|
+
constructor(config: { baseUrl: string }) {
|
|
9
|
+
this.http = axios.create({ baseURL: config.baseUrl })
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
use<T extends ApiExtension>(plugin: ApiClientPlugin<T>): ApiClient<Extensions & T> {
|
|
13
|
+
const extension = plugin.setup(this as any)
|
|
14
|
+
return Object.assign(this, extension)
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|