meta-cloud-api 0.0.3 → 0.0.5

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 (173) hide show
  1. package/README.md +216 -0
  2. package/dist/api/base.d.mts +1 -1
  3. package/dist/api/base.d.ts +1 -1
  4. package/dist/api/businessProfile.d.mts +142 -0
  5. package/dist/api/businessProfile.d.ts +142 -0
  6. package/dist/api/businessProfile.js +2 -0
  7. package/dist/api/businessProfile.js.map +1 -0
  8. package/dist/api/businessProfile.mjs +2 -0
  9. package/dist/api/businessProfile.mjs.map +1 -0
  10. package/dist/api/encryption.d.mts +1 -1
  11. package/dist/api/encryption.d.ts +1 -1
  12. package/dist/api/encryption.js +1 -1
  13. package/dist/api/encryption.mjs +1 -1
  14. package/dist/api/flow.d.mts +1 -1
  15. package/dist/api/flow.d.ts +1 -1
  16. package/dist/api/flow.js +1 -1
  17. package/dist/api/flow.mjs +1 -1
  18. package/dist/api/index.d.mts +16 -14
  19. package/dist/api/index.d.ts +16 -14
  20. package/dist/api/index.js +1 -1
  21. package/dist/api/index.js.map +1 -1
  22. package/dist/api/index.mjs +1 -1
  23. package/dist/api/index.mjs.map +1 -1
  24. package/dist/api/media.d.mts +1 -1
  25. package/dist/api/media.d.ts +1 -1
  26. package/dist/api/media.js +1 -1
  27. package/dist/api/media.mjs +1 -1
  28. package/dist/api/messages.d.mts +1 -1
  29. package/dist/api/messages.d.ts +1 -1
  30. package/dist/api/messages.js +1 -1
  31. package/dist/api/messages.mjs +1 -1
  32. package/dist/api/phoneNumber.d.mts +1 -1
  33. package/dist/api/phoneNumber.d.ts +1 -1
  34. package/dist/api/phoneNumber.js +1 -1
  35. package/dist/api/phoneNumber.mjs +1 -1
  36. package/dist/api/qrCode.d.mts +1 -1
  37. package/dist/api/qrCode.d.ts +1 -1
  38. package/dist/api/qrCode.js +1 -1
  39. package/dist/api/qrCode.mjs +1 -1
  40. package/dist/api/registration.d.mts +1 -1
  41. package/dist/api/registration.d.ts +1 -1
  42. package/dist/api/registration.js +1 -1
  43. package/dist/api/registration.mjs +1 -1
  44. package/dist/api/template.d.mts +1 -1
  45. package/dist/api/template.d.ts +1 -1
  46. package/dist/api/template.js +1 -1
  47. package/dist/api/template.mjs +1 -1
  48. package/dist/api/twoStepVerification.d.mts +1 -1
  49. package/dist/api/twoStepVerification.d.ts +1 -1
  50. package/dist/api/twoStepVerification.js +1 -1
  51. package/dist/api/twoStepVerification.mjs +1 -1
  52. package/dist/api/waba.d.mts +1 -1
  53. package/dist/api/waba.d.ts +1 -1
  54. package/dist/api/waba.js +1 -1
  55. package/dist/api/waba.mjs +1 -1
  56. package/dist/{enums-D6WRUWH9.d.mts → enums-Dn5Y1Nom.d.mts} +94 -2
  57. package/dist/{enums-D6WRUWH9.d.ts → enums-Dn5Y1Nom.d.ts} +94 -2
  58. package/dist/httpsClient.d.mts +1 -1
  59. package/dist/httpsClient.d.ts +1 -1
  60. package/dist/index.d.mts +20 -18
  61. package/dist/index.d.ts +20 -18
  62. package/dist/index.js +1 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +1 -1
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/request.d.mts +1 -1
  67. package/dist/request.d.ts +1 -1
  68. package/dist/types/base.d.mts +1 -1
  69. package/dist/types/base.d.ts +1 -1
  70. package/dist/types/businessProfile.d.mts +147 -0
  71. package/dist/types/businessProfile.d.ts +147 -0
  72. package/dist/types/businessProfile.js +2 -0
  73. package/dist/types/businessProfile.js.map +1 -0
  74. package/dist/types/businessProfile.mjs +1 -0
  75. package/dist/types/businessProfile.mjs.map +1 -0
  76. package/dist/types/config.d.mts +1 -1
  77. package/dist/types/config.d.ts +1 -1
  78. package/dist/types/encryption.d.mts +1 -1
  79. package/dist/types/encryption.d.ts +1 -1
  80. package/dist/types/enums.d.mts +1 -1
  81. package/dist/types/enums.d.ts +1 -1
  82. package/dist/types/enums.js +1 -1
  83. package/dist/types/enums.js.map +1 -1
  84. package/dist/types/enums.mjs +1 -1
  85. package/dist/types/enums.mjs.map +1 -1
  86. package/dist/types/flow.d.mts +1 -1
  87. package/dist/types/flow.d.ts +1 -1
  88. package/dist/types/httpsClient.d.mts +1 -1
  89. package/dist/types/httpsClient.d.ts +1 -1
  90. package/dist/types/index.d.mts +3 -1
  91. package/dist/types/index.d.ts +3 -1
  92. package/dist/types/index.js +1 -1
  93. package/dist/types/index.js.map +1 -1
  94. package/dist/types/index.mjs +1 -1
  95. package/dist/types/index.mjs.map +1 -1
  96. package/dist/types/media.d.mts +1 -1
  97. package/dist/types/media.d.ts +1 -1
  98. package/dist/types/messages.d.mts +1 -1
  99. package/dist/types/messages.d.ts +1 -1
  100. package/dist/types/phoneNumber.d.mts +1 -1
  101. package/dist/types/phoneNumber.d.ts +1 -1
  102. package/dist/types/qrCode.d.mts +1 -1
  103. package/dist/types/qrCode.d.ts +1 -1
  104. package/dist/types/registration.d.mts +1 -1
  105. package/dist/types/registration.d.ts +1 -1
  106. package/dist/types/request.d.mts +1 -1
  107. package/dist/types/request.d.ts +1 -1
  108. package/dist/types/template.d.mts +1 -1
  109. package/dist/types/template.d.ts +1 -1
  110. package/dist/types/twoStepVerification.d.mts +1 -1
  111. package/dist/types/twoStepVerification.d.ts +1 -1
  112. package/dist/types/waba.d.mts +1 -1
  113. package/dist/types/waba.d.ts +1 -1
  114. package/dist/types/whatsapp.d.mts +28 -0
  115. package/dist/types/whatsapp.d.ts +28 -0
  116. package/dist/types/whatsapp.js +1 -1
  117. package/dist/types/whatsapp.js.map +1 -1
  118. package/dist/utils/importConfig.d.mts +14 -1
  119. package/dist/utils/importConfig.d.ts +14 -1
  120. package/dist/utils/importConfig.js +1 -1
  121. package/dist/utils/importConfig.mjs +1 -1
  122. package/dist/utils/index.d.mts +14 -1
  123. package/dist/utils/index.d.ts +14 -1
  124. package/dist/utils/index.js +1 -1
  125. package/dist/utils/index.mjs +1 -1
  126. package/dist/whatsapp.d.mts +21 -18
  127. package/dist/whatsapp.d.ts +21 -18
  128. package/dist/whatsapp.js +1 -1
  129. package/dist/whatsapp.js.map +1 -1
  130. package/dist/whatsapp.mjs +1 -1
  131. package/dist/whatsapp.mjs.map +1 -1
  132. package/package.json +2 -2
  133. package/src/api/base.ts +0 -19
  134. package/src/api/encryption.ts +0 -34
  135. package/src/api/flow.ts +0 -253
  136. package/src/api/index.ts +0 -24
  137. package/src/api/media.ts +0 -52
  138. package/src/api/messages.ts +0 -160
  139. package/src/api/phoneNumber.ts +0 -59
  140. package/src/api/qrCode.ts +0 -64
  141. package/src/api/registration.ts +0 -38
  142. package/src/api/template.ts +0 -70
  143. package/src/api/twoStepVerification.ts +0 -24
  144. package/src/api/waba.ts +0 -55
  145. package/src/httpsClient.ts +0 -83
  146. package/src/index.ts +0 -3
  147. package/src/request.ts +0 -104
  148. package/src/types/base.ts +0 -5
  149. package/src/types/config.ts +0 -68
  150. package/src/types/encryption.ts +0 -11
  151. package/src/types/enums.ts +0 -563
  152. package/src/types/flow.ts +0 -274
  153. package/src/types/httpsClient.ts +0 -28
  154. package/src/types/index.ts +0 -16
  155. package/src/types/logger.ts +0 -7
  156. package/src/types/media.ts +0 -31
  157. package/src/types/messages.ts +0 -453
  158. package/src/types/phoneNumber.ts +0 -111
  159. package/src/types/qrCode.ts +0 -30
  160. package/src/types/registration.ts +0 -17
  161. package/src/types/request.ts +0 -66
  162. package/src/types/template.ts +0 -134
  163. package/src/types/twoStepVerification.ts +0 -9
  164. package/src/types/waba.ts +0 -18
  165. package/src/types/whatsapp.ts +0 -31
  166. package/src/utils/.gitkeep +0 -0
  167. package/src/utils/generateXHub256Sig.ts +0 -5
  168. package/src/utils/importConfig.ts +0 -55
  169. package/src/utils/index.ts +0 -2
  170. package/src/utils/isMetaError.ts +0 -44
  171. package/src/utils/logger.ts +0 -46
  172. package/src/utils/objectToQueryString.ts +0 -16
  173. package/src/whatsapp.ts +0 -96
package/src/types/flow.ts DELETED
@@ -1,274 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- import { RequesterResponseInterface, ResponseSuccess } from './request';
9
-
10
- /**
11
- * Enum for Flow Status
12
- */
13
- export enum FlowStatusEnum {
14
- Draft = 'DRAFT',
15
- Published = 'PUBLISHED',
16
- Throttled = 'THROTTLED',
17
- Blocked = 'BLOCKED',
18
- Deprecated = 'DEPRECATED',
19
- }
20
-
21
- /**
22
- * Enum for Flow Categories
23
- */
24
- export enum FlowCategoryEnum {
25
- SignUp = 'SIGN_UP',
26
- SignIn = 'SIGN_IN',
27
- AppointmentBooking = 'APPOINTMENT_BOOKING',
28
- LeadGeneration = 'LEAD_GENERATION',
29
- ContactUs = 'CONTACT_US',
30
- CustomerSupport = 'CUSTOMER_SUPPORT',
31
- Survey = 'SURVEY',
32
- Other = 'OTHER',
33
- }
34
-
35
- /**
36
- * Flow Validation Error Pointer
37
- */
38
- export interface FlowValidationErrorPointer {
39
- line_start: number;
40
- line_end: number;
41
- column_start: number;
42
- column_end: number;
43
- path: string;
44
- }
45
-
46
- /**
47
- * Flow Validation Error
48
- */
49
- export interface FlowValidationError {
50
- error: string;
51
- error_type: string;
52
- message: string;
53
- line_start: number;
54
- line_end: number;
55
- column_start: number;
56
- column_end: number;
57
- pointers: FlowValidationErrorPointer[];
58
- }
59
-
60
- /**
61
- * Flow Item
62
- */
63
- export interface Flow {
64
- id: string;
65
- name: string;
66
- status: FlowStatusEnum;
67
- categories: FlowCategoryEnum[];
68
- validation_errors: FlowValidationError[];
69
- }
70
-
71
- /**
72
- * Pagination Cursors
73
- */
74
- export interface PaginationCursors {
75
- before: string;
76
- after: string;
77
- }
78
-
79
- /**
80
- * Pagination Object
81
- */
82
- export interface Pagination {
83
- cursors: PaginationCursors;
84
- }
85
-
86
- /**
87
- * Flows List Response
88
- */
89
- export interface FlowsListResponse {
90
- data: Flow[];
91
- paging: Pagination;
92
- }
93
-
94
- /**
95
- * Flow Asset
96
- */
97
- export interface FlowAsset {
98
- name: string;
99
- asset_type: string;
100
- download_url: string;
101
- }
102
-
103
- /**
104
- * Flow Assets Response
105
- */
106
- export interface FlowAssetsResponse {
107
- data: FlowAsset[];
108
- paging: Pagination;
109
- }
110
-
111
- /**
112
- * Flow Preview
113
- */
114
- export interface FlowPreview {
115
- preview_url: string;
116
- expires_at: string;
117
- }
118
-
119
- /**
120
- * Flow Preview Response
121
- */
122
- export interface FlowPreviewResponse {
123
- preview: FlowPreview;
124
- id: string;
125
- }
126
-
127
- /**
128
- * Flow Migration Result
129
- */
130
- export interface FlowMigrationResult {
131
- source_name: string;
132
- source_id: string;
133
- migrated_id: string;
134
- }
135
-
136
- /**
137
- * Flow Migration Failure
138
- */
139
- export interface FlowMigrationFailure {
140
- source_name: string;
141
- error_code: string;
142
- error_message: string;
143
- }
144
-
145
- /**
146
- * Flow Migration Response
147
- */
148
- export interface FlowMigrationResponse {
149
- migrated_flows: FlowMigrationResult[];
150
- failed_flows: FlowMigrationFailure[];
151
- }
152
-
153
- export interface FlowClass {
154
- /**
155
- * List Flows
156
- *
157
- * @param wabaId - The WABA ID
158
- * @returns Promise with the list of flows
159
- */
160
- listFlows(wabaId: string): Promise<RequesterResponseInterface<FlowsListResponse>>;
161
-
162
- /**
163
- * Create Flow
164
- *
165
- * @param wabaId - The WABA ID
166
- * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
167
- * @returns Promise with the created flow ID
168
- */
169
- createFlow(
170
- wabaId: string,
171
- data: {
172
- name: string;
173
- categories?: FlowCategoryEnum[];
174
- endpoint_uri?: string;
175
- clone_flow_id?: string;
176
- flow_json?: string;
177
- publish?: boolean;
178
- },
179
- ): Promise<RequesterResponseInterface<{ id: string; success: boolean; validation_errors?: FlowValidationError[] }>>;
180
-
181
- /**
182
- * Get Flow
183
- *
184
- * @param flowId - The flow ID
185
- * @param fields - Optional fields to return
186
- * @param dateFormat - Optional date format
187
- * @returns Promise with the flow details
188
- */
189
- getFlow(
190
- flowId: string,
191
- fields?: string,
192
- dateFormat?: string,
193
- ): Promise<RequesterResponseInterface<Flow | FlowPreviewResponse>>;
194
-
195
- /**
196
- * Update Flow Metadata
197
- *
198
- * @param flowId - The flow ID
199
- * @param data - The flow metadata to update
200
- * @returns Promise with the success status
201
- */
202
- updateFlowMetadata(
203
- flowId: string,
204
- data: {
205
- name?: string;
206
- categories?: FlowCategoryEnum[];
207
- endpoint_uri?: string;
208
- application_id?: string;
209
- },
210
- ): Promise<RequesterResponseInterface<ResponseSuccess>>;
211
-
212
- /**
213
- * Delete Flow
214
- *
215
- * @param flowId - The flow ID
216
- * @returns Promise with the success status
217
- */
218
- deleteFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>>;
219
-
220
- /**
221
- * List Assets (Get Flow JSON URL)
222
- *
223
- * @param flowId - The flow ID
224
- * @returns Promise with the list of assets
225
- */
226
- listAssets(flowId: string): Promise<RequesterResponseInterface<FlowAssetsResponse>>;
227
-
228
- /**
229
- * Update Flow JSON
230
- *
231
- * @param flowId - The flow ID
232
- * @param data - The asset data including asset_type, file, and name
233
- * @returns Promise with the success status and validation errors
234
- */
235
- updateFlowJson(
236
- flowId: string,
237
- data: {
238
- asset_type: 'FLOW_JSON';
239
- file: Blob;
240
- name: string;
241
- },
242
- ): Promise<RequesterResponseInterface<{ success: boolean; validation_errors?: FlowValidationError[] }>>;
243
-
244
- /**
245
- * Publish Flow
246
- *
247
- * @param flowId - The flow ID
248
- * @returns Promise with the success status
249
- */
250
- publishFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>>;
251
-
252
- /**
253
- * Deprecate Flow
254
- *
255
- * @param flowId - The flow ID
256
- * @returns Promise with the success status
257
- */
258
- deprecateFlow(flowId: string): Promise<RequesterResponseInterface<ResponseSuccess>>;
259
-
260
- /**
261
- * Migrate Flows
262
- *
263
- * @param wabaId - The destination WABA ID
264
- * @param data - The migration data including source_waba_id and optional source_flow_names
265
- * @returns Promise with migration results
266
- */
267
- migrateFlows(
268
- wabaId: string,
269
- data: {
270
- source_waba_id: string;
271
- source_flow_names?: string[];
272
- },
273
- ): Promise<RequesterResponseInterface<FlowMigrationResponse>>;
274
- }
@@ -1,28 +0,0 @@
1
- import { HttpMethodsEnum } from './enums';
2
-
3
- export type ResponseHeaderValue = string | string[] | undefined;
4
-
5
- export type ResponseHeaders = Record<string, ResponseHeaderValue>;
6
-
7
- export type ResponseJSONBody = Record<string, unknown>;
8
-
9
- export declare class HttpsClientResponseClass {
10
- constructor(resp: Response);
11
- statusCode: () => number;
12
- headers: () => ResponseHeaders;
13
- rawResponse: () => Response;
14
- json: () => Promise<ResponseJSONBody>;
15
- }
16
-
17
- export declare class HttpsClientClass {
18
- constructor();
19
- clearSockets: () => boolean;
20
- sendRequest: (
21
- host: string,
22
- path: string,
23
- method: HttpMethodsEnum,
24
- headers: HeadersInit,
25
- timeout: number,
26
- body?: BodyInit | null,
27
- ) => Promise<HttpsClientResponseClass>;
28
- }
@@ -1,16 +0,0 @@
1
- export * from './config';
2
- export * from './enums';
3
- export * from './request';
4
- export * from './base';
5
- export * from './httpsClient';
6
- export * from './logger';
7
- export * from './messages';
8
- export * from './whatsapp';
9
- export * from './template';
10
- export * from './phoneNumber';
11
- export * from './registration';
12
- export * from './twoStepVerification';
13
- export * from './qrCode';
14
- export * from './encryption';
15
- export * from './waba';
16
- export * from './media';
@@ -1,7 +0,0 @@
1
- export interface LoggerInterface {
2
- log(...data: any[]): void;
3
- error(...data: any[]): void;
4
- warn(...data: any[]): void;
5
- info(...data: any[]): void;
6
- debug(...data: any[]): void;
7
- }
@@ -1,31 +0,0 @@
1
- import type { RequesterResponseInterface, ResponseSuccess } from './request';
2
-
3
- export type MediaResponse = {
4
- id: string;
5
- url: string;
6
- mime_type: string;
7
- sha256: string;
8
- file_size: number;
9
- messaging_product: 'whatsapp';
10
- };
11
-
12
- export type MediasResponse = {
13
- data: MediaResponse[];
14
- paging: {
15
- cursors: {
16
- before: string;
17
- after: string;
18
- };
19
- };
20
- };
21
-
22
- export type UploadMediaResponse = {
23
- id: string;
24
- };
25
-
26
- export interface MediaClass {
27
- getMediaById(mediaId: string, phone_number_id?: string): Promise<RequesterResponseInterface<MediaResponse>>;
28
- uploadMedia(file: File, messagingProduct?: string): Promise<RequesterResponseInterface<UploadMediaResponse>>;
29
- deleteMedia(mediaId: string, phone_number_id?: string): Promise<RequesterResponseInterface<ResponseSuccess>>;
30
- downloadMedia(mediaUrl: string): Promise<RequesterResponseInterface<Blob>>;
31
- }