@olastudio/social-media-sdk 0.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.
Files changed (76) hide show
  1. package/README.md +112 -0
  2. package/dist/adapters/expo.d.mts +19 -0
  3. package/dist/adapters/expo.d.ts +19 -0
  4. package/dist/adapters/expo.js +100 -0
  5. package/dist/adapters/expo.js.map +1 -0
  6. package/dist/adapters/expo.mjs +77 -0
  7. package/dist/adapters/expo.mjs.map +1 -0
  8. package/dist/adapters/index.d.mts +21 -0
  9. package/dist/adapters/index.d.ts +21 -0
  10. package/dist/adapters/index.js +6 -0
  11. package/dist/adapters/index.js.map +1 -0
  12. package/dist/adapters/index.mjs +3 -0
  13. package/dist/adapters/index.mjs.map +1 -0
  14. package/dist/auth.types-DTXCyA56.d.mts +128 -0
  15. package/dist/auth.types-DTXCyA56.d.ts +128 -0
  16. package/dist/chunk-36RADUUO.mjs +31 -0
  17. package/dist/chunk-36RADUUO.mjs.map +1 -0
  18. package/dist/chunk-7QAMNVQU.js +666 -0
  19. package/dist/chunk-7QAMNVQU.js.map +1 -0
  20. package/dist/chunk-B6NUTR54.js +4 -0
  21. package/dist/chunk-B6NUTR54.js.map +1 -0
  22. package/dist/chunk-BX3RO5PW.js +4 -0
  23. package/dist/chunk-BX3RO5PW.js.map +1 -0
  24. package/dist/chunk-CGNGZNVG.mjs +391 -0
  25. package/dist/chunk-CGNGZNVG.mjs.map +1 -0
  26. package/dist/chunk-ER5A6TIL.js +296 -0
  27. package/dist/chunk-ER5A6TIL.js.map +1 -0
  28. package/dist/chunk-GF3OEIKI.mjs +3 -0
  29. package/dist/chunk-GF3OEIKI.mjs.map +1 -0
  30. package/dist/chunk-H5GAC4UG.mjs +277 -0
  31. package/dist/chunk-H5GAC4UG.mjs.map +1 -0
  32. package/dist/chunk-HPLIHYLQ.js +35 -0
  33. package/dist/chunk-HPLIHYLQ.js.map +1 -0
  34. package/dist/chunk-MV6HJQQO.mjs +3 -0
  35. package/dist/chunk-MV6HJQQO.mjs.map +1 -0
  36. package/dist/chunk-ONR2OJOB.mjs +848 -0
  37. package/dist/chunk-ONR2OJOB.mjs.map +1 -0
  38. package/dist/chunk-PJ4KYVHH.js +854 -0
  39. package/dist/chunk-PJ4KYVHH.js.map +1 -0
  40. package/dist/chunk-QRGJXASL.js +402 -0
  41. package/dist/chunk-QRGJXASL.js.map +1 -0
  42. package/dist/chunk-QZHJXRRW.mjs +661 -0
  43. package/dist/chunk-QZHJXRRW.mjs.map +1 -0
  44. package/dist/core/index.d.mts +105 -0
  45. package/dist/core/index.d.ts +105 -0
  46. package/dist/core/index.js +94 -0
  47. package/dist/core/index.js.map +1 -0
  48. package/dist/core/index.mjs +5 -0
  49. package/dist/core/index.mjs.map +1 -0
  50. package/dist/index.d.mts +7 -0
  51. package/dist/index.d.ts +7 -0
  52. package/dist/index.js +174 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/index.mjs +9 -0
  55. package/dist/index.mjs.map +1 -0
  56. package/dist/insights.types-5z7HJnbt.d.mts +351 -0
  57. package/dist/insights.types-DF2_r0L1.d.ts +351 -0
  58. package/dist/providers/facebook/index.d.mts +464 -0
  59. package/dist/providers/facebook/index.d.ts +464 -0
  60. package/dist/providers/facebook/index.js +30 -0
  61. package/dist/providers/facebook/index.js.map +1 -0
  62. package/dist/providers/facebook/index.mjs +5 -0
  63. package/dist/providers/facebook/index.mjs.map +1 -0
  64. package/dist/providers/instagram/index.d.mts +355 -0
  65. package/dist/providers/instagram/index.d.ts +355 -0
  66. package/dist/providers/instagram/index.js +26 -0
  67. package/dist/providers/instagram/index.js.map +1 -0
  68. package/dist/providers/instagram/index.mjs +5 -0
  69. package/dist/providers/instagram/index.mjs.map +1 -0
  70. package/dist/providers/tiktok/index.d.mts +346 -0
  71. package/dist/providers/tiktok/index.d.ts +346 -0
  72. package/dist/providers/tiktok/index.js +48 -0
  73. package/dist/providers/tiktok/index.js.map +1 -0
  74. package/dist/providers/tiktok/index.mjs +3 -0
  75. package/dist/providers/tiktok/index.mjs.map +1 -0
  76. package/package.json +97 -0
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # @cachis/social-media-sdk
2
+
3
+ Modular SDK for managing authentication and APIs of multiple social media platforms.
4
+
5
+ **Works everywhere:**
6
+ - Node.js
7
+ - Deno (Supabase Edge Functions)
8
+ - Browser
9
+ - React Native / Expo
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @cachis/social-media-sdk
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ### Basic Usage (Node.js / Deno / Edge Functions)
20
+
21
+ ```typescript
22
+ import { FacebookProvider, InstagramProvider } from '@cachis/social-media-sdk';
23
+
24
+ // Initialize providers
25
+ const facebookProvider = new FacebookProvider({
26
+ appId: process.env.FACEBOOK_APP_ID!,
27
+ });
28
+
29
+ const instagramProvider = new InstagramProvider({
30
+ appId: process.env.FACEBOOK_APP_ID!,
31
+ });
32
+
33
+ // Set access token
34
+ facebookProvider.setAccessToken(userAccessToken);
35
+ instagramProvider.setAccessToken(userAccessToken);
36
+
37
+ // Use APIs
38
+ const pages = await facebookProvider.api.getPages();
39
+ const insights = await instagramProvider.api.getAccountInsights(accountId, {
40
+ metric: ['reach', 'impressions'],
41
+ period: 'day',
42
+ since: startTimestamp,
43
+ until: endTimestamp,
44
+ });
45
+ ```
46
+
47
+ ### With Expo/React Native (OAuth)
48
+
49
+ ```typescript
50
+ // ExpoAdapter must be imported separately
51
+ import { ExpoAdapter } from '@cachis/social-media-sdk/adapters/expo';
52
+ import { FacebookProvider } from '@cachis/social-media-sdk';
53
+
54
+ const oauthAdapter = new ExpoAdapter();
55
+ const facebookProvider = new FacebookProvider({ appId: FB_APP_ID });
56
+
57
+ // Start OAuth flow
58
+ const oauthConfig = facebookProvider.auth.getOAuthConfig(
59
+ ['public_profile', 'email', 'pages_manage_posts'],
60
+ redirectUri
61
+ );
62
+
63
+ const result = await oauthAdapter.startAuthFlow(oauthConfig);
64
+ if (result.type === 'success') {
65
+ facebookProvider.setAccessToken(result.accessToken);
66
+ }
67
+ ```
68
+
69
+ ## Supported Platforms
70
+
71
+ ### Facebook
72
+ - Pages management
73
+ - Posts publishing (text, photos, videos)
74
+ - Page insights
75
+ - Fan count
76
+
77
+ ### Instagram
78
+ - Account insights
79
+ - Media management
80
+ - Content publishing
81
+ - Stories
82
+
83
+ ### TikTok
84
+ - User info
85
+ - Video list
86
+ - Account insights
87
+ - Content publishing
88
+
89
+ ## Deno / Edge Functions
90
+
91
+ This SDK works seamlessly with Deno and Supabase Edge Functions:
92
+
93
+ ```typescript
94
+ // In Supabase Edge Function
95
+ import { FacebookProvider, InstagramProvider } from 'npm:@cachis/social-media-sdk';
96
+
97
+ Deno.serve(async (req) => {
98
+ const facebookProvider = new FacebookProvider({ appId: Deno.env.get('FB_APP_ID')! });
99
+ facebookProvider.setAccessToken(accessToken);
100
+
101
+ const insights = await facebookProvider.api.getPageInsights(pageId, {
102
+ metric: ['page_impressions'],
103
+ period: 'day',
104
+ });
105
+
106
+ return new Response(JSON.stringify(insights));
107
+ });
108
+ ```
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,19 @@
1
+ import { OAuthAdapter } from './index.mjs';
2
+ import { O as OAuthConfig, d as OAuthResult } from '../auth.types-DTXCyA56.mjs';
3
+
4
+ /**
5
+ * Expo Adapter - OAuth adapter for React Native / Expo
6
+ */
7
+
8
+ declare class ExpoAdapter implements OAuthAdapter {
9
+ /**
10
+ * Start OAuth authentication flow using Expo AuthSession
11
+ */
12
+ startAuthFlow(config: OAuthConfig): Promise<OAuthResult>;
13
+ /**
14
+ * Process AuthSession result
15
+ */
16
+ private processAuthResult;
17
+ }
18
+
19
+ export { ExpoAdapter, OAuthAdapter };
@@ -0,0 +1,19 @@
1
+ import { OAuthAdapter } from './index.js';
2
+ import { O as OAuthConfig, d as OAuthResult } from '../auth.types-DTXCyA56.js';
3
+
4
+ /**
5
+ * Expo Adapter - OAuth adapter for React Native / Expo
6
+ */
7
+
8
+ declare class ExpoAdapter implements OAuthAdapter {
9
+ /**
10
+ * Start OAuth authentication flow using Expo AuthSession
11
+ */
12
+ startAuthFlow(config: OAuthConfig): Promise<OAuthResult>;
13
+ /**
14
+ * Process AuthSession result
15
+ */
16
+ private processAuthResult;
17
+ }
18
+
19
+ export { ExpoAdapter, OAuthAdapter };
@@ -0,0 +1,100 @@
1
+ 'use strict';
2
+
3
+ var chunkHPLIHYLQ_js = require('../chunk-HPLIHYLQ.js');
4
+ var AuthSession = require('expo-auth-session');
5
+ var WebBrowser = require('expo-web-browser');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var AuthSession__namespace = /*#__PURE__*/_interopNamespace(AuthSession);
26
+ var WebBrowser__namespace = /*#__PURE__*/_interopNamespace(WebBrowser);
27
+
28
+ WebBrowser__namespace.maybeCompleteAuthSession();
29
+ var ExpoAdapter = class {
30
+ /**
31
+ * Start OAuth authentication flow using Expo AuthSession
32
+ */
33
+ async startAuthFlow(config) {
34
+ try {
35
+ const request = new AuthSession__namespace.AuthRequest({
36
+ clientId: config.clientId,
37
+ scopes: config.scopes,
38
+ redirectUri: config.redirectUri,
39
+ responseType: config.responseType === "code" ? AuthSession__namespace.ResponseType.Code : AuthSession__namespace.ResponseType.Token,
40
+ extraParams: config.extraParams
41
+ });
42
+ await request.makeAuthUrlAsync({
43
+ authorizationEndpoint: config.authorizationEndpoint
44
+ });
45
+ const result = await request.promptAsync({
46
+ authorizationEndpoint: config.authorizationEndpoint
47
+ });
48
+ return this.processAuthResult(result);
49
+ } catch (error) {
50
+ console.error("Error in OAuth flow:", error);
51
+ throw new chunkHPLIHYLQ_js.AuthError(
52
+ `OAuth flow failed: ${error instanceof Error ? error.message : "Unknown error"}`,
53
+ "OAUTH_FLOW_ERROR",
54
+ error
55
+ );
56
+ }
57
+ }
58
+ /**
59
+ * Process AuthSession result
60
+ */
61
+ processAuthResult(result) {
62
+ switch (result.type) {
63
+ case "success":
64
+ return {
65
+ type: "success",
66
+ accessToken: result.params.access_token,
67
+ code: result.params.code,
68
+ state: result.params.state,
69
+ params: result.params
70
+ };
71
+ case "error":
72
+ return {
73
+ type: "error",
74
+ error: result.params.error,
75
+ errorDescription: result.params.error_description,
76
+ params: result.params
77
+ };
78
+ case "cancel":
79
+ case "dismiss":
80
+ return {
81
+ type: "cancel",
82
+ error: "User cancelled authentication"
83
+ };
84
+ case "locked":
85
+ return {
86
+ type: "error",
87
+ error: "Authentication flow is locked"
88
+ };
89
+ default:
90
+ return {
91
+ type: "error",
92
+ error: "Unknown authentication result"
93
+ };
94
+ }
95
+ }
96
+ };
97
+
98
+ exports.ExpoAdapter = ExpoAdapter;
99
+ //# sourceMappingURL=expo.js.map
100
+ //# sourceMappingURL=expo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../adapters/ExpoAdapter.ts"],"names":["WebBrowser","AuthSession","AuthError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWWA,qBAAA,CAAA,wBAAA,EAAyB;AAE7B,IAAM,cAAN,MAA0C;AAAA;AAAA;AAAA;AAAA,EAI/C,MAAM,cAAc,MAAA,EAA2C;AAC7D,IAAA,IAAI;AAEF,MAAA,MAAM,OAAA,GAAU,IAAgBC,sBAAA,CAAA,WAAA,CAAY;AAAA,QAC1C,UAAU,MAAA,CAAO,QAAA;AAAA,QACjB,QAAQ,MAAA,CAAO,MAAA;AAAA,QACf,aAAa,MAAA,CAAO,WAAA;AAAA,QACpB,cACE,MAAA,CAAO,YAAA,KAAiB,MAAA,GACRA,sBAAA,CAAA,YAAA,CAAa,OACbA,sBAAA,CAAA,YAAA,CAAa,KAAA;AAAA,QAC/B,aAAa,MAAA,CAAO;AAAA,OACrB,CAAA;AAGD,MAAA,MAAM,QAAQ,gBAAA,CAAiB;AAAA,QAC7B,uBAAuB,MAAA,CAAO;AAAA,OAC/B,CAAA;AAGD,MAAA,MAAM,MAAA,GAAS,MAAM,OAAA,CAAQ,WAAA,CAAY;AAAA,QACvC,uBAAuB,MAAA,CAAO;AAAA,OAC/B,CAAA;AAGD,MAAA,OAAO,IAAA,CAAK,kBAAkB,MAAM,CAAA;AAAA,IACtC,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAA,CAAM,wBAAwB,KAAK,CAAA;AAC3C,MAAA,MAAM,IAAIC,0BAAA;AAAA,QACR,CAAA,mBAAA,EAAsB,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,UAAU,eAAe,CAAA,CAAA;AAAA,QAC9E,kBAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKQ,kBACN,MAAA,EACa;AACb,IAAA,QAAQ,OAAO,IAAA;AAAM,MACnB,KAAK,SAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,SAAA;AAAA,UACN,WAAA,EAAa,OAAO,MAAA,CAAO,YAAA;AAAA,UAC3B,IAAA,EAAM,OAAO,MAAA,CAAO,IAAA;AAAA,UACpB,KAAA,EAAO,OAAO,MAAA,CAAO,KAAA;AAAA,UACrB,QAAQ,MAAA,CAAO;AAAA,SACjB;AAAA,MAEF,KAAK,OAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,OAAA;AAAA,UACN,KAAA,EAAO,OAAO,MAAA,CAAO,KAAA;AAAA,UACrB,gBAAA,EAAkB,OAAO,MAAA,CAAO,iBAAA;AAAA,UAChC,QAAQ,MAAA,CAAO;AAAA,SACjB;AAAA,MAEF,KAAK,QAAA;AAAA,MACL,KAAK,SAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,QAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACT;AAAA,MAEF,KAAK,QAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,OAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACT;AAAA,MAEF;AACE,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,OAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACT;AAAA;AACJ,EACF;AACF","file":"expo.js","sourcesContent":["/**\n * Expo Adapter - OAuth adapter for React Native / Expo\n */\n\nimport * as AuthSession from 'expo-auth-session';\nimport * as WebBrowser from 'expo-web-browser';\nimport { OAuthAdapter } from './BaseAdapter';\nimport { OAuthConfig, OAuthResult } from '../core/types';\nimport { AuthError } from '../core/errors';\n\n// Required for web browser to close properly after auth\nWebBrowser.maybeCompleteAuthSession();\n\nexport class ExpoAdapter implements OAuthAdapter {\n /**\n * Start OAuth authentication flow using Expo AuthSession\n */\n async startAuthFlow(config: OAuthConfig): Promise<OAuthResult> {\n try {\n // Create authentication request\n const request = new AuthSession.AuthRequest({\n clientId: config.clientId,\n scopes: config.scopes,\n redirectUri: config.redirectUri,\n responseType:\n config.responseType === 'code'\n ? AuthSession.ResponseType.Code\n : AuthSession.ResponseType.Token,\n extraParams: config.extraParams,\n });\n\n // Prepare authorization URL\n await request.makeAuthUrlAsync({\n authorizationEndpoint: config.authorizationEndpoint,\n });\n\n // Open browser and wait for result\n const result = await request.promptAsync({\n authorizationEndpoint: config.authorizationEndpoint,\n });\n\n // Process result\n return this.processAuthResult(result);\n } catch (error) {\n console.error('Error in OAuth flow:', error);\n throw new AuthError(\n `OAuth flow failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'OAUTH_FLOW_ERROR',\n error\n );\n }\n }\n\n /**\n * Process AuthSession result\n */\n private processAuthResult(\n result: AuthSession.AuthSessionResult\n ): OAuthResult {\n switch (result.type) {\n case 'success':\n return {\n type: 'success',\n accessToken: result.params.access_token,\n code: result.params.code,\n state: result.params.state,\n params: result.params,\n };\n\n case 'error':\n return {\n type: 'error',\n error: result.params.error,\n errorDescription: result.params.error_description,\n params: result.params,\n };\n\n case 'cancel':\n case 'dismiss':\n return {\n type: 'cancel',\n error: 'User cancelled authentication',\n };\n\n case 'locked':\n return {\n type: 'error',\n error: 'Authentication flow is locked',\n };\n\n default:\n return {\n type: 'error',\n error: 'Unknown authentication result',\n };\n }\n }\n}\n\n\n"]}
@@ -0,0 +1,77 @@
1
+ import { AuthError } from '../chunk-36RADUUO.mjs';
2
+ import * as AuthSession from 'expo-auth-session';
3
+ import * as WebBrowser from 'expo-web-browser';
4
+
5
+ WebBrowser.maybeCompleteAuthSession();
6
+ var ExpoAdapter = class {
7
+ /**
8
+ * Start OAuth authentication flow using Expo AuthSession
9
+ */
10
+ async startAuthFlow(config) {
11
+ try {
12
+ const request = new AuthSession.AuthRequest({
13
+ clientId: config.clientId,
14
+ scopes: config.scopes,
15
+ redirectUri: config.redirectUri,
16
+ responseType: config.responseType === "code" ? AuthSession.ResponseType.Code : AuthSession.ResponseType.Token,
17
+ extraParams: config.extraParams
18
+ });
19
+ await request.makeAuthUrlAsync({
20
+ authorizationEndpoint: config.authorizationEndpoint
21
+ });
22
+ const result = await request.promptAsync({
23
+ authorizationEndpoint: config.authorizationEndpoint
24
+ });
25
+ return this.processAuthResult(result);
26
+ } catch (error) {
27
+ console.error("Error in OAuth flow:", error);
28
+ throw new AuthError(
29
+ `OAuth flow failed: ${error instanceof Error ? error.message : "Unknown error"}`,
30
+ "OAUTH_FLOW_ERROR",
31
+ error
32
+ );
33
+ }
34
+ }
35
+ /**
36
+ * Process AuthSession result
37
+ */
38
+ processAuthResult(result) {
39
+ switch (result.type) {
40
+ case "success":
41
+ return {
42
+ type: "success",
43
+ accessToken: result.params.access_token,
44
+ code: result.params.code,
45
+ state: result.params.state,
46
+ params: result.params
47
+ };
48
+ case "error":
49
+ return {
50
+ type: "error",
51
+ error: result.params.error,
52
+ errorDescription: result.params.error_description,
53
+ params: result.params
54
+ };
55
+ case "cancel":
56
+ case "dismiss":
57
+ return {
58
+ type: "cancel",
59
+ error: "User cancelled authentication"
60
+ };
61
+ case "locked":
62
+ return {
63
+ type: "error",
64
+ error: "Authentication flow is locked"
65
+ };
66
+ default:
67
+ return {
68
+ type: "error",
69
+ error: "Unknown authentication result"
70
+ };
71
+ }
72
+ }
73
+ };
74
+
75
+ export { ExpoAdapter };
76
+ //# sourceMappingURL=expo.mjs.map
77
+ //# sourceMappingURL=expo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../adapters/ExpoAdapter.ts"],"names":[],"mappings":";;;;AAWW,UAAA,CAAA,wBAAA,EAAyB;AAE7B,IAAM,cAAN,MAA0C;AAAA;AAAA;AAAA;AAAA,EAI/C,MAAM,cAAc,MAAA,EAA2C;AAC7D,IAAA,IAAI;AAEF,MAAA,MAAM,OAAA,GAAU,IAAgB,WAAA,CAAA,WAAA,CAAY;AAAA,QAC1C,UAAU,MAAA,CAAO,QAAA;AAAA,QACjB,QAAQ,MAAA,CAAO,MAAA;AAAA,QACf,aAAa,MAAA,CAAO,WAAA;AAAA,QACpB,cACE,MAAA,CAAO,YAAA,KAAiB,MAAA,GACR,WAAA,CAAA,YAAA,CAAa,OACb,WAAA,CAAA,YAAA,CAAa,KAAA;AAAA,QAC/B,aAAa,MAAA,CAAO;AAAA,OACrB,CAAA;AAGD,MAAA,MAAM,QAAQ,gBAAA,CAAiB;AAAA,QAC7B,uBAAuB,MAAA,CAAO;AAAA,OAC/B,CAAA;AAGD,MAAA,MAAM,MAAA,GAAS,MAAM,OAAA,CAAQ,WAAA,CAAY;AAAA,QACvC,uBAAuB,MAAA,CAAO;AAAA,OAC/B,CAAA;AAGD,MAAA,OAAO,IAAA,CAAK,kBAAkB,MAAM,CAAA;AAAA,IACtC,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAA,CAAM,wBAAwB,KAAK,CAAA;AAC3C,MAAA,MAAM,IAAI,SAAA;AAAA,QACR,CAAA,mBAAA,EAAsB,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,UAAU,eAAe,CAAA,CAAA;AAAA,QAC9E,kBAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKQ,kBACN,MAAA,EACa;AACb,IAAA,QAAQ,OAAO,IAAA;AAAM,MACnB,KAAK,SAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,SAAA;AAAA,UACN,WAAA,EAAa,OAAO,MAAA,CAAO,YAAA;AAAA,UAC3B,IAAA,EAAM,OAAO,MAAA,CAAO,IAAA;AAAA,UACpB,KAAA,EAAO,OAAO,MAAA,CAAO,KAAA;AAAA,UACrB,QAAQ,MAAA,CAAO;AAAA,SACjB;AAAA,MAEF,KAAK,OAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,OAAA;AAAA,UACN,KAAA,EAAO,OAAO,MAAA,CAAO,KAAA;AAAA,UACrB,gBAAA,EAAkB,OAAO,MAAA,CAAO,iBAAA;AAAA,UAChC,QAAQ,MAAA,CAAO;AAAA,SACjB;AAAA,MAEF,KAAK,QAAA;AAAA,MACL,KAAK,SAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,QAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACT;AAAA,MAEF,KAAK,QAAA;AACH,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,OAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACT;AAAA,MAEF;AACE,QAAA,OAAO;AAAA,UACL,IAAA,EAAM,OAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACT;AAAA;AACJ,EACF;AACF","file":"expo.mjs","sourcesContent":["/**\n * Expo Adapter - OAuth adapter for React Native / Expo\n */\n\nimport * as AuthSession from 'expo-auth-session';\nimport * as WebBrowser from 'expo-web-browser';\nimport { OAuthAdapter } from './BaseAdapter';\nimport { OAuthConfig, OAuthResult } from '../core/types';\nimport { AuthError } from '../core/errors';\n\n// Required for web browser to close properly after auth\nWebBrowser.maybeCompleteAuthSession();\n\nexport class ExpoAdapter implements OAuthAdapter {\n /**\n * Start OAuth authentication flow using Expo AuthSession\n */\n async startAuthFlow(config: OAuthConfig): Promise<OAuthResult> {\n try {\n // Create authentication request\n const request = new AuthSession.AuthRequest({\n clientId: config.clientId,\n scopes: config.scopes,\n redirectUri: config.redirectUri,\n responseType:\n config.responseType === 'code'\n ? AuthSession.ResponseType.Code\n : AuthSession.ResponseType.Token,\n extraParams: config.extraParams,\n });\n\n // Prepare authorization URL\n await request.makeAuthUrlAsync({\n authorizationEndpoint: config.authorizationEndpoint,\n });\n\n // Open browser and wait for result\n const result = await request.promptAsync({\n authorizationEndpoint: config.authorizationEndpoint,\n });\n\n // Process result\n return this.processAuthResult(result);\n } catch (error) {\n console.error('Error in OAuth flow:', error);\n throw new AuthError(\n `OAuth flow failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'OAUTH_FLOW_ERROR',\n error\n );\n }\n }\n\n /**\n * Process AuthSession result\n */\n private processAuthResult(\n result: AuthSession.AuthSessionResult\n ): OAuthResult {\n switch (result.type) {\n case 'success':\n return {\n type: 'success',\n accessToken: result.params.access_token,\n code: result.params.code,\n state: result.params.state,\n params: result.params,\n };\n\n case 'error':\n return {\n type: 'error',\n error: result.params.error,\n errorDescription: result.params.error_description,\n params: result.params,\n };\n\n case 'cancel':\n case 'dismiss':\n return {\n type: 'cancel',\n error: 'User cancelled authentication',\n };\n\n case 'locked':\n return {\n type: 'error',\n error: 'Authentication flow is locked',\n };\n\n default:\n return {\n type: 'error',\n error: 'Unknown authentication result',\n };\n }\n }\n}\n\n\n"]}
@@ -0,0 +1,21 @@
1
+ import { O as OAuthConfig, d as OAuthResult } from '../auth.types-DTXCyA56.mjs';
2
+
3
+ /**
4
+ * Base Adapter - Interface for OAuth adapters
5
+ */
6
+
7
+ /**
8
+ * Interface that each OAuth adapter must implement
9
+ */
10
+ interface OAuthAdapter {
11
+ /**
12
+ * Start OAuth authentication flow
13
+ */
14
+ startAuthFlow(config: OAuthConfig): Promise<OAuthResult>;
15
+ /**
16
+ * Handle OAuth callback (optional, for some adapters)
17
+ */
18
+ handleCallback?(url: string): Promise<OAuthResult>;
19
+ }
20
+
21
+ export type { OAuthAdapter };
@@ -0,0 +1,21 @@
1
+ import { O as OAuthConfig, d as OAuthResult } from '../auth.types-DTXCyA56.js';
2
+
3
+ /**
4
+ * Base Adapter - Interface for OAuth adapters
5
+ */
6
+
7
+ /**
8
+ * Interface that each OAuth adapter must implement
9
+ */
10
+ interface OAuthAdapter {
11
+ /**
12
+ * Start OAuth authentication flow
13
+ */
14
+ startAuthFlow(config: OAuthConfig): Promise<OAuthResult>;
15
+ /**
16
+ * Handle OAuth callback (optional, for some adapters)
17
+ */
18
+ handleCallback?(url: string): Promise<OAuthResult>;
19
+ }
20
+
21
+ export type { OAuthAdapter };
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ require('../chunk-B6NUTR54.js');
4
+
5
+ //# sourceMappingURL=index.js.map
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,3 @@
1
+ import '../chunk-GF3OEIKI.mjs';
2
+ //# sourceMappingURL=index.mjs.map
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Common Types - Types shared between all providers
3
+ */
4
+ type ProviderName = 'facebook' | 'instagram' | 'threads' | 'x' | 'tiktok';
5
+ /**
6
+ * Authentication result
7
+ */
8
+ interface AuthResult {
9
+ accessToken: string;
10
+ refreshToken?: string;
11
+ expiresAt?: number;
12
+ tokenType?: string;
13
+ user?: UserProfile;
14
+ metadata?: Record<string, any>;
15
+ }
16
+ /**
17
+ * Generic user profile
18
+ */
19
+ interface UserProfile {
20
+ id: string;
21
+ name?: string;
22
+ email?: string;
23
+ picture?: string | {
24
+ data: {
25
+ url: string;
26
+ };
27
+ };
28
+ username?: string;
29
+ [key: string]: any;
30
+ }
31
+ /**
32
+ * OAuth login configuration
33
+ */
34
+ interface LoginConfig {
35
+ clientId: string;
36
+ clientSecret?: string;
37
+ redirectUri: string;
38
+ scopes: string[];
39
+ state?: string;
40
+ extraParams?: Record<string, any>;
41
+ }
42
+ /**
43
+ * Options for HTTP requests
44
+ */
45
+ interface RequestOptions {
46
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
47
+ headers?: Record<string, string>;
48
+ body?: any;
49
+ params?: Record<string, any>;
50
+ timeout?: number;
51
+ }
52
+ /**
53
+ * Generic paginated response
54
+ */
55
+ interface PaginatedResponse<T> {
56
+ data: T[];
57
+ paging?: {
58
+ cursors?: {
59
+ before?: string;
60
+ after?: string;
61
+ };
62
+ next?: string;
63
+ previous?: string;
64
+ };
65
+ }
66
+ /**
67
+ * Generic API error data
68
+ */
69
+ interface APIErrorData {
70
+ message: string;
71
+ code?: string | number;
72
+ type?: string;
73
+ statusCode?: number;
74
+ details?: any;
75
+ }
76
+
77
+ /**
78
+ * Auth Types - Authentication interfaces
79
+ */
80
+
81
+ /**
82
+ * Interface that each authentication provider must implement
83
+ */
84
+ interface AuthProvider {
85
+ /**
86
+ * Exchange OAuth token for session
87
+ */
88
+ exchangeToken(token: string): Promise<AuthResult>;
89
+ /**
90
+ * Get user profile
91
+ */
92
+ getProfile(accessToken: string): Promise<UserProfile>;
93
+ /**
94
+ * Refresh token (if supported)
95
+ */
96
+ refreshToken?(refreshToken: string): Promise<AuthResult>;
97
+ /**
98
+ * Logout / revoke token
99
+ */
100
+ logout?(accessToken: string): Promise<void>;
101
+ }
102
+ /**
103
+ * OAuth configuration
104
+ */
105
+ interface OAuthConfig {
106
+ authorizationEndpoint: string;
107
+ tokenEndpoint?: string;
108
+ clientId: string;
109
+ clientSecret?: string;
110
+ redirectUri: string;
111
+ scopes: string[];
112
+ responseType: 'code' | 'token';
113
+ extraParams?: Record<string, any>;
114
+ }
115
+ /**
116
+ * OAuth result
117
+ */
118
+ interface OAuthResult {
119
+ type: 'success' | 'error' | 'cancel';
120
+ accessToken?: string;
121
+ code?: string;
122
+ state?: string;
123
+ error?: string;
124
+ errorDescription?: string;
125
+ params?: Record<string, any>;
126
+ }
127
+
128
+ export type { AuthResult as A, LoginConfig as L, OAuthConfig as O, ProviderName as P, RequestOptions as R, UserProfile as U, PaginatedResponse as a, APIErrorData as b, AuthProvider as c, OAuthResult as d };
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Common Types - Types shared between all providers
3
+ */
4
+ type ProviderName = 'facebook' | 'instagram' | 'threads' | 'x' | 'tiktok';
5
+ /**
6
+ * Authentication result
7
+ */
8
+ interface AuthResult {
9
+ accessToken: string;
10
+ refreshToken?: string;
11
+ expiresAt?: number;
12
+ tokenType?: string;
13
+ user?: UserProfile;
14
+ metadata?: Record<string, any>;
15
+ }
16
+ /**
17
+ * Generic user profile
18
+ */
19
+ interface UserProfile {
20
+ id: string;
21
+ name?: string;
22
+ email?: string;
23
+ picture?: string | {
24
+ data: {
25
+ url: string;
26
+ };
27
+ };
28
+ username?: string;
29
+ [key: string]: any;
30
+ }
31
+ /**
32
+ * OAuth login configuration
33
+ */
34
+ interface LoginConfig {
35
+ clientId: string;
36
+ clientSecret?: string;
37
+ redirectUri: string;
38
+ scopes: string[];
39
+ state?: string;
40
+ extraParams?: Record<string, any>;
41
+ }
42
+ /**
43
+ * Options for HTTP requests
44
+ */
45
+ interface RequestOptions {
46
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
47
+ headers?: Record<string, string>;
48
+ body?: any;
49
+ params?: Record<string, any>;
50
+ timeout?: number;
51
+ }
52
+ /**
53
+ * Generic paginated response
54
+ */
55
+ interface PaginatedResponse<T> {
56
+ data: T[];
57
+ paging?: {
58
+ cursors?: {
59
+ before?: string;
60
+ after?: string;
61
+ };
62
+ next?: string;
63
+ previous?: string;
64
+ };
65
+ }
66
+ /**
67
+ * Generic API error data
68
+ */
69
+ interface APIErrorData {
70
+ message: string;
71
+ code?: string | number;
72
+ type?: string;
73
+ statusCode?: number;
74
+ details?: any;
75
+ }
76
+
77
+ /**
78
+ * Auth Types - Authentication interfaces
79
+ */
80
+
81
+ /**
82
+ * Interface that each authentication provider must implement
83
+ */
84
+ interface AuthProvider {
85
+ /**
86
+ * Exchange OAuth token for session
87
+ */
88
+ exchangeToken(token: string): Promise<AuthResult>;
89
+ /**
90
+ * Get user profile
91
+ */
92
+ getProfile(accessToken: string): Promise<UserProfile>;
93
+ /**
94
+ * Refresh token (if supported)
95
+ */
96
+ refreshToken?(refreshToken: string): Promise<AuthResult>;
97
+ /**
98
+ * Logout / revoke token
99
+ */
100
+ logout?(accessToken: string): Promise<void>;
101
+ }
102
+ /**
103
+ * OAuth configuration
104
+ */
105
+ interface OAuthConfig {
106
+ authorizationEndpoint: string;
107
+ tokenEndpoint?: string;
108
+ clientId: string;
109
+ clientSecret?: string;
110
+ redirectUri: string;
111
+ scopes: string[];
112
+ responseType: 'code' | 'token';
113
+ extraParams?: Record<string, any>;
114
+ }
115
+ /**
116
+ * OAuth result
117
+ */
118
+ interface OAuthResult {
119
+ type: 'success' | 'error' | 'cancel';
120
+ accessToken?: string;
121
+ code?: string;
122
+ state?: string;
123
+ error?: string;
124
+ errorDescription?: string;
125
+ params?: Record<string, any>;
126
+ }
127
+
128
+ export type { AuthResult as A, LoginConfig as L, OAuthConfig as O, ProviderName as P, RequestOptions as R, UserProfile as U, PaginatedResponse as a, APIErrorData as b, AuthProvider as c, OAuthResult as d };