need4deed-sdk 0.0.7 → 0.0.11
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/constants/endpoints.d.ts +6 -0
- package/dist/constants/endpoints.js +10 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +17 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +17 -0
- package/dist/core/utils.d.ts +13 -0
- package/dist/core/utils.js +57 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/styles/global.css +892 -0
- package/dist/styles/n4d.css +896 -0
- package/dist/types/api/common.d.ts +9 -0
- package/dist/types/api/common.js +2 -0
- package/dist/types/api/event.d.ts +27 -0
- package/dist/types/api/event.js +8 -0
- package/dist/types/api/index.d.ts +5 -0
- package/dist/types/api/index.js +21 -0
- package/dist/types/api/opportunity.d.ts +36 -0
- package/dist/types/api/opportunity.js +14 -0
- package/dist/types/api/testimonial.d.ts +6 -0
- package/dist/types/api/testimonial.js +2 -0
- package/dist/types/api/volunteer.d.ts +19 -0
- package/dist/types/api/volunteer.js +2 -0
- package/dist/types/core.d.ts +23 -0
- package/dist/types/core.js +28 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +18 -0
- package/package.json +42 -3
- package/src/index.ts +0 -1
- package/src/types/api.ts +0 -102
- package/src/types/common.ts +0 -21
- package/src/types/index.ts +0 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Endpoint = void 0;
|
|
4
|
+
var Endpoint;
|
|
5
|
+
(function (Endpoint) {
|
|
6
|
+
Endpoint["OPPORTUNITY"] = "/opportunity";
|
|
7
|
+
Endpoint["EVENT"] = "/event";
|
|
8
|
+
Endpoint["TESTIMONIAL"] = "/testimonial";
|
|
9
|
+
Endpoint["VOLUNTEER"] = "/volunteer";
|
|
10
|
+
})(Endpoint || (exports.Endpoint = Endpoint = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./endpoints";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./endpoints"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./utils";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function fetchFn<R, D = R>({ url, options, fnDTO, }: {
|
|
2
|
+
url: string;
|
|
3
|
+
options?: RequestInit;
|
|
4
|
+
fnDTO?: (data: R) => D;
|
|
5
|
+
}): Promise<D>;
|
|
6
|
+
/**
|
|
7
|
+
* Converts the keys of an object from snake_case to camelCase.
|
|
8
|
+
* Handles nested objects and arrays recursively.
|
|
9
|
+
*
|
|
10
|
+
* @param snakeCaseObject The object with keys in snake_case.
|
|
11
|
+
* @returns A new object with keys converted to camelCase.
|
|
12
|
+
*/
|
|
13
|
+
export declare function snakeToCamelCase(snakeCaseObject: any): any;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchFn = fetchFn;
|
|
4
|
+
exports.snakeToCamelCase = snakeToCamelCase;
|
|
5
|
+
function fetchFn({ url, options, fnDTO, }) {
|
|
6
|
+
return fetch(url, options)
|
|
7
|
+
.then((response) => {
|
|
8
|
+
if (response.ok)
|
|
9
|
+
return response.json();
|
|
10
|
+
throw new Error(response.statusText);
|
|
11
|
+
})
|
|
12
|
+
.then((data) => {
|
|
13
|
+
return fnDTO ? fnDTO(data) : data;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Converts the keys of an object from snake_case to camelCase.
|
|
18
|
+
* Handles nested objects and arrays recursively.
|
|
19
|
+
*
|
|
20
|
+
* @param snakeCaseObject The object with keys in snake_case.
|
|
21
|
+
* @returns A new object with keys converted to camelCase.
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
function snakeToCamelCase(snakeCaseObject) {
|
|
25
|
+
if (snakeCaseObject === null || typeof snakeCaseObject !== "object") {
|
|
26
|
+
return snakeCaseObject;
|
|
27
|
+
}
|
|
28
|
+
// Handle arrays
|
|
29
|
+
if (Array.isArray(snakeCaseObject)) {
|
|
30
|
+
return snakeCaseObject.map((item) => snakeToCamelCase(item));
|
|
31
|
+
}
|
|
32
|
+
// Handle objects
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
const camelCaseObject = {};
|
|
35
|
+
Object.keys(snakeCaseObject).forEach((key) => {
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(snakeCaseObject, key)) {
|
|
37
|
+
let camelCaseKey;
|
|
38
|
+
// skip if all caps
|
|
39
|
+
if (key.match(/^[A-Z0-9_]+$/)) {
|
|
40
|
+
camelCaseKey = key;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Convert snake_case key to camelCase
|
|
44
|
+
const parts = key.split("_");
|
|
45
|
+
camelCaseKey =
|
|
46
|
+
parts[0] +
|
|
47
|
+
parts
|
|
48
|
+
.slice(1)
|
|
49
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
50
|
+
.join("");
|
|
51
|
+
}
|
|
52
|
+
// Recursively convert nested values
|
|
53
|
+
camelCaseObject[camelCaseKey] = snakeToCamelCase(snakeCaseObject[key]);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return camelCaseObject;
|
|
57
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./core"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|