-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Good morning, how are you?
First, I'd like to thank you for all the hard work you put into developing this library. I'm still preparing my project to use it, but I ran into a problem that I made an adjustment to, which I'll discuss below.
Error:
I'm not very familiar with JavaScript, and I could be wrong. I have a Node project where I installed the library, and it generates an error when compiling. The error below indicates that it can't find the files. I solved the problem by simply adding js to the end of each imported file. From what I've researched, this is an error in newer versions where the import requires the extension.
Error: Cannot find module 'F:\Projetos\ApiPost\node_modules\threads-graph-api\dist\src\api-client' imported from F:\Projetos\ApiPost\node_modules\threads-grapndex.js
at finalizeResolution (node:internal/modules/esm/resolve:274:11)
at moduleResolve (node:internal/modules/esm/resolve:859:10)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:783:12)
at ModuleLoader.#cachedDefaultResolve (node:internal/modules/esm/loader:707:25)
at ModuleLoader.#resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:742:38)
at ModuleLoader.resolveSync (node:internal/modules/esm/loader:765:52)
at ModuleLoader.#cachedResolveSync (node:internal/modules/esm/loader:726:25)
at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:453:50)
at new ModuleJobSync (node:internal/modules/esm/module_job:393:34) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///F:/Projetos/ApiPost/node_modules/threads-graph-api/dist/src/api-client'
}
To solve the problem I just added the .js file extension to the imports.
Below is the patch made for the library that may help in understanding:
diff --git a/node_modules/threads-graph-api/dist/src/api-client.js b/node_modules/threads-graph-api/dist/src/api-client.js
index adfd559..f4b2852 100644
--- a/node_modules/threads-graph-api/dist/src/api-client.js
+++ b/node_modules/threads-graph-api/dist/src/api-client.js
@@ -71,7 +71,7 @@ var __rest = (this && this.__rest) || function (s, e) {
}
return t;
};
-import { CreateMediaContainerResponseSchema, ErrorResponseSchema, ExchangeAuthorizationCodeResponseSchema, GetAccountMetricsResponseSchema, GetConversationResponseSchema, GetMediaMetricsResponseSchema, GetMediaObjectResponseSchema, GetRepliesResponseSchema, GetUserProfileResponseSchema, GetUserThreadsPublishingLimitResponseSchema, GetUserThreadsResponseSchema, ManageReplyResponseSchema, PublishResponseSchema, } from './types';
+import { CreateMediaContainerResponseSchema, ErrorResponseSchema, ExchangeAuthorizationCodeResponseSchema, GetAccountMetricsResponseSchema, GetConversationResponseSchema, GetMediaMetricsResponseSchema, GetMediaObjectResponseSchema, GetRepliesResponseSchema, GetUserProfileResponseSchema, GetUserThreadsPublishingLimitResponseSchema, GetUserThreadsResponseSchema, ManageReplyResponseSchema, PublishResponseSchema, } from './types.js';
var ThreadsApiError = /** @class */ (function (_super) {
__extends(ThreadsApiError, _super);
function ThreadsApiError(error) {
diff --git a/node_modules/threads-graph-api/dist/src/index.js b/node_modules/threads-graph-api/dist/src/index.js
index 671fb77..92d3d80 100644
--- a/node_modules/threads-graph-api/dist/src/index.js
+++ b/node_modules/threads-graph-api/dist/src/index.js
@@ -1,2 +1,2 @@
-export * from './api-client';
-export * from './types';
+export * from './api-client.js';
+export * from './types.js';
Suggestion:
Another point I'd like to request in a potential update is the addition of the new topic_tag field, which is available in the API. It's a recent update that merges posts about topics.