@superdurable/connector-google-docs 0.0.0-stage → 0.1.1

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/dist/mock.d.ts ADDED
@@ -0,0 +1,142 @@
1
+ import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
2
+ import { Failure } from '@superdurable/connectors-sdk';
3
+ import { O as Operations, C as Connection, G as GetDocumentTextInput, d as GetDocumentTextOutput, b as CreateDocumentInput, c as CreateDocumentOutput, R as ReplaceDocumentTextInput, e as ReplaceDocumentTextOutput, A as AppendTextInput, a as AppendTextOutput, n as CreatedDocument, P as PlaceholderReplacement, s as PlaceholderReplacementResult } from './connection-CAHPwRm8.js';
4
+ import 'zod';
5
+
6
+ /** Go zero value for GetDocumentTextInput in scripted cases. */
7
+ declare const emptyGetDocumentTextInput: GetDocumentTextInput;
8
+ /** Go zero value for GetDocumentTextOutput in scripted cases. */
9
+ declare const emptyGetDocumentTextOutput: GetDocumentTextOutput;
10
+ /** Go zero value for CreateDocumentInput in scripted cases. */
11
+ declare const emptyCreateDocumentInput: CreateDocumentInput;
12
+ /** Go zero value for CreatedDocument in scripted cases. */
13
+ declare const emptyCreatedDocument: CreatedDocument;
14
+ /** Go zero value for CreateDocumentOutput in scripted cases. */
15
+ declare const emptyCreateDocumentOutput: CreateDocumentOutput;
16
+ /** Go zero value for PlaceholderReplacement in scripted cases. */
17
+ declare const emptyPlaceholderReplacement: PlaceholderReplacement;
18
+ /** Go zero value for ReplaceDocumentTextInput in scripted cases. */
19
+ declare const emptyReplaceDocumentTextInput: ReplaceDocumentTextInput;
20
+ /** Go zero value for PlaceholderReplacementResult in scripted cases. */
21
+ declare const emptyPlaceholderReplacementResult: PlaceholderReplacementResult;
22
+ /** Go zero value for ReplaceDocumentTextOutput in scripted cases. */
23
+ declare const emptyReplaceDocumentTextOutput: ReplaceDocumentTextOutput;
24
+ /** Go zero value for AppendTextInput in scripted cases. */
25
+ declare const emptyAppendTextInput: AppendTextInput;
26
+ /** Go zero value for AppendTextOutput in scripted cases. */
27
+ declare const emptyAppendTextOutput: AppendTextOutput;
28
+ /** Script the read branch. */
29
+ declare function getDocumentTextRead(value: GetDocumentTextOutput, failure?: Failure): Case<GetDocumentTextOutput>;
30
+ /** Script the notFound branch. */
31
+ declare function getDocumentTextNotFound(value: GetDocumentTextOutput, failure?: Failure): Case<GetDocumentTextOutput>;
32
+ /** Script the tooLarge branch. */
33
+ declare function getDocumentTextTooLarge(value: GetDocumentTextOutput, failure?: Failure): Case<GetDocumentTextOutput>;
34
+ /** Script the providerRejected branch. */
35
+ declare function getDocumentTextProviderRejected(value: GetDocumentTextOutput, failure?: Failure): Case<GetDocumentTextOutput>;
36
+ /** Script the invalidResponse branch. */
37
+ declare function getDocumentTextInvalidResponse(value: GetDocumentTextOutput, failure?: Failure): Case<GetDocumentTextOutput>;
38
+ /** Script the defect branch. */
39
+ declare function getDocumentTextDefect(value: GetDocumentTextOutput, failure?: Failure): Case<GetDocumentTextOutput>;
40
+ /** Script a safe retry of getDocumentText. */
41
+ declare function getDocumentTextRetry(failure: Failure, retryAfterMs?: number): Case<GetDocumentTextOutput>;
42
+ /** Manifest scenario policyTemplate for getDocumentText. */
43
+ declare function getDocumentTextPolicyTemplate(): Case<GetDocumentTextOutput>;
44
+ /** Default getDocumentText scenario. */
45
+ declare function getDocumentTextDefault(): Case<GetDocumentTextOutput>;
46
+ /** Manifest scenario notFoundFailure for getDocumentText. */
47
+ declare function getDocumentTextNotFoundFailure(): Case<GetDocumentTextOutput>;
48
+ /** Manifest scenario tooLargeFailure for getDocumentText. */
49
+ declare function getDocumentTextTooLargeFailure(): Case<GetDocumentTextOutput>;
50
+ /** Manifest scenario providerRejectedFailure for getDocumentText. */
51
+ declare function getDocumentTextProviderRejectedFailure(): Case<GetDocumentTextOutput>;
52
+ /** Manifest scenario invalidResponseFailure for getDocumentText. */
53
+ declare function getDocumentTextInvalidResponseFailure(): Case<GetDocumentTextOutput>;
54
+ /** Script the created branch. */
55
+ declare function createDocumentCreated(value: CreateDocumentOutput, failure?: Failure): Case<CreateDocumentOutput>;
56
+ /** Script the providerRejected branch. */
57
+ declare function createDocumentProviderRejected(value: CreateDocumentOutput, failure?: Failure): Case<CreateDocumentOutput>;
58
+ /** Script the invalidResponse branch. */
59
+ declare function createDocumentInvalidResponse(value: CreateDocumentOutput, failure?: Failure): Case<CreateDocumentOutput>;
60
+ /** Script the defect branch. */
61
+ declare function createDocumentDefect(value: CreateDocumentOutput, failure?: Failure): Case<CreateDocumentOutput>;
62
+ /** Script a safe retry of createDocument. */
63
+ declare function createDocumentRetry(failure: Failure, retryAfterMs?: number): Case<CreateDocumentOutput>;
64
+ /** Script an uncertain createDocument attempt. */
65
+ declare function createDocumentUncertain(value: CreateDocumentOutput, failure: Failure): Case<CreateDocumentOutput>;
66
+ /** Manifest scenario createdPolicyDraft for createDocument. */
67
+ declare function createDocumentCreatedPolicyDraft(): Case<CreateDocumentOutput>;
68
+ /** Default createDocument scenario. */
69
+ declare function createDocumentDefault(): Case<CreateDocumentOutput>;
70
+ /** Manifest scenario providerRejectedFailure for createDocument. */
71
+ declare function createDocumentProviderRejectedFailure(): Case<CreateDocumentOutput>;
72
+ /** Manifest scenario invalidResponseFailure for createDocument. */
73
+ declare function createDocumentInvalidResponseFailure(): Case<CreateDocumentOutput>;
74
+ /** Script the replaced branch. */
75
+ declare function replaceDocumentTextReplaced(value: ReplaceDocumentTextOutput, failure?: Failure): Case<ReplaceDocumentTextOutput>;
76
+ /** Script the placeholderNotFound branch. */
77
+ declare function replaceDocumentTextPlaceholderNotFound(value: ReplaceDocumentTextOutput, failure?: Failure): Case<ReplaceDocumentTextOutput>;
78
+ /** Script the revisionChanged branch. */
79
+ declare function replaceDocumentTextRevisionChanged(value: ReplaceDocumentTextOutput, failure?: Failure): Case<ReplaceDocumentTextOutput>;
80
+ /** Script the notFound branch. */
81
+ declare function replaceDocumentTextNotFound(value: ReplaceDocumentTextOutput, failure?: Failure): Case<ReplaceDocumentTextOutput>;
82
+ /** Script the providerRejected branch. */
83
+ declare function replaceDocumentTextProviderRejected(value: ReplaceDocumentTextOutput, failure?: Failure): Case<ReplaceDocumentTextOutput>;
84
+ /** Script the invalidResponse branch. */
85
+ declare function replaceDocumentTextInvalidResponse(value: ReplaceDocumentTextOutput, failure?: Failure): Case<ReplaceDocumentTextOutput>;
86
+ /** Script the defect branch. */
87
+ declare function replaceDocumentTextDefect(value: ReplaceDocumentTextOutput, failure?: Failure): Case<ReplaceDocumentTextOutput>;
88
+ /** Script a safe retry of replaceDocumentText. */
89
+ declare function replaceDocumentTextRetry(failure: Failure, retryAfterMs?: number): Case<ReplaceDocumentTextOutput>;
90
+ /** Manifest scenario filledPolicyDraft for replaceDocumentText. */
91
+ declare function replaceDocumentTextFilledPolicyDraft(): Case<ReplaceDocumentTextOutput>;
92
+ /** Default replaceDocumentText scenario. */
93
+ declare function replaceDocumentTextDefault(): Case<ReplaceDocumentTextOutput>;
94
+ /** Manifest scenario placeholderNotFoundFailure for replaceDocumentText. */
95
+ declare function replaceDocumentTextPlaceholderNotFoundFailure(): Case<ReplaceDocumentTextOutput>;
96
+ /** Manifest scenario revisionChangedFailure for replaceDocumentText. */
97
+ declare function replaceDocumentTextRevisionChangedFailure(): Case<ReplaceDocumentTextOutput>;
98
+ /** Manifest scenario notFoundFailure for replaceDocumentText. */
99
+ declare function replaceDocumentTextNotFoundFailure(): Case<ReplaceDocumentTextOutput>;
100
+ /** Manifest scenario providerRejectedFailure for replaceDocumentText. */
101
+ declare function replaceDocumentTextProviderRejectedFailure(): Case<ReplaceDocumentTextOutput>;
102
+ /** Manifest scenario invalidResponseFailure for replaceDocumentText. */
103
+ declare function replaceDocumentTextInvalidResponseFailure(): Case<ReplaceDocumentTextOutput>;
104
+ /** Script the appended branch. */
105
+ declare function appendTextAppended(value: AppendTextOutput, failure?: Failure): Case<AppendTextOutput>;
106
+ /** Script the revisionChanged branch. */
107
+ declare function appendTextRevisionChanged(value: AppendTextOutput, failure?: Failure): Case<AppendTextOutput>;
108
+ /** Script the notFound branch. */
109
+ declare function appendTextNotFound(value: AppendTextOutput, failure?: Failure): Case<AppendTextOutput>;
110
+ /** Script the providerRejected branch. */
111
+ declare function appendTextProviderRejected(value: AppendTextOutput, failure?: Failure): Case<AppendTextOutput>;
112
+ /** Script the invalidResponse branch. */
113
+ declare function appendTextInvalidResponse(value: AppendTextOutput, failure?: Failure): Case<AppendTextOutput>;
114
+ /** Script the defect branch. */
115
+ declare function appendTextDefect(value: AppendTextOutput, failure?: Failure): Case<AppendTextOutput>;
116
+ /** Script a safe retry of appendText. */
117
+ declare function appendTextRetry(failure: Failure, retryAfterMs?: number): Case<AppendTextOutput>;
118
+ /** Manifest scenario stampedPolicyDraft for appendText. */
119
+ declare function appendTextStampedPolicyDraft(): Case<AppendTextOutput>;
120
+ /** Default appendText scenario. */
121
+ declare function appendTextDefault(): Case<AppendTextOutput>;
122
+ /** Manifest scenario revisionChangedFailure for appendText. */
123
+ declare function appendTextRevisionChangedFailure(): Case<AppendTextOutput>;
124
+ /** Manifest scenario notFoundFailure for appendText. */
125
+ declare function appendTextNotFoundFailure(): Case<AppendTextOutput>;
126
+ /** Manifest scenario providerRejectedFailure for appendText. */
127
+ declare function appendTextProviderRejectedFailure(): Case<AppendTextOutput>;
128
+ /** Manifest scenario invalidResponseFailure for appendText. */
129
+ declare function appendTextInvalidResponseFailure(): Case<AppendTextOutput>;
130
+ /** Scripted operations and manifest defaults for this connector. */
131
+ declare class GeneratedMock implements Operations {
132
+ #private;
133
+ constructor(connectionName: string);
134
+ connection(): Connection;
135
+ getDocumentText(): MockQuery<GetDocumentTextInput, GetDocumentTextOutput>;
136
+ createDocument(): MockMutation<CreateDocumentInput, CreateDocumentOutput>;
137
+ replaceDocumentText(): MockMutation<ReplaceDocumentTextInput, ReplaceDocumentTextOutput>;
138
+ appendText(): MockMutation<AppendTextInput, AppendTextOutput>;
139
+ assertNoFailures(): void;
140
+ }
141
+
142
+ export { GeneratedMock, appendTextAppended, appendTextDefault, appendTextDefect, appendTextInvalidResponse, appendTextInvalidResponseFailure, appendTextNotFound, appendTextNotFoundFailure, appendTextProviderRejected, appendTextProviderRejectedFailure, appendTextRetry, appendTextRevisionChanged, appendTextRevisionChangedFailure, appendTextStampedPolicyDraft, createDocumentCreated, createDocumentCreatedPolicyDraft, createDocumentDefault, createDocumentDefect, createDocumentInvalidResponse, createDocumentInvalidResponseFailure, createDocumentProviderRejected, createDocumentProviderRejectedFailure, createDocumentRetry, createDocumentUncertain, emptyAppendTextInput, emptyAppendTextOutput, emptyCreateDocumentInput, emptyCreateDocumentOutput, emptyCreatedDocument, emptyGetDocumentTextInput, emptyGetDocumentTextOutput, emptyPlaceholderReplacement, emptyPlaceholderReplacementResult, emptyReplaceDocumentTextInput, emptyReplaceDocumentTextOutput, getDocumentTextDefault, getDocumentTextDefect, getDocumentTextInvalidResponse, getDocumentTextInvalidResponseFailure, getDocumentTextNotFound, getDocumentTextNotFoundFailure, getDocumentTextPolicyTemplate, getDocumentTextProviderRejected, getDocumentTextProviderRejectedFailure, getDocumentTextRead, getDocumentTextRetry, getDocumentTextTooLarge, getDocumentTextTooLargeFailure, replaceDocumentTextDefault, replaceDocumentTextDefect, replaceDocumentTextFilledPolicyDraft, replaceDocumentTextInvalidResponse, replaceDocumentTextInvalidResponseFailure, replaceDocumentTextNotFound, replaceDocumentTextNotFoundFailure, replaceDocumentTextPlaceholderNotFound, replaceDocumentTextPlaceholderNotFoundFailure, replaceDocumentTextProviderRejected, replaceDocumentTextProviderRejectedFailure, replaceDocumentTextReplaced, replaceDocumentTextRetry, replaceDocumentTextRevisionChanged, replaceDocumentTextRevisionChangedFailure };
package/dist/mock.js ADDED
@@ -0,0 +1,338 @@
1
+ import {
2
+ AppendTextDefinition,
3
+ AppendTextInputSchema,
4
+ AppendTextOutputSchema,
5
+ ConnectorID,
6
+ CreateDocumentDefinition,
7
+ CreateDocumentInputSchema,
8
+ CreateDocumentOutputSchema,
9
+ CreatedDocumentSchema,
10
+ GetDocumentTextDefinition,
11
+ GetDocumentTextInputSchema,
12
+ GetDocumentTextOutputSchema,
13
+ PlaceholderReplacementResultSchema,
14
+ PlaceholderReplacementSchema,
15
+ ProviderID,
16
+ ReplaceDocumentTextDefinition,
17
+ ReplaceDocumentTextInputSchema,
18
+ ReplaceDocumentTextOutputSchema,
19
+ newConnectionWithOperations
20
+ } from "./chunk-2AMHZOKT.js";
21
+
22
+ // src/generated/mock.ts
23
+ import { branchCase, retryCase, uncertainCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
24
+ var emptyGetDocumentTextInput = GetDocumentTextInputSchema.parse({
25
+ "documentId": ""
26
+ });
27
+ var emptyGetDocumentTextOutput = GetDocumentTextOutputSchema.parse({
28
+ "documentId": "",
29
+ "title": "",
30
+ "format": "",
31
+ "byteCount": 0
32
+ });
33
+ var emptyCreateDocumentInput = CreateDocumentInputSchema.parse({
34
+ "title": ""
35
+ });
36
+ var emptyCreatedDocument = CreatedDocumentSchema.parse({
37
+ "documentId": "",
38
+ "title": ""
39
+ });
40
+ var emptyCreateDocumentOutput = CreateDocumentOutputSchema.parse({
41
+ "document": emptyCreatedDocument
42
+ });
43
+ var emptyPlaceholderReplacement = PlaceholderReplacementSchema.parse({
44
+ "placeholder": "",
45
+ "text": ""
46
+ });
47
+ var emptyReplaceDocumentTextInput = ReplaceDocumentTextInputSchema.parse({
48
+ "documentId": "",
49
+ "requiredRevisionId": "",
50
+ "target": ""
51
+ });
52
+ var emptyPlaceholderReplacementResult = PlaceholderReplacementResultSchema.parse({
53
+ "placeholder": "",
54
+ "occurrencesChanged": 0
55
+ });
56
+ var emptyReplaceDocumentTextOutput = ReplaceDocumentTextOutputSchema.parse({
57
+ "documentId": ""
58
+ });
59
+ var emptyAppendTextInput = AppendTextInputSchema.parse({
60
+ "documentId": "",
61
+ "requiredRevisionId": "",
62
+ "text": ""
63
+ });
64
+ var emptyAppendTextOutput = AppendTextOutputSchema.parse({
65
+ "documentId": ""
66
+ });
67
+ function getDocumentTextRead(value, failure) {
68
+ return branchCase("read", value, failure);
69
+ }
70
+ function getDocumentTextNotFound(value, failure) {
71
+ return branchCase("notFound", value, failure);
72
+ }
73
+ function getDocumentTextTooLarge(value, failure) {
74
+ return branchCase("tooLarge", value, failure);
75
+ }
76
+ function getDocumentTextProviderRejected(value, failure) {
77
+ return branchCase("providerRejected", value, failure);
78
+ }
79
+ function getDocumentTextInvalidResponse(value, failure) {
80
+ return branchCase("invalidResponse", value, failure);
81
+ }
82
+ function getDocumentTextDefect(value, failure) {
83
+ return branchCase("defect", value, failure);
84
+ }
85
+ function getDocumentTextRetry(failure, retryAfterMs = 0) {
86
+ return retryCase(failure, retryAfterMs);
87
+ }
88
+ function getDocumentTextPolicyTemplate() {
89
+ const value = GetDocumentTextOutputSchema.parse({ "byteCount": 76, "documentId": "policyTemplate1", "format": "markdown", "revisionId": "rev-template-1", "text": "# Refund Policy\n\nEffective {{effectiveDate}} for {{companyName}} customers.\n", "title": "Refund Policy Template" });
90
+ return branchCase("read", value);
91
+ }
92
+ function getDocumentTextDefault() {
93
+ return getDocumentTextPolicyTemplate();
94
+ }
95
+ function getDocumentTextNotFoundFailure() {
96
+ const value = emptyGetDocumentTextOutput;
97
+ return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "getDocumentText", message: "The document does not exist or the connection cannot see it." });
98
+ }
99
+ function getDocumentTextTooLargeFailure() {
100
+ const value = emptyGetDocumentTextOutput;
101
+ return branchCase("tooLarge", value, { kind: "RESPONSE_TOO_LARGE", provider: ConnectorID, operation: "getDocumentText", message: "The Google Docs response exceeds the configured limit." });
102
+ }
103
+ function getDocumentTextProviderRejectedFailure() {
104
+ const value = emptyGetDocumentTextOutput;
105
+ return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "getDocumentText", message: "The connection cannot read the document." });
106
+ }
107
+ function getDocumentTextInvalidResponseFailure() {
108
+ const value = emptyGetDocumentTextOutput;
109
+ return branchCase("invalidResponse", value, { kind: "PROTOCOL", provider: ConnectorID, operation: "getDocumentText", message: "Google returned an invalid document response." });
110
+ }
111
+ function createDocumentCreated(value, failure) {
112
+ return branchCase("created", value, failure);
113
+ }
114
+ function createDocumentProviderRejected(value, failure) {
115
+ return branchCase("providerRejected", value, failure);
116
+ }
117
+ function createDocumentInvalidResponse(value, failure) {
118
+ return branchCase("invalidResponse", value, failure);
119
+ }
120
+ function createDocumentDefect(value, failure) {
121
+ return branchCase("defect", value, failure);
122
+ }
123
+ function createDocumentRetry(failure, retryAfterMs = 0) {
124
+ return retryCase(failure, retryAfterMs);
125
+ }
126
+ function createDocumentUncertain(value, failure) {
127
+ return uncertainCase(value, failure);
128
+ }
129
+ function createDocumentCreatedPolicyDraft() {
130
+ const value = CreateDocumentOutputSchema.parse({ "document": { "createdTime": "2026-10-26T09:00:00Z", "documentId": "policyDraft1", "parents": ["fld_policies"], "title": "Acme Refund Policy", "webViewLink": "https://docs.google.com/document/d/policyDraft1/edit" } });
131
+ return branchCase("created", value);
132
+ }
133
+ function createDocumentDefault() {
134
+ return createDocumentCreatedPolicyDraft();
135
+ }
136
+ function createDocumentProviderRejectedFailure() {
137
+ const value = emptyCreateDocumentOutput;
138
+ return branchCase("providerRejected", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "createDocument", message: "The parent Drive folder was not found." });
139
+ }
140
+ function createDocumentInvalidResponseFailure() {
141
+ const value = emptyCreateDocumentOutput;
142
+ return branchCase("invalidResponse", value, { kind: "PROTOCOL", provider: ConnectorID, operation: "createDocument", message: "The duplicate lookup returned an invalid response." });
143
+ }
144
+ function replaceDocumentTextReplaced(value, failure) {
145
+ return branchCase("replaced", value, failure);
146
+ }
147
+ function replaceDocumentTextPlaceholderNotFound(value, failure) {
148
+ return branchCase("placeholderNotFound", value, failure);
149
+ }
150
+ function replaceDocumentTextRevisionChanged(value, failure) {
151
+ return branchCase("revisionChanged", value, failure);
152
+ }
153
+ function replaceDocumentTextNotFound(value, failure) {
154
+ return branchCase("notFound", value, failure);
155
+ }
156
+ function replaceDocumentTextProviderRejected(value, failure) {
157
+ return branchCase("providerRejected", value, failure);
158
+ }
159
+ function replaceDocumentTextInvalidResponse(value, failure) {
160
+ return branchCase("invalidResponse", value, failure);
161
+ }
162
+ function replaceDocumentTextDefect(value, failure) {
163
+ return branchCase("defect", value, failure);
164
+ }
165
+ function replaceDocumentTextRetry(failure, retryAfterMs = 0) {
166
+ return retryCase(failure, retryAfterMs);
167
+ }
168
+ function replaceDocumentTextFilledPolicyDraft() {
169
+ const value = ReplaceDocumentTextOutputSchema.parse({ "documentId": "policyDraft1", "replacements": [{ "occurrencesChanged": 1, "placeholder": "{{effectiveDate}}" }, { "occurrencesChanged": 1, "placeholder": "{{companyName}}" }], "revisionId": "rev-draft-2" });
170
+ return branchCase("replaced", value);
171
+ }
172
+ function replaceDocumentTextDefault() {
173
+ return replaceDocumentTextFilledPolicyDraft();
174
+ }
175
+ function replaceDocumentTextPlaceholderNotFoundFailure() {
176
+ const value = emptyReplaceDocumentTextOutput;
177
+ return branchCase("placeholderNotFound", value, { kind: "VALIDATION", provider: ConnectorID, operation: "replaceDocumentText", message: "A requested placeholder is absent from the document body." });
178
+ }
179
+ function replaceDocumentTextRevisionChangedFailure() {
180
+ const value = emptyReplaceDocumentTextOutput;
181
+ return branchCase("revisionChanged", value, { kind: "CONFLICT", provider: ConnectorID, operation: "replaceDocumentText", message: "The document revision changed before the replacement." });
182
+ }
183
+ function replaceDocumentTextNotFoundFailure() {
184
+ const value = emptyReplaceDocumentTextOutput;
185
+ return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "replaceDocumentText", message: "The document does not exist or the connection cannot see it." });
186
+ }
187
+ function replaceDocumentTextProviderRejectedFailure() {
188
+ const value = emptyReplaceDocumentTextOutput;
189
+ return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "replaceDocumentText", message: "The connection cannot edit the document." });
190
+ }
191
+ function replaceDocumentTextInvalidResponseFailure() {
192
+ const value = emptyReplaceDocumentTextOutput;
193
+ return branchCase("invalidResponse", value, { kind: "PROTOCOL", provider: ConnectorID, operation: "replaceDocumentText", message: "Google returned a malformed document response." });
194
+ }
195
+ function appendTextAppended(value, failure) {
196
+ return branchCase("appended", value, failure);
197
+ }
198
+ function appendTextRevisionChanged(value, failure) {
199
+ return branchCase("revisionChanged", value, failure);
200
+ }
201
+ function appendTextNotFound(value, failure) {
202
+ return branchCase("notFound", value, failure);
203
+ }
204
+ function appendTextProviderRejected(value, failure) {
205
+ return branchCase("providerRejected", value, failure);
206
+ }
207
+ function appendTextInvalidResponse(value, failure) {
208
+ return branchCase("invalidResponse", value, failure);
209
+ }
210
+ function appendTextDefect(value, failure) {
211
+ return branchCase("defect", value, failure);
212
+ }
213
+ function appendTextRetry(failure, retryAfterMs = 0) {
214
+ return retryCase(failure, retryAfterMs);
215
+ }
216
+ function appendTextStampedPolicyDraft() {
217
+ const value = AppendTextOutputSchema.parse({ "documentId": "policyDraft1", "revisionId": "rev-draft-3" });
218
+ return branchCase("appended", value);
219
+ }
220
+ function appendTextDefault() {
221
+ return appendTextStampedPolicyDraft();
222
+ }
223
+ function appendTextRevisionChangedFailure() {
224
+ const value = emptyAppendTextOutput;
225
+ return branchCase("revisionChanged", value, { kind: "CONFLICT", provider: ConnectorID, operation: "appendText", message: "The document revision changed before the append." });
226
+ }
227
+ function appendTextNotFoundFailure() {
228
+ const value = emptyAppendTextOutput;
229
+ return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "appendText", message: "The document does not exist or the connection cannot see it." });
230
+ }
231
+ function appendTextProviderRejectedFailure() {
232
+ const value = emptyAppendTextOutput;
233
+ return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "appendText", message: "The connection cannot edit the document." });
234
+ }
235
+ function appendTextInvalidResponseFailure() {
236
+ const value = emptyAppendTextOutput;
237
+ return branchCase("invalidResponse", value, { kind: "PROTOCOL", provider: ConnectorID, operation: "appendText", message: "Google returned a malformed document response." });
238
+ }
239
+ var GeneratedMock = class {
240
+ #getDocumentText;
241
+ #createDocument;
242
+ #replaceDocumentText;
243
+ #appendText;
244
+ #connection;
245
+ constructor(connectionName) {
246
+ this.#getDocumentText = newQuery(GetDocumentTextDefinition).default(getDocumentTextDefault());
247
+ this.#createDocument = newMutation(CreateDocumentDefinition).default(createDocumentDefault());
248
+ this.#replaceDocumentText = newMutation(ReplaceDocumentTextDefinition).default(replaceDocumentTextDefault());
249
+ this.#appendText = newMutation(AppendTextDefinition).default(appendTextDefault());
250
+ this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
251
+ }
252
+ connection() {
253
+ return this.#connection;
254
+ }
255
+ getDocumentText() {
256
+ return this.#getDocumentText;
257
+ }
258
+ createDocument() {
259
+ return this.#createDocument;
260
+ }
261
+ replaceDocumentText() {
262
+ return this.#replaceDocumentText;
263
+ }
264
+ appendText() {
265
+ return this.#appendText;
266
+ }
267
+ assertNoFailures() {
268
+ this.#getDocumentText.assertNoFailures();
269
+ this.#createDocument.assertNoFailures();
270
+ this.#replaceDocumentText.assertNoFailures();
271
+ this.#appendText.assertNoFailures();
272
+ }
273
+ };
274
+ export {
275
+ GeneratedMock,
276
+ appendTextAppended,
277
+ appendTextDefault,
278
+ appendTextDefect,
279
+ appendTextInvalidResponse,
280
+ appendTextInvalidResponseFailure,
281
+ appendTextNotFound,
282
+ appendTextNotFoundFailure,
283
+ appendTextProviderRejected,
284
+ appendTextProviderRejectedFailure,
285
+ appendTextRetry,
286
+ appendTextRevisionChanged,
287
+ appendTextRevisionChangedFailure,
288
+ appendTextStampedPolicyDraft,
289
+ createDocumentCreated,
290
+ createDocumentCreatedPolicyDraft,
291
+ createDocumentDefault,
292
+ createDocumentDefect,
293
+ createDocumentInvalidResponse,
294
+ createDocumentInvalidResponseFailure,
295
+ createDocumentProviderRejected,
296
+ createDocumentProviderRejectedFailure,
297
+ createDocumentRetry,
298
+ createDocumentUncertain,
299
+ emptyAppendTextInput,
300
+ emptyAppendTextOutput,
301
+ emptyCreateDocumentInput,
302
+ emptyCreateDocumentOutput,
303
+ emptyCreatedDocument,
304
+ emptyGetDocumentTextInput,
305
+ emptyGetDocumentTextOutput,
306
+ emptyPlaceholderReplacement,
307
+ emptyPlaceholderReplacementResult,
308
+ emptyReplaceDocumentTextInput,
309
+ emptyReplaceDocumentTextOutput,
310
+ getDocumentTextDefault,
311
+ getDocumentTextDefect,
312
+ getDocumentTextInvalidResponse,
313
+ getDocumentTextInvalidResponseFailure,
314
+ getDocumentTextNotFound,
315
+ getDocumentTextNotFoundFailure,
316
+ getDocumentTextPolicyTemplate,
317
+ getDocumentTextProviderRejected,
318
+ getDocumentTextProviderRejectedFailure,
319
+ getDocumentTextRead,
320
+ getDocumentTextRetry,
321
+ getDocumentTextTooLarge,
322
+ getDocumentTextTooLargeFailure,
323
+ replaceDocumentTextDefault,
324
+ replaceDocumentTextDefect,
325
+ replaceDocumentTextFilledPolicyDraft,
326
+ replaceDocumentTextInvalidResponse,
327
+ replaceDocumentTextInvalidResponseFailure,
328
+ replaceDocumentTextNotFound,
329
+ replaceDocumentTextNotFoundFailure,
330
+ replaceDocumentTextPlaceholderNotFound,
331
+ replaceDocumentTextPlaceholderNotFoundFailure,
332
+ replaceDocumentTextProviderRejected,
333
+ replaceDocumentTextProviderRejectedFailure,
334
+ replaceDocumentTextReplaced,
335
+ replaceDocumentTextRetry,
336
+ replaceDocumentTextRevisionChanged,
337
+ replaceDocumentTextRevisionChangedFailure
338
+ };
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@superdurable/connector-google-docs",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "license": "MIT",
5
+ "description": "Dex Google Docs connector for TypeScript",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/superdurable/dex-connectors-library.git",
9
+ "directory": "connectors/google/docs/typescript"
10
+ },
11
+ "type": "module",
12
+ "engines": {
13
+ "node": "^22.0.0 || ^24.0.0"
14
+ },
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./mock": {
23
+ "types": "./dist/mock.d.ts",
24
+ "import": "./dist/mock.js"
25
+ },
26
+ "./dex-connector.json": "./dex-connector.json"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "dex-connector.json",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
36
+ "typecheck": "npm run build && tsc --noEmit",
37
+ "lint": "eslint src test examples",
38
+ "test": "npm run build && vitest run test/*.test.ts",
39
+ "test:integration": "npm run build && vitest run test/integration/*.integration.test.ts",
40
+ "example:worker": "npm run build && tsx examples/policy-documents/main.ts",
41
+ "example:start": "npm run build && tsx examples/policy-documents/start.ts",
42
+ "check": "npm run typecheck && npm run lint && npm test"
43
+ },
44
+ "dependencies": {
45
+ "@superdurable/connectors-sdk": "0.12.0",
46
+ "@superdurable/dex": ">=1.28.0",
47
+ "zod": "^4.1.0"
48
+ },
49
+ "devDependencies": {
50
+ "@eslint/js": "^9.0.0",
51
+ "@types/node": "^22.0.0",
52
+ "eslint": "^9.0.0",
53
+ "tsup": "^8.0.0",
54
+ "tsx": "^4.20.0",
55
+ "typescript": "^5.9.0",
56
+ "typescript-eslint": "^8.0.0",
57
+ "vitest": "^3.0.0",
58
+ "yaml": "^2.9.1"
59
+ }
60
+ }