bb-fca 2.0.3 → 2.0.6
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/deltas/apis/create.js +22 -0
- package/dist/deltas/apis/create.js.map +1 -1
- package/dist/deltas/apis/posting/post.js +346 -1
- package/dist/deltas/apis/posting/post.js.map +1 -1
- package/dist/deltas/apis/posting/story.js +147 -0
- package/dist/deltas/apis/posting/story.js.map +1 -1
- package/dist/deltas/apis/users/getUserFriends.js +285 -0
- package/dist/deltas/apis/users/getUserFriends.js.map +1 -0
- package/dist/deltas/apis/users/searchCity.js +91 -0
- package/dist/deltas/apis/users/searchCity.js.map +1 -0
- package/dist/deltas/apis/users/searchCompany.js +86 -0
- package/dist/deltas/apis/users/searchCompany.js.map +1 -0
- package/dist/deltas/apis/users/searchJobTitle.js +85 -0
- package/dist/deltas/apis/users/searchJobTitle.js.map +1 -0
- package/dist/deltas/apis/users/updateCity.js +98 -0
- package/dist/deltas/apis/users/updateCity.js.map +1 -0
- package/dist/deltas/apis/users/updateHometown.js +97 -0
- package/dist/deltas/apis/users/updateHometown.js.map +1 -0
- package/dist/deltas/apis/users/updateWorkExperience.js +131 -0
- package/dist/deltas/apis/users/updateWorkExperience.js.map +1 -0
- package/dist/index.d.ts +128 -0
- package/dist/types/deltas/apis/create.d.ts +22 -0
- package/dist/types/deltas/apis/posting/post.d.ts +7 -0
- package/dist/types/deltas/apis/posting/story.d.ts +21 -0
- package/dist/types/deltas/apis/users/getUserFriends.d.ts +30 -0
- package/dist/types/deltas/apis/users/searchCity.d.ts +10 -0
- package/dist/types/deltas/apis/users/searchCompany.d.ts +10 -0
- package/dist/types/deltas/apis/users/searchJobTitle.d.ts +10 -0
- package/dist/types/deltas/apis/users/updateCity.d.ts +10 -0
- package/dist/types/deltas/apis/users/updateHometown.d.ts +10 -0
- package/dist/types/deltas/apis/users/updateWorkExperience.d.ts +30 -0
- package/dist/types/utils/axios.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/utils/axios.js +12 -0
- package/dist/utils/axios.js.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/examples/post.example.js +41 -1
- package/package.json +1 -1
- package/src/deltas/apis/create.ts +25 -0
- package/src/deltas/apis/posting/post.ts +439 -1
- package/src/deltas/apis/posting/story.ts +147 -0
- package/src/deltas/apis/users/getUserFriends.ts +373 -0
- package/src/deltas/apis/users/searchCity.ts +106 -0
- package/src/deltas/apis/users/searchCompany.ts +100 -0
- package/src/deltas/apis/users/searchJobTitle.ts +99 -0
- package/src/deltas/apis/users/updateCity.ts +113 -0
- package/src/deltas/apis/users/updateHometown.ts +112 -0
- package/src/deltas/apis/users/updateWorkExperience.ts +160 -0
- package/src/types/index.d.ts +128 -0
- package/src/utils/axios.ts +19 -0
- package/src/utils/index.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -123,6 +123,15 @@ export interface UploadPhotoResult {
|
|
|
123
123
|
data: any;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
export interface UploadVideoResult {
|
|
127
|
+
success: boolean;
|
|
128
|
+
videoID: string;
|
|
129
|
+
uploadID: string;
|
|
130
|
+
uploadSessionID: string;
|
|
131
|
+
fileHandle: string;
|
|
132
|
+
data: any;
|
|
133
|
+
}
|
|
134
|
+
|
|
126
135
|
export interface ChangeNameResult {
|
|
127
136
|
/** Raw preview response data from AccountsCenter name validation query. */
|
|
128
137
|
preview: any;
|
|
@@ -606,6 +615,10 @@ export interface API {
|
|
|
606
615
|
photoPath: string,
|
|
607
616
|
callback?: Callback<UploadPhotoResult>,
|
|
608
617
|
): Promise<UploadPhotoResult>;
|
|
618
|
+
uploadVideo(
|
|
619
|
+
videoPath: string,
|
|
620
|
+
callback?: Callback<UploadVideoResult>,
|
|
621
|
+
): Promise<UploadVideoResult>;
|
|
609
622
|
};
|
|
610
623
|
|
|
611
624
|
/** Comment on a Facebook post. */
|
|
@@ -699,6 +712,121 @@ export interface API {
|
|
|
699
712
|
|
|
700
713
|
// ── Session ────────────────────────────────────────────────────
|
|
701
714
|
|
|
715
|
+
/**
|
|
716
|
+
* Searches for cities matching the given query string.
|
|
717
|
+
* Uses Facebook's Directory Typeahead data source.
|
|
718
|
+
* @param query The search query (city name or partial name).
|
|
719
|
+
* @param searchCategory The category to search (default: 'CURRENT_CITY').
|
|
720
|
+
*/
|
|
721
|
+
searchCity(
|
|
722
|
+
query: string,
|
|
723
|
+
searchCategory?: string,
|
|
724
|
+
): Promise<Array<{
|
|
725
|
+
fbid: string;
|
|
726
|
+
title: string;
|
|
727
|
+
value: string;
|
|
728
|
+
photoUri: string;
|
|
729
|
+
subtitle: string;
|
|
730
|
+
secondSubtitle: string;
|
|
731
|
+
}>>;
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Searches for companies/workplaces matching the given query string.
|
|
735
|
+
* Uses Facebook's Directory Typeahead data source with WORKPLACE category.
|
|
736
|
+
* @param query The search query (company name or partial name).
|
|
737
|
+
*/
|
|
738
|
+
searchCompany(
|
|
739
|
+
query: string,
|
|
740
|
+
): Promise<Array<{
|
|
741
|
+
fbid: string;
|
|
742
|
+
title: string;
|
|
743
|
+
value: string;
|
|
744
|
+
photoUri: string;
|
|
745
|
+
subtitle: string;
|
|
746
|
+
secondSubtitle: string;
|
|
747
|
+
}>>;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Searches for job titles/positions matching the given query string.
|
|
751
|
+
* Uses Facebook's Directory Typeahead data source with JOB_TITLE category.
|
|
752
|
+
* @param query The search query (job title or partial name).
|
|
753
|
+
*/
|
|
754
|
+
searchJobTitle(
|
|
755
|
+
query: string,
|
|
756
|
+
): Promise<Array<{
|
|
757
|
+
fbid: string;
|
|
758
|
+
title: string;
|
|
759
|
+
value: string;
|
|
760
|
+
photoUri: string;
|
|
761
|
+
subtitle: string;
|
|
762
|
+
secondSubtitle: string;
|
|
763
|
+
}>>;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Fetches the friend list of a given user with pagination support.
|
|
767
|
+
* @param userID The Facebook user ID whose friends to fetch.
|
|
768
|
+
* @param count Number of friends per page (default: 8).
|
|
769
|
+
* @param cursor Pagination cursor from previous response's endCursor (default: null).
|
|
770
|
+
*/
|
|
771
|
+
getUserFriends(
|
|
772
|
+
userID: string,
|
|
773
|
+
count?: number,
|
|
774
|
+
cursor?: string | null,
|
|
775
|
+
): Promise<{
|
|
776
|
+
friends: Array<{
|
|
777
|
+
id: string;
|
|
778
|
+
name: string;
|
|
779
|
+
avatarUri: string;
|
|
780
|
+
profileUrl: string;
|
|
781
|
+
mutualFriendsText: string;
|
|
782
|
+
friendshipStatus: string;
|
|
783
|
+
gender: string;
|
|
784
|
+
}>;
|
|
785
|
+
endCursor: string | null;
|
|
786
|
+
hasNextPage: boolean;
|
|
787
|
+
}>;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Adds or updates a work experience entry on the profile.
|
|
791
|
+
* Use searchCompany() and searchJobTitle() to get IDs first.
|
|
792
|
+
* @param options Work experience details.
|
|
793
|
+
*/
|
|
794
|
+
updateWorkExperience(options: {
|
|
795
|
+
companyName: string;
|
|
796
|
+
companyId?: string;
|
|
797
|
+
positionName?: string;
|
|
798
|
+
positionId?: string;
|
|
799
|
+
isCurrent?: boolean;
|
|
800
|
+
startDate?: { year?: number; month?: number; day?: number };
|
|
801
|
+
endDate?: { year?: number; month?: number; day?: number };
|
|
802
|
+
description?: string;
|
|
803
|
+
locationId?: string;
|
|
804
|
+
privacy?: string;
|
|
805
|
+
workExperienceID?: string | null;
|
|
806
|
+
}): Promise<any>;
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Updates the current city on the profile.
|
|
810
|
+
* Use searchCity() to get the city fbid first.
|
|
811
|
+
* @param cityId The Facebook ID of the city (from searchCity's fbid field).
|
|
812
|
+
* @param privacy Privacy setting: 'EVERYONE', 'FRIENDS', or 'SELF' (default: 'EVERYONE').
|
|
813
|
+
*/
|
|
814
|
+
updateCity(
|
|
815
|
+
cityId: string,
|
|
816
|
+
privacy?: string,
|
|
817
|
+
): Promise<any>;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Updates the hometown on the profile.
|
|
821
|
+
* Use searchCity() to get the city fbid first.
|
|
822
|
+
* @param cityId The Facebook ID of the city (from searchCity's fbid field).
|
|
823
|
+
* @param privacy Privacy setting: 'EVERYONE', 'FRIENDS', or 'SELF' (default: 'EVERYONE').
|
|
824
|
+
*/
|
|
825
|
+
updateHometown(
|
|
826
|
+
cityId: string,
|
|
827
|
+
privacy?: string,
|
|
828
|
+
): Promise<any>;
|
|
829
|
+
|
|
702
830
|
/**
|
|
703
831
|
* Changes the Facebook account display name (two-step: preview then confirm).
|
|
704
832
|
* Calls AccountsCenter GraphQL API.
|
|
@@ -20,4 +20,26 @@ export default function (defaultFuncs: any, api: any, ctx: any): {
|
|
|
20
20
|
* @returns {Promise<object>} The server's response.
|
|
21
21
|
*/
|
|
22
22
|
deletePost: any;
|
|
23
|
+
/**
|
|
24
|
+
* Gets comments from a Facebook post.
|
|
25
|
+
* @param {string|object} postID - The post's story_fbid (string) or options object with story_fbid and id.
|
|
26
|
+
* @param {Function} [callback] - Optional callback function.
|
|
27
|
+
* @returns {Promise<object[]>} Array of comment objects.
|
|
28
|
+
*/
|
|
29
|
+
getComments: any;
|
|
30
|
+
/**
|
|
31
|
+
* Uploads a photo to Facebook for later use in posts.
|
|
32
|
+
* @param {string} photoPath - Local file path to the photo.
|
|
33
|
+
* @param {Function} [callback] - Optional callback function.
|
|
34
|
+
* @returns {Promise<object>} Upload result with photoID.
|
|
35
|
+
*/
|
|
36
|
+
uploadPhoto: any;
|
|
37
|
+
/**
|
|
38
|
+
* Uploads a video to Facebook for later use in posts.
|
|
39
|
+
* Uses the 7-step resumable upload flow.
|
|
40
|
+
* @param {string} videoPath - Local file path to the video.
|
|
41
|
+
* @param {Function} [callback] - Optional callback function.
|
|
42
|
+
* @returns {Promise<object>} Upload result with videoID.
|
|
43
|
+
*/
|
|
44
|
+
uploadVideo: any;
|
|
23
45
|
};
|
|
@@ -10,6 +10,12 @@ export default function (defaultFuncs: any, api: any, ctx: any): {
|
|
|
10
10
|
url: any;
|
|
11
11
|
data: any;
|
|
12
12
|
}>;
|
|
13
|
+
createPost: (options: any, callback: any) => Promise<{
|
|
14
|
+
success: boolean;
|
|
15
|
+
postID: any;
|
|
16
|
+
url: any;
|
|
17
|
+
data: any;
|
|
18
|
+
}>;
|
|
13
19
|
delete: (postID: any, callback: any) => Promise<{
|
|
14
20
|
success: boolean;
|
|
15
21
|
postID: any;
|
|
@@ -17,4 +23,5 @@ export default function (defaultFuncs: any, api: any, ctx: any): {
|
|
|
17
23
|
}>;
|
|
18
24
|
getComments: (postID: any, callback: any) => Promise<any>;
|
|
19
25
|
uploadPhoto: (photoPath: any, callback: any) => Promise<any>;
|
|
26
|
+
uploadVideo: (videoPath: any, callback: any) => Promise<any>;
|
|
20
27
|
};
|
|
@@ -16,6 +16,27 @@ export default function (defaultFuncs: any, api: any, ctx: any): {
|
|
|
16
16
|
success: boolean;
|
|
17
17
|
storyID: any;
|
|
18
18
|
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Uploads a photo for use in an image story.
|
|
21
|
+
* @param {string} photoPath Absolute path to the photo file.
|
|
22
|
+
* @returns {Promise<{success: boolean, photoID: string, photoId: string, imageSrc: string, data: object}>}
|
|
23
|
+
*/
|
|
24
|
+
uploadStoryPhoto: (photoPath: any) => Promise<{
|
|
25
|
+
success: boolean;
|
|
26
|
+
photoID: string;
|
|
27
|
+
photoId: string;
|
|
28
|
+
imageSrc: any;
|
|
29
|
+
data: any;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new image-based story. Handles upload + publish in one call.
|
|
33
|
+
* @param {string} photoPath Absolute path to the photo file.
|
|
34
|
+
* @returns {Promise<{success: boolean, storyID: string}>}
|
|
35
|
+
*/
|
|
36
|
+
createImageStory: (photoPath: any) => Promise<{
|
|
37
|
+
success: boolean;
|
|
38
|
+
storyID: any;
|
|
39
|
+
}>;
|
|
19
40
|
/**
|
|
20
41
|
* Reacts to a story with a specific emoji.
|
|
21
42
|
* @param {string} storyIdOrUrl The ID or full URL of the story to react to.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ChoruOfficial
|
|
3
|
+
* @description A module for fetching a user's friend list via Facebook's GraphQL API.
|
|
4
|
+
* First resolves the user's friends page to extract the dynamic collection ID,
|
|
5
|
+
* then calls ProfileCometAppCollectionNonSelfFriendsListRendererPaginationQuery via /api/graphql/.
|
|
6
|
+
* Supports cursor-based pagination without re-fetching HTML on subsequent pages.
|
|
7
|
+
* @param {Object} defaultFuncs The default functions provided by the API wrapper.
|
|
8
|
+
* @param {Object} api The full API object.
|
|
9
|
+
* @param {Object} ctx The context object containing the user's session state.
|
|
10
|
+
* @returns {Function} An async function that fetches a user's friend list.
|
|
11
|
+
*/
|
|
12
|
+
export default function getUserFriendsModule(defaultFuncs: any, api: any, ctx: any): (userID: string, cursor?: string | null, collectionId?: string, count?: number) => Promise<{
|
|
13
|
+
friends: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
avatarUri: string;
|
|
17
|
+
profileUrl: string;
|
|
18
|
+
mutualFriendsText: string;
|
|
19
|
+
friendshipStatus: string;
|
|
20
|
+
gender: string;
|
|
21
|
+
}[];
|
|
22
|
+
endCursor: string | null;
|
|
23
|
+
hasNextPage: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The collection ID extracted from the friends page HTML.
|
|
26
|
+
* Pass this back into subsequent `getUserFriends` calls to skip
|
|
27
|
+
* the HTML re-fetch on page 2 onward.
|
|
28
|
+
*/
|
|
29
|
+
collectionId: string;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ChoruOfficial
|
|
3
|
+
* @description A module for searching cities via Facebook's Directory Typeahead API.
|
|
4
|
+
* Calls useProfileCometDirectoryTypeaheadDataSourceQuery via /api/graphql/.
|
|
5
|
+
* @param {Object} defaultFuncs The default functions provided by the API wrapper.
|
|
6
|
+
* @param {Object} api The full API object.
|
|
7
|
+
* @param {Object} ctx The context object containing the user's session state.
|
|
8
|
+
* @returns {Function} An async function that searches for cities by name.
|
|
9
|
+
*/
|
|
10
|
+
export default function (defaultFuncs: any, api: any, ctx: any): (query: string, searchCategory?: string) => Promise<any[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ChoruOfficial
|
|
3
|
+
* @description A module for searching companies/workplaces via Facebook's Directory Typeahead API.
|
|
4
|
+
* Calls useProfileCometDirectoryTypeaheadDataSourceQuery via /api/graphql/.
|
|
5
|
+
* @param {Object} defaultFuncs The default functions provided by the API wrapper.
|
|
6
|
+
* @param {Object} api The full API object.
|
|
7
|
+
* @param {Object} ctx The context object containing the user's session state.
|
|
8
|
+
* @returns {Function} An async function that searches for companies by name.
|
|
9
|
+
*/
|
|
10
|
+
export default function searchCompanyModule(defaultFuncs: any, api: any, ctx: any): (query: string) => Promise<any[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ChoruOfficial
|
|
3
|
+
* @description A module for searching job titles via Facebook's Directory Typeahead API.
|
|
4
|
+
* Calls useProfileCometDirectoryTypeaheadDataSourceQuery via /api/graphql/.
|
|
5
|
+
* @param {Object} defaultFuncs The default functions provided by the API wrapper.
|
|
6
|
+
* @param {Object} api The full API object.
|
|
7
|
+
* @param {Object} ctx The context object containing the user's session state.
|
|
8
|
+
* @returns {Function} An async function that searches for job titles by name.
|
|
9
|
+
*/
|
|
10
|
+
export default function searchJobTitleModule(defaultFuncs: any, api: any, ctx: any): (query: string) => Promise<any[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ChoruOfficial
|
|
3
|
+
* @description A module for updating the current city on a Facebook profile.
|
|
4
|
+
* Calls ProfileCometCurrentCityProfileFieldSaveMutation via /api/graphql/.
|
|
5
|
+
* @param {Object} defaultFuncs The default functions provided by the API wrapper.
|
|
6
|
+
* @param {Object} api The full API object.
|
|
7
|
+
* @param {Object} ctx The context object containing the user's session state.
|
|
8
|
+
* @returns {Function} An async function that updates the account's current city.
|
|
9
|
+
*/
|
|
10
|
+
export default function (defaultFuncs: any, api: any, ctx: any): (cityId: string, privacy?: string) => Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ChoruOfficial
|
|
3
|
+
* @description A module for updating the hometown on a Facebook profile.
|
|
4
|
+
* Calls ProfileCometHometownProfileFieldSaveMutation via /api/graphql/.
|
|
5
|
+
* @param {Object} defaultFuncs The default functions provided by the API wrapper.
|
|
6
|
+
* @param {Object} api The full API object.
|
|
7
|
+
* @param {Object} ctx The context object containing the user's session state.
|
|
8
|
+
* @returns {Function} An async function that updates the account's hometown.
|
|
9
|
+
*/
|
|
10
|
+
export default function (defaultFuncs: any, api: any, ctx: any): (cityId: string, privacy?: string) => Promise<any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ChoruOfficial
|
|
3
|
+
* @description A module for adding/updating work experience on a Facebook profile.
|
|
4
|
+
* Calls ProfileCometWorkExperienceSaveMutation via /api/graphql/.
|
|
5
|
+
* @param {Object} defaultFuncs The default functions provided by the API wrapper.
|
|
6
|
+
* @param {Object} api The full API object.
|
|
7
|
+
* @param {Object} ctx The context object containing the user's session state.
|
|
8
|
+
* @returns {Function} An async function that updates work experience.
|
|
9
|
+
*/
|
|
10
|
+
export default function updateWorkExperienceModule(defaultFuncs: any, api: any, ctx: any): (options: {
|
|
11
|
+
companyName: string;
|
|
12
|
+
companyId?: string;
|
|
13
|
+
positionName?: string;
|
|
14
|
+
positionId?: string;
|
|
15
|
+
isCurrent?: boolean;
|
|
16
|
+
startDate?: {
|
|
17
|
+
year?: number;
|
|
18
|
+
month?: number;
|
|
19
|
+
day?: number;
|
|
20
|
+
};
|
|
21
|
+
endDate?: {
|
|
22
|
+
year?: number;
|
|
23
|
+
month?: number;
|
|
24
|
+
day?: number;
|
|
25
|
+
};
|
|
26
|
+
description?: string;
|
|
27
|
+
locationId?: string;
|
|
28
|
+
privacy?: string;
|
|
29
|
+
workExperienceID?: string | null;
|
|
30
|
+
}) => Promise<any>;
|
|
@@ -4,4 +4,5 @@ export declare function cleanGet(url: string): Promise<any>;
|
|
|
4
4
|
export declare function get(url: string, reqJar: any, qs?: any, options?: any, ctx?: any, customHeader?: any): Promise<any>;
|
|
5
5
|
export declare function post(url: string, reqJar: any, form?: any, options?: any, ctx?: any, customHeader?: any): Promise<any>;
|
|
6
6
|
export declare function postFormData(url: string, reqJar: any, form: any, qs?: any, options?: any, ctx?: any): Promise<any>;
|
|
7
|
+
export declare function postRaw(url: string, reqJar: any, body: Buffer, options?: any, ctx?: any, customHeader?: any): Promise<any>;
|
|
7
8
|
export declare const getJar: () => CookieJar;
|
|
@@ -70,6 +70,7 @@ declare const utils: {
|
|
|
70
70
|
get(url: string, reqJar: any, qs?: any, options?: any, ctx?: any, customHeader?: any): Promise<any>;
|
|
71
71
|
post(url: string, reqJar: any, form?: any, options?: any, ctx?: any, customHeader?: any): Promise<any>;
|
|
72
72
|
postFormData(url: string, reqJar: any, form: any, qs?: any, options?: any, ctx?: any): Promise<any>;
|
|
73
|
+
postRaw(url: string, reqJar: any, body: Buffer, options?: any, ctx?: any, customHeader?: any): Promise<any>;
|
|
73
74
|
getJar: () => import("tough-cookie").CookieJar;
|
|
74
75
|
};
|
|
75
76
|
export = utils;
|
package/dist/utils/axios.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.cleanGet = cleanGet;
|
|
|
9
9
|
exports.get = get;
|
|
10
10
|
exports.post = post;
|
|
11
11
|
exports.postFormData = postFormData;
|
|
12
|
+
exports.postRaw = postRaw;
|
|
12
13
|
const axios_1 = __importDefault(require("axios"));
|
|
13
14
|
const axios_cookiejar_support_1 = require("axios-cookiejar-support");
|
|
14
15
|
const form_data_1 = __importDefault(require("form-data"));
|
|
@@ -143,6 +144,17 @@ async function postFormData(url, reqJar, form, qs, options, ctx) {
|
|
|
143
144
|
};
|
|
144
145
|
return requestWithRetry(async () => await client.post(url, formData, config));
|
|
145
146
|
}
|
|
147
|
+
async function postRaw(url, reqJar, body, options, ctx, customHeader) {
|
|
148
|
+
const config = {
|
|
149
|
+
headers: (0, headers_1.getHeaders)(url, options, ctx, customHeader),
|
|
150
|
+
timeout: 300000, // 5 min for large uploads
|
|
151
|
+
...proxyConfig,
|
|
152
|
+
maxContentLength: Infinity,
|
|
153
|
+
maxBodyLength: Infinity,
|
|
154
|
+
validateStatus: (status) => status >= 200 && status < 600,
|
|
155
|
+
};
|
|
156
|
+
return requestWithRetry(async () => await client.post(url, body, config));
|
|
157
|
+
}
|
|
146
158
|
const getJar = () => jar;
|
|
147
159
|
exports.getJar = getJar;
|
|
148
160
|
//# sourceMappingURL=axios.js.map
|
package/dist/utils/axios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../src/utils/axios.ts"],"names":[],"mappings":";;;;;;AA2DA,4BAyBC;AAED,4BAGC;AAED,kBAgBC;AAED,oBAqCC;AAED,oCA2BC;
|
|
1
|
+
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../src/utils/axios.ts"],"names":[],"mappings":";;;;;;AA2DA,4BAyBC;AAED,4BAGC;AAED,kBAgBC;AAED,oBAqCC;AAED,oCA2BC;AAED,0BAiBC;AAlMD,kDAA0B;AAC1B,qEAAkD;AAClD,0DAAiC;AACjC,+CAAyC;AACzC,2CAAsC;AACtC,uCAAuC;AAEvC,MAAM,GAAG,GAAG,IAAI,wBAAS,EAAE,CAAC;AAC5B,MAAM,MAAM,GAAG,IAAA,iCAAO,EAAC,eAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAS,CAAC,CA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AC;QACpD,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,EAAE;QACV,GAAG,WAAW;QACd,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;KAClE,CAAC;IACF,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAChF,CAAC;AAEM,KAAK,UAAU,OAAO,CAC3B,GAAW,EACX,MAAW,EACX,IAAY,EACZ,OAAa,EACb,GAAS,EACT,YAAkB;IAElB,MAAM,MAAM,GAAQ;QAClB,OAAO,EAAE,IAAA,oBAAU,EAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,CAAC;QACpD,OAAO,EAAE,MAAM,EAAE,0BAA0B;QAC3C,GAAG,WAAW;QACd,gBAAgB,EAAE,QAAQ;QAC1B,aAAa,EAAE,QAAQ;QACvB,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;KAClE,CAAC;IACF,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAC5E,CAAC;AAEM,MAAM,MAAM,GAAG,GAAc,EAAE,CAAC,GAAG,CAAC;AAA9B,QAAA,MAAM,UAAwB"}
|
package/dist/utils/index.js
CHANGED
|
@@ -87,6 +87,7 @@ function makeDefaults(html, userID, ctx) {
|
|
|
87
87
|
get: (url, jar, qs, ctxx, customHeader = {}) => network.get(url, jar, mergeWithDefaults(qs), ctx.globalOptions, ctxx || ctx, customHeader),
|
|
88
88
|
post: (url, jar, form, ctxx, customHeader = {}) => network.post(url, jar, mergeWithDefaults(form), ctx.globalOptions, ctxx || ctx, customHeader),
|
|
89
89
|
postFormData: (url, jar, form, qs, ctxx) => network.postFormData(url, jar, mergeWithDefaults(form), mergeWithDefaults(qs), ctx.globalOptions, ctxx || ctx),
|
|
90
|
+
postRaw: (url, jar, body, ctxx, customHeader = {}) => network.postRaw(url, jar, body, ctx.globalOptions, ctxx || ctx, customHeader),
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
93
|
const utils = {
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,mDAAqC;AACrC,mDAAqC;AACrC,uDAAyC;AACzC,yDAA2C;AAC3C,0DAA4C;AAC5C,iDAAmC;AACnC,2CAA6B;AAE7B,KAAK,UAAU,IAAI,CAAC,GAAW,EAAE,GAAQ,EAAE,EAAQ,EAAE,OAAa,EAAE,GAAS,EAAE,YAAkB;IAC/F,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;QACxE,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACtB,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,OAAO,GAAG,CAAC,CAAC,iCAAiC,CAAC,CAAC;QACrD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,SAAS,CAAC,IAAI,CAAC,qDAAqD,GAAG,EAAE,CAAC,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,WAAW,GAAU,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,KAAa,EAAE,OAAY,EAAE,EAAE;YAC3C,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG,C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AAC,aAAa,EAAE,IAAI,IAAI,GAAG,EAAE,YAAY,CAAC;QAC9K,YAAY,EAAE,CAAC,GAAW,EAAE,GAAQ,EAAE,IAAS,EAAE,EAAQ,EAAE,IAAU,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,aAAa,EAAE,IAAI,IAAI,GAAG,CAAC;QACxL,OAAO,EAAE,CAAC,GAAW,EAAE,GAAQ,EAAE,IAAY,EAAE,IAAU,EAAE,eAAoB,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,aAAa,EAAE,IAAI,IAAI,GAAG,EAAE,YAAY,CAAC;KACpK,CAAC;AACJ,CAAC;AAED,MAAM,KAAK,GAAG;IACZ,GAAG,OAAO;IACV,GAAG,OAAO;IACV,GAAG,OAAO;IACV,GAAG,SAAS;IACZ,GAAG,UAAU;IACb,GAAG,UAAU;IACb,IAAI;IACJ,YAAY;IACZ,SAAS,EAAE,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC9C,KAAK,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CAC3D,CAAC;AAEF,iBAAS,KAAK,CAAC"}
|
package/examples/post.example.js
CHANGED
|
@@ -135,7 +135,47 @@ login(credentials, (err, api) => {
|
|
|
135
135
|
console.error('Error:', err);
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
-
// Example
|
|
138
|
+
// Example 7: Upload a video
|
|
139
|
+
api.post.uploadVideo('./path/to/your/video.mp4', (err, result) => {
|
|
140
|
+
if (err) {
|
|
141
|
+
console.error('Error uploading video:', err);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.log('Video uploaded successfully!');
|
|
146
|
+
console.log('Video ID:', result.videoID);
|
|
147
|
+
console.log('Upload ID:', result.uploadID);
|
|
148
|
+
console.log('Upload Session ID:', result.uploadSessionID);
|
|
149
|
+
console.log('Success:', result.success);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Example 8: Upload video with Promise
|
|
153
|
+
api.post.uploadVideo('./path/to/your/video.mp4')
|
|
154
|
+
.then(result => {
|
|
155
|
+
console.log('Video uploaded:', result.videoID);
|
|
156
|
+
})
|
|
157
|
+
.catch(err => {
|
|
158
|
+
console.error('Video upload failed:', err);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Example 9: Create a post with a video attachment
|
|
162
|
+
api.post.uploadVideo('./path/to/your/video.mp4')
|
|
163
|
+
.then(uploadResult => {
|
|
164
|
+
return api.post.create({
|
|
165
|
+
message: 'Check out this video!',
|
|
166
|
+
privacy: 'SELF',
|
|
167
|
+
videos: [uploadResult.videoID]
|
|
168
|
+
});
|
|
169
|
+
})
|
|
170
|
+
.then(createResult => {
|
|
171
|
+
console.log('Post with video created successfully!');
|
|
172
|
+
console.log('Post ID:', createResult.postID);
|
|
173
|
+
})
|
|
174
|
+
.catch(err => {
|
|
175
|
+
console.error('Error:', err);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Example 10: Delete a post
|
|
139
179
|
api.post.delete('post_id_here', (err, result) => {
|
|
140
180
|
if (err) {
|
|
141
181
|
console.error('Error deleting post:', err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bb-fca",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "BB-FCA is a powerful and user-friendly Facebook Chat API wrapper for Node.js, designed to simplify the process of creating chatbots and automating interactions on Facebook Messenger. With BB-FCA, developers can easily send messages, manage conversations, and interact with the Facebook Messenger platform using a simple and intuitive API.",
|
|
5
5
|
"main": "dist/core/client.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,5 +24,30 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
24
24
|
* @returns {Promise<object>} The server's response.
|
|
25
25
|
*/
|
|
26
26
|
deletePost: postModule.delete,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Gets comments from a Facebook post.
|
|
30
|
+
* @param {string|object} postID - The post's story_fbid (string) or options object with story_fbid and id.
|
|
31
|
+
* @param {Function} [callback] - Optional callback function.
|
|
32
|
+
* @returns {Promise<object[]>} Array of comment objects.
|
|
33
|
+
*/
|
|
34
|
+
getComments: postModule.getComments,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Uploads a photo to Facebook for later use in posts.
|
|
38
|
+
* @param {string} photoPath - Local file path to the photo.
|
|
39
|
+
* @param {Function} [callback] - Optional callback function.
|
|
40
|
+
* @returns {Promise<object>} Upload result with photoID.
|
|
41
|
+
*/
|
|
42
|
+
uploadPhoto: postModule.uploadPhoto,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Uploads a video to Facebook for later use in posts.
|
|
46
|
+
* Uses the 7-step resumable upload flow.
|
|
47
|
+
* @param {string} videoPath - Local file path to the video.
|
|
48
|
+
* @param {Function} [callback] - Optional callback function.
|
|
49
|
+
* @returns {Promise<object>} Upload result with videoID.
|
|
50
|
+
*/
|
|
51
|
+
uploadVideo: postModule.uploadVideo,
|
|
27
52
|
};
|
|
28
53
|
}
|