@jwork-space/strapi-sdk 1.0.6 → 1.0.7

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.js CHANGED
@@ -850,7 +850,7 @@ var StrapiUploaderSDK = class extends BaseUploaderAPI {
850
850
  const prefix = config?.prefix ?? "";
851
851
  super(resource, prefix, config?.tokenKey, baseURL);
852
852
  this.uploadStrapiFile = async (resource, opt) => {
853
- const uri = opt?.url ?? `${this.baseURL}/upload`;
853
+ const uri = opt?.url ?? this.endpoint;
854
854
  const data = this.getRequestParams(opt);
855
855
  const formData = new FormData();
856
856
  const isMultiple = Array.isArray(resource);
@@ -984,7 +984,7 @@ var StrapiUploaderSDK = class extends BaseUploaderAPI {
984
984
  };
985
985
  this.newUploadFile = async (resource, opt, serializeOptions) => {
986
986
  const options = { ...serializeOptions };
987
- const uri = opt?.url ?? "/strapi/upload-file";
987
+ const uri = opt?.url ?? this.endpoint;
988
988
  const data = this.getRequestParams(opt);
989
989
  options.exclude = ["id", ...options.exclude ?? []];
990
990
  const formData = new FormData();
@@ -993,6 +993,9 @@ var StrapiUploaderSDK = class extends BaseUploaderAPI {
993
993
  const dataResponse = await this.postCall(uri, data);
994
994
  return dataResponse;
995
995
  };
996
+ const paths = [prefix, resource];
997
+ const pathURL = this.normalizePath(this.buildPath(...paths));
998
+ this.endpoint = `${baseURL}${pathURL}`;
996
999
  this.config = {
997
1000
  onCreate: {
998
1001
  generateUID: config?.onCreate?.generateUID ?? true,
@@ -1031,7 +1034,7 @@ var StrapiUploaderSDK = class extends BaseUploaderAPI {
1031
1034
  return options;
1032
1035
  }
1033
1036
  async destroyFile(id) {
1034
- const uri = `${this.baseURL}/strapi/upload/files/${id}`;
1037
+ const uri = `${this.endpoint}/${id}`;
1035
1038
  await this.deleteCall(uri);
1036
1039
  return true;
1037
1040
  }
package/dist/index.mjs CHANGED
@@ -801,7 +801,7 @@ var StrapiUploaderSDK = class extends BaseUploaderAPI {
801
801
  const prefix = config?.prefix ?? "";
802
802
  super(resource, prefix, config?.tokenKey, baseURL);
803
803
  this.uploadStrapiFile = async (resource, opt) => {
804
- const uri = opt?.url ?? `${this.baseURL}/upload`;
804
+ const uri = opt?.url ?? this.endpoint;
805
805
  const data = this.getRequestParams(opt);
806
806
  const formData = new FormData();
807
807
  const isMultiple = Array.isArray(resource);
@@ -935,7 +935,7 @@ var StrapiUploaderSDK = class extends BaseUploaderAPI {
935
935
  };
936
936
  this.newUploadFile = async (resource, opt, serializeOptions) => {
937
937
  const options = { ...serializeOptions };
938
- const uri = opt?.url ?? "/strapi/upload-file";
938
+ const uri = opt?.url ?? this.endpoint;
939
939
  const data = this.getRequestParams(opt);
940
940
  options.exclude = ["id", ...options.exclude ?? []];
941
941
  const formData = new FormData();
@@ -944,6 +944,9 @@ var StrapiUploaderSDK = class extends BaseUploaderAPI {
944
944
  const dataResponse = await this.postCall(uri, data);
945
945
  return dataResponse;
946
946
  };
947
+ const paths = [prefix, resource];
948
+ const pathURL = this.normalizePath(this.buildPath(...paths));
949
+ this.endpoint = `${baseURL}${pathURL}`;
947
950
  this.config = {
948
951
  onCreate: {
949
952
  generateUID: config?.onCreate?.generateUID ?? true,
@@ -982,7 +985,7 @@ var StrapiUploaderSDK = class extends BaseUploaderAPI {
982
985
  return options;
983
986
  }
984
987
  async destroyFile(id) {
985
- const uri = `${this.baseURL}/strapi/upload/files/${id}`;
988
+ const uri = `${this.endpoint}/${id}`;
986
989
  await this.deleteCall(uri);
987
990
  return true;
988
991
  }
package/package.json CHANGED
@@ -1,66 +1,67 @@
1
1
  {
2
- "name": "@jwork-space/strapi-sdk",
3
- "version": "1.0.6",
4
- "description": "SDK para Strapi con soporte para React Query y TypeScript",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "author": "Roman Ernesto Gonzalez Alas, Jonathan Fernando González Ramos",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://gitlab.com/Jona11/strapi-sdk"
13
- },
14
- "publishConfig": {
15
- "access": "public"
16
- },
17
- "engines": {
18
- "node": ">=18.0.0"
19
- },
20
- "peerDependencies": {
21
- "@tanstack/react-query": ">=5.90.0",
22
- "antd": ">=5.0.0",
23
- "axios": ">=1.7.0",
24
- "dayjs": ">=1.11.10",
25
- "qs": ">=6.11.0",
26
- "react": ">=18.0.0",
27
- "react-dom": ">=18.0.0"
28
- },
29
- "devDependencies": {
30
- "@semantic-release/git": "^10.0.1",
31
- "@semantic-release/gitlab": "^13.2.9",
32
- "@semantic-release/npm": "^13.1.2",
33
- "@types/qs": "^6.14.0",
34
- "@types/react": "^19.2.2",
35
- "@types/react-dom": "^19.2.2",
36
- "semantic-release": "^25.0.2",
37
- "tsup": "^8.5.0",
38
- "typescript": "^5.9.3"
39
- },
40
- "release": {
41
- "plugins": [
42
- "@semantic-release/commit-analyzer",
43
- "@semantic-release/release-notes-generator",
44
- "@semantic-release/npm",
45
- "@semantic-release/gitlab",
46
- [
47
- "@semantic-release/git",
48
- {
49
- "assets": [
50
- "package.json"
51
- ],
52
- "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
53
- }
54
- ]
2
+ "name": "@jwork-space/strapi-sdk",
3
+ "version": "1.0.7",
4
+ "description": "SDK para Strapi con soporte para React Query y TypeScript",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "author": "Roman Ernesto Gonzalez Alas, Jonathan Fernando González Ramos",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://gitlab.com/Jona11/strapi-sdk"
13
+ },
14
+ "scripts": {
15
+ "build": "tsup src/index.ts --format esm,cjs --dts",
16
+ "prepublishOnly": "npm run build",
17
+ "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
18
+ "semantic-release": "semantic-release"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "engines": {
24
+ "node": ">=18.0.0"
25
+ },
26
+ "peerDependencies": {
27
+ "@tanstack/react-query": ">=5.90.0",
28
+ "antd": ">=5.0.0",
29
+ "axios": ">=1.7.0",
30
+ "dayjs": ">=1.11.10",
31
+ "qs": ">=6.11.0",
32
+ "react": ">=18.0.0",
33
+ "react-dom": ">=18.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@semantic-release/git": "^10.0.1",
37
+ "@semantic-release/gitlab": "^13.2.9",
38
+ "@semantic-release/npm": "^13.1.2",
39
+ "@types/qs": "^6.14.0",
40
+ "@types/react": "^19.2.2",
41
+ "@types/react-dom": "^19.2.2",
42
+ "semantic-release": "^25.0.2",
43
+ "tsup": "^8.5.0",
44
+ "typescript": "^5.9.3"
45
+ },
46
+ "release": {
47
+ "plugins": [
48
+ "@semantic-release/commit-analyzer",
49
+ "@semantic-release/release-notes-generator",
50
+ "@semantic-release/npm",
51
+ "@semantic-release/gitlab",
52
+ [
53
+ "@semantic-release/git",
54
+ {
55
+ "assets": [
56
+ "package.json"
57
+ ],
58
+ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
59
+ }
60
+ ]
61
+ ]
62
+ },
63
+ "files": [
64
+ "dist",
65
+ "README.md"
55
66
  ]
56
- },
57
- "files": [
58
- "dist",
59
- "README.md"
60
- ],
61
- "scripts": {
62
- "build": "tsup src/index.ts --format esm,cjs --dts",
63
- "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
64
- "semantic-release": "semantic-release"
65
- }
66
- }
67
+ }