@superdurable/connector-buffer 0.0.0-stage → 0.2.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.
@@ -0,0 +1,422 @@
1
+ import { SecretString, CredentialProvider, Mutation, Query, ConnectionRef } from '@superdurable/connectors-sdk';
2
+ import { z } from 'zod';
3
+ import { Codec } from '@superdurable/dex';
4
+
5
+ /** A signed 64-bit JSON integer. Values outside the safe number range retain their decimal token. */
6
+ type SignedInteger = number | Readonly<{
7
+ rawJSON: string;
8
+ }>;
9
+ /** Decode one signed Go integer from a safe number or a native raw JSON number token. */
10
+ declare function decodeSignedInteger(value: unknown): SignedInteger;
11
+ /** Read provider JSON with the original syntax of every numeric token for typed field validation. */
12
+ declare function parseJSONNumberTokens(text: string): unknown;
13
+ /** Decode JSON while retaining exact decimal tokens for integers outside JavaScript's safe range. */
14
+ declare function parseExactIntegerJSON(text: string): unknown;
15
+ /** JSON-wire codec for records with signed integer fields. An optional decoder validates the application type. */
16
+ declare function exactIntegerJSONCodec<T>(decode?: (value: unknown) => T): Codec<T>;
17
+ /** Connector configuration; omitted fields use manifest defaults. */
18
+ interface Config {
19
+ /** Buffer GraphQL HTTPS endpoint. Blank uses the displayed production URL; override only for a trusted test gateway. Do not append a path or credentials. */
20
+ baseUrl?: string;
21
+ /** Maximum duration of one GraphQL request as a positive Go duration. Blank uses the displayed default; increase only for slow responses. Runtime value in milliseconds. */
22
+ timeoutMs?: number;
23
+ /** Maximum complete GraphQL JSON response in bytes as a positive integer. Blank uses the displayed default; increase only for large responses. */
24
+ maxResponseBytes?: number;
25
+ }
26
+ /** Runtime schema for manifest configuration. */
27
+ declare const ConfigSchema: z.ZodObject<{
28
+ baseUrl: z.ZodOptional<z.ZodString>;
29
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
30
+ maxResponseBytes: z.ZodOptional<z.ZodNumber>;
31
+ }, z.core.$strip>;
32
+ /** Private connector credentials resolved by the host. */
33
+ interface Credentials {
34
+ /** Secret account API key from Buffer > Settings > API > Create a new API key. Copy the complete key; blank prevents calls. Dex sends it as a Bearer credential, never in Flow data. Rotate it on the same page if exposed. */
35
+ apiKey: SecretString;
36
+ }
37
+ /** Stored credential material that fails the connector credential checks, so no retry can succeed. */
38
+ declare class CredentialMaterialError extends TypeError {
39
+ constructor(message: string);
40
+ }
41
+ /** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
42
+ declare function isCredentialMaterialError(error: unknown): boolean;
43
+ /** Decode private credential fields for the connector. */
44
+ declare function decodeCredentials(value: unknown): Credentials;
45
+ /** Host-owned source of private connector credentials. */
46
+ type CredentialSource = CredentialProvider<Credentials>;
47
+ /** CreateIdeaInput creates an idea in an organization visible to the API key. */
48
+ interface CreateIdeaInput {
49
+ /** OrganizationID is returned by ListOrganizations. */
50
+ "organizationId": string;
51
+ /** Title is the nonempty idea title. */
52
+ "title": string;
53
+ /** Text is the nonempty idea body. */
54
+ "text": string;
55
+ }
56
+ /** IdeaProfile contains an idea's identity and text content. */
57
+ interface IdeaProfile {
58
+ /** ID is Buffer's idea identifier. */
59
+ "id": string;
60
+ /** Title is the idea title. */
61
+ "title": string;
62
+ /** Text is the idea body. */
63
+ "text": string;
64
+ }
65
+ /** ListIdeasInput selects one page of ideas in an organization. */
66
+ interface ListIdeasInput {
67
+ /** OrganizationID is returned by ListOrganizations. */
68
+ "organizationId": string;
69
+ /** First is the page size from 1 to 100; zero uses 20. */
70
+ "first": number;
71
+ /** After is an opaque cursor; blank begins at the first page. */
72
+ "after"?: string | undefined;
73
+ }
74
+ /** IdeasPage contains one page of ideas and its next-page cursor. */
75
+ interface IdeasPage {
76
+ /** Ideas are the selected idea identities and text. */
77
+ "ideas": Array<IdeaProfile> | null;
78
+ /** EndCursor is passed as After when HasNextPage is true. */
79
+ "endCursor"?: string | undefined;
80
+ /** HasNextPage reports whether another page exists. */
81
+ "hasNextPage": boolean;
82
+ }
83
+ /** ListOrganizationsInput requests organizations available to the API key. */
84
+ interface ListOrganizationsInput {
85
+ }
86
+ /** OrganizationIdentity contains one organization ID and name. */
87
+ interface OrganizationIdentity {
88
+ /** ID is Buffer's organization identifier. */
89
+ "id": string;
90
+ /** Name is the organization display name. */
91
+ "name": string;
92
+ }
93
+ /** OrganizationsList contains the account's organization identities. */
94
+ interface OrganizationsList {
95
+ /** Organizations are those visible to the API key. */
96
+ "organizations": Array<OrganizationIdentity> | null;
97
+ }
98
+ /** ListChannelsInput selects an organization. */
99
+ interface ListChannelsInput {
100
+ /** OrganizationID is returned by ListOrganizations. */
101
+ "organizationId": string;
102
+ }
103
+ /** ChannelProfile contains public metadata for one connected channel. */
104
+ interface ChannelProfile {
105
+ /** ID is the Buffer channel ID. */
106
+ "id": string;
107
+ /** Name is the connected channel name. */
108
+ "name": string;
109
+ /** Service is the social platform identifier. */
110
+ "service": string;
111
+ }
112
+ /** ChannelsList contains the organization's visible channels. */
113
+ interface ChannelsList {
114
+ /** Channels are the channel IDs, names, and services. */
115
+ "channels": Array<ChannelProfile> | null;
116
+ }
117
+ /** GetPostInput selects one Buffer post. */
118
+ interface GetPostInput {
119
+ /** PostID is returned by create or list operations. */
120
+ "postId": string;
121
+ }
122
+ /** PostProfile contains a post's selected public fields. */
123
+ interface PostProfile {
124
+ /** ID is the Buffer post ID. */
125
+ "id": string;
126
+ /** Text is the post's text content. */
127
+ "text": string;
128
+ /** ChannelID is the connected channel ID. */
129
+ "channelId": string;
130
+ }
131
+ /** ListPostsInput selects a bounded page of organization posts. */
132
+ interface ListPostsInput {
133
+ /** OrganizationID is returned by ListOrganizations. */
134
+ "organizationId": string;
135
+ /** First is the page size from 1 to 100; zero uses 20. */
136
+ "first": number;
137
+ /** After is an opaque cursor; blank begins at the first page. */
138
+ "after"?: string | undefined;
139
+ }
140
+ /** PostsList contains one page of posts and a next-page cursor. */
141
+ interface PostsList {
142
+ /** Posts are the selected post fields in this page. */
143
+ "posts": Array<PostProfile> | null;
144
+ /** EndCursor is passed as After to continue when HasNextPage is true. */
145
+ "endCursor"?: string | undefined;
146
+ /** HasNextPage reports whether another page is available. */
147
+ "hasNextPage": boolean;
148
+ }
149
+ /** PostAsset references one publicly hosted image, video, or document. */
150
+ interface PostAsset {
151
+ /** Type is image, video, or document. */
152
+ "type": string;
153
+ /** URL is a direct public HTTPS file URL without credentials or a query string. */
154
+ "url": string;
155
+ /** ThumbnailURL is optional for images and required for documents. */
156
+ "thumbnailUrl"?: string | undefined;
157
+ /** Title is required for documents. */
158
+ "title"?: string | undefined;
159
+ /** ThumbnailOffsetMs selects a video thumbnail frame in milliseconds. */
160
+ "thumbnailOffsetMs"?: SignedInteger | undefined;
161
+ }
162
+ /** CreatePostInput queues a post with text or public media on a connected channel. */
163
+ interface CreatePostInput {
164
+ /** ChannelID is the target channel ID. */
165
+ "channelId": string;
166
+ /** Text is post content; at least one asset is required when blank. */
167
+ "text": string;
168
+ /** Assets are publicly hosted images, videos, or documents. */
169
+ "assets"?: Array<PostAsset> | undefined;
170
+ }
171
+ /** CreateScheduledPostInput creates a post at a specific UTC time. */
172
+ interface CreateScheduledPostInput {
173
+ /** ChannelID is the connected channel ID. */
174
+ "channelId": string;
175
+ /** Text is post content; at least one asset is required when blank. */
176
+ "text": string;
177
+ /** Assets are publicly hosted images, videos, or documents. */
178
+ "assets"?: Array<PostAsset> | undefined;
179
+ /** DueAt is the publish time as an RFC 3339 timestamp with a UTC offset. */
180
+ "dueAt": string;
181
+ }
182
+ /** PublishPostNowInput creates a post for immediate publishing. */
183
+ interface PublishPostNowInput {
184
+ /** ChannelID is the connected channel ID. */
185
+ "channelId": string;
186
+ /** Text is post content; at least one asset is required when blank. */
187
+ "text": string;
188
+ /** Assets are publicly hosted images, videos, or documents. */
189
+ "assets"?: Array<PostAsset> | undefined;
190
+ }
191
+ /** EditPostInput replaces the text of one Buffer post. */
192
+ interface EditPostInput {
193
+ /** PostID is the post to edit. */
194
+ "postId": string;
195
+ /** Text is replacement content; at least one asset is required when blank. */
196
+ "text": string;
197
+ /** Assets replace attached media when nonnil. */
198
+ "assets"?: Array<PostAsset> | undefined;
199
+ }
200
+ /** DeletePostInput selects one post for deletion from Buffer. */
201
+ interface DeletePostInput {
202
+ /** PostID is the post to delete. */
203
+ "postId": string;
204
+ }
205
+ /** PostDeleteResult identifies the post Buffer deleted. */
206
+ interface PostDeleteResult {
207
+ /** ID is the deleted Buffer post ID. */
208
+ "id": string;
209
+ }
210
+ /** GetChannelInput selects a connected Buffer channel by opaque ID. */
211
+ interface GetChannelInput {
212
+ /** ChannelID is the ID returned by Buffer channel queries. */
213
+ "channelId": string;
214
+ }
215
+ /** Runtime validator for CreateIdeaInput. */
216
+ declare const CreateIdeaInputSchema: z.ZodObject<{
217
+ organizationId: z.ZodString;
218
+ title: z.ZodString;
219
+ text: z.ZodString;
220
+ }, z.core.$strict>;
221
+ /** Runtime validator for IdeaProfile. */
222
+ declare const IdeaProfileSchema: z.ZodObject<{
223
+ id: z.ZodString;
224
+ title: z.ZodString;
225
+ text: z.ZodString;
226
+ }, z.core.$strict>;
227
+ /** Runtime validator for ListIdeasInput. */
228
+ declare const ListIdeasInputSchema: z.ZodObject<{
229
+ organizationId: z.ZodString;
230
+ first: z.ZodNumber;
231
+ after: z.ZodOptional<z.ZodString>;
232
+ }, z.core.$strict>;
233
+ /** Runtime validator for IdeasPage. */
234
+ declare const IdeasPageSchema: z.ZodObject<{
235
+ ideas: z.ZodNullable<z.ZodArray<z.ZodObject<{
236
+ id: z.ZodString;
237
+ title: z.ZodString;
238
+ text: z.ZodString;
239
+ }, z.core.$strict>>>;
240
+ endCursor: z.ZodOptional<z.ZodString>;
241
+ hasNextPage: z.ZodBoolean;
242
+ }, z.core.$strict>;
243
+ /** Runtime validator for ListOrganizationsInput. */
244
+ declare const ListOrganizationsInputSchema: z.ZodObject<{}, z.core.$strict>;
245
+ /** Runtime validator for OrganizationIdentity. */
246
+ declare const OrganizationIdentitySchema: z.ZodObject<{
247
+ id: z.ZodString;
248
+ name: z.ZodString;
249
+ }, z.core.$strict>;
250
+ /** Runtime validator for OrganizationsList. */
251
+ declare const OrganizationsListSchema: z.ZodObject<{
252
+ organizations: z.ZodNullable<z.ZodArray<z.ZodObject<{
253
+ id: z.ZodString;
254
+ name: z.ZodString;
255
+ }, z.core.$strict>>>;
256
+ }, z.core.$strict>;
257
+ /** Runtime validator for ListChannelsInput. */
258
+ declare const ListChannelsInputSchema: z.ZodObject<{
259
+ organizationId: z.ZodString;
260
+ }, z.core.$strict>;
261
+ /** Runtime validator for ChannelProfile. */
262
+ declare const ChannelProfileSchema: z.ZodObject<{
263
+ id: z.ZodString;
264
+ name: z.ZodString;
265
+ service: z.ZodString;
266
+ }, z.core.$strict>;
267
+ /** Runtime validator for ChannelsList. */
268
+ declare const ChannelsListSchema: z.ZodObject<{
269
+ channels: z.ZodNullable<z.ZodArray<z.ZodObject<{
270
+ id: z.ZodString;
271
+ name: z.ZodString;
272
+ service: z.ZodString;
273
+ }, z.core.$strict>>>;
274
+ }, z.core.$strict>;
275
+ /** Runtime validator for GetPostInput. */
276
+ declare const GetPostInputSchema: z.ZodObject<{
277
+ postId: z.ZodString;
278
+ }, z.core.$strict>;
279
+ /** Runtime validator for PostProfile. */
280
+ declare const PostProfileSchema: z.ZodObject<{
281
+ id: z.ZodString;
282
+ text: z.ZodString;
283
+ channelId: z.ZodString;
284
+ }, z.core.$strict>;
285
+ /** Runtime validator for ListPostsInput. */
286
+ declare const ListPostsInputSchema: z.ZodObject<{
287
+ organizationId: z.ZodString;
288
+ first: z.ZodNumber;
289
+ after: z.ZodOptional<z.ZodString>;
290
+ }, z.core.$strict>;
291
+ /** Runtime validator for PostsList. */
292
+ declare const PostsListSchema: z.ZodObject<{
293
+ posts: z.ZodNullable<z.ZodArray<z.ZodObject<{
294
+ id: z.ZodString;
295
+ text: z.ZodString;
296
+ channelId: z.ZodString;
297
+ }, z.core.$strict>>>;
298
+ endCursor: z.ZodOptional<z.ZodString>;
299
+ hasNextPage: z.ZodBoolean;
300
+ }, z.core.$strict>;
301
+ /** Runtime validator for PostAsset. */
302
+ declare const PostAssetSchema: z.ZodObject<{
303
+ type: z.ZodString;
304
+ url: z.ZodString;
305
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
306
+ title: z.ZodOptional<z.ZodString>;
307
+ thumbnailOffsetMs: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | Readonly<{
308
+ rawJSON: string;
309
+ }>, unknown>>>;
310
+ }, z.core.$strict>;
311
+ /** Runtime validator for CreatePostInput. */
312
+ declare const CreatePostInputSchema: z.ZodObject<{
313
+ channelId: z.ZodString;
314
+ text: z.ZodString;
315
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
316
+ type: z.ZodString;
317
+ url: z.ZodString;
318
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
319
+ title: z.ZodOptional<z.ZodString>;
320
+ thumbnailOffsetMs: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | Readonly<{
321
+ rawJSON: string;
322
+ }>, unknown>>>;
323
+ }, z.core.$strict>>>;
324
+ }, z.core.$strict>;
325
+ /** Runtime validator for CreateScheduledPostInput. */
326
+ declare const CreateScheduledPostInputSchema: z.ZodObject<{
327
+ channelId: z.ZodString;
328
+ text: z.ZodString;
329
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
330
+ type: z.ZodString;
331
+ url: z.ZodString;
332
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
333
+ title: z.ZodOptional<z.ZodString>;
334
+ thumbnailOffsetMs: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | Readonly<{
335
+ rawJSON: string;
336
+ }>, unknown>>>;
337
+ }, z.core.$strict>>>;
338
+ dueAt: z.ZodString;
339
+ }, z.core.$strict>;
340
+ /** Runtime validator for PublishPostNowInput. */
341
+ declare const PublishPostNowInputSchema: z.ZodObject<{
342
+ channelId: z.ZodString;
343
+ text: z.ZodString;
344
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
345
+ type: z.ZodString;
346
+ url: z.ZodString;
347
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
348
+ title: z.ZodOptional<z.ZodString>;
349
+ thumbnailOffsetMs: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | Readonly<{
350
+ rawJSON: string;
351
+ }>, unknown>>>;
352
+ }, z.core.$strict>>>;
353
+ }, z.core.$strict>;
354
+ /** Runtime validator for EditPostInput. */
355
+ declare const EditPostInputSchema: z.ZodObject<{
356
+ postId: z.ZodString;
357
+ text: z.ZodString;
358
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
359
+ type: z.ZodString;
360
+ url: z.ZodString;
361
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
362
+ title: z.ZodOptional<z.ZodString>;
363
+ thumbnailOffsetMs: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | Readonly<{
364
+ rawJSON: string;
365
+ }>, unknown>>>;
366
+ }, z.core.$strict>>>;
367
+ }, z.core.$strict>;
368
+ /** Runtime validator for DeletePostInput. */
369
+ declare const DeletePostInputSchema: z.ZodObject<{
370
+ postId: z.ZodString;
371
+ }, z.core.$strict>;
372
+ /** Runtime validator for PostDeleteResult. */
373
+ declare const PostDeleteResultSchema: z.ZodObject<{
374
+ id: z.ZodString;
375
+ }, z.core.$strict>;
376
+ /** Runtime validator for GetChannelInput. */
377
+ declare const GetChannelInputSchema: z.ZodObject<{
378
+ channelId: z.ZodString;
379
+ }, z.core.$strict>;
380
+
381
+ /** Typed operations supplied by a client or mock. */
382
+ interface Operations {
383
+ /** Invoke createIdea through this connection. */
384
+ createIdea(): Mutation<CreateIdeaInput, IdeaProfile>;
385
+ /** Invoke listIdeas through this connection. */
386
+ listIdeas(): Query<ListIdeasInput, IdeasPage>;
387
+ /** Invoke listOrganizations through this connection. */
388
+ listOrganizations(): Query<ListOrganizationsInput, OrganizationsList>;
389
+ /** Invoke listChannels through this connection. */
390
+ listChannels(): Query<ListChannelsInput, ChannelsList>;
391
+ /** Invoke getPost through this connection. */
392
+ getPost(): Query<GetPostInput, PostProfile>;
393
+ /** Invoke listPosts through this connection. */
394
+ listPosts(): Query<ListPostsInput, PostsList>;
395
+ /** Invoke createPost through this connection. */
396
+ createPost(): Mutation<CreatePostInput, PostProfile>;
397
+ /** Invoke createScheduledPost through this connection. */
398
+ createScheduledPost(): Mutation<CreateScheduledPostInput, PostProfile>;
399
+ /** Invoke publishPostNow through this connection. */
400
+ publishPostNow(): Mutation<PublishPostNowInput, PostProfile>;
401
+ /** Invoke editPost through this connection. */
402
+ editPost(): Mutation<EditPostInput, PostProfile>;
403
+ /** Invoke deletePost through this connection. */
404
+ deletePost(): Mutation<DeletePostInput, PostDeleteResult>;
405
+ /** Invoke getChannel through this connection. */
406
+ getChannel(): Query<GetChannelInput, ChannelProfile>;
407
+ }
408
+ /** Named connector connection kept outside Flow state. */
409
+ declare class Connection<BoundOperations = Operations> {
410
+ /** Stable provider and connection name. */
411
+ readonly reference: ConnectionRef;
412
+ /** Bound provider operations. */
413
+ readonly operations: BoundOperations;
414
+ /** Validate a reference and bind operations. */
415
+ constructor(reference: ConnectionRef, operations: BoundOperations);
416
+ }
417
+ /** Bind a client to a named connection. */
418
+ declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
419
+ /** Bind scripted operations to a named connection. */
420
+ declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
421
+
422
+ export { decodeSignedInteger as $, GetChannelInputSchema as A, GetPostInputSchema as B, type CreateIdeaInput as C, type DeletePostInput as D, type EditPostInput as E, IdeaProfileSchema as F, type GetChannelInput as G, IdeasPageSchema as H, type IdeaProfile as I, ListChannelsInputSchema as J, ListIdeasInputSchema as K, type ListChannelsInput as L, ListOrganizationsInputSchema as M, ListPostsInputSchema as N, type OrganizationsList as O, type PostProfile as P, type OrganizationIdentity as Q, OrganizationIdentitySchema as R, OrganizationsListSchema as S, type PostAsset as T, PostAssetSchema as U, PostDeleteResultSchema as V, PostProfileSchema as W, PostsListSchema as X, PublishPostNowInputSchema as Y, type SignedInteger as Z, decodeCredentials as _, Connection as a, exactIntegerJSONCodec as a0, isCredentialMaterialError as a1, newConnection as a2, newConnectionWithOperations as a3, parseExactIntegerJSON as a4, parseJSONNumberTokens as a5, type CreatePostInput as b, type CreateScheduledPostInput as c, type PostDeleteResult as d, type ChannelProfile as e, type GetPostInput as f, type ChannelsList as g, type ListIdeasInput as h, type IdeasPage as i, type ListOrganizationsInput as j, type ListPostsInput as k, type PostsList as l, type PublishPostNowInput as m, type Operations as n, type Config as o, type Credentials as p, ChannelProfileSchema as q, ChannelsListSchema as r, ConfigSchema as s, CreateIdeaInputSchema as t, CreatePostInputSchema as u, CreateScheduledPostInputSchema as v, CredentialMaterialError as w, type CredentialSource as x, DeletePostInputSchema as y, EditPostInputSchema as z };