@superdurable/connector-buffer 0.1.0 → 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.
@@ -1,106 +0,0 @@
1
- // src/generated/models.ts
2
- import { z } from "zod";
3
- import { SecretString } from "@superdurable/connectors-sdk";
4
- var ConfigSchema = z.object({
5
- "baseUrl": z.string().optional(),
6
- "timeoutMs": z.number().int().optional(),
7
- "maxResponseBytes": z.number().int().optional()
8
- });
9
- function decodeCredentials(value) {
10
- if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
11
- const fields = value;
12
- const allowed = /* @__PURE__ */ new Set(["apiKey"]);
13
- if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
14
- if (fields["apiKey"] != null && !(typeof fields["apiKey"] === "string")) throw new TypeError("credential apiKey has an invalid type");
15
- const credentials = {};
16
- if (!fields["apiKey"]) throw new TypeError("credential apiKey is required");
17
- credentials.apiKey = new SecretString(fields["apiKey"] ?? "");
18
- return credentials;
19
- }
20
- var GetChannelInputSchema = z.strictObject({
21
- "channelId": z.string()
22
- });
23
- var ChannelProfileSchema = z.strictObject({
24
- "id": z.string(),
25
- "name": z.string(),
26
- "service": z.string()
27
- });
28
-
29
- // src/generated/definitions.ts
30
- var ConnectorID = "buffer";
31
- var ProviderID = "buffer";
32
- var GetChannelBranch = {
33
- Found: "found",
34
- NotFound: "notFound",
35
- ProviderRejected: "providerRejected",
36
- InvalidResponse: "invalidResponse",
37
- Defect: "defect"
38
- };
39
- var GetChannelBranchFound = GetChannelBranch.Found;
40
- var GetChannelBranchNotFound = GetChannelBranch.NotFound;
41
- var GetChannelBranchProviderRejected = GetChannelBranch.ProviderRejected;
42
- var GetChannelBranchInvalidResponse = GetChannelBranch.InvalidResponse;
43
- var GetChannelBranchDefect = GetChannelBranch.Defect;
44
- var GetChannelDefinition = {
45
- operation: { connectorId: ConnectorID, operationId: "getChannel" },
46
- branches: [
47
- { id: "found", description: "Buffer returned the channel." },
48
- { id: "notFound", description: "Buffer did not expose a channel for this ID.", optional: true },
49
- { id: "providerRejected", description: "Buffer returned a definite GraphQL or HTTP rejection.", optional: true },
50
- { id: "invalidResponse", description: "Buffer returned malformed or oversized JSON.", optional: true },
51
- { id: "defect", description: "Local input or credentials are invalid.", optional: true }
52
- ],
53
- stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
54
- };
55
- var GetChannelMetadata = { kind: "query", idempotency: "none", authorization: "required" };
56
-
57
- // src/generated/connection.ts
58
- import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
59
- var Connection = class {
60
- /** Stable provider and connection name. */
61
- reference;
62
- /** Bound provider operations. */
63
- operations;
64
- /** Validate a reference and bind operations. */
65
- constructor(reference, operations) {
66
- this.reference = ConnectionRefSchema.parse(reference);
67
- if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
68
- if (!operations) throw new TypeError("connector operations are required");
69
- this.operations = operations;
70
- }
71
- };
72
- function newConnection(client, reference) {
73
- if (!client) throw new TypeError("connector client is required");
74
- return new Connection(reference, client);
75
- }
76
- function newConnectionWithOperations(operations, reference) {
77
- return new Connection(reference, operations);
78
- }
79
- function newProjectConnection(project, connectionName, createClient) {
80
- if (!project) throw new TypeError("loaded project is required");
81
- const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
82
- const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
83
- if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
84
- return newConnection(createClient(project, connectionName), reference);
85
- }
86
-
87
- export {
88
- ConfigSchema,
89
- decodeCredentials,
90
- GetChannelInputSchema,
91
- ChannelProfileSchema,
92
- ConnectorID,
93
- ProviderID,
94
- GetChannelBranch,
95
- GetChannelBranchFound,
96
- GetChannelBranchNotFound,
97
- GetChannelBranchProviderRejected,
98
- GetChannelBranchInvalidResponse,
99
- GetChannelBranchDefect,
100
- GetChannelDefinition,
101
- GetChannelMetadata,
102
- Connection,
103
- newConnection,
104
- newConnectionWithOperations,
105
- newProjectConnection
106
- };
@@ -1,72 +0,0 @@
1
- import { SecretString, CredentialProvider, Query, ConnectionRef } from '@superdurable/connectors-sdk';
2
- import { z } from 'zod';
3
-
4
- /** Connector configuration; omitted fields use manifest defaults. */
5
- interface Config {
6
- /** Buffer GraphQL HTTPS endpoint. Blank uses the displayed production URL; override only for a trusted test gateway. Do not append a path or credentials. */
7
- baseUrl?: string;
8
- /** Maximum duration of one channel query as a positive Go duration. Blank uses the displayed default; increase only for slow responses. Runtime value in milliseconds. */
9
- timeoutMs?: number;
10
- /** Maximum complete GraphQL JSON response in bytes as a positive integer. Blank uses the displayed default; increase only for large responses. */
11
- maxResponseBytes?: number;
12
- }
13
- /** Runtime schema for manifest configuration. */
14
- declare const ConfigSchema: z.ZodObject<{
15
- baseUrl: z.ZodOptional<z.ZodString>;
16
- timeoutMs: z.ZodOptional<z.ZodNumber>;
17
- maxResponseBytes: z.ZodOptional<z.ZodNumber>;
18
- }, z.core.$strip>;
19
- /** Private connector credentials resolved by the host. */
20
- interface Credentials {
21
- /** 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. */
22
- apiKey: SecretString;
23
- }
24
- /** Decode private credential fields for the connector. */
25
- declare function decodeCredentials(value: unknown): Credentials;
26
- /** Host-owned source of private connector credentials. */
27
- type CredentialSource = CredentialProvider<Credentials>;
28
- /** GetChannelInput selects a connected Buffer channel by opaque ID. */
29
- interface GetChannelInput {
30
- /** ChannelID is the ID returned by Buffer channel queries. */
31
- "channelId": string;
32
- }
33
- /** ChannelProfile contains public metadata for one connected channel. */
34
- interface ChannelProfile {
35
- /** ID is the Buffer channel ID. */
36
- "id": string;
37
- /** Name is the connected channel name. */
38
- "name": string;
39
- /** Service is the social platform identifier. */
40
- "service": string;
41
- }
42
- /** Runtime validator for GetChannelInput. */
43
- declare const GetChannelInputSchema: z.ZodObject<{
44
- channelId: z.ZodString;
45
- }, z.core.$strict>;
46
- /** Runtime validator for ChannelProfile. */
47
- declare const ChannelProfileSchema: z.ZodObject<{
48
- id: z.ZodString;
49
- name: z.ZodString;
50
- service: z.ZodString;
51
- }, z.core.$strict>;
52
-
53
- /** Typed operations supplied by a client or mock. */
54
- interface Operations {
55
- /** Invoke getChannel through this connection. */
56
- getChannel(): Query<GetChannelInput, ChannelProfile>;
57
- }
58
- /** Named connector connection kept outside Flow state. */
59
- declare class Connection<BoundOperations = Operations> {
60
- /** Stable provider and connection name. */
61
- readonly reference: ConnectionRef;
62
- /** Bound provider operations. */
63
- readonly operations: BoundOperations;
64
- /** Validate a reference and bind operations. */
65
- constructor(reference: ConnectionRef, operations: BoundOperations);
66
- }
67
- /** Bind a client to a named connection. */
68
- declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
69
- /** Bind scripted operations to a named connection. */
70
- declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
71
-
72
- export { type ChannelProfile as C, type GetChannelInput as G, type Operations as O, Connection as a, type Config as b, type Credentials as c, ChannelProfileSchema as d, ConfigSchema as e, type CredentialSource as f, GetChannelInputSchema as g, decodeCredentials as h, newConnectionWithOperations as i, newConnection as n };