@productcraft/social 1.0.4 → 1.1.0
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/README.md +187 -175
- package/api.md +4993 -0
- package/dist/index.cjs +5172 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6238 -32
- package/dist/index.d.ts +6238 -32
- package/dist/index.js +5107 -8
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +3226 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +32 -0
- package/dist/testing.d.ts +32 -0
- package/dist/testing.js +3224 -0
- package/dist/testing.js.map +1 -0
- package/manifest.json +3080 -0
- package/package.json +14 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Every operation name, as `resource.method`. */
|
|
2
|
+
type OperationName = "actors.archived.list" | "actors.assets.list" | "actors.batch" | "actors.blocks.list" | "actors.bookmarks.list" | "actors.byExternal.batch" | "actors.byExternal.retrieve" | "actors.closeFriends.list" | "actors.counters" | "actors.create" | "actors.delete" | "actors.dismissedSuggestions.list" | "actors.drafts.list" | "actors.feed.list" | "actors.followRequests.list" | "actors.followers.list" | "actors.following.list" | "actors.hashtagFollows.create" | "actors.hashtagFollows.delete" | "actors.hashtagFollows.list" | "actors.hides.list" | "actors.highlights.list" | "actors.insights" | "actors.list" | "actors.mentions.list" | "actors.mutedTerms.create" | "actors.mutedTerms.delete" | "actors.mutedTerms.list" | "actors.mutes.list" | "actors.notificationPrefs.list" | "actors.notificationPrefs.update" | "actors.notifications.list" | "actors.notifications.markAllRead" | "actors.notifications.unreadCount" | "actors.notifications.update" | "actors.postState" | "actors.relationships.list" | "actors.restricts.list" | "actors.retrieve" | "actors.scheduledPosts.list" | "actors.storyTray.list" | "actors.suggestedFollows.list" | "actors.tagged.list" | "actors.update" | "assets.complete" | "assets.create" | "assets.delete" | "assets.retrieve" | "blocks.create" | "blocks.delete" | "closeFriends.create" | "closeFriends.delete" | "collections.create" | "collections.delete" | "collections.items.create" | "collections.items.delete" | "collections.items.list" | "collections.items.update" | "collections.list" | "collections.retrieve" | "collections.update" | "communities.actors.comments.list" | "communities.actors.reactions.list" | "communities.analytics" | "communities.create" | "communities.delete" | "communities.list" | "communities.moderation.actions.create" | "communities.moderation.actors.shadowBan" | "communities.moderation.actors.unshadowBan" | "communities.moderation.audit.list" | "communities.moderation.blockedTerms.create" | "communities.moderation.blockedTerms.delete" | "communities.moderation.blockedTerms.list" | "communities.moderation.conversations.list" | "communities.moderation.conversations.messages.list" | "communities.moderation.flags.list" | "communities.moderation.flags.resolve" | "communities.moderation.shadowBanned.list" | "communities.retrieve" | "communities.update" | "communities.webhooks.endpoints.create" | "communities.webhooks.endpoints.delete" | "communities.webhooks.endpoints.list" | "communities.webhooks.endpoints.retrieve" | "communities.webhooks.endpoints.rotateSecret" | "communities.webhooks.endpoints.test" | "communities.webhooks.endpoints.update" | "communities.webhooks.eventTypes.list" | "communities.webhooks.events.list" | "communities.webhooks.events.replay" | "communities.webhooks.events.retrieve" | "connections.accept" | "connections.create" | "connections.delete" | "conversations.create" | "conversations.delete" | "conversations.list" | "conversations.markRead" | "conversations.members.create" | "conversations.members.delete" | "conversations.members.update" | "conversations.messages.create" | "conversations.messages.delete" | "conversations.messages.list" | "conversations.messages.reactions.create" | "conversations.messages.reactions.delete" | "conversations.messages.reactions.list" | "conversations.messages.retrieve" | "conversations.messages.update" | "conversations.retrieve" | "conversations.unreadCount" | "conversations.update" | "counters.list" | "discoverFeed.list" | "dismissedSuggestions.create" | "dismissedSuggestions.delete" | "flags.create" | "flags.list" | "followRequests.approve" | "followRequests.delete" | "follows.batch" | "follows.create" | "follows.delete" | "hashtags.list" | "hashtags.posts.list" | "hashtags.retrieve" | "hides.create" | "hides.delete" | "lists.create" | "lists.delete" | "lists.feed.list" | "lists.list" | "lists.members.create" | "lists.members.delete" | "lists.members.list" | "lists.retrieve" | "lists.update" | "mutes.create" | "mutes.delete" | "posts.bookmark" | "posts.comments.approve" | "posts.comments.create" | "posts.comments.delete" | "posts.comments.list" | "posts.comments.pin" | "posts.comments.reactions.create" | "posts.comments.reactions.delete" | "posts.comments.reactions.list" | "posts.comments.retrieve" | "posts.comments.unpin" | "posts.comments.update" | "posts.create" | "posts.delete" | "posts.insights" | "posts.list" | "posts.pollResults" | "posts.quotes.list" | "posts.reactions.create" | "posts.reactions.delete" | "posts.reactions.list" | "posts.recordImpressions" | "posts.recordView" | "posts.repost" | "posts.reposts.list" | "posts.retrieve" | "posts.revisions.list" | "posts.tags.approve" | "posts.tags.delete" | "posts.unbookmark" | "posts.unrepost" | "posts.update" | "posts.viewers.list" | "posts.voters.list" | "posts.votes.create" | "posts.votes.delete" | "posts.votes.retrieve" | "restricts.create" | "restricts.delete" | "search.actors.list" | "search.hashtags.list" | "search.posts.list" | "stats.retrieve" | "webhooks.endpoints.create" | "webhooks.endpoints.create" | "webhooks.endpoints.delete" | "webhooks.endpoints.delete" | "webhooks.endpoints.list" | "webhooks.endpoints.list" | "webhooks.endpoints.retrieve" | "webhooks.endpoints.retrieve" | "webhooks.endpoints.rotateSecret" | "webhooks.endpoints.rotateSecret" | "webhooks.endpoints.test" | "webhooks.endpoints.test" | "webhooks.endpoints.update" | "webhooks.endpoints.update" | "webhooks.eventTypes.list" | "webhooks.eventTypes.list" | "webhooks.events.list" | "webhooks.events.list" | "webhooks.events.replay" | "webhooks.events.replay" | "webhooks.events.retrieve" | "webhooks.events.retrieve";
|
|
3
|
+
/** One request the mock received. */
|
|
4
|
+
interface MockCall {
|
|
5
|
+
/** The matched operation, or `undefined` when nothing matched (the mock answers 404). */
|
|
6
|
+
operation: OperationName | undefined;
|
|
7
|
+
method: string;
|
|
8
|
+
url: URL;
|
|
9
|
+
headers: Headers;
|
|
10
|
+
/** The JSON-parsed body (the raw value when it is not JSON). */
|
|
11
|
+
body: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** Answers one call: a `Response`, or a value sent as JSON with the operation's success status. */
|
|
14
|
+
type MockHandler = (call: MockCall) => unknown;
|
|
15
|
+
interface MockFetch {
|
|
16
|
+
(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
17
|
+
/** Every call, in order. */
|
|
18
|
+
readonly calls: MockCall[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A `fetch` that answers every Social operation with its spec example, for unit tests.
|
|
22
|
+
* Override an operation with a value (sent as its JSON body) or a handler.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const fetch = createMockFetch();
|
|
27
|
+
* const social = new Social({ apiKey: "test", workspaceId: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b", fetch });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function createMockFetch(overrides?: Partial<Record<OperationName, unknown>>): MockFetch;
|
|
31
|
+
|
|
32
|
+
export { type MockCall, type MockFetch, type MockHandler, type OperationName, createMockFetch };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Every operation name, as `resource.method`. */
|
|
2
|
+
type OperationName = "actors.archived.list" | "actors.assets.list" | "actors.batch" | "actors.blocks.list" | "actors.bookmarks.list" | "actors.byExternal.batch" | "actors.byExternal.retrieve" | "actors.closeFriends.list" | "actors.counters" | "actors.create" | "actors.delete" | "actors.dismissedSuggestions.list" | "actors.drafts.list" | "actors.feed.list" | "actors.followRequests.list" | "actors.followers.list" | "actors.following.list" | "actors.hashtagFollows.create" | "actors.hashtagFollows.delete" | "actors.hashtagFollows.list" | "actors.hides.list" | "actors.highlights.list" | "actors.insights" | "actors.list" | "actors.mentions.list" | "actors.mutedTerms.create" | "actors.mutedTerms.delete" | "actors.mutedTerms.list" | "actors.mutes.list" | "actors.notificationPrefs.list" | "actors.notificationPrefs.update" | "actors.notifications.list" | "actors.notifications.markAllRead" | "actors.notifications.unreadCount" | "actors.notifications.update" | "actors.postState" | "actors.relationships.list" | "actors.restricts.list" | "actors.retrieve" | "actors.scheduledPosts.list" | "actors.storyTray.list" | "actors.suggestedFollows.list" | "actors.tagged.list" | "actors.update" | "assets.complete" | "assets.create" | "assets.delete" | "assets.retrieve" | "blocks.create" | "blocks.delete" | "closeFriends.create" | "closeFriends.delete" | "collections.create" | "collections.delete" | "collections.items.create" | "collections.items.delete" | "collections.items.list" | "collections.items.update" | "collections.list" | "collections.retrieve" | "collections.update" | "communities.actors.comments.list" | "communities.actors.reactions.list" | "communities.analytics" | "communities.create" | "communities.delete" | "communities.list" | "communities.moderation.actions.create" | "communities.moderation.actors.shadowBan" | "communities.moderation.actors.unshadowBan" | "communities.moderation.audit.list" | "communities.moderation.blockedTerms.create" | "communities.moderation.blockedTerms.delete" | "communities.moderation.blockedTerms.list" | "communities.moderation.conversations.list" | "communities.moderation.conversations.messages.list" | "communities.moderation.flags.list" | "communities.moderation.flags.resolve" | "communities.moderation.shadowBanned.list" | "communities.retrieve" | "communities.update" | "communities.webhooks.endpoints.create" | "communities.webhooks.endpoints.delete" | "communities.webhooks.endpoints.list" | "communities.webhooks.endpoints.retrieve" | "communities.webhooks.endpoints.rotateSecret" | "communities.webhooks.endpoints.test" | "communities.webhooks.endpoints.update" | "communities.webhooks.eventTypes.list" | "communities.webhooks.events.list" | "communities.webhooks.events.replay" | "communities.webhooks.events.retrieve" | "connections.accept" | "connections.create" | "connections.delete" | "conversations.create" | "conversations.delete" | "conversations.list" | "conversations.markRead" | "conversations.members.create" | "conversations.members.delete" | "conversations.members.update" | "conversations.messages.create" | "conversations.messages.delete" | "conversations.messages.list" | "conversations.messages.reactions.create" | "conversations.messages.reactions.delete" | "conversations.messages.reactions.list" | "conversations.messages.retrieve" | "conversations.messages.update" | "conversations.retrieve" | "conversations.unreadCount" | "conversations.update" | "counters.list" | "discoverFeed.list" | "dismissedSuggestions.create" | "dismissedSuggestions.delete" | "flags.create" | "flags.list" | "followRequests.approve" | "followRequests.delete" | "follows.batch" | "follows.create" | "follows.delete" | "hashtags.list" | "hashtags.posts.list" | "hashtags.retrieve" | "hides.create" | "hides.delete" | "lists.create" | "lists.delete" | "lists.feed.list" | "lists.list" | "lists.members.create" | "lists.members.delete" | "lists.members.list" | "lists.retrieve" | "lists.update" | "mutes.create" | "mutes.delete" | "posts.bookmark" | "posts.comments.approve" | "posts.comments.create" | "posts.comments.delete" | "posts.comments.list" | "posts.comments.pin" | "posts.comments.reactions.create" | "posts.comments.reactions.delete" | "posts.comments.reactions.list" | "posts.comments.retrieve" | "posts.comments.unpin" | "posts.comments.update" | "posts.create" | "posts.delete" | "posts.insights" | "posts.list" | "posts.pollResults" | "posts.quotes.list" | "posts.reactions.create" | "posts.reactions.delete" | "posts.reactions.list" | "posts.recordImpressions" | "posts.recordView" | "posts.repost" | "posts.reposts.list" | "posts.retrieve" | "posts.revisions.list" | "posts.tags.approve" | "posts.tags.delete" | "posts.unbookmark" | "posts.unrepost" | "posts.update" | "posts.viewers.list" | "posts.voters.list" | "posts.votes.create" | "posts.votes.delete" | "posts.votes.retrieve" | "restricts.create" | "restricts.delete" | "search.actors.list" | "search.hashtags.list" | "search.posts.list" | "stats.retrieve" | "webhooks.endpoints.create" | "webhooks.endpoints.create" | "webhooks.endpoints.delete" | "webhooks.endpoints.delete" | "webhooks.endpoints.list" | "webhooks.endpoints.list" | "webhooks.endpoints.retrieve" | "webhooks.endpoints.retrieve" | "webhooks.endpoints.rotateSecret" | "webhooks.endpoints.rotateSecret" | "webhooks.endpoints.test" | "webhooks.endpoints.test" | "webhooks.endpoints.update" | "webhooks.endpoints.update" | "webhooks.eventTypes.list" | "webhooks.eventTypes.list" | "webhooks.events.list" | "webhooks.events.list" | "webhooks.events.replay" | "webhooks.events.replay" | "webhooks.events.retrieve" | "webhooks.events.retrieve";
|
|
3
|
+
/** One request the mock received. */
|
|
4
|
+
interface MockCall {
|
|
5
|
+
/** The matched operation, or `undefined` when nothing matched (the mock answers 404). */
|
|
6
|
+
operation: OperationName | undefined;
|
|
7
|
+
method: string;
|
|
8
|
+
url: URL;
|
|
9
|
+
headers: Headers;
|
|
10
|
+
/** The JSON-parsed body (the raw value when it is not JSON). */
|
|
11
|
+
body: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** Answers one call: a `Response`, or a value sent as JSON with the operation's success status. */
|
|
14
|
+
type MockHandler = (call: MockCall) => unknown;
|
|
15
|
+
interface MockFetch {
|
|
16
|
+
(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
17
|
+
/** Every call, in order. */
|
|
18
|
+
readonly calls: MockCall[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A `fetch` that answers every Social operation with its spec example, for unit tests.
|
|
22
|
+
* Override an operation with a value (sent as its JSON body) or a handler.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const fetch = createMockFetch();
|
|
27
|
+
* const social = new Social({ apiKey: "test", workspaceId: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b", fetch });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function createMockFetch(overrides?: Partial<Record<OperationName, unknown>>): MockFetch;
|
|
31
|
+
|
|
32
|
+
export { type MockCall, type MockFetch, type MockHandler, type OperationName, createMockFetch };
|