need4deed-sdk 0.0.7 → 0.0.10

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.
Files changed (57) hide show
  1. package/dist/cjs/constants/endpoints.js +10 -0
  2. package/dist/cjs/constants/index.js +17 -0
  3. package/dist/cjs/core/index.js +17 -0
  4. package/dist/cjs/core/utils.js +57 -0
  5. package/dist/cjs/index.js +19 -0
  6. package/dist/cjs/types/api/common.js +2 -0
  7. package/dist/cjs/types/api/event.js +8 -0
  8. package/dist/cjs/types/api/index.js +21 -0
  9. package/dist/cjs/types/api/opportunity.js +14 -0
  10. package/dist/cjs/types/api/testimonial.js +2 -0
  11. package/dist/cjs/types/api/volunteer.js +2 -0
  12. package/dist/cjs/types/core.js +28 -0
  13. package/dist/cjs/types/index.js +18 -0
  14. package/dist/constants/endpoints.js +10 -0
  15. package/dist/constants/index.js +17 -0
  16. package/dist/core/index.js +17 -0
  17. package/dist/core/utils.js +57 -0
  18. package/dist/esm/constants/endpoints.js +7 -0
  19. package/dist/esm/constants/index.js +1 -0
  20. package/dist/esm/core/index.js +1 -0
  21. package/dist/esm/core/utils.js +53 -0
  22. package/dist/esm/index.js +3 -0
  23. package/dist/esm/types/api/common.js +1 -0
  24. package/dist/esm/types/api/event.js +5 -0
  25. package/dist/esm/types/api/index.js +5 -0
  26. package/dist/esm/types/api/opportunity.js +11 -0
  27. package/dist/esm/types/api/testimonial.js +1 -0
  28. package/dist/esm/types/api/volunteer.js +1 -0
  29. package/dist/esm/types/core.js +25 -0
  30. package/dist/esm/types/index.js +2 -0
  31. package/dist/index.js +19 -0
  32. package/dist/types/api/common.js +2 -0
  33. package/dist/types/api/event.js +8 -0
  34. package/dist/types/api/index.js +21 -0
  35. package/dist/types/api/opportunity.js +14 -0
  36. package/dist/types/api/testimonial.js +2 -0
  37. package/dist/types/api/volunteer.js +2 -0
  38. package/dist/types/constants/endpoints.d.ts +6 -0
  39. package/dist/types/constants/index.d.ts +1 -0
  40. package/dist/types/core/index.d.ts +1 -0
  41. package/dist/types/core/utils.d.ts +13 -0
  42. package/dist/types/core.js +28 -0
  43. package/dist/types/index.d.ts +3 -0
  44. package/dist/types/index.js +18 -0
  45. package/dist/types/types/api/common.d.ts +9 -0
  46. package/dist/types/types/api/event.d.ts +27 -0
  47. package/dist/types/types/api/index.d.ts +5 -0
  48. package/dist/types/types/api/opportunity.d.ts +36 -0
  49. package/dist/types/types/api/testimonial.d.ts +6 -0
  50. package/dist/types/types/api/volunteer.d.ts +19 -0
  51. package/dist/types/types/core.d.ts +23 -0
  52. package/dist/types/types/index.d.ts +2 -0
  53. package/package.json +36 -4
  54. package/src/index.ts +0 -1
  55. package/src/types/api.ts +0 -102
  56. package/src/types/common.ts +0 -21
  57. 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,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,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,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
+ }
@@ -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);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventN4DType = void 0;
4
+ var EventN4DType;
5
+ (function (EventN4DType) {
6
+ EventN4DType["PARTY"] = "party";
7
+ EventN4DType["WORKSHOP"] = "workshop";
8
+ })(EventN4DType || (exports.EventN4DType = EventN4DType = {}));
@@ -0,0 +1,21 @@
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("./common"), exports);
18
+ __exportStar(require("./event"), exports);
19
+ __exportStar(require("./opportunity"), exports);
20
+ __exportStar(require("./testimonial"), exports);
21
+ __exportStar(require("./volunteer"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TranslatedIntoType = exports.OpportunityType = void 0;
4
+ var OpportunityType;
5
+ (function (OpportunityType) {
6
+ OpportunityType["GENERAL"] = "volunteering";
7
+ OpportunityType["ACCOMPANYING"] = "accompanying";
8
+ })(OpportunityType || (exports.OpportunityType = OpportunityType = {}));
9
+ var TranslatedIntoType;
10
+ (function (TranslatedIntoType) {
11
+ TranslatedIntoType["DEUTSCHE"] = "deutsche";
12
+ TranslatedIntoType["ENGLISH_OK"] = "englishOk";
13
+ TranslatedIntoType["NO_TRANSLATION"] = "noTranslation";
14
+ })(TranslatedIntoType || (exports.TranslatedIntoType = TranslatedIntoType = {}));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpMethod = exports.LangProficiency = exports.Lang = void 0;
4
+ var Lang;
5
+ (function (Lang) {
6
+ Lang["EN"] = "en";
7
+ Lang["DE"] = "de";
8
+ })(Lang || (exports.Lang = Lang = {}));
9
+ var LangProficiency;
10
+ (function (LangProficiency) {
11
+ LangProficiency["BEGINER"] = "beginer";
12
+ LangProficiency["INTERMEDIATE"] = "intermediate";
13
+ LangProficiency["ADVANCED"] = "advanced";
14
+ LangProficiency["FLUENT"] = "fluent";
15
+ LangProficiency["NATIVE"] = "native";
16
+ })(LangProficiency || (exports.LangProficiency = LangProficiency = {}));
17
+ var HttpMethod;
18
+ (function (HttpMethod) {
19
+ HttpMethod["GET"] = "GET";
20
+ HttpMethod["HEAD"] = "HEAD";
21
+ HttpMethod["POST"] = "POST";
22
+ HttpMethod["PUT"] = "PUT";
23
+ HttpMethod["DELETE"] = "DELETE";
24
+ HttpMethod["TRACE"] = "TRACE";
25
+ HttpMethod["OPTIONS"] = "OPTIONS";
26
+ HttpMethod["CONNECT"] = "CONNECT";
27
+ HttpMethod["PATCH"] = "PATCH";
28
+ })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
@@ -0,0 +1,18 @@
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("./api"), exports);
18
+ __exportStar(require("./core"), exports);
@@ -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,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,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,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
+ }
@@ -0,0 +1,7 @@
1
+ export var Endpoint;
2
+ (function (Endpoint) {
3
+ Endpoint["OPPORTUNITY"] = "/opportunity";
4
+ Endpoint["EVENT"] = "/event";
5
+ Endpoint["TESTIMONIAL"] = "/testimonial";
6
+ Endpoint["VOLUNTEER"] = "/volunteer";
7
+ })(Endpoint || (Endpoint = {}));
@@ -0,0 +1 @@
1
+ export * from "./endpoints";
@@ -0,0 +1 @@
1
+ export * from "./utils";
@@ -0,0 +1,53 @@
1
+ export function fetchFn({ url, options, fnDTO, }) {
2
+ return fetch(url, options)
3
+ .then((response) => {
4
+ if (response.ok)
5
+ return response.json();
6
+ throw new Error(response.statusText);
7
+ })
8
+ .then((data) => {
9
+ return fnDTO ? fnDTO(data) : data;
10
+ });
11
+ }
12
+ /**
13
+ * Converts the keys of an object from snake_case to camelCase.
14
+ * Handles nested objects and arrays recursively.
15
+ *
16
+ * @param snakeCaseObject The object with keys in snake_case.
17
+ * @returns A new object with keys converted to camelCase.
18
+ */
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ export function snakeToCamelCase(snakeCaseObject) {
21
+ if (snakeCaseObject === null || typeof snakeCaseObject !== "object") {
22
+ return snakeCaseObject;
23
+ }
24
+ // Handle arrays
25
+ if (Array.isArray(snakeCaseObject)) {
26
+ return snakeCaseObject.map((item) => snakeToCamelCase(item));
27
+ }
28
+ // Handle objects
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ const camelCaseObject = {};
31
+ Object.keys(snakeCaseObject).forEach((key) => {
32
+ if (Object.prototype.hasOwnProperty.call(snakeCaseObject, key)) {
33
+ let camelCaseKey;
34
+ // skip if all caps
35
+ if (key.match(/^[A-Z0-9_]+$/)) {
36
+ camelCaseKey = key;
37
+ }
38
+ else {
39
+ // Convert snake_case key to camelCase
40
+ const parts = key.split("_");
41
+ camelCaseKey =
42
+ parts[0] +
43
+ parts
44
+ .slice(1)
45
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
46
+ .join("");
47
+ }
48
+ // Recursively convert nested values
49
+ camelCaseObject[camelCaseKey] = snakeToCamelCase(snakeCaseObject[key]);
50
+ }
51
+ });
52
+ return camelCaseObject;
53
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./constants";
2
+ export * from "./core";
3
+ export * from "./types";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export var EventN4DType;
2
+ (function (EventN4DType) {
3
+ EventN4DType["PARTY"] = "party";
4
+ EventN4DType["WORKSHOP"] = "workshop";
5
+ })(EventN4DType || (EventN4DType = {}));
@@ -0,0 +1,5 @@
1
+ export * from "./common";
2
+ export * from "./event";
3
+ export * from "./opportunity";
4
+ export * from "./testimonial";
5
+ export * from "./volunteer";
@@ -0,0 +1,11 @@
1
+ export var OpportunityType;
2
+ (function (OpportunityType) {
3
+ OpportunityType["GENERAL"] = "volunteering";
4
+ OpportunityType["ACCOMPANYING"] = "accompanying";
5
+ })(OpportunityType || (OpportunityType = {}));
6
+ export var TranslatedIntoType;
7
+ (function (TranslatedIntoType) {
8
+ TranslatedIntoType["DEUTSCHE"] = "deutsche";
9
+ TranslatedIntoType["ENGLISH_OK"] = "englishOk";
10
+ TranslatedIntoType["NO_TRANSLATION"] = "noTranslation";
11
+ })(TranslatedIntoType || (TranslatedIntoType = {}));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ export var Lang;
2
+ (function (Lang) {
3
+ Lang["EN"] = "en";
4
+ Lang["DE"] = "de";
5
+ })(Lang || (Lang = {}));
6
+ export var LangProficiency;
7
+ (function (LangProficiency) {
8
+ LangProficiency["BEGINER"] = "beginer";
9
+ LangProficiency["INTERMEDIATE"] = "intermediate";
10
+ LangProficiency["ADVANCED"] = "advanced";
11
+ LangProficiency["FLUENT"] = "fluent";
12
+ LangProficiency["NATIVE"] = "native";
13
+ })(LangProficiency || (LangProficiency = {}));
14
+ export var HttpMethod;
15
+ (function (HttpMethod) {
16
+ HttpMethod["GET"] = "GET";
17
+ HttpMethod["HEAD"] = "HEAD";
18
+ HttpMethod["POST"] = "POST";
19
+ HttpMethod["PUT"] = "PUT";
20
+ HttpMethod["DELETE"] = "DELETE";
21
+ HttpMethod["TRACE"] = "TRACE";
22
+ HttpMethod["OPTIONS"] = "OPTIONS";
23
+ HttpMethod["CONNECT"] = "CONNECT";
24
+ HttpMethod["PATCH"] = "PATCH";
25
+ })(HttpMethod || (HttpMethod = {}));
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./core";
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);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventN4DType = void 0;
4
+ var EventN4DType;
5
+ (function (EventN4DType) {
6
+ EventN4DType["PARTY"] = "party";
7
+ EventN4DType["WORKSHOP"] = "workshop";
8
+ })(EventN4DType || (exports.EventN4DType = EventN4DType = {}));
@@ -0,0 +1,21 @@
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("./common"), exports);
18
+ __exportStar(require("./event"), exports);
19
+ __exportStar(require("./opportunity"), exports);
20
+ __exportStar(require("./testimonial"), exports);
21
+ __exportStar(require("./volunteer"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TranslatedIntoType = exports.OpportunityType = void 0;
4
+ var OpportunityType;
5
+ (function (OpportunityType) {
6
+ OpportunityType["GENERAL"] = "volunteering";
7
+ OpportunityType["ACCOMPANYING"] = "accompanying";
8
+ })(OpportunityType || (exports.OpportunityType = OpportunityType = {}));
9
+ var TranslatedIntoType;
10
+ (function (TranslatedIntoType) {
11
+ TranslatedIntoType["DEUTSCHE"] = "deutsche";
12
+ TranslatedIntoType["ENGLISH_OK"] = "englishOk";
13
+ TranslatedIntoType["NO_TRANSLATION"] = "noTranslation";
14
+ })(TranslatedIntoType || (exports.TranslatedIntoType = TranslatedIntoType = {}));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export declare enum Endpoint {
2
+ OPPORTUNITY = "/opportunity",
3
+ EVENT = "/event",
4
+ TESTIMONIAL = "/testimonial",
5
+ VOLUNTEER = "/volunteer"
6
+ }
@@ -0,0 +1 @@
1
+ export * from "./endpoints";
@@ -0,0 +1 @@
1
+ export * from "./utils";
@@ -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,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpMethod = exports.LangProficiency = exports.Lang = void 0;
4
+ var Lang;
5
+ (function (Lang) {
6
+ Lang["EN"] = "en";
7
+ Lang["DE"] = "de";
8
+ })(Lang || (exports.Lang = Lang = {}));
9
+ var LangProficiency;
10
+ (function (LangProficiency) {
11
+ LangProficiency["BEGINER"] = "beginer";
12
+ LangProficiency["INTERMEDIATE"] = "intermediate";
13
+ LangProficiency["ADVANCED"] = "advanced";
14
+ LangProficiency["FLUENT"] = "fluent";
15
+ LangProficiency["NATIVE"] = "native";
16
+ })(LangProficiency || (exports.LangProficiency = LangProficiency = {}));
17
+ var HttpMethod;
18
+ (function (HttpMethod) {
19
+ HttpMethod["GET"] = "GET";
20
+ HttpMethod["HEAD"] = "HEAD";
21
+ HttpMethod["POST"] = "POST";
22
+ HttpMethod["PUT"] = "PUT";
23
+ HttpMethod["DELETE"] = "DELETE";
24
+ HttpMethod["TRACE"] = "TRACE";
25
+ HttpMethod["OPTIONS"] = "OPTIONS";
26
+ HttpMethod["CONNECT"] = "CONNECT";
27
+ HttpMethod["PATCH"] = "PATCH";
28
+ })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
@@ -0,0 +1,3 @@
1
+ export * from "./constants";
2
+ export * from "./core";
3
+ export * from "./types";
@@ -0,0 +1,18 @@
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("./api"), exports);
18
+ __exportStar(require("./core"), exports);
@@ -0,0 +1,9 @@
1
+ import { Lang } from "../core";
2
+ export type OptionTitle = Partial<{
3
+ [key in Lang]: string;
4
+ }>;
5
+ export type OptionId = string | number;
6
+ export interface Option {
7
+ id: OptionId;
8
+ title: OptionTitle;
9
+ }
@@ -0,0 +1,27 @@
1
+ export declare enum EventN4DType {
2
+ PARTY = "party",
3
+ WORKSHOP = "workshop"
4
+ }
5
+ export interface EventN4D {
6
+ active: boolean;
7
+ title: string;
8
+ subTitle?: string;
9
+ menuTitle: string;
10
+ hostName?: string;
11
+ date: Date;
12
+ dateEnd?: Date;
13
+ type: EventN4DType;
14
+ pic?: string;
15
+ time: string;
16
+ address: string;
17
+ locationLink?: string;
18
+ locationComment?: string;
19
+ description: string;
20
+ shortDescription: string;
21
+ linkRSVP: string;
22
+ followUpText?: string;
23
+ followUpLink?: string;
24
+ additionalTitle?: string;
25
+ additionalInfo?: string[];
26
+ outro?: string;
27
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./common";
2
+ export * from "./event";
3
+ export * from "./opportunity";
4
+ export * from "./testimonial";
5
+ export * from "./volunteer";
@@ -0,0 +1,36 @@
1
+ import { OptionId } from "./common";
2
+ export declare enum OpportunityType {
3
+ GENERAL = "volunteering",
4
+ ACCOMPANYING = "accompanying"
5
+ }
6
+ export declare enum TranslatedIntoType {
7
+ DEUTSCHE = "deutsche",
8
+ ENGLISH_OK = "englishOk",
9
+ NO_TRANSLATION = "noTranslation"
10
+ }
11
+ export interface Opportunity {
12
+ title: string;
13
+ rac_email: string;
14
+ rac_full_name: string;
15
+ rac_phone: string;
16
+ rac_address: string;
17
+ rac_plz: string;
18
+ opportunity_type: OpportunityType;
19
+ accomp_address: string;
20
+ accomp_postcode: string;
21
+ accomp_datetime?: string;
22
+ accomp_name?: string;
23
+ accomp_phone?: string;
24
+ accomp_information?: string;
25
+ accomp_translation?: TranslatedIntoType;
26
+ berlin_locations?: OptionId[];
27
+ languages: OptionId[];
28
+ activities: OptionId[];
29
+ skills: OptionId[];
30
+ timeslots?: [number, OptionId][];
31
+ volunteers_number: number;
32
+ vo_information?: string;
33
+ category: string;
34
+ category_id: OptionId;
35
+ last_edited_time_notion?: string;
36
+ }
@@ -0,0 +1,6 @@
1
+ export interface Testimonial {
2
+ name: string;
3
+ pic: string;
4
+ translated_text: string;
5
+ activities: string[];
6
+ }
@@ -0,0 +1,19 @@
1
+ import { OptionId } from "./common";
2
+ export interface Volunteer {
3
+ origin_opportunity: number | undefined;
4
+ full_name: string;
5
+ phone: string;
6
+ email: string;
7
+ postal_code: number;
8
+ good_conduct_certificate: "Yes" | "No";
9
+ if_measles_vaccination: boolean;
10
+ lead_from: string;
11
+ schedule: [number, OptionId][];
12
+ preferred_berlin_locations: OptionId[];
13
+ activities: OptionId[];
14
+ skills: OptionId[];
15
+ native_languages: OptionId[];
16
+ fluent_languages: OptionId[];
17
+ intermediate_languages: OptionId[];
18
+ comments: string;
19
+ }
@@ -0,0 +1,23 @@
1
+ export declare enum Lang {
2
+ EN = "en",
3
+ DE = "de"
4
+ }
5
+ export declare enum LangProficiency {
6
+ BEGINER = "beginer",
7
+ INTERMEDIATE = "intermediate",
8
+ ADVANCED = "advanced",
9
+ FLUENT = "fluent",
10
+ NATIVE = "native"
11
+ }
12
+ export declare enum HttpMethod {
13
+ GET = "GET",
14
+ HEAD = "HEAD",
15
+ POST = "POST",
16
+ PUT = "PUT",
17
+ DELETE = "DELETE",
18
+ TRACE = "TRACE",
19
+ OPTIONS = "OPTIONS",
20
+ CONNECT = "CONNECT",
21
+ PATCH = "PATCH"
22
+ }
23
+ export type SomeType = "some" | "type";
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./core";
package/package.json CHANGED
@@ -1,14 +1,46 @@
1
1
  {
2
2
  "name": "need4deed-sdk",
3
- "version": "0.0.7",
3
+ "version": "0.0.10",
4
4
  "description": "Need4Deed.org SDK",
5
- "main": "src/index.ts",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.mjs",
7
+ "types": "dist/types/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
6
11
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
12
+ "build:cjs": "tsc --project tsconfig.cjs.json",
13
+ "build:esm": "tsc --project tsconfig.esm.json",
14
+ "build:types": "tsc --project tsconfig.cjs.json --emitDeclarationOnly --declarationDir dist/types",
15
+ "build": "yarn build:cjs && yarn build:esm && yarn build:types",
16
+ "watch": "tsc --watch --project tsconfig.cjs.json",
17
+ "prepublishOnly": "yarn build",
18
+ "publish": "yarn publish",
19
+ "publish:npm": "yarn publish --access public"
8
20
  },
21
+ "keywords": [
22
+ "sdk",
23
+ "react",
24
+ "typescript",
25
+ "api-hooks",
26
+ "ui-components",
27
+ "layouts",
28
+ "styling",
29
+ "utilities"
30
+ ],
9
31
  "author": "Need4Deed.org",
10
32
  "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/need4deed-org/sdk.git"
36
+ },
11
37
  "devDependencies": {
12
- "typescript": "^5.8.3"
38
+ "typescript": "^5.8.3",
39
+ "@types/react": "^18.0.0",
40
+ "@types/react-dom": "^18.0.0"
41
+ },
42
+ "peerDependencies": {
43
+ "react": "^17.0.0 || ^18.0.0",
44
+ "react-dom": "^17.0.0 || ^18.0.0"
13
45
  }
14
46
  }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./types";
package/src/types/api.ts DELETED
@@ -1,102 +0,0 @@
1
- import { Lang } from "./common";
2
-
3
- export interface Testimonial {
4
- name: string;
5
- pic: string; // base64 encoded thumb most probably
6
- translated_text: string;
7
- activities: string[];
8
- }
9
-
10
- export enum EventN4DType {
11
- PARTY = "party",
12
- WORKSHOP = "workshop",
13
- }
14
-
15
- export interface EventN4D {
16
- active: boolean;
17
- title: string;
18
- subTitle?: string;
19
- menuTitle: string; // for the menu
20
- hostName?: string;
21
- date: Date;
22
- dateEnd?: Date;
23
- type: EventN4DType;
24
- pic?: string; // or standard one depending on type
25
- time: string;
26
- address: string; // address
27
- locationLink?: string; // to google maps
28
- locationComment?: string; // how to spot
29
- description: string;
30
- shortDescription: string; // for card view
31
- linkRSVP: string; // registration form
32
- followUpText?: string;
33
- followUpLink?: string; // the adjacent event
34
- additionalTitle?: string;
35
- additionalInfo?: string[]; // lineup, content, etc.
36
- outro?: string;
37
- }
38
-
39
- export enum OpportunityType {
40
- GENERAL = "volunteering",
41
- ACCOMPANYING = "accompanying",
42
- }
43
-
44
- export enum TranslatedIntoType {
45
- DEUTSCHE = "deutsche",
46
- ENGLISH_OK = "englishOk",
47
- NO_TRANSLATION = "noTranslation",
48
- }
49
-
50
- export type OptionTitle = Partial<{
51
- [key in Lang]: string;
52
- }>;
53
-
54
- export type OptionId = string | number;
55
-
56
- export interface Option {
57
- id: OptionId;
58
- title: OptionTitle;
59
- }
60
-
61
- export interface Opportunity {
62
- title: string;
63
- rac_email: string;
64
- rac_full_name: string;
65
- rac_phone: string;
66
- rac_address: string;
67
- rac_plz: string;
68
- opportunity_type: OpportunityType;
69
- accomp_address: string;
70
- accomp_postcode: string;
71
- accomp_datetime?: string;
72
- accomp_name?: string;
73
- accomp_phone?: string;
74
- accomp_information?: string;
75
- accomp_translation?: TranslatedIntoType;
76
- berlin_locations?: OptionId[];
77
- languages: OptionId[];
78
- activities: OptionId[];
79
- skills: OptionId[];
80
- timeslots?: [number, OptionId][];
81
- volunteers_number: number;
82
- vo_information?: string;
83
- }
84
-
85
- export interface Volunteer {
86
- origin_opportunity: number | undefined;
87
- full_name: string;
88
- phone: string;
89
- email: string;
90
- postal_code: number;
91
- good_conduct_certificate: "Yes" | "No";
92
- if_measles_vaccination: boolean;
93
- lead_from: string;
94
- schedule: [number, OptionId][];
95
- preferred_berlin_locations: OptionId[];
96
- activities: OptionId[];
97
- skills: OptionId[];
98
- native_languages: OptionId[];
99
- fluent_languages: OptionId[];
100
- intermediate_languages: OptionId[];
101
- comments: string;
102
- }
@@ -1,21 +0,0 @@
1
- export enum Lang {
2
- EN = "en",
3
- DE = "de",
4
- RU = "ru",
5
- AR = "ar",
6
- FA = "fa",
7
- TR = "tr",
8
- ES = "es",
9
- }
10
-
11
- export enum HttpMethod {
12
- GET = "GET",
13
- HEAD = "HEAD",
14
- POST = "POST",
15
- PUT = "PUT",
16
- DELETE = "DELETE",
17
- TRACE = "TRACE",
18
- OPTIONS = "OPTIONS",
19
- CONNECT = "CONNECT",
20
- PATCH = "PATCH",
21
- }
@@ -1,2 +0,0 @@
1
- export * from "./api";
2
- export * from "./common";