@superdurable/connector-google-docs 0.0.0-stage → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Super Durable
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,3 +1,18 @@
1
- # Temporary Holding Version
1
+ # Google Docs TypeScript connector
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@superdurable/connector-google-docs` provides operation-specific Dex Steps
4
+ for `getDocumentText`, `createDocument`, `replaceDocumentText`, and `appendText`.
5
+ The manifest supplies generated models, factories, mocks, and refresh wiring
6
+ for Google OAuth and Workspace domain delegation. The provider client bounds
7
+ responses and text, reads only the first tab, and uses revision guards for
8
+ writes. `createDocument` uses a single-dispatch fence and Drive app-property
9
+ lookup to recover an earlier create without repeating an uncertain write.
10
+
11
+ The runnable [policy documents example](examples/policy-documents/README.md)
12
+ uses the static `policy-docs` connection and exercises every operation through
13
+ a Dex Worker. Its input file contains no credentials.
14
+
15
+ Run `npm ci && npm run check`, then run `npm run test:integration` with a local
16
+ `dexcli dev` and `DEX_FLOW_SERVICE_ADDRESS` set to its gRPC address. The
17
+ conformance test replays Go-recorded provider exchanges. Live Google provider
18
+ authorization and calls have not been verified.
@@ -0,0 +1,183 @@
1
+ {
2
+ "connectorId": "google-docs",
3
+ "releaseTag": "connectors/google/docs/go/v0.24.0",
4
+ "package": {
5
+ "ecosystem": "npm",
6
+ "name": "@superdurable/connector-google-docs",
7
+ "version": "0.1.0"
8
+ },
9
+ "factories": [
10
+ {
11
+ "name": "newGetDocumentTextStep",
12
+ "kind": "query",
13
+ "operationId": "getDocumentText",
14
+ "fields": {
15
+ "stepType": "stepType",
16
+ "annotations": "annotations",
17
+ "connectionName": "connectionName",
18
+ "resultAttribute": "resultAttribute"
19
+ },
20
+ "branches": [
21
+ {
22
+ "id": "read",
23
+ "field": "read",
24
+ "optional": false
25
+ },
26
+ {
27
+ "id": "notFound",
28
+ "field": "notFound",
29
+ "optional": true
30
+ },
31
+ {
32
+ "id": "tooLarge",
33
+ "field": "tooLarge",
34
+ "optional": true
35
+ },
36
+ {
37
+ "id": "providerRejected",
38
+ "field": "providerRejected",
39
+ "optional": true
40
+ },
41
+ {
42
+ "id": "invalidResponse",
43
+ "field": "invalidResponse",
44
+ "optional": true
45
+ },
46
+ {
47
+ "id": "defect",
48
+ "field": "defect",
49
+ "optional": true
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "name": "newCreateDocumentStep",
55
+ "kind": "mutation",
56
+ "operationId": "createDocument",
57
+ "fields": {
58
+ "stepType": "stepType",
59
+ "annotations": "annotations",
60
+ "connectionName": "connectionName",
61
+ "resultAttribute": "resultAttribute"
62
+ },
63
+ "branches": [
64
+ {
65
+ "id": "created",
66
+ "field": "created",
67
+ "optional": false
68
+ },
69
+ {
70
+ "id": "providerRejected",
71
+ "field": "providerRejected",
72
+ "optional": true
73
+ },
74
+ {
75
+ "id": "invalidResponse",
76
+ "field": "invalidResponse",
77
+ "optional": true
78
+ },
79
+ {
80
+ "id": "uncertain",
81
+ "field": "uncertain",
82
+ "optional": true
83
+ },
84
+ {
85
+ "id": "defect",
86
+ "field": "defect",
87
+ "optional": true
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ "name": "newReplaceDocumentTextStep",
93
+ "kind": "mutation",
94
+ "operationId": "replaceDocumentText",
95
+ "fields": {
96
+ "stepType": "stepType",
97
+ "annotations": "annotations",
98
+ "connectionName": "connectionName",
99
+ "resultAttribute": "resultAttribute"
100
+ },
101
+ "branches": [
102
+ {
103
+ "id": "replaced",
104
+ "field": "replaced",
105
+ "optional": false
106
+ },
107
+ {
108
+ "id": "placeholderNotFound",
109
+ "field": "placeholderNotFound",
110
+ "optional": true
111
+ },
112
+ {
113
+ "id": "revisionChanged",
114
+ "field": "revisionChanged",
115
+ "optional": true
116
+ },
117
+ {
118
+ "id": "notFound",
119
+ "field": "notFound",
120
+ "optional": true
121
+ },
122
+ {
123
+ "id": "providerRejected",
124
+ "field": "providerRejected",
125
+ "optional": true
126
+ },
127
+ {
128
+ "id": "invalidResponse",
129
+ "field": "invalidResponse",
130
+ "optional": true
131
+ },
132
+ {
133
+ "id": "defect",
134
+ "field": "defect",
135
+ "optional": true
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ "name": "newAppendTextStep",
141
+ "kind": "mutation",
142
+ "operationId": "appendText",
143
+ "fields": {
144
+ "stepType": "stepType",
145
+ "annotations": "annotations",
146
+ "connectionName": "connectionName",
147
+ "resultAttribute": "resultAttribute"
148
+ },
149
+ "branches": [
150
+ {
151
+ "id": "appended",
152
+ "field": "appended",
153
+ "optional": false
154
+ },
155
+ {
156
+ "id": "revisionChanged",
157
+ "field": "revisionChanged",
158
+ "optional": true
159
+ },
160
+ {
161
+ "id": "notFound",
162
+ "field": "notFound",
163
+ "optional": true
164
+ },
165
+ {
166
+ "id": "providerRejected",
167
+ "field": "providerRejected",
168
+ "optional": true
169
+ },
170
+ {
171
+ "id": "invalidResponse",
172
+ "field": "invalidResponse",
173
+ "optional": true
174
+ },
175
+ {
176
+ "id": "defect",
177
+ "field": "defect",
178
+ "optional": true
179
+ }
180
+ ]
181
+ }
182
+ ]
183
+ }
@@ -0,0 +1,361 @@
1
+ // src/generated/models.ts
2
+ import { z } from "zod";
3
+ import { SecretString } from "@superdurable/connectors-sdk";
4
+ var goTimeJSONPattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{1,2}):(\d{2}):(\d{2})(?:[.,](\d+))?(Z|([+-])(\d{2}):(\d{2}))$/;
5
+ function isGoTimeJSON(value) {
6
+ const match = goTimeJSONPattern.exec(value);
7
+ if (!match) return false;
8
+ const [, yearText, monthText, dayText, hourText, minuteText, secondText, , zone, , zoneHourText, zoneMinuteText] = match;
9
+ const year = Number(yearText);
10
+ const month = Number(monthText);
11
+ const day = Number(dayText);
12
+ const isLeap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
13
+ const monthDays = [31, isLeap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
14
+ return month >= 1 && month <= 12 && day >= 1 && day <= monthDays[month - 1] && Number(hourText) <= 23 && Number(minuteText) <= 59 && Number(secondText) <= 59 && (zone === "Z" || Number(zoneHourText) <= 24 && Number(zoneMinuteText) <= 60);
15
+ }
16
+ function canonicalGoTimeJSON(value) {
17
+ const match = goTimeJSONPattern.exec(value);
18
+ const [, year, month, day, hour, minute, second, fraction, zone, sign, zoneHour, zoneMinute] = match;
19
+ const clock = year + "-" + month + "-" + day + "T" + hour.padStart(2, "0") + ":" + minute + ":" + second;
20
+ const digits = (fraction ?? "").slice(0, 9).replace(/0+$/, "");
21
+ const offsetMinutes = zone === "Z" ? 0 : (Number(zoneHour) * 60 + Number(zoneMinute)) * (sign === "+" ? 1 : -1);
22
+ if (Math.abs(offsetMinutes) >= 1440) return value;
23
+ const offset = offsetMinutes === 0 ? "Z" : (offsetMinutes > 0 ? "+" : "-") + String(Math.floor(Math.abs(offsetMinutes) / 60)).padStart(2, "0") + ":" + String(Math.abs(offsetMinutes) % 60).padStart(2, "0");
24
+ return clock + (digits ? "." + digits : "") + offset;
25
+ }
26
+ var GoTimeJSONSchema = z.string().refine(isGoTimeJSON, "invalid Go time.Time JSON timestamp").transform(canonicalGoTimeJSON);
27
+ var ConfigSchema = z.object({
28
+ "docsEndpoint": z.string().optional(),
29
+ "driveEndpoint": z.string().optional(),
30
+ "maxResponseBytes": z.number().int().optional(),
31
+ "maxTextBytes": z.number().int().optional()
32
+ });
33
+ function decodeCredentials(value) {
34
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
35
+ const fields = value;
36
+ const allowed = /* @__PURE__ */ new Set(["auth_method", "access_token", "delegated_user", "oauth_client_id", "oauth_client_secret", "refresh_token", "service_account_key"]);
37
+ if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
38
+ if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
39
+ if (fields["delegated_user"] != null && !(typeof fields["delegated_user"] === "string")) throw new TypeError("credential delegated_user has an invalid type");
40
+ if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new TypeError("credential oauth_client_id has an invalid type");
41
+ if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new TypeError("credential oauth_client_secret has an invalid type");
42
+ if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new TypeError("credential refresh_token has an invalid type");
43
+ if (fields["service_account_key"] != null && !(typeof fields["service_account_key"] === "string")) throw new TypeError("credential service_account_key has an invalid type");
44
+ const selectedMethod = fields["auth_method"] ?? "";
45
+ if (typeof selectedMethod !== "string") throw new TypeError("credential auth_method is invalid");
46
+ const method = selectedMethod || "google-oauth";
47
+ const credentials = { authMethodId: method };
48
+ if (method === "google-oauth") {
49
+ if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
50
+ if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
51
+ if (!fields["oauth_client_secret"]) throw new TypeError("credential oauth_client_secret is required");
52
+ if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
53
+ if (!fields["access_token"]) throw new TypeError("credential access_token is required");
54
+ if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
55
+ if (!fields["refresh_token"]) throw new TypeError("credential refresh_token is required");
56
+ if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
57
+ } else if (method === "workspace-domain-delegation") {
58
+ if (!fields["service_account_key"]) throw new TypeError("credential service_account_key is required");
59
+ if (fields["service_account_key"]) credentials.serviceAccountKey = new SecretString(fields["service_account_key"]);
60
+ if (!fields["delegated_user"]) throw new TypeError("credential delegated_user is required");
61
+ if (fields["delegated_user"]) credentials.delegatedUser = fields["delegated_user"];
62
+ credentials.accessToken = new SecretString(fields["access_token"] ?? "");
63
+ } else {
64
+ throw new TypeError("credential auth_method is invalid");
65
+ }
66
+ return credentials;
67
+ }
68
+ function decodeSharedCredentials(value) {
69
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
70
+ const fields = value;
71
+ const allowed = /* @__PURE__ */ new Set(["auth_method", "access_token", "delegated_user", "oauth_client_id", "oauth_client_secret", "refresh_token", "service_account_key"]);
72
+ if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
73
+ if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
74
+ if (fields["delegated_user"] != null && !(typeof fields["delegated_user"] === "string")) throw new TypeError("credential delegated_user has an invalid type");
75
+ if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new TypeError("credential oauth_client_id has an invalid type");
76
+ if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new TypeError("credential oauth_client_secret has an invalid type");
77
+ if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new TypeError("credential refresh_token has an invalid type");
78
+ if (fields["service_account_key"] != null && !(typeof fields["service_account_key"] === "string")) throw new TypeError("credential service_account_key has an invalid type");
79
+ const selectedMethod = fields["auth_method"] ?? "";
80
+ if (typeof selectedMethod !== "string") throw new TypeError("credential auth_method is invalid");
81
+ const method = selectedMethod || "google-oauth";
82
+ const credentials = { authMethodId: method };
83
+ if (method === "google-oauth") {
84
+ if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
85
+ if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
86
+ if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
87
+ if (!fields["access_token"]) throw new TypeError("credential access_token is required");
88
+ if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
89
+ if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
90
+ } else if (method === "workspace-domain-delegation") {
91
+ if (fields["service_account_key"]) credentials.serviceAccountKey = new SecretString(fields["service_account_key"]);
92
+ if (!fields["delegated_user"]) throw new TypeError("credential delegated_user is required");
93
+ if (fields["delegated_user"]) credentials.delegatedUser = fields["delegated_user"];
94
+ if (!fields["access_token"]) throw new TypeError("credential access_token is required");
95
+ credentials.accessToken = new SecretString(fields["access_token"] ?? "");
96
+ } else {
97
+ throw new TypeError("credential auth_method is invalid");
98
+ }
99
+ return credentials;
100
+ }
101
+ var GetDocumentTextInputSchema = z.strictObject({
102
+ "documentId": z.string(),
103
+ "format": z.string().optional()
104
+ });
105
+ var GetDocumentTextOutputSchema = z.strictObject({
106
+ "documentId": z.string(),
107
+ "title": z.string(),
108
+ "revisionId": z.string().optional(),
109
+ "format": z.string(),
110
+ "text": z.string().optional(),
111
+ "byteCount": z.number().int(),
112
+ "hasOtherTabs": z.boolean().optional()
113
+ });
114
+ var CreateDocumentInputSchema = z.strictObject({
115
+ "title": z.string(),
116
+ "parentFolderId": z.string().optional(),
117
+ "initialText": z.string().optional(),
118
+ "initialTextFormat": z.string().optional()
119
+ });
120
+ var CreatedDocumentSchema = z.strictObject({
121
+ "documentId": z.string(),
122
+ "title": z.string(),
123
+ "parents": z.array(z.string()).optional(),
124
+ "webViewLink": z.string().optional(),
125
+ "createdTime": GoTimeJSONSchema.optional(),
126
+ "isTrashed": z.boolean().optional()
127
+ });
128
+ var CreateDocumentOutputSchema = z.strictObject({
129
+ "document": CreatedDocumentSchema,
130
+ "isFromEarlierAttempt": z.boolean().optional()
131
+ });
132
+ var PlaceholderReplacementSchema = z.strictObject({
133
+ "placeholder": z.string(),
134
+ "text": z.string()
135
+ });
136
+ var ReplaceDocumentTextInputSchema = z.strictObject({
137
+ "documentId": z.string(),
138
+ "requiredRevisionId": z.string(),
139
+ "target": z.string(),
140
+ "text": z.string().optional(),
141
+ "placeholders": z.array(PlaceholderReplacementSchema).optional()
142
+ });
143
+ var PlaceholderReplacementResultSchema = z.strictObject({
144
+ "placeholder": z.string(),
145
+ "occurrencesChanged": z.number().int()
146
+ });
147
+ var ReplaceDocumentTextOutputSchema = z.strictObject({
148
+ "documentId": z.string(),
149
+ "revisionId": z.string().optional(),
150
+ "replacements": z.array(PlaceholderReplacementResultSchema).optional(),
151
+ "missingPlaceholders": z.array(z.string()).optional(),
152
+ "wasAlreadyApplied": z.boolean().optional()
153
+ });
154
+ var AppendTextInputSchema = z.strictObject({
155
+ "documentId": z.string(),
156
+ "requiredRevisionId": z.string(),
157
+ "text": z.string()
158
+ });
159
+ var AppendTextOutputSchema = z.strictObject({
160
+ "documentId": z.string(),
161
+ "revisionId": z.string().optional(),
162
+ "wasAlreadyApplied": z.boolean().optional()
163
+ });
164
+
165
+ // src/generated/definitions.ts
166
+ var ConnectorID = "google-docs";
167
+ var ProviderID = "google";
168
+ var GetDocumentTextBranch = {
169
+ Read: "read",
170
+ NotFound: "notFound",
171
+ TooLarge: "tooLarge",
172
+ ProviderRejected: "providerRejected",
173
+ InvalidResponse: "invalidResponse",
174
+ Defect: "defect"
175
+ };
176
+ var GetDocumentTextBranchRead = GetDocumentTextBranch.Read;
177
+ var GetDocumentTextBranchNotFound = GetDocumentTextBranch.NotFound;
178
+ var GetDocumentTextBranchTooLarge = GetDocumentTextBranch.TooLarge;
179
+ var GetDocumentTextBranchProviderRejected = GetDocumentTextBranch.ProviderRejected;
180
+ var GetDocumentTextBranchInvalidResponse = GetDocumentTextBranch.InvalidResponse;
181
+ var GetDocumentTextBranchDefect = GetDocumentTextBranch.Defect;
182
+ var GetDocumentTextDefinition = {
183
+ operation: { connectorId: ConnectorID, operationId: "getDocumentText" },
184
+ branches: [
185
+ { id: "read", description: "The document text was rendered within the configured limit." },
186
+ { id: "notFound", description: "The document does not exist or the connection cannot see it.", optional: true },
187
+ { id: "tooLarge", description: "The document response or its rendered text exceeds the configured limit.", optional: true },
188
+ { id: "providerRejected", description: "Google conclusively rejected the read, such as a revoked grant or a missing permission.", optional: true },
189
+ { id: "invalidResponse", description: "Google returned an invalid document response.", optional: true },
190
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
191
+ ],
192
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
193
+ };
194
+ var GetDocumentTextMetadata = { kind: "query", idempotency: "none", authorization: "required" };
195
+ var CreateDocumentBranch = {
196
+ Created: "created",
197
+ ProviderRejected: "providerRejected",
198
+ InvalidResponse: "invalidResponse",
199
+ Uncertain: "uncertain",
200
+ Defect: "defect"
201
+ };
202
+ var CreateDocumentBranchCreated = CreateDocumentBranch.Created;
203
+ var CreateDocumentBranchProviderRejected = CreateDocumentBranch.ProviderRejected;
204
+ var CreateDocumentBranchInvalidResponse = CreateDocumentBranch.InvalidResponse;
205
+ var CreateDocumentBranchUncertain = CreateDocumentBranch.Uncertain;
206
+ var CreateDocumentBranchDefect = CreateDocumentBranch.Defect;
207
+ var CreateDocumentDefinition = {
208
+ operation: { connectorId: ConnectorID, operationId: "createDocument" },
209
+ branches: [
210
+ { id: "created", description: "Google created the document or returned the one an earlier attempt of the same Step execution created." },
211
+ { id: "providerRejected", description: "Google conclusively rejected the creation or the duplicate lookup, such as a missing parent folder; no document was created.", optional: true },
212
+ { id: "invalidResponse", description: "Google returned an invalid or oversized duplicate-lookup response before the creation was sent.", optional: true },
213
+ { id: "uncertain", description: "A creation may have been sent but its outcome cannot be confirmed, so the document may exist; the connector sends nothing after selecting this branch.", optional: true },
214
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
215
+ ],
216
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 5, totalDurationMs: 3e5 } }
217
+ };
218
+ var CreateDocumentMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
219
+ var ReplaceDocumentTextBranch = {
220
+ Replaced: "replaced",
221
+ PlaceholderNotFound: "placeholderNotFound",
222
+ RevisionChanged: "revisionChanged",
223
+ NotFound: "notFound",
224
+ ProviderRejected: "providerRejected",
225
+ InvalidResponse: "invalidResponse",
226
+ Defect: "defect"
227
+ };
228
+ var ReplaceDocumentTextBranchReplaced = ReplaceDocumentTextBranch.Replaced;
229
+ var ReplaceDocumentTextBranchPlaceholderNotFound = ReplaceDocumentTextBranch.PlaceholderNotFound;
230
+ var ReplaceDocumentTextBranchRevisionChanged = ReplaceDocumentTextBranch.RevisionChanged;
231
+ var ReplaceDocumentTextBranchNotFound = ReplaceDocumentTextBranch.NotFound;
232
+ var ReplaceDocumentTextBranchProviderRejected = ReplaceDocumentTextBranch.ProviderRejected;
233
+ var ReplaceDocumentTextBranchInvalidResponse = ReplaceDocumentTextBranch.InvalidResponse;
234
+ var ReplaceDocumentTextBranchDefect = ReplaceDocumentTextBranch.Defect;
235
+ var ReplaceDocumentTextDefinition = {
236
+ operation: { connectorId: ConnectorID, operationId: "replaceDocumentText" },
237
+ branches: [
238
+ { id: "replaced", description: "The document holds the requested text, written by this attempt or an earlier attempt of the same Step execution." },
239
+ { id: "placeholderNotFound", description: "A requested placeholder does not occur in the body at the required revision; nothing was written.", optional: true },
240
+ { id: "revisionChanged", description: "The document changed after the required revision and does not hold the requested text; nothing was written.", optional: true },
241
+ { id: "notFound", description: "The document does not exist or the connection cannot see it.", optional: true },
242
+ { id: "providerRejected", description: "Google conclusively rejected the change, such as a connection without edit access.", optional: true },
243
+ { id: "invalidResponse", description: "Google returned an invalid or oversized document response.", optional: true },
244
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
245
+ ],
246
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
247
+ };
248
+ var ReplaceDocumentTextMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
249
+ var AppendTextBranch = {
250
+ Appended: "appended",
251
+ RevisionChanged: "revisionChanged",
252
+ NotFound: "notFound",
253
+ ProviderRejected: "providerRejected",
254
+ InvalidResponse: "invalidResponse",
255
+ Defect: "defect"
256
+ };
257
+ var AppendTextBranchAppended = AppendTextBranch.Appended;
258
+ var AppendTextBranchRevisionChanged = AppendTextBranch.RevisionChanged;
259
+ var AppendTextBranchNotFound = AppendTextBranch.NotFound;
260
+ var AppendTextBranchProviderRejected = AppendTextBranch.ProviderRejected;
261
+ var AppendTextBranchInvalidResponse = AppendTextBranch.InvalidResponse;
262
+ var AppendTextBranchDefect = AppendTextBranch.Defect;
263
+ var AppendTextDefinition = {
264
+ operation: { connectorId: ConnectorID, operationId: "appendText" },
265
+ branches: [
266
+ { id: "appended", description: "The document ends with the requested text, appended by this attempt or an earlier attempt of the same Step execution." },
267
+ { id: "revisionChanged", description: "The document changed after the required revision and does not end with the requested text; nothing was written.", optional: true },
268
+ { id: "notFound", description: "The document does not exist or the connection cannot see it.", optional: true },
269
+ { id: "providerRejected", description: "Google conclusively rejected the change, such as a connection without edit access.", optional: true },
270
+ { id: "invalidResponse", description: "Google returned an invalid or oversized document response.", optional: true },
271
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
272
+ ],
273
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
274
+ };
275
+ var AppendTextMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
276
+
277
+ // src/generated/connection.ts
278
+ import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
279
+ import { newRefreshingCredentialProvider } from "@superdurable/connectors-sdk/projectconfig";
280
+ var Connection = class {
281
+ /** Stable provider and connection name. */
282
+ reference;
283
+ /** Bound provider operations. */
284
+ operations;
285
+ /** Validate a reference and bind operations. */
286
+ constructor(reference, operations) {
287
+ this.reference = ConnectionRefSchema.parse(reference);
288
+ if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
289
+ if (!operations) throw new TypeError("connector operations are required");
290
+ this.operations = operations;
291
+ }
292
+ };
293
+ function newConnection(client, reference) {
294
+ if (!client) throw new TypeError("connector client is required");
295
+ return new Connection(reference, client);
296
+ }
297
+ function newConnectionWithOperations(operations, reference) {
298
+ return new Connection(reference, operations);
299
+ }
300
+ function newProjectCredentialProvider(project, connectionName, decode, encode, decodeShared) {
301
+ return newRefreshingCredentialProvider(project.connections, { connectorId: ConnectorID, connectionName }, decode, encode, decodeShared);
302
+ }
303
+
304
+ export {
305
+ ConfigSchema,
306
+ decodeCredentials,
307
+ decodeSharedCredentials,
308
+ GetDocumentTextInputSchema,
309
+ GetDocumentTextOutputSchema,
310
+ CreateDocumentInputSchema,
311
+ CreatedDocumentSchema,
312
+ CreateDocumentOutputSchema,
313
+ PlaceholderReplacementSchema,
314
+ ReplaceDocumentTextInputSchema,
315
+ PlaceholderReplacementResultSchema,
316
+ ReplaceDocumentTextOutputSchema,
317
+ AppendTextInputSchema,
318
+ AppendTextOutputSchema,
319
+ ConnectorID,
320
+ ProviderID,
321
+ GetDocumentTextBranch,
322
+ GetDocumentTextBranchRead,
323
+ GetDocumentTextBranchNotFound,
324
+ GetDocumentTextBranchTooLarge,
325
+ GetDocumentTextBranchProviderRejected,
326
+ GetDocumentTextBranchInvalidResponse,
327
+ GetDocumentTextBranchDefect,
328
+ GetDocumentTextDefinition,
329
+ GetDocumentTextMetadata,
330
+ CreateDocumentBranch,
331
+ CreateDocumentBranchCreated,
332
+ CreateDocumentBranchProviderRejected,
333
+ CreateDocumentBranchInvalidResponse,
334
+ CreateDocumentBranchUncertain,
335
+ CreateDocumentBranchDefect,
336
+ CreateDocumentDefinition,
337
+ CreateDocumentMetadata,
338
+ ReplaceDocumentTextBranch,
339
+ ReplaceDocumentTextBranchReplaced,
340
+ ReplaceDocumentTextBranchPlaceholderNotFound,
341
+ ReplaceDocumentTextBranchRevisionChanged,
342
+ ReplaceDocumentTextBranchNotFound,
343
+ ReplaceDocumentTextBranchProviderRejected,
344
+ ReplaceDocumentTextBranchInvalidResponse,
345
+ ReplaceDocumentTextBranchDefect,
346
+ ReplaceDocumentTextDefinition,
347
+ ReplaceDocumentTextMetadata,
348
+ AppendTextBranch,
349
+ AppendTextBranchAppended,
350
+ AppendTextBranchRevisionChanged,
351
+ AppendTextBranchNotFound,
352
+ AppendTextBranchProviderRejected,
353
+ AppendTextBranchInvalidResponse,
354
+ AppendTextBranchDefect,
355
+ AppendTextDefinition,
356
+ AppendTextMetadata,
357
+ Connection,
358
+ newConnection,
359
+ newConnectionWithOperations,
360
+ newProjectCredentialProvider
361
+ };