@opengeni/contracts 0.50.0 → 1.0.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/atlassian.js +1 -1
- package/dist/{chunk-Q6A7XT2N.js → chunk-NX5JNF4L.js} +1900 -1847
- package/dist/chunk-NX5JNF4L.js.map +1 -0
- package/dist/google-drive.d.ts +88 -1
- package/dist/google-drive.js +65 -5
- package/dist/google-drive.js.map +1 -1
- package/dist/index.d.ts +79 -6
- package/dist/index.js +7 -1
- package/dist/knowledge.d.ts +73 -0
- package/package.json +1 -1
- package/src/google-drive.ts +76 -4
- package/src/index.ts +194 -136
- package/src/knowledge.ts +15 -0
- package/dist/chunk-Q6A7XT2N.js.map +0 -1
package/dist/knowledge.d.ts
CHANGED
|
@@ -47,6 +47,19 @@ export declare const KnowledgeSource: z.ZodObject<{
|
|
|
47
47
|
version: z.ZodNullable<z.ZodString>;
|
|
48
48
|
}, z.core.$strip>;
|
|
49
49
|
export type KnowledgeSource = z.infer<typeof KnowledgeSource>;
|
|
50
|
+
export declare const KnowledgeProviderCitation: z.ZodObject<{
|
|
51
|
+
provider: z.ZodLiteral<"google_drive">;
|
|
52
|
+
externalObjectId: z.ZodString;
|
|
53
|
+
providerRevision: z.ZodNullable<z.ZodString>;
|
|
54
|
+
sourceVersion: z.ZodString;
|
|
55
|
+
driveId: z.ZodNullable<z.ZodString>;
|
|
56
|
+
deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
57
|
+
aclRevision: z.ZodString;
|
|
58
|
+
authorizationObservedAt: z.ZodString;
|
|
59
|
+
authorizationExpiresAt: z.ZodString;
|
|
60
|
+
reauthorizedAt: z.ZodString;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type KnowledgeProviderCitation = z.infer<typeof KnowledgeProviderCitation>;
|
|
50
63
|
export declare const KnowledgeLinkTarget: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
51
64
|
kind: z.ZodLiteral<"knowledge">;
|
|
52
65
|
id: z.ZodString;
|
|
@@ -121,6 +134,18 @@ export declare const KnowledgeRecord: z.ZodObject<{
|
|
|
121
134
|
version: z.ZodNullable<z.ZodString>;
|
|
122
135
|
}, z.core.$strip>;
|
|
123
136
|
indexedAt: z.ZodString;
|
|
137
|
+
citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
138
|
+
provider: z.ZodLiteral<"google_drive">;
|
|
139
|
+
externalObjectId: z.ZodString;
|
|
140
|
+
providerRevision: z.ZodNullable<z.ZodString>;
|
|
141
|
+
sourceVersion: z.ZodString;
|
|
142
|
+
driveId: z.ZodNullable<z.ZodString>;
|
|
143
|
+
deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
144
|
+
aclRevision: z.ZodString;
|
|
145
|
+
authorizationObservedAt: z.ZodString;
|
|
146
|
+
authorizationExpiresAt: z.ZodString;
|
|
147
|
+
reauthorizedAt: z.ZodString;
|
|
148
|
+
}, z.core.$strip>>>;
|
|
124
149
|
}, z.core.$strip>;
|
|
125
150
|
lifecycle: z.ZodObject<{
|
|
126
151
|
state: z.ZodLiteral<"active">;
|
|
@@ -208,6 +233,18 @@ export declare const KnowledgeSearchResult: z.ZodObject<{
|
|
|
208
233
|
version: z.ZodNullable<z.ZodString>;
|
|
209
234
|
}, z.core.$strip>;
|
|
210
235
|
indexedAt: z.ZodString;
|
|
236
|
+
citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
237
|
+
provider: z.ZodLiteral<"google_drive">;
|
|
238
|
+
externalObjectId: z.ZodString;
|
|
239
|
+
providerRevision: z.ZodNullable<z.ZodString>;
|
|
240
|
+
sourceVersion: z.ZodString;
|
|
241
|
+
driveId: z.ZodNullable<z.ZodString>;
|
|
242
|
+
deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
243
|
+
aclRevision: z.ZodString;
|
|
244
|
+
authorizationObservedAt: z.ZodString;
|
|
245
|
+
authorizationExpiresAt: z.ZodString;
|
|
246
|
+
reauthorizedAt: z.ZodString;
|
|
247
|
+
}, z.core.$strip>>>;
|
|
211
248
|
}, z.core.$strip>;
|
|
212
249
|
lifecycle: z.ZodObject<{
|
|
213
250
|
state: z.ZodLiteral<"active">;
|
|
@@ -307,6 +344,18 @@ export declare const KnowledgeSearchResponse: z.ZodObject<{
|
|
|
307
344
|
version: z.ZodNullable<z.ZodString>;
|
|
308
345
|
}, z.core.$strip>;
|
|
309
346
|
indexedAt: z.ZodString;
|
|
347
|
+
citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
348
|
+
provider: z.ZodLiteral<"google_drive">;
|
|
349
|
+
externalObjectId: z.ZodString;
|
|
350
|
+
providerRevision: z.ZodNullable<z.ZodString>;
|
|
351
|
+
sourceVersion: z.ZodString;
|
|
352
|
+
driveId: z.ZodNullable<z.ZodString>;
|
|
353
|
+
deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
354
|
+
aclRevision: z.ZodString;
|
|
355
|
+
authorizationObservedAt: z.ZodString;
|
|
356
|
+
authorizationExpiresAt: z.ZodString;
|
|
357
|
+
reauthorizedAt: z.ZodString;
|
|
358
|
+
}, z.core.$strip>>>;
|
|
310
359
|
}, z.core.$strip>;
|
|
311
360
|
lifecycle: z.ZodObject<{
|
|
312
361
|
state: z.ZodLiteral<"active">;
|
|
@@ -406,6 +455,18 @@ export declare const KnowledgeGetResponse: z.ZodObject<{
|
|
|
406
455
|
version: z.ZodNullable<z.ZodString>;
|
|
407
456
|
}, z.core.$strip>;
|
|
408
457
|
indexedAt: z.ZodString;
|
|
458
|
+
citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
459
|
+
provider: z.ZodLiteral<"google_drive">;
|
|
460
|
+
externalObjectId: z.ZodString;
|
|
461
|
+
providerRevision: z.ZodNullable<z.ZodString>;
|
|
462
|
+
sourceVersion: z.ZodString;
|
|
463
|
+
driveId: z.ZodNullable<z.ZodString>;
|
|
464
|
+
deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
465
|
+
aclRevision: z.ZodString;
|
|
466
|
+
authorizationObservedAt: z.ZodString;
|
|
467
|
+
authorizationExpiresAt: z.ZodString;
|
|
468
|
+
reauthorizedAt: z.ZodString;
|
|
469
|
+
}, z.core.$strip>>>;
|
|
409
470
|
}, z.core.$strip>;
|
|
410
471
|
lifecycle: z.ZodObject<{
|
|
411
472
|
state: z.ZodLiteral<"active">;
|
|
@@ -494,6 +555,18 @@ export declare const KnowledgeBrowseResponse: z.ZodObject<{
|
|
|
494
555
|
version: z.ZodNullable<z.ZodString>;
|
|
495
556
|
}, z.core.$strip>;
|
|
496
557
|
indexedAt: z.ZodString;
|
|
558
|
+
citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
559
|
+
provider: z.ZodLiteral<"google_drive">;
|
|
560
|
+
externalObjectId: z.ZodString;
|
|
561
|
+
providerRevision: z.ZodNullable<z.ZodString>;
|
|
562
|
+
sourceVersion: z.ZodString;
|
|
563
|
+
driveId: z.ZodNullable<z.ZodString>;
|
|
564
|
+
deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
565
|
+
aclRevision: z.ZodString;
|
|
566
|
+
authorizationObservedAt: z.ZodString;
|
|
567
|
+
authorizationExpiresAt: z.ZodString;
|
|
568
|
+
reauthorizedAt: z.ZodString;
|
|
569
|
+
}, z.core.$strip>>>;
|
|
497
570
|
}, z.core.$strip>;
|
|
498
571
|
lifecycle: z.ZodObject<{
|
|
499
572
|
state: z.ZodLiteral<"active">;
|
package/package.json
CHANGED
package/src/google-drive.ts
CHANGED
|
@@ -17,9 +17,13 @@ export const GOOGLE_DRIVE_READONLY_SCOPE =
|
|
|
17
17
|
export const GOOGLE_DRIVE_CREDENTIAL_ROLE = "google_drive_metadata" as const;
|
|
18
18
|
export const GOOGLE_DRIVE_CREDENTIAL_LABEL = "Google Drive read-only source sync" as const;
|
|
19
19
|
export const GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL = "Google Drive metadata browser" as const;
|
|
20
|
+
export const GOOGLE_DRIVE_PUBLICATION_SERVER_ID = "google-drive-publishing" as const;
|
|
21
|
+
export const GOOGLE_DRIVE_PUBLICATION_TOOL_NAME = "google_drive_publish_file" as const;
|
|
22
|
+
export const GOOGLE_DRIVE_PUBLICATION_CREATE_ACTION = "create" as const;
|
|
20
23
|
|
|
21
24
|
export const GoogleDriveOAuthCapability = z.enum([
|
|
22
25
|
"picker_file_read",
|
|
26
|
+
"publish_file",
|
|
23
27
|
"source_metadata_discovery",
|
|
24
28
|
"source_content_read",
|
|
25
29
|
"recursive_source_sync",
|
|
@@ -27,7 +31,7 @@ export const GoogleDriveOAuthCapability = z.enum([
|
|
|
27
31
|
export type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;
|
|
28
32
|
|
|
29
33
|
export type GoogleDriveOAuthScopeDecision = {
|
|
30
|
-
accessMode: "metadata_readonly" | "readonly" | null;
|
|
34
|
+
accessMode: "file_only" | "metadata_readonly" | "readonly" | null;
|
|
31
35
|
capabilities: GoogleDriveOAuthCapability[];
|
|
32
36
|
};
|
|
33
37
|
|
|
@@ -43,11 +47,13 @@ export function googleDriveOAuthScopeDecision(
|
|
|
43
47
|
const granted = new Set(grantedScopes);
|
|
44
48
|
const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);
|
|
45
49
|
const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);
|
|
50
|
+
const hasFileWrite = hasFullDrive || granted.has(GOOGLE_DRIVE_FILE_SCOPE);
|
|
46
51
|
const hasSourceMetadataDiscovery =
|
|
47
52
|
hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);
|
|
48
|
-
const hasPickerFileRead = hasSourceContentRead ||
|
|
53
|
+
const hasPickerFileRead = hasSourceContentRead || hasFileWrite;
|
|
49
54
|
const capabilities: GoogleDriveOAuthCapability[] = [];
|
|
50
55
|
if (hasPickerFileRead) capabilities.push("picker_file_read");
|
|
56
|
+
if (hasFileWrite) capabilities.push("publish_file");
|
|
51
57
|
if (hasSourceMetadataDiscovery) capabilities.push("source_metadata_discovery");
|
|
52
58
|
if (hasSourceContentRead) {
|
|
53
59
|
capabilities.push("source_content_read", "recursive_source_sync");
|
|
@@ -57,7 +63,9 @@ export function googleDriveOAuthScopeDecision(
|
|
|
57
63
|
? "readonly"
|
|
58
64
|
: hasSourceMetadataDiscovery
|
|
59
65
|
? "metadata_readonly"
|
|
60
|
-
:
|
|
66
|
+
: hasFileWrite
|
|
67
|
+
? "file_only"
|
|
68
|
+
: null,
|
|
61
69
|
capabilities,
|
|
62
70
|
};
|
|
63
71
|
}
|
|
@@ -148,6 +156,26 @@ export const GoogleDriveSelectedSource = z.object({
|
|
|
148
156
|
});
|
|
149
157
|
export type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;
|
|
150
158
|
|
|
159
|
+
export const GoogleDriveOutputDestination = z
|
|
160
|
+
.object({
|
|
161
|
+
folderId: z.string().min(1).max(256),
|
|
162
|
+
folderName: z.string().min(1).max(1024),
|
|
163
|
+
driveId: z.string().min(1).max(256).nullable(),
|
|
164
|
+
location: z.enum(["my_drive", "shared_drive"]),
|
|
165
|
+
selectedAt: z.string().datetime({ offset: true }),
|
|
166
|
+
})
|
|
167
|
+
.strict()
|
|
168
|
+
.superRefine((value, context) => {
|
|
169
|
+
if ((value.location === "my_drive") !== (value.driveId === null)) {
|
|
170
|
+
context.addIssue({
|
|
171
|
+
code: "custom",
|
|
172
|
+
path: ["driveId"],
|
|
173
|
+
message: "Google Drive destination location does not match its drive identity",
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
export type GoogleDriveOutputDestination = z.infer<typeof GoogleDriveOutputDestination>;
|
|
178
|
+
|
|
151
179
|
export const GoogleDriveConnectionMetadata = z
|
|
152
180
|
.object({
|
|
153
181
|
credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),
|
|
@@ -159,8 +187,9 @@ export const GoogleDriveConnectionMetadata = z
|
|
|
159
187
|
googleEmail: z.string().email().max(320),
|
|
160
188
|
googleDisplayName: z.string().min(1).max(512).nullable(),
|
|
161
189
|
verifiedAt: z.string().datetime({ offset: true }),
|
|
162
|
-
accessMode: z.enum(["metadata_readonly", "readonly"]),
|
|
190
|
+
accessMode: z.enum(["file_only", "metadata_readonly", "readonly"]),
|
|
163
191
|
lifecycle: GoogleDriveConnectionLifecycle.optional(),
|
|
192
|
+
outputDestination: GoogleDriveOutputDestination.optional(),
|
|
164
193
|
documentDestination: ConnectorDocumentDestination.optional(),
|
|
165
194
|
selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),
|
|
166
195
|
/** @deprecated Read `selectedSources`; retained while existing connections migrate. */
|
|
@@ -171,6 +200,7 @@ export type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnection
|
|
|
171
200
|
|
|
172
201
|
export const GoogleDriveOAuthStartRequest = z.object({
|
|
173
202
|
connectionId: z.string().uuid().optional(),
|
|
203
|
+
capability: z.enum(["source_read", "publish"]).default("source_read"),
|
|
174
204
|
});
|
|
175
205
|
export type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;
|
|
176
206
|
|
|
@@ -192,6 +222,48 @@ export const GoogleDriveDisconnectRequest = z.object({
|
|
|
192
222
|
});
|
|
193
223
|
export type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;
|
|
194
224
|
|
|
225
|
+
export const GoogleDrivePublicationExportFile = z
|
|
226
|
+
.object({
|
|
227
|
+
fileId: z.string().uuid(),
|
|
228
|
+
filename: z.string().trim().min(1).max(512),
|
|
229
|
+
contentType: z.string().trim().min(1).max(256),
|
|
230
|
+
sizeBytes: z.number().int().positive(),
|
|
231
|
+
sha256: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
232
|
+
artifactId: z.string().regex(/^[0-9a-f]{32}$/u),
|
|
233
|
+
versionId: z.string().regex(/^[0-9a-f]{32}$/u),
|
|
234
|
+
materializationJobId: z.string().regex(/^[0-9a-f]{32}$/u),
|
|
235
|
+
sourceHeadSequence: z.number().int().nonnegative(),
|
|
236
|
+
sourceStateHash: z.string().regex(/^sha256:[0-9a-f]{64}$/u),
|
|
237
|
+
})
|
|
238
|
+
.strict();
|
|
239
|
+
export type GoogleDrivePublicationExportFile = z.infer<typeof GoogleDrivePublicationExportFile>;
|
|
240
|
+
|
|
241
|
+
export const GoogleDrivePublicationToolInput = z
|
|
242
|
+
.object({
|
|
243
|
+
title: z.string().trim().min(1).max(512),
|
|
244
|
+
modality: z.enum(["document", "spreadsheet", "presentation"]),
|
|
245
|
+
file: GoogleDrivePublicationExportFile,
|
|
246
|
+
idempotencyKey: z.string().trim().min(1).max(200),
|
|
247
|
+
})
|
|
248
|
+
.strict();
|
|
249
|
+
export type GoogleDrivePublicationToolInput = z.infer<typeof GoogleDrivePublicationToolInput>;
|
|
250
|
+
|
|
251
|
+
export const GoogleDrivePublicationReceipt = z
|
|
252
|
+
.object({
|
|
253
|
+
connectionId: z.string().uuid(),
|
|
254
|
+
providerFileId: z.string().min(1).max(256),
|
|
255
|
+
webViewLink: z.string().url(),
|
|
256
|
+
mimeType: z.enum([
|
|
257
|
+
"application/vnd.google-apps.document",
|
|
258
|
+
"application/vnd.google-apps.spreadsheet",
|
|
259
|
+
"application/vnd.google-apps.presentation",
|
|
260
|
+
]),
|
|
261
|
+
destination: GoogleDriveOutputDestination,
|
|
262
|
+
replayed: z.boolean(),
|
|
263
|
+
})
|
|
264
|
+
.strict();
|
|
265
|
+
export type GoogleDrivePublicationReceipt = z.infer<typeof GoogleDrivePublicationReceipt>;
|
|
266
|
+
|
|
195
267
|
export const GoogleDriveBrowseItem = z.object({
|
|
196
268
|
id: z.string().min(1).max(256),
|
|
197
269
|
name: z.string().min(1).max(1024),
|