mp-js-api 0.0.9 → 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/api.d.ts CHANGED
@@ -4,7 +4,9 @@ export type APIGetOneInstance = <T, R>({ id, path, mpOptions, config }: APIGetPa
4
4
  }) => Promise<R | undefined | {
5
5
  error: ErrorDetails;
6
6
  }>;
7
- export type APIGetMultipleInstance = <T, R>({ path, mpOptions, config }: APIGetParameter) => Promise<R[] | {
7
+ export type APIGetMultipleInstance = <T, R>({ path, mpOptions, config }: APIGetParameter & {
8
+ mpOptions: MPGetOptions;
9
+ }) => Promise<R[] | {
8
10
  error: ErrorDetails;
9
11
  }>;
10
12
  export type APICreateOneInstance = <T, R>({ path, mpOptions, params, config }: APICreateOneParameter<T>) => Promise<R | {
@@ -29,13 +31,12 @@ export interface MPApiBase {
29
31
  }
30
32
  export interface ErrorDetails {
31
33
  message: string;
32
- name: string;
34
+ name?: string;
33
35
  code?: string;
34
36
  status?: number;
35
37
  method?: string;
36
38
  url?: string;
37
- data: string;
38
- error: true;
39
+ data?: string;
39
40
  }
40
41
  export declare const createApiBase: ({ auth }: {
41
42
  auth: {
@@ -80,5 +81,6 @@ interface APIUpdateParameter<T> {
80
81
  mpOptions?: MPCreateOptions;
81
82
  config?: AxiosRequestConfig;
82
83
  }
84
+ export type DateTimeIsoString = `${number}-${number}-${number}T${number}:${number}:${number}`;
83
85
  export {};
84
86
  //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,UAAU,EAAE,aAAa,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAK5F,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE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AM,CAAC;IACb,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,MAAM,iBAAiB,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC"}
package/dist/api.js CHANGED
@@ -149,7 +149,6 @@ const createApiBase = ({ auth }) => {
149
149
  });
150
150
  const getError = function (error) {
151
151
  return {
152
- error: true,
153
152
  message: error.message,
154
153
  name: error.name,
155
154
  code: error.code,
@@ -167,7 +166,7 @@ const createApiBase = ({ auth }) => {
167
166
  put,
168
167
  post,
169
168
  getOne,
170
- getMany: getMany,
169
+ getMany,
171
170
  getError
172
171
  };
173
172
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MPApiBase, ErrorDetails, MPGetOptions, MPCreateOptions, MPUpdateOptions } from './api';
1
+ import { MPApiBase, ErrorDetails, MPGetOptions, MPCreateOptions, MPUpdateOptions, DateTimeIsoString } from './api';
2
2
  import { convertToCamelCase, convertToSnakeCase, escapeSql, stringifyURLParams } from './utils/strings';
3
3
  import { Contact } from './tables/contacts';
4
4
  import { Event } from './tables/events';
@@ -12,7 +12,11 @@ import { ContactAttribute } from './tables/contact-attributes';
12
12
  import { FormResponse } from './tables/form-responses';
13
13
  import { FormResponseAnswer } from './tables/from-response-answers';
14
14
  import { AxiosInstance } from 'axios';
15
- type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
15
+ import { ContactEmailAddress } from './tables/contact-email-addresses';
16
+ export type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
17
+ export type AtLeastOne<T> = {
18
+ [K in keyof T]-?: Required<Pick<T, K>>;
19
+ }[keyof T];
16
20
  export type CreateContactParams = WithRequired<Omit<Partial<Contact>, 'contactID'>, 'company' | 'displayName'>;
17
21
  export type CreateHouseholdParams = WithRequired<Partial<Household>, 'householdName'>;
18
22
  export type CreateAddressParams = WithRequired<Partial<Address>, 'addressLine1'>;
@@ -22,6 +26,7 @@ export type CreateGroupParticipantParams = WithRequired<Partial<GroupParticipant
22
26
  export type CreateContactAttributeParams = WithRequired<Partial<ContactAttribute>, 'attributeID' | 'contactID' | 'startDate'>;
23
27
  export type CreateFormResponseParams = WithRequired<Omit<Partial<FormResponse>, 'formResponseID'>, 'formID' | 'responseDate'>;
24
28
  export type CreateFormResponseAnswerParams = WithRequired<Omit<Partial<FormResponseAnswer>, 'formResponseAnswerID'>, 'formFieldID' | 'formResponseID'>;
29
+ export type CreateContactEmailAddressParams = WithRequired<Omit<Partial<ContactEmailAddress>, 'emailAddressID'>, 'emailAddress' | 'contactID'>;
25
30
  export type MPInstance = {
26
31
  get: AxiosInstance['get'];
27
32
  put: AxiosInstance['put'];
@@ -34,6 +39,12 @@ export type MPInstance = {
34
39
  getContact(id: number, options?: MPGetOptions): Promise<Contact | undefined | {
35
40
  error: ErrorDetails;
36
41
  }>;
42
+ getContactAttribute(id: number, options?: MPGetOptions): Promise<ContactAttribute | undefined | {
43
+ error: ErrorDetails;
44
+ }>;
45
+ getContactEmailAddress(id: number, options?: MPGetOptions): Promise<ContactEmailAddress | undefined | {
46
+ error: ErrorDetails;
47
+ }>;
37
48
  getHousehold(id: number, options?: MPGetOptions): Promise<Household | undefined | {
38
49
  error: ErrorDetails;
39
50
  }>;
@@ -43,9 +54,6 @@ export type MPInstance = {
43
54
  getParticipant(id: number, options?: MPGetOptions): Promise<Participant | undefined | {
44
55
  error: ErrorDetails;
45
56
  }>;
46
- getContactAttribute(id: number, options?: MPGetOptions): Promise<ContactAttribute | undefined | {
47
- error: ErrorDetails;
48
- }>;
49
57
  getEvent(id: number, options?: MPGetOptions): Promise<Event | undefined | {
50
58
  error: ErrorDetails;
51
59
  }>;
@@ -61,28 +69,34 @@ export type MPInstance = {
61
69
  getFormResponse(id: number, options?: MPGetOptions): Promise<FormResponse | undefined | {
62
70
  error: ErrorDetails;
63
71
  }>;
64
- getContacts(options?: MPGetOptions): Promise<Contact[] | {
72
+ getContacts(options: AtLeastOne<MPGetOptions>): Promise<Contact[] | {
73
+ error: ErrorDetails;
74
+ }>;
75
+ getContactAttributes(options: AtLeastOne<MPGetOptions>): Promise<ContactAttribute[] | {
65
76
  error: ErrorDetails;
66
77
  }>;
67
- getHouseholds(options?: MPGetOptions): Promise<Household[] | {
78
+ getContactEmailAddresses(options: AtLeastOne<MPGetOptions>): Promise<ContactEmailAddress[] | {
68
79
  error: ErrorDetails;
69
80
  }>;
70
- getAddresses(options?: MPGetOptions): Promise<Address[] | {
81
+ getHouseholds(options: AtLeastOne<MPGetOptions>): Promise<Household[] | {
71
82
  error: ErrorDetails;
72
83
  }>;
73
- getParticipants(options?: MPGetOptions): Promise<Participant[] | {
84
+ getAddresses(options: AtLeastOne<MPGetOptions>): Promise<Address[] | {
74
85
  error: ErrorDetails;
75
86
  }>;
76
- getEvents(options?: MPGetOptions): Promise<Event[] | {
87
+ getParticipants(options: AtLeastOne<MPGetOptions>): Promise<Participant[] | {
77
88
  error: ErrorDetails;
78
89
  }>;
79
- getGroups(options?: MPGetOptions): Promise<Group[] | {
90
+ getEvents(options: AtLeastOne<MPGetOptions>): Promise<Event[] | {
80
91
  error: ErrorDetails;
81
92
  }>;
82
- getEventParticipants(options?: MPGetOptions): Promise<EventParticipant[] | {
93
+ getGroups(options: AtLeastOne<MPGetOptions>): Promise<Group[] | {
83
94
  error: ErrorDetails;
84
95
  }>;
85
- getGroupParticipants(options?: MPGetOptions): Promise<GroupParticipant[] | {
96
+ getEventParticipants(options: AtLeastOne<MPGetOptions>): Promise<EventParticipant[] | {
97
+ error: ErrorDetails;
98
+ }>;
99
+ getGroupParticipants(options: AtLeastOne<MPGetOptions>): Promise<GroupParticipant[] | {
86
100
  error: ErrorDetails;
87
101
  }>;
88
102
  createContact(params: CreateContactParams, options?: MPCreateOptions): Promise<Contact | {
@@ -112,6 +126,9 @@ export type MPInstance = {
112
126
  createFormResponseAnswers(params: CreateFormResponseAnswerParams[], options?: MPCreateOptions): Promise<FormResponseAnswer[] | {
113
127
  error: ErrorDetails;
114
128
  }>;
129
+ createContactEmailAddress(params: CreateContactEmailAddressParams[], options?: MPCreateOptions): Promise<ContactEmailAddress[] | {
130
+ error: ErrorDetails;
131
+ }>;
115
132
  updateContacts(contacts: WithRequired<Partial<Contact>, 'contactID'>[], options?: MPUpdateOptions): Promise<Contact[] | {
116
133
  error: ErrorDetails;
117
134
  }>;
@@ -125,5 +142,5 @@ export declare const createMPInstance: ({ auth }: {
125
142
  password: string;
126
143
  };
127
144
  }) => MPInstance;
128
- export { Contact, Participant, Event, Group, EventParticipant, GroupParticipant, ContactAttribute, Household, Address, FormResponse, FormResponseAnswer, ErrorDetails, convertToCamelCase, convertToSnakeCase, stringifyURLParams, escapeSql };
145
+ export { Contact, Participant, Event, Group, EventParticipant, GroupParticipant, ContactAttribute, Household, Address, FormResponse, FormResponseAnswer, ContactEmailAddress, ErrorDetails, DateTimeIsoString, convertToCamelCase, convertToSnakeCase, stringifyURLParams, escapeSql };
129
146
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,OAAO,EAAiB,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAiB,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAmB,M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E,KAAK,EAAE,YAAY,CAAC;KAAE,CAAC,CAAC;CAC3D,CAAC;AAGF,eAAO,MAAM,gBAAgB,aAAc;IAAE,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;KAAE,CAAC;CAAE,KAAG,UAoL/F,CAAC;AAEF,OAAO,EACL,OAAO,EACP,WAAW,EACX,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACV,CAAC"}
package/dist/index.js CHANGED
@@ -21,6 +21,12 @@ const createMPInstance = ({ auth }) => {
21
21
  async getContact(id, mpOptions = {}) {
22
22
  return getOne({ path: `/tables/contacts`, id, mpOptions });
23
23
  },
24
+ async getContactAttribute(id, mpOptions = {}) {
25
+ return getOne({ path: `/tables/contact_attributes`, id, mpOptions });
26
+ },
27
+ async getContactEmailAddress(id, mpOptions = {}) {
28
+ return getOne({ path: `/tables/contact_email_addresses`, id, mpOptions });
29
+ },
24
30
  async getHousehold(id, mpOptions = {}) {
25
31
  return getOne({ path: `/tables/households`, id, mpOptions });
26
32
  },
@@ -30,9 +36,6 @@ const createMPInstance = ({ auth }) => {
30
36
  async getParticipant(id, mpOptions = {}) {
31
37
  return getOne({ path: `/tables/participants`, id, mpOptions });
32
38
  },
33
- async getContactAttribute(id, mpOptions = {}) {
34
- return getOne({ path: `/tables/participants`, id, mpOptions });
35
- },
36
39
  async getEvent(id, mpOptions = {}) {
37
40
  return getOne({ path: `/tables/events`, id, mpOptions });
38
41
  },
@@ -48,28 +51,34 @@ const createMPInstance = ({ auth }) => {
48
51
  async getFormResponse(id, mpOptions = {}) {
49
52
  return getOne({ path: `/tables/form_responses`, id, mpOptions });
50
53
  },
51
- async getContacts(mpOptions = {}) {
54
+ async getContacts(mpOptions) {
52
55
  return getMany({ path: `/tables/contacts`, mpOptions });
53
56
  },
54
- async getHouseholds(mpOptions = {}) {
57
+ async getContactAttributes(mpOptions) {
58
+ return getMany({ path: `/tables/contact_attributes`, mpOptions });
59
+ },
60
+ async getContactEmailAddresses(mpOptions) {
61
+ return getMany({ path: `/tables/contact_email_addresses`, mpOptions });
62
+ },
63
+ async getHouseholds(mpOptions) {
55
64
  return getMany({ path: `/tables/households`, mpOptions });
56
65
  },
57
- async getAddresses(mpOptions = {}) {
66
+ async getAddresses(mpOptions) {
58
67
  return getMany({ path: `/tables/addresses`, mpOptions });
59
68
  },
60
- async getParticipants(mpOptions = {}) {
69
+ async getParticipants(mpOptions) {
61
70
  return getMany({ path: `/tables/participants`, mpOptions });
62
71
  },
63
- async getEvents(mpOptions = {}) {
72
+ async getEvents(mpOptions) {
64
73
  return getMany({ path: `/tables/events`, mpOptions });
65
74
  },
66
- async getGroups(mpOptions = {}) {
75
+ async getGroups(mpOptions) {
67
76
  return getMany({ path: `/tables/groups`, mpOptions });
68
77
  },
69
- async getEventParticipants(mpOptions = {}) {
78
+ async getEventParticipants(mpOptions) {
70
79
  return getMany({ path: `/tables/event_participants`, mpOptions });
71
80
  },
72
- async getGroupParticipants(mpOptions = {}) {
81
+ async getGroupParticipants(mpOptions) {
73
82
  return getMany({ path: `/tables/group_participants`, mpOptions });
74
83
  },
75
84
  async createContact(params, mpOptions = {}) {
@@ -99,6 +108,9 @@ const createMPInstance = ({ auth }) => {
99
108
  async createFormResponseAnswers(params, mpOptions) {
100
109
  return createMany({ path: `/tables/form_response_answers`, mpOptions, params });
101
110
  },
111
+ async createContactEmailAddress(params, mpOptions) {
112
+ return createMany({ path: `/tables/contact_email_addresses`, mpOptions, params });
113
+ },
102
114
  async updateContacts(params, mpOptions) {
103
115
  return update({ path: `/tables/contacts`, mpOptions, params });
104
116
  },
@@ -0,0 +1,18 @@
1
+ import { DateTimeIsoString } from "../api";
2
+ export interface ContactEmailAddressRecord {
3
+ Email_Address_ID: number;
4
+ Email_Address: string;
5
+ Contact_ID: number;
6
+ Email_Type_ID?: number;
7
+ End_Date?: DateTimeIsoString | null;
8
+ Notes?: string | null;
9
+ }
10
+ export interface ContactEmailAddress {
11
+ emailAddressID: number;
12
+ emailAddress: string;
13
+ contactID: number;
14
+ emailTypeID?: number;
15
+ endDate?: DateTimeIsoString | null;
16
+ notes?: string | null;
17
+ }
18
+ //# sourceMappingURL=contact-email-addresses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-email-addresses.d.ts","sourceRoot":"","sources":["../../src/tables/contact-email-addresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -38,18 +38,18 @@ export interface Participant {
38
38
  participantStartDate: string;
39
39
  participantEndDate: null | string;
40
40
  notes: string;
41
- firstAttendanceEver: null | string;
42
- secondAttendanceEver: null | string;
43
- thirdAttendanceEver: null | string;
44
- lastAttendanceEver: null | string;
41
+ _firstAttendanceEver: null | string;
42
+ _secondAttendanceEver: null | string;
43
+ _thirdAttendanceEver: null | string;
44
+ _lastAttendanceEver: null | string;
45
45
  subStatusName: null | string;
46
46
  statusDate: null | string;
47
47
  formerDenomination: null | string;
48
48
  formerChurch: null | string;
49
- backgroundCheckInformation: null | string;
50
- backgroundCheckType: null | string;
51
- backgroundCheckStatus: null | string;
52
- backgroundCheckDate: null | string;
49
+ _backgroundCheckInformation: null | string;
50
+ _backgroundCheckType: null | string;
51
+ _backgroundCheckStatus: null | string;
52
+ _backgroundCheckDate: null | string;
53
53
  sacramentInformation: null | string;
54
54
  churchOfRecord: null | string;
55
55
  baptismParishName: null | string;
@@ -1 +1 @@
1
- {"version":3,"file":"participants.d.ts","sourceRoot":"","sources":["../../src/tables/participants.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,IAAI,GAAG,MAAM,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,IAAI,GAAG,MAAM,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB,EAAE,IAAI,GAAG,MAAM,CAAC;IACtC,uBAAuB,EAAE,IAAI,GAAG,MAAM,CAAC;IACvC,sBAAsB,EAAE,IAAI,GAAG,MAAM,CAAC;IACtC,qBAAqB,EAAE,IAAI,GAAG,MAAM,CAAC;IACrC,cAAc,EAAE,IAAI,GAAG,MAAM,CAAC;IAC9B,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,mBAAmB,EAAE,IAAI,GAAG,MAAM,CAAC;IACnC,aAAa,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,6BAA6B,EAAE,IAAI,GAA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AAI,GAAG,MAAM,CAAC;IACpC,sBAAsB,EAAE,IAAI,GAAG,MAAM,CAAC;IACtC,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;IACpC,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;IACpC,cAAc,EAAE,IAAI,GAAG,MAAM,CAAC;IAC9B,iBAAiB,EAAE,IAAI,GAAG,MAAM,CAAC;IACjC,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;IACpC,uBAAuB,EAAE,IAAI,GAAG,MAAM,CAAC;IACvC,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;IACpC,qBAAqB,EAAE,IAAI,GAAG,MAAM,CAAC;CACxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=json-sql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-sql.d.ts","sourceRoot":"","sources":["../../src/utils/json-sql.ts"],"names":[],"mappings":""}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function jsonToSqlFilter(json) {
4
+ const conditions = [];
5
+ // Loop through each key-value pair in the JSON object
6
+ for (const [key, value] of Object.entries(json)) {
7
+ let condition = '';
8
+ // If the value is a string, wrap it in quotes
9
+ if (typeof value === 'string') {
10
+ condition = `${key} = '${value}'`;
11
+ }
12
+ // If the value is a number or boolean, no quotes are needed
13
+ else if (typeof value === 'number' || typeof value === 'boolean') {
14
+ condition = `${key} = ${value}`;
15
+ }
16
+ // If the value is an array, assume it represents an IN condition
17
+ else if (Array.isArray(value)) {
18
+ const valueList = value.map(val => typeof val === 'string' ? `'${val}'` : val).join(', ');
19
+ condition = `${key} IN (${valueList})`;
20
+ }
21
+ // If the value is an object, we can assume it's a nested condition (e.g., for complex queries)
22
+ else if (typeof value === 'object') {
23
+ const subConditions = Object.entries(value).map(([subKey, subValue]) => {
24
+ if (typeof subValue === 'string') {
25
+ return `${subKey} = '${subValue}'`;
26
+ }
27
+ else {
28
+ return `${subKey} = ${subValue}`;
29
+ }
30
+ }).join(' AND ');
31
+ condition = `${key} (${subConditions})`;
32
+ }
33
+ conditions.push(condition);
34
+ }
35
+ // Join the conditions with 'AND'
36
+ return conditions.length ? `WHERE ${conditions.join(' AND ')}` : '';
37
+ }
38
+ // Example Usage
39
+ const json1 = {
40
+ name: "John",
41
+ age: 30,
42
+ active: true,
43
+ hobbies: ["reading", "gaming"],
44
+ address: {
45
+ city: "New York",
46
+ zip: "10001"
47
+ }
48
+ };
49
+ const query1 = jsonToSqlFilter(json1);
50
+ console.log(query1);
51
+ function jsonToSqlQuery(json) {
52
+ const conditions = [];
53
+ // Loop through each key-value pair in the JSON object
54
+ for (const [key, value] of Object.entries(json)) {
55
+ let condition = '';
56
+ // If the value is an object (operator condition)
57
+ if (typeof value === 'object' && value !== null) {
58
+ const operatorConditions = [];
59
+ let [operator, operatorValue] = [null, null];
60
+ for ([operator, operatorValue] of Object.entries(value)) {
61
+ switch (operator) {
62
+ case "$eq":
63
+ operatorConditions.push(`${key} = '${operatorValue}'`);
64
+ break;
65
+ case "$gt":
66
+ operatorConditions.push(`${key} > ${operatorValue}`);
67
+ break;
68
+ case "$lt":
69
+ operatorConditions.push(`${key} < ${operatorValue}`);
70
+ break;
71
+ case "$gte":
72
+ operatorConditions.push(`${key} >= ${operatorValue}`);
73
+ break;
74
+ case "$lte":
75
+ operatorConditions.push(`${key} <= ${operatorValue}`);
76
+ break;
77
+ case "$ne":
78
+ operatorConditions.push(`${key} != '${operatorValue}'`);
79
+ break;
80
+ case "$in":
81
+ const inValues = operatorValue.map((val) => typeof val === 'string' ? `'${val}'` : val).join(', ');
82
+ operatorConditions.push(`${key} IN (${inValues})`);
83
+ break;
84
+ case "$like":
85
+ operatorConditions.push(`${key} LIKE '%${operatorValue}%'`);
86
+ break;
87
+ default:
88
+ throw new Error(`Unsupported operator: ${operator}`);
89
+ }
90
+ }
91
+ // Join all conditions for a field with AND
92
+ condition = operatorConditions.join(' AND ');
93
+ }
94
+ else {
95
+ // For simple equality condition
96
+ condition = `${key} = '${value}'`;
97
+ }
98
+ conditions.push(condition);
99
+ }
100
+ // Join the conditions with AND
101
+ return conditions.length ? `WHERE ${conditions.join(' AND ')}` : '';
102
+ }
103
+ // Example Usage
104
+ const json = {
105
+ "age": { "$gt": 30 },
106
+ "name": { "$eq": "John" },
107
+ "status": { "$in": ["active", "pending"] },
108
+ "address.city": { "$eq": "New York" }
109
+ };
110
+ const query = jsonToSqlQuery(json);
111
+ console.log(query);
@@ -1 +1 @@
1
- {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAM,UAS5E;AAGD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,UA2BpC;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,UAAkB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;CAAM,UAM7F;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,UAAkB,EAAE,YAAmB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CAAM,UAKjJ;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,UAAkB,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAAE,OAkB5H;AAED,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,UAAO,GAAG,CAAC,CAE1F;AAED,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,UAAO,GAAG,CAAC,CAE1F"}
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAM,UAS5E;AAGD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,UA2BpC;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,UAAkB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;CAAM,UAO7F;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,UAAkB,EAAE,YAAmB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CAAM,UAKjJ;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,UAAkB,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAAE,OAkB5H;AAED,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,UAAO,GAAG,CAAC,CAE1F;AAED,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,UAAO,GAAG,CAAC,CAE1F"}
@@ -48,7 +48,8 @@ function escapeSql(str) {
48
48
  }
49
49
  function toCamelCase(str, { capitalIds = false } = {}) {
50
50
  str = str.replace('-', '');
51
- str = str.replace(/^_?[A-Z]{1,3}/, match => match.toLowerCase()); // Don't convert if start with ID, HS, SMS, etc
51
+ str = str.toLowerCase();
52
+ // str = str.replace(/^_?[A-Z]{1,3}/, match => match.toLowerCase()); // Don't convert if start with ID, HS, SMS, etc
52
53
  str = str.replace(/(?<=^_|^__)[^\W_]/g, match => match.at(-1)?.toLowerCase() || ''); // keep underscore if first char
53
54
  str = str.replace(/(?<!^_|^)_[^\W_]/g, match => match.charAt(1).toUpperCase()); // remove underscore if not first char
54
55
  return capitalIds ? str.replace(/id$/i, 'ID') : str;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-js-api",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Node MinistryPlatform API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/api.ts CHANGED
@@ -4,7 +4,7 @@ import { convertToCamelCase, convertToSnakeCase, stringifyURLParams } from './ut
4
4
 
5
5
 
6
6
  export type APIGetOneInstance = <T, R>({ id, path, mpOptions, config }: APIGetParameter & { id: number; }) => Promise<R | undefined | { error: ErrorDetails; }>;
7
- export type APIGetMultipleInstance = <T, R>({ path, mpOptions, config }: APIGetParameter) => Promise<R[] | { error: ErrorDetails; }>;
7
+ export type APIGetMultipleInstance = <T, R>({ path, mpOptions, config }: APIGetParameter & { mpOptions: MPGetOptions; }) => Promise<R[] | { error: ErrorDetails; }>;
8
8
  export type APICreateOneInstance = <T, R>({ path, mpOptions, params, config }: APICreateOneParameter<T>) => Promise<R | { error: ErrorDetails; }>;
9
9
  export type APICreateManyInstance = <T, R>({ path, mpOptions, params, config }: APICreateManyParameter<T>) => Promise<R[] | { error: ErrorDetails; }>;
10
10
  export type APIUpdateInstance = <T, R>({ path, mpOptions, params, config }: APIUpdateParameter<T>) => Promise<R[] | { error: ErrorDetails; }>;
@@ -93,9 +93,9 @@ export const createApiBase = ({ auth }: { auth: { username: string; password: st
93
93
  }
94
94
  };
95
95
 
96
- const getMany: APIGetMultipleInstance = async <T, R>({ id, path, mpOptions, config }: APIGetParameter) => {
96
+ const getMany: APIGetMultipleInstance = async <T, R>({ path, mpOptions, config }: APIGetParameter) => {
97
97
  try {
98
- const url = id ? `${path}/${id}` : path + stringifyURLParams(mpOptions);
98
+ const url = path + stringifyURLParams(mpOptions);
99
99
  const res = await api.get<T[]>(url, {
100
100
  ...config,
101
101
  headers: {
@@ -229,7 +229,7 @@ export const createApiBase = ({ auth }: { auth: { username: string; password: st
229
229
  put,
230
230
  post,
231
231
  getOne,
232
- getMany: getMany,
232
+ getMany,
233
233
  getError
234
234
  };
235
235
  };
@@ -267,7 +267,6 @@ export type MPCreateOptions = {
267
267
  export type MPUpdateOptions = MPCreateOptions;
268
268
 
269
269
  interface APIGetParameter {
270
- id?: number;
271
270
  path: string;
272
271
  mpOptions?: MPGetOptions;
273
272
  config?: AxiosRequestConfig;
package/src/index.ts CHANGED
@@ -15,8 +15,8 @@ import { AxiosInstance } from 'axios';
15
15
  import { ContactEmailAddress, ContactEmailAddressRecord } from './tables/contact-email-addresses';
16
16
 
17
17
 
18
- type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
19
-
18
+ export type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
19
+ export type AtLeastOne<T> = { [K in keyof T]-?: Required<Pick<T, K>> }[keyof T];
20
20
 
21
21
  export type CreateContactParams = WithRequired<
22
22
  Omit<Partial<Contact>, 'contactID'>,
@@ -75,6 +75,14 @@ export type MPInstance = {
75
75
  id: number,
76
76
  options?: MPGetOptions
77
77
  ): Promise<Contact | undefined | { error: ErrorDetails; }>;
78
+ getContactAttribute(
79
+ id: number,
80
+ options?: MPGetOptions
81
+ ): Promise<ContactAttribute | undefined | { error: ErrorDetails; }>;
82
+ getContactEmailAddress(
83
+ id: number,
84
+ options?: MPGetOptions
85
+ ): Promise<ContactEmailAddress | undefined | { error: ErrorDetails; }>;
78
86
  getHousehold(
79
87
  id: number,
80
88
  options?: MPGetOptions
@@ -87,10 +95,6 @@ export type MPInstance = {
87
95
  id: number,
88
96
  options?: MPGetOptions
89
97
  ): Promise<Participant | undefined | { error: ErrorDetails; }>;
90
- getContactAttribute(
91
- id: number,
92
- options?: MPGetOptions
93
- ): Promise<ContactAttribute | undefined | { error: ErrorDetails; }>;
94
98
  getEvent(
95
99
  id: number,
96
100
  options?: MPGetOptions
@@ -113,28 +117,34 @@ export type MPInstance = {
113
117
  ): Promise<FormResponse | undefined | { error: ErrorDetails; }>;
114
118
 
115
119
  getContacts(
116
- options?: MPGetOptions
120
+ options: AtLeastOne<MPGetOptions>
117
121
  ): Promise<Contact[] | { error: ErrorDetails; }>;
122
+ getContactAttributes(
123
+ options: AtLeastOne<MPGetOptions>
124
+ ): Promise<ContactAttribute[] | { error: ErrorDetails; }>;
118
125
  getContactEmailAddresses(
119
- id?: number,
120
- options?: MPGetOptions
126
+ options: AtLeastOne<MPGetOptions>
121
127
  ): Promise<ContactEmailAddress[] | { error: ErrorDetails; }>;
122
128
  getHouseholds(
123
- options?: MPGetOptions
129
+ options: AtLeastOne<MPGetOptions>
124
130
  ): Promise<Household[] | { error: ErrorDetails; }>;
125
131
  getAddresses(
126
- options?: MPGetOptions
132
+ options: AtLeastOne<MPGetOptions>
127
133
  ): Promise<Address[] | { error: ErrorDetails; }>;
128
134
  getParticipants(
129
- options?: MPGetOptions
135
+ options: AtLeastOne<MPGetOptions>
130
136
  ): Promise<Participant[] | { error: ErrorDetails; }>;
131
- getEvents(options?: MPGetOptions): Promise<Event[] | { error: ErrorDetails; }>;
132
- getGroups(options?: MPGetOptions): Promise<Group[] | { error: ErrorDetails; }>;
137
+ getEvents(
138
+ options: AtLeastOne<MPGetOptions>
139
+ ): Promise<Event[] | { error: ErrorDetails; }>;
140
+ getGroups(
141
+ options: AtLeastOne<MPGetOptions>
142
+ ): Promise<Group[] | { error: ErrorDetails; }>;
133
143
  getEventParticipants(
134
- options?: MPGetOptions
144
+ options: AtLeastOne<MPGetOptions>
135
145
  ): Promise<EventParticipant[] | { error: ErrorDetails; }>;
136
146
  getGroupParticipants(
137
- options?: MPGetOptions
147
+ options: AtLeastOne<MPGetOptions>
138
148
  ): Promise<GroupParticipant[] | { error: ErrorDetails; }>;
139
149
 
140
150
  createContact(
@@ -207,6 +217,16 @@ export const createMPInstance = ({ auth }: { auth: { username: string; password:
207
217
  { path: `/tables/contacts`, id, mpOptions }
208
218
  );
209
219
  },
220
+ async getContactAttribute(id, mpOptions = {}) {
221
+ return getOne<ContactAttributeRecord, ContactAttribute>(
222
+ { path: `/tables/contact_attributes`, id, mpOptions }
223
+ );
224
+ },
225
+ async getContactEmailAddress(id, mpOptions = {}) {
226
+ return getOne<ContactEmailAddressRecord, ContactEmailAddress>(
227
+ { path: `/tables/contact_email_addresses`, id, mpOptions }
228
+ );
229
+ },
210
230
  async getHousehold(id, mpOptions = {}) {
211
231
  return getOne<HouseholdRecord, Household>(
212
232
  { path: `/tables/households`, id, mpOptions }
@@ -222,11 +242,6 @@ export const createMPInstance = ({ auth }: { auth: { username: string; password:
222
242
  { path: `/tables/participants`, id, mpOptions }
223
243
  );
224
244
  },
225
- async getContactAttribute(id, mpOptions = {}) {
226
- return getOne<ContactAttributeRecord, ContactAttribute>(
227
- { path: `/tables/participants`, id, mpOptions }
228
- );
229
- },
230
245
  async getEvent(id, mpOptions = {}) {
231
246
  return getOne<EventRecord, Event>(
232
247
  { path: `/tables/events`, id, mpOptions }
@@ -252,47 +267,52 @@ export const createMPInstance = ({ auth }: { auth: { username: string; password:
252
267
  { path: `/tables/form_responses`, id, mpOptions }
253
268
  );
254
269
  },
255
- async getContacts(mpOptions = {}) {
270
+ async getContacts(mpOptions) {
256
271
  return getMany<ContactRecord, Contact>(
257
272
  { path: `/tables/contacts`, mpOptions }
258
273
  );
259
274
  },
260
- async getHouseholds(mpOptions = {}) {
275
+ async getContactAttributes(mpOptions) {
276
+ return getMany<ContactAttributeRecord, ContactAttribute>(
277
+ { path: `/tables/contact_attributes`, mpOptions }
278
+ );
279
+ },
280
+ async getContactEmailAddresses(mpOptions) {
281
+ return getMany<ContactEmailAddressRecord, ContactEmailAddress>(
282
+ { path: `/tables/contact_email_addresses`, mpOptions }
283
+ );
284
+ },
285
+ async getHouseholds(mpOptions) {
261
286
  return getMany<HouseholdRecord, Household>(
262
287
  { path: `/tables/households`, mpOptions }
263
288
  );
264
289
  },
265
- async getAddresses(mpOptions = {}) {
290
+ async getAddresses(mpOptions) {
266
291
  return getMany<AddressRecord, Address>(
267
292
  { path: `/tables/addresses`, mpOptions }
268
293
  );
269
294
  },
270
- async getContactEmailAddresses(id, mpOptions = {}) {
271
- return getMany<ContactEmailAddressRecord, ContactEmailAddress>(
272
- { path: `/tables/contact_email_addresses`, id, mpOptions }
273
- );
274
- },
275
- async getParticipants(mpOptions = {}) {
295
+ async getParticipants(mpOptions) {
276
296
  return getMany<ParticipantRecord, Participant>(
277
297
  { path: `/tables/participants`, mpOptions }
278
298
  );
279
299
  },
280
- async getEvents(mpOptions = {}) {
300
+ async getEvents(mpOptions) {
281
301
  return getMany<EventRecord, Event>(
282
302
  { path: `/tables/events`, mpOptions }
283
303
  );
284
304
  },
285
- async getGroups(mpOptions = {}) {
305
+ async getGroups(mpOptions) {
286
306
  return getMany<GroupRecord, Group>(
287
307
  { path: `/tables/groups`, mpOptions }
288
308
  );
289
309
  },
290
- async getEventParticipants(mpOptions = {}) {
310
+ async getEventParticipants(mpOptions) {
291
311
  return getMany<EventParticipantRecord, EventParticipant>(
292
312
  { path: `/tables/event_participants`, mpOptions }
293
313
  );
294
314
  },
295
- async getGroupParticipants(mpOptions = {}) {
315
+ async getGroupParticipants(mpOptions) {
296
316
  return getMany<GroupParticipantRecord, GroupParticipant>(
297
317
  { path: `/tables/group_participants`, mpOptions }
298
318
  );
@@ -39,18 +39,18 @@ export interface Participant {
39
39
  participantStartDate: string;
40
40
  participantEndDate: null | string;
41
41
  notes: string;
42
- firstAttendanceEver: null | string;
43
- secondAttendanceEver: null | string;
44
- thirdAttendanceEver: null | string;
45
- lastAttendanceEver: null | string;
42
+ _firstAttendanceEver: null | string;
43
+ _secondAttendanceEver: null | string;
44
+ _thirdAttendanceEver: null | string;
45
+ _lastAttendanceEver: null | string;
46
46
  subStatusName: null | string;
47
47
  statusDate: null | string;
48
48
  formerDenomination: null | string;
49
49
  formerChurch: null | string;
50
- backgroundCheckInformation: null | string;
51
- backgroundCheckType: null | string;
52
- backgroundCheckStatus: null | string;
53
- backgroundCheckDate: null | string;
50
+ _backgroundCheckInformation: null | string;
51
+ _backgroundCheckType: null | string;
52
+ _backgroundCheckStatus: null | string;
53
+ _backgroundCheckDate: null | string;
54
54
  sacramentInformation: null | string;
55
55
  churchOfRecord: null | string;
56
56
  baptismParishName: null | string;
@@ -0,0 +1,132 @@
1
+ function jsonToSqlFilter(json: Record<string, any>): string {
2
+ const conditions: string[] = [];
3
+
4
+ // Loop through each key-value pair in the JSON object
5
+ for (const [key, value] of Object.entries(json)) {
6
+ let condition = '';
7
+
8
+ // If the value is a string, wrap it in quotes
9
+ if (typeof value === 'string') {
10
+ condition = `${key} = '${value}'`;
11
+ }
12
+ // If the value is a number or boolean, no quotes are needed
13
+ else if (typeof value === 'number' || typeof value === 'boolean') {
14
+ condition = `${key} = ${value}`;
15
+ }
16
+ // If the value is an array, assume it represents an IN condition
17
+ else if (Array.isArray(value)) {
18
+ const valueList = value.map(val =>
19
+ typeof val === 'string' ? `'${val}'` : val
20
+ ).join(', ');
21
+ condition = `${key} IN (${valueList})`;
22
+ }
23
+ // If the value is an object, we can assume it's a nested condition (e.g., for complex queries)
24
+ else if (typeof value === 'object') {
25
+ const subConditions = Object.entries(value).map(([subKey, subValue]) => {
26
+ if (typeof subValue === 'string') {
27
+ return `${subKey} = '${subValue}'`;
28
+ } else {
29
+ return `${subKey} = ${subValue}`;
30
+ }
31
+ }).join(' AND ');
32
+ condition = `${key} (${subConditions})`;
33
+ }
34
+
35
+ conditions.push(condition);
36
+ }
37
+
38
+ // Join the conditions with 'AND'
39
+ return conditions.length ? `WHERE ${conditions.join(' AND ')}` : '';
40
+ }
41
+
42
+ // Example Usage
43
+ const json1 = {
44
+ name: "John",
45
+ age: 30,
46
+ active: true,
47
+ hobbies: ["reading", "gaming"],
48
+ address: {
49
+ city: "New York",
50
+ zip: "10001"
51
+ }
52
+ };
53
+
54
+ const query1 = jsonToSqlFilter(json1);
55
+ console.log(query1);
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ type QueryCondition = {
64
+ [key: string]: any; // key is field, value is condition or value
65
+ };
66
+
67
+ function jsonToSqlQuery(json: QueryCondition): string {
68
+ const conditions: string[] = [];
69
+
70
+ // Loop through each key-value pair in the JSON object
71
+ for (const [key, value] of Object.entries(json)) {
72
+ let condition = '';
73
+
74
+ // If the value is an object (operator condition)
75
+ if (typeof value === 'object' && value !== null) {
76
+ const operatorConditions: string[] = [];
77
+ let [operator, operatorValue]: any[] = [null, null];
78
+ for ([operator, operatorValue] of Object.entries(value)) {
79
+ switch (operator) {
80
+ case "$eq":
81
+ operatorConditions.push(`${key} = '${operatorValue}'`);
82
+ break;
83
+ case "$gt":
84
+ operatorConditions.push(`${key} > ${operatorValue}`);
85
+ break;
86
+ case "$lt":
87
+ operatorConditions.push(`${key} < ${operatorValue}`);
88
+ break;
89
+ case "$gte":
90
+ operatorConditions.push(`${key} >= ${operatorValue}`);
91
+ break;
92
+ case "$lte":
93
+ operatorConditions.push(`${key} <= ${operatorValue}`);
94
+ break;
95
+ case "$ne":
96
+ operatorConditions.push(`${key} != '${operatorValue}'`);
97
+ break;
98
+ case "$in":
99
+ const inValues = operatorValue.map((val: any) => typeof val === 'string' ? `'${val}'` : val).join(', ');
100
+ operatorConditions.push(`${key} IN (${inValues})`);
101
+ break;
102
+ case "$like":
103
+ operatorConditions.push(`${key} LIKE '%${operatorValue}%'`);
104
+ break;
105
+ default:
106
+ throw new Error(`Unsupported operator: ${operator}`);
107
+ }
108
+ }
109
+ // Join all conditions for a field with AND
110
+ condition = operatorConditions.join(' AND ');
111
+ } else {
112
+ // For simple equality condition
113
+ condition = `${key} = '${value}'`;
114
+ }
115
+
116
+ conditions.push(condition);
117
+ }
118
+
119
+ // Join the conditions with AND
120
+ return conditions.length ? `WHERE ${conditions.join(' AND ')}` : '';
121
+ }
122
+
123
+ // Example Usage
124
+ const json = {
125
+ "age": { "$gt": 30 },
126
+ "name": { "$eq": "John" },
127
+ "status": { "$in": ["active", "pending"] },
128
+ "address.city": { "$eq": "New York" }
129
+ };
130
+
131
+ const query = jsonToSqlQuery(json);
132
+ console.log(query);