@crosspost/types 0.1.3 → 0.1.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Open Crosspost
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # @crosspost/types
2
2
 
3
- Shared type definitions for the Crosspost API ecosystem.
3
+ Shared type definitions for the Crosspost API and SDK.
4
4
 
5
5
  ## Overview
6
6
 
7
- This package contains TypeScript type definitions used across the Crosspost API ecosystem,
8
- including:
7
+ This package contains TypeScript type definitions, including:
9
8
 
10
9
  - Common types (PlatformName, ApiErrorCode, etc.)
11
10
  - Request types for all API endpoints
@@ -13,20 +12,10 @@ including:
13
12
 
14
13
  ## Installation
15
14
 
16
- ### Node.js / npm
15
+ ### Node.js
17
16
 
18
17
  ```bash
19
- # Using npm
20
18
  npm install @crosspost/types
21
-
22
- # Using yarn
23
- yarn add @crosspost/types
24
-
25
- # Using pnpm
26
- pnpm add @crosspost/types
27
-
28
- # Using bun
29
- bun add @crosspost/types
30
19
  ```
31
20
 
32
21
  ### Deno
@@ -48,6 +37,7 @@ import { CreatePostRequest, CreatePostResponse, PlatformName } from '@crosspost/
48
37
  const platform: PlatformName = 'twitter';
49
38
 
50
39
  const request: CreatePostRequest = {
40
+ targets: [{ platform: 'twitter', userId: 'your-twitter-id' }],
51
41
  content: {
52
42
  text: 'Hello, world!',
53
43
  },
@@ -105,21 +95,3 @@ const errorResponse = createEnhancedErrorResponse([
105
95
  ),
106
96
  ]);
107
97
  ```
108
-
109
- ### Request Types
110
-
111
- - Authentication requests
112
- - Post creation and management requests
113
- - Media upload requests
114
- - Rate limit requests
115
-
116
- ### Response Types
117
-
118
- - Authentication responses
119
- - Post creation and management responses
120
- - Media upload responses
121
- - Rate limit responses
122
-
123
- ## License
124
-
125
- MIT
package/dist/index.cjs CHANGED
@@ -93,7 +93,9 @@ __export(index_exports, {
93
93
  ReplyToPostResponseSchema: () => ReplyToPostResponseSchema,
94
94
  RepostRequestSchema: () => RepostRequestSchema,
95
95
  RepostResponseSchema: () => RepostResponseSchema,
96
+ SUPPORTED_PLATFORMS: () => SUPPORTED_PLATFORMS,
96
97
  SuccessDetailSchema: () => SuccessDetailSchema,
98
+ SupportedPlatformSchema: () => SupportedPlatformSchema,
97
99
  TargetSchema: () => TargetSchema,
98
100
  TimePeriod: () => TimePeriod,
99
101
  UnlikePostRequestSchema: () => UnlikePostRequestSchema,
@@ -106,25 +108,28 @@ __export(index_exports, {
106
108
  createErrorDetail: () => createErrorDetail,
107
109
  createErrorResponse: () => createErrorResponse,
108
110
  createMultiStatusResponse: () => createMultiStatusResponse,
109
- createSuccessDetail: () => createSuccessDetail
111
+ createSuccessDetail: () => createSuccessDetail,
112
+ isPlatformSupported: () => isPlatformSupported
110
113
  });
111
114
  module.exports = __toCommonJS(index_exports);
112
115
 
113
116
  // src/common.ts
114
117
  var import_zod = require("zod");
115
- var PlatformSchema = import_zod.z.enum([
116
- "unknown",
117
- "twitter"
118
- // Add more platforms as they're implemented
119
- // 'linkedin',
120
- // 'facebook',
121
- // 'instagram',
122
- ]).describe("Social media platform");
123
118
  var Platform = /* @__PURE__ */ ((Platform2) => {
124
119
  Platform2["UNKNOWN"] = "unknown";
125
120
  Platform2["TWITTER"] = "twitter";
126
121
  return Platform2;
127
122
  })(Platform || {});
123
+ var PlatformSchema = import_zod.z.nativeEnum(Platform).describe("Social media platform");
124
+ var SUPPORTED_PLATFORMS = [
125
+ "twitter" /* TWITTER */
126
+ // Add more platforms here as they're implemented
127
+ ];
128
+ var SupportedPlatformSchema = SUPPORTED_PLATFORMS.length > 0 ? import_zod.z.enum(SUPPORTED_PLATFORMS) : import_zod.z.never();
129
+ SupportedPlatformSchema.describe("Currently supported social media platforms");
130
+ function isPlatformSupported(platform) {
131
+ return SUPPORTED_PLATFORMS.includes(platform);
132
+ }
128
133
 
129
134
  // src/response.ts
130
135
  var import_zod2 = require("zod");
@@ -957,7 +962,9 @@ var ProfileRefreshResponseSchema = EnhancedResponseSchema(
957
962
  ReplyToPostResponseSchema,
958
963
  RepostRequestSchema,
959
964
  RepostResponseSchema,
965
+ SUPPORTED_PLATFORMS,
960
966
  SuccessDetailSchema,
967
+ SupportedPlatformSchema,
961
968
  TargetSchema,
962
969
  TimePeriod,
963
970
  UnlikePostRequestSchema,
@@ -970,5 +977,6 @@ var ProfileRefreshResponseSchema = EnhancedResponseSchema(
970
977
  createErrorDetail,
971
978
  createErrorResponse,
972
979
  createMultiStatusResponse,
973
- createSuccessDetail
980
+ createSuccessDetail,
981
+ isPlatformSupported
974
982
  });