@opengeni/contracts 0.36.0 → 0.37.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/dist/{chunk-F4KMLKSL.js → chunk-WVE7RAHN.js} +2 -2
- package/dist/chunk-WVE7RAHN.js.map +1 -0
- package/dist/chunk-WYBDERIY.js +102 -0
- package/dist/chunk-WYBDERIY.js.map +1 -0
- package/dist/connector-destinations.d.ts +48 -0
- package/dist/connector-destinations.js +21 -0
- package/dist/connector-destinations.js.map +1 -0
- package/dist/google-drive.d.ts +61 -8
- package/dist/google-drive.js +14 -3
- package/dist/google-drive.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +19 -1
- package/package.json +5 -1
- package/src/connector-destinations.ts +132 -0
- package/src/google-drive.ts +32 -18
- package/src/index.ts +7 -2
- package/dist/chunk-F4KMLKSL.js.map +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// src/connector-destinations.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var ConnectorDocumentDestinationAuthority = z.enum([
|
|
4
|
+
"organization",
|
|
5
|
+
"workspace",
|
|
6
|
+
"personal"
|
|
7
|
+
]);
|
|
8
|
+
var ConnectorDocumentDestinationSelection = z.object({
|
|
9
|
+
authorityKind: ConnectorDocumentDestinationAuthority,
|
|
10
|
+
collectionId: z.string().uuid().nullable().default(null)
|
|
11
|
+
});
|
|
12
|
+
var ConnectorDocumentDestination = z.object({
|
|
13
|
+
authorityKind: ConnectorDocumentDestinationAuthority,
|
|
14
|
+
authorityAccountId: z.string().uuid(),
|
|
15
|
+
authorityWorkspaceId: z.string().uuid().nullable(),
|
|
16
|
+
authoritySubjectId: z.string().trim().min(1).max(1024).nullable(),
|
|
17
|
+
collectionId: z.string().uuid().nullable().default(null)
|
|
18
|
+
}).superRefine((destination, context) => {
|
|
19
|
+
if (destination.authorityKind === "organization") {
|
|
20
|
+
if (destination.authorityWorkspaceId !== null || destination.authoritySubjectId !== null) {
|
|
21
|
+
context.addIssue({
|
|
22
|
+
code: "custom",
|
|
23
|
+
message: "organization connector destinations cannot bind workspace or subject authority"
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (destination.authorityWorkspaceId === null) {
|
|
29
|
+
context.addIssue({
|
|
30
|
+
code: "custom",
|
|
31
|
+
message: "workspace and personal connector destinations require workspace authority"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (destination.authorityKind === "workspace" && destination.authoritySubjectId !== null) {
|
|
35
|
+
context.addIssue({
|
|
36
|
+
code: "custom",
|
|
37
|
+
message: "workspace connector destinations cannot bind subject authority"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (destination.authorityKind === "personal" && destination.authoritySubjectId === null) {
|
|
41
|
+
context.addIssue({
|
|
42
|
+
code: "custom",
|
|
43
|
+
message: "personal connector destinations require immutable subject authority"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
function bindConnectorDocumentDestination(selection, context) {
|
|
48
|
+
return ConnectorDocumentDestination.parse({
|
|
49
|
+
authorityKind: selection.authorityKind,
|
|
50
|
+
authorityAccountId: context.accountId,
|
|
51
|
+
authorityWorkspaceId: selection.authorityKind === "organization" ? null : context.workspaceId,
|
|
52
|
+
authoritySubjectId: selection.authorityKind === "personal" ? context.initiatingSubjectId : null,
|
|
53
|
+
collectionId: selection.collectionId
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function legacyWorkspaceConnectorDocumentDestination(context) {
|
|
57
|
+
return ConnectorDocumentDestination.parse({
|
|
58
|
+
authorityKind: "workspace",
|
|
59
|
+
authorityAccountId: context.accountId,
|
|
60
|
+
authorityWorkspaceId: context.workspaceId,
|
|
61
|
+
authoritySubjectId: null,
|
|
62
|
+
collectionId: null
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function resolveConnectorDocumentDestination(value, context) {
|
|
66
|
+
if (value === void 0 || value === null) {
|
|
67
|
+
return legacyWorkspaceConnectorDocumentDestination(context);
|
|
68
|
+
}
|
|
69
|
+
const destination = ConnectorDocumentDestination.parse(value);
|
|
70
|
+
if (destination.authorityAccountId !== context.accountId) {
|
|
71
|
+
throw new Error("connector destination organization authority mismatch");
|
|
72
|
+
}
|
|
73
|
+
if (destination.authorityKind !== "organization" && destination.authorityWorkspaceId !== context.workspaceId) {
|
|
74
|
+
throw new Error("connector destination workspace authority mismatch");
|
|
75
|
+
}
|
|
76
|
+
if (destination.authorityKind === "personal" && destination.authoritySubjectId !== context.connectionSubjectId) {
|
|
77
|
+
throw new Error("connector destination personal authority mismatch");
|
|
78
|
+
}
|
|
79
|
+
return destination;
|
|
80
|
+
}
|
|
81
|
+
function connectorDestinationDocumentAuthority(destination) {
|
|
82
|
+
return {
|
|
83
|
+
authorityKind: destination.authorityKind,
|
|
84
|
+
authorityWorkspaceId: destination.authorityWorkspaceId,
|
|
85
|
+
authoritySubjectId: destination.authoritySubjectId
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function connectorDocumentDestinationCollectionId(destination, defaultCollectionId) {
|
|
89
|
+
return destination.collectionId ?? z.string().uuid().parse(defaultCollectionId);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
ConnectorDocumentDestinationAuthority,
|
|
94
|
+
ConnectorDocumentDestinationSelection,
|
|
95
|
+
ConnectorDocumentDestination,
|
|
96
|
+
bindConnectorDocumentDestination,
|
|
97
|
+
legacyWorkspaceConnectorDocumentDestination,
|
|
98
|
+
resolveConnectorDocumentDestination,
|
|
99
|
+
connectorDestinationDocumentAuthority,
|
|
100
|
+
connectorDocumentDestinationCollectionId
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=chunk-WYBDERIY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/connector-destinations.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ConnectorDocumentDestinationAuthority = z.enum([\n \"organization\",\n \"workspace\",\n \"personal\",\n]);\nexport type ConnectorDocumentDestinationAuthority = z.infer<\n typeof ConnectorDocumentDestinationAuthority\n>;\n\nexport const ConnectorDocumentDestinationSelection = z.object({\n authorityKind: ConnectorDocumentDestinationAuthority,\n collectionId: z.string().uuid().nullable().default(null),\n});\nexport type ConnectorDocumentDestinationSelection = z.infer<\n typeof ConnectorDocumentDestinationSelection\n>;\n\nexport const ConnectorDocumentDestination = z\n .object({\n authorityKind: ConnectorDocumentDestinationAuthority,\n authorityAccountId: z.string().uuid(),\n authorityWorkspaceId: z.string().uuid().nullable(),\n authoritySubjectId: z.string().trim().min(1).max(1024).nullable(),\n collectionId: z.string().uuid().nullable().default(null),\n })\n .superRefine((destination, context) => {\n if (destination.authorityKind === \"organization\") {\n if (destination.authorityWorkspaceId !== null || destination.authoritySubjectId !== null) {\n context.addIssue({\n code: \"custom\",\n message: \"organization connector destinations cannot bind workspace or subject authority\",\n });\n }\n return;\n }\n if (destination.authorityWorkspaceId === null) {\n context.addIssue({\n code: \"custom\",\n message: \"workspace and personal connector destinations require workspace authority\",\n });\n }\n if (destination.authorityKind === \"workspace\" && destination.authoritySubjectId !== null) {\n context.addIssue({\n code: \"custom\",\n message: \"workspace connector destinations cannot bind subject authority\",\n });\n }\n if (destination.authorityKind === \"personal\" && destination.authoritySubjectId === null) {\n context.addIssue({\n code: \"custom\",\n message: \"personal connector destinations require immutable subject authority\",\n });\n }\n });\nexport type ConnectorDocumentDestination = z.infer<typeof ConnectorDocumentDestination>;\n\nexport function bindConnectorDocumentDestination(\n selection: ConnectorDocumentDestinationSelection,\n context: { accountId: string; workspaceId: string; initiatingSubjectId: string },\n): ConnectorDocumentDestination {\n return ConnectorDocumentDestination.parse({\n authorityKind: selection.authorityKind,\n authorityAccountId: context.accountId,\n authorityWorkspaceId: selection.authorityKind === \"organization\" ? null : context.workspaceId,\n authoritySubjectId: selection.authorityKind === \"personal\" ? context.initiatingSubjectId : null,\n collectionId: selection.collectionId,\n });\n}\n\nexport function legacyWorkspaceConnectorDocumentDestination(context: {\n accountId: string;\n workspaceId: string;\n}): ConnectorDocumentDestination {\n return ConnectorDocumentDestination.parse({\n authorityKind: \"workspace\",\n authorityAccountId: context.accountId,\n authorityWorkspaceId: context.workspaceId,\n authoritySubjectId: null,\n collectionId: null,\n });\n}\n\nexport function resolveConnectorDocumentDestination(\n value: unknown,\n context: {\n accountId: string;\n workspaceId: string;\n connectionSubjectId?: string | null | undefined;\n },\n): ConnectorDocumentDestination {\n if (value === undefined || value === null) {\n return legacyWorkspaceConnectorDocumentDestination(context);\n }\n const destination = ConnectorDocumentDestination.parse(value);\n if (destination.authorityAccountId !== context.accountId) {\n throw new Error(\"connector destination organization authority mismatch\");\n }\n if (\n destination.authorityKind !== \"organization\" &&\n destination.authorityWorkspaceId !== context.workspaceId\n ) {\n throw new Error(\"connector destination workspace authority mismatch\");\n }\n if (\n destination.authorityKind === \"personal\" &&\n destination.authoritySubjectId !== context.connectionSubjectId\n ) {\n throw new Error(\"connector destination personal authority mismatch\");\n }\n return destination;\n}\n\nexport function connectorDestinationDocumentAuthority(destination: ConnectorDocumentDestination): {\n authorityKind: ConnectorDocumentDestinationAuthority;\n authorityWorkspaceId: string | null;\n authoritySubjectId: string | null;\n} {\n return {\n authorityKind: destination.authorityKind,\n authorityWorkspaceId: destination.authorityWorkspaceId,\n authoritySubjectId: destination.authoritySubjectId,\n };\n}\n\nexport function connectorDocumentDestinationCollectionId(\n destination: ConnectorDocumentDestination,\n defaultCollectionId: string,\n): string {\n return destination.collectionId ?? z.string().uuid().parse(defaultCollectionId);\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,wCAAwC,EAAE,KAAK;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAKM,IAAM,wCAAwC,EAAE,OAAO;AAAA,EAC5D,eAAe;AAAA,EACf,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAA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AEO,SAAS,4CAA4C,SAG3B;AAC/B,SAAO,6BAA6B,MAAM;AAAA,IACxC,eAAe;AAAA,IACf,oBAAoB,QAAQ;AAAA,IAC5B,sBAAsB,QAAQ;AAAA,IAC9B,oBAAoB;AAAA,IACpB,cAAc;AAAA,EAChB,CAAC;AACH;AAEO,SAAS,oCACd,OACA,SAK8B;AAC9B,MAAI,UAAU,UAAa,UAAU,MAAM;AACzC,WAAO,4CAA4C,OAAO;AAAA,EAC5D;AACA,QAAM,cAAc,6BAA6B,MAAM,KAAK;AAC5D,MAAI,YAAY,uBAAuB,QAAQ,WAAW;AACxD,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,MACE,YAAY,kBAAkB,kBAC9B,YAAY,yBAAyB,QAAQ,aAC7C;AACA,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,MACE,YAAY,kBAAkB,cAC9B,YAAY,uBAAuB,QAAQ,qBAC3C;AACA,UAAM,IAAI,MAAM,mDAAmD;AAAA,EACrE;AACA,SAAO;AACT;AAEO,SAAS,sCAAsC,aAIpD;AACA,SAAO;AAAA,IACL,eAAe,YAAY;AAAA,IAC3B,sBAAsB,YAAY;AAAA,IAClC,oBAAoB,YAAY;AAAA,EAClC;AACF;AAEO,SAAS,yCACd,aACA,qBACQ;AACR,SAAO,YAAY,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB;AAChF;","names":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ConnectorDocumentDestinationAuthority: z.ZodEnum<{
|
|
3
|
+
organization: "organization";
|
|
4
|
+
personal: "personal";
|
|
5
|
+
workspace: "workspace";
|
|
6
|
+
}>;
|
|
7
|
+
export type ConnectorDocumentDestinationAuthority = z.infer<typeof ConnectorDocumentDestinationAuthority>;
|
|
8
|
+
export declare const ConnectorDocumentDestinationSelection: z.ZodObject<{
|
|
9
|
+
authorityKind: z.ZodEnum<{
|
|
10
|
+
organization: "organization";
|
|
11
|
+
personal: "personal";
|
|
12
|
+
workspace: "workspace";
|
|
13
|
+
}>;
|
|
14
|
+
collectionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type ConnectorDocumentDestinationSelection = z.infer<typeof ConnectorDocumentDestinationSelection>;
|
|
17
|
+
export declare const ConnectorDocumentDestination: z.ZodObject<{
|
|
18
|
+
authorityKind: z.ZodEnum<{
|
|
19
|
+
organization: "organization";
|
|
20
|
+
personal: "personal";
|
|
21
|
+
workspace: "workspace";
|
|
22
|
+
}>;
|
|
23
|
+
authorityAccountId: z.ZodString;
|
|
24
|
+
authorityWorkspaceId: z.ZodNullable<z.ZodString>;
|
|
25
|
+
authoritySubjectId: z.ZodNullable<z.ZodString>;
|
|
26
|
+
collectionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type ConnectorDocumentDestination = z.infer<typeof ConnectorDocumentDestination>;
|
|
29
|
+
export declare function bindConnectorDocumentDestination(selection: ConnectorDocumentDestinationSelection, context: {
|
|
30
|
+
accountId: string;
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
initiatingSubjectId: string;
|
|
33
|
+
}): ConnectorDocumentDestination;
|
|
34
|
+
export declare function legacyWorkspaceConnectorDocumentDestination(context: {
|
|
35
|
+
accountId: string;
|
|
36
|
+
workspaceId: string;
|
|
37
|
+
}): ConnectorDocumentDestination;
|
|
38
|
+
export declare function resolveConnectorDocumentDestination(value: unknown, context: {
|
|
39
|
+
accountId: string;
|
|
40
|
+
workspaceId: string;
|
|
41
|
+
connectionSubjectId?: string | null | undefined;
|
|
42
|
+
}): ConnectorDocumentDestination;
|
|
43
|
+
export declare function connectorDestinationDocumentAuthority(destination: ConnectorDocumentDestination): {
|
|
44
|
+
authorityKind: ConnectorDocumentDestinationAuthority;
|
|
45
|
+
authorityWorkspaceId: string | null;
|
|
46
|
+
authoritySubjectId: string | null;
|
|
47
|
+
};
|
|
48
|
+
export declare function connectorDocumentDestinationCollectionId(destination: ConnectorDocumentDestination, defaultCollectionId: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectorDocumentDestination,
|
|
3
|
+
ConnectorDocumentDestinationAuthority,
|
|
4
|
+
ConnectorDocumentDestinationSelection,
|
|
5
|
+
bindConnectorDocumentDestination,
|
|
6
|
+
connectorDestinationDocumentAuthority,
|
|
7
|
+
connectorDocumentDestinationCollectionId,
|
|
8
|
+
legacyWorkspaceConnectorDocumentDestination,
|
|
9
|
+
resolveConnectorDocumentDestination
|
|
10
|
+
} from "./chunk-WYBDERIY.js";
|
|
11
|
+
export {
|
|
12
|
+
ConnectorDocumentDestination,
|
|
13
|
+
ConnectorDocumentDestinationAuthority,
|
|
14
|
+
ConnectorDocumentDestinationSelection,
|
|
15
|
+
bindConnectorDocumentDestination,
|
|
16
|
+
connectorDestinationDocumentAuthority,
|
|
17
|
+
connectorDocumentDestinationCollectionId,
|
|
18
|
+
legacyWorkspaceConnectorDocumentDestination,
|
|
19
|
+
resolveConnectorDocumentDestination
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=connector-destinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/google-drive.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type GoogleDriveOAuthScopeDecision = {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function googleDriveOAuthScopeDecision(grantedScopes: readonly string[]): GoogleDriveOAuthScopeDecision;
|
|
27
27
|
export declare function googleDriveScopesAllowCapability(grantedScopes: readonly string[], capability: GoogleDriveOAuthCapability): boolean;
|
|
28
|
+
/** @deprecated Connector document destinations use organization/workspace/personal authority. */
|
|
28
29
|
export declare const GoogleDriveTargetScope: z.ZodEnum<{
|
|
29
30
|
organization: "organization";
|
|
30
31
|
user: "user";
|
|
@@ -88,11 +89,22 @@ export declare const GoogleDriveSelectedSource: z.ZodObject<{
|
|
|
88
89
|
name: z.ZodString;
|
|
89
90
|
mimeType: z.ZodString;
|
|
90
91
|
driveId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
91
|
-
|
|
92
|
+
destination: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
authorityKind: z.ZodEnum<{
|
|
94
|
+
organization: "organization";
|
|
95
|
+
personal: "personal";
|
|
96
|
+
workspace: "workspace";
|
|
97
|
+
}>;
|
|
98
|
+
authorityAccountId: z.ZodString;
|
|
99
|
+
authorityWorkspaceId: z.ZodNullable<z.ZodString>;
|
|
100
|
+
authoritySubjectId: z.ZodNullable<z.ZodString>;
|
|
101
|
+
collectionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
targetScope: z.ZodOptional<z.ZodEnum<{
|
|
92
104
|
organization: "organization";
|
|
93
105
|
user: "user";
|
|
94
106
|
workspace: "workspace";
|
|
95
|
-
}
|
|
107
|
+
}>>;
|
|
96
108
|
syncCadence: z.ZodDefault<z.ZodEnum<{
|
|
97
109
|
daily: "daily";
|
|
98
110
|
hourly: "hourly";
|
|
@@ -146,16 +158,38 @@ export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
|
|
|
146
158
|
recoverable: z.ZodLiteral<true>;
|
|
147
159
|
observedAt: z.ZodString;
|
|
148
160
|
}, z.core.$strip>], "state">>;
|
|
161
|
+
documentDestination: z.ZodOptional<z.ZodObject<{
|
|
162
|
+
authorityKind: z.ZodEnum<{
|
|
163
|
+
organization: "organization";
|
|
164
|
+
personal: "personal";
|
|
165
|
+
workspace: "workspace";
|
|
166
|
+
}>;
|
|
167
|
+
authorityAccountId: z.ZodString;
|
|
168
|
+
authorityWorkspaceId: z.ZodNullable<z.ZodString>;
|
|
169
|
+
authoritySubjectId: z.ZodNullable<z.ZodString>;
|
|
170
|
+
collectionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
171
|
+
}, z.core.$strip>>;
|
|
149
172
|
selectedSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
150
173
|
id: z.ZodString;
|
|
151
174
|
name: z.ZodString;
|
|
152
175
|
mimeType: z.ZodString;
|
|
153
176
|
driveId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
154
|
-
|
|
177
|
+
destination: z.ZodOptional<z.ZodObject<{
|
|
178
|
+
authorityKind: z.ZodEnum<{
|
|
179
|
+
organization: "organization";
|
|
180
|
+
personal: "personal";
|
|
181
|
+
workspace: "workspace";
|
|
182
|
+
}>;
|
|
183
|
+
authorityAccountId: z.ZodString;
|
|
184
|
+
authorityWorkspaceId: z.ZodNullable<z.ZodString>;
|
|
185
|
+
authoritySubjectId: z.ZodNullable<z.ZodString>;
|
|
186
|
+
collectionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
}, z.core.$strip>>;
|
|
188
|
+
targetScope: z.ZodOptional<z.ZodEnum<{
|
|
155
189
|
organization: "organization";
|
|
156
190
|
user: "user";
|
|
157
191
|
workspace: "workspace";
|
|
158
|
-
}
|
|
192
|
+
}>>;
|
|
159
193
|
syncCadence: z.ZodDefault<z.ZodEnum<{
|
|
160
194
|
daily: "daily";
|
|
161
195
|
hourly: "hourly";
|
|
@@ -173,11 +207,22 @@ export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
|
|
|
173
207
|
name: z.ZodString;
|
|
174
208
|
mimeType: z.ZodString;
|
|
175
209
|
driveId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
176
|
-
|
|
210
|
+
destination: z.ZodOptional<z.ZodObject<{
|
|
211
|
+
authorityKind: z.ZodEnum<{
|
|
212
|
+
organization: "organization";
|
|
213
|
+
personal: "personal";
|
|
214
|
+
workspace: "workspace";
|
|
215
|
+
}>;
|
|
216
|
+
authorityAccountId: z.ZodString;
|
|
217
|
+
authorityWorkspaceId: z.ZodNullable<z.ZodString>;
|
|
218
|
+
authoritySubjectId: z.ZodNullable<z.ZodString>;
|
|
219
|
+
collectionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
220
|
+
}, z.core.$strip>>;
|
|
221
|
+
targetScope: z.ZodOptional<z.ZodEnum<{
|
|
177
222
|
organization: "organization";
|
|
178
223
|
user: "user";
|
|
179
224
|
workspace: "workspace";
|
|
180
|
-
}
|
|
225
|
+
}>>;
|
|
181
226
|
syncCadence: z.ZodDefault<z.ZodEnum<{
|
|
182
227
|
daily: "daily";
|
|
183
228
|
hourly: "hourly";
|
|
@@ -299,11 +344,19 @@ export declare const SaveGoogleDriveSourceRequest: z.ZodObject<{
|
|
|
299
344
|
mimeType: z.ZodString;
|
|
300
345
|
driveId: z.ZodNullable<z.ZodString>;
|
|
301
346
|
}, z.core.$strip>>;
|
|
302
|
-
|
|
347
|
+
destination: z.ZodOptional<z.ZodObject<{
|
|
348
|
+
authorityKind: z.ZodEnum<{
|
|
349
|
+
organization: "organization";
|
|
350
|
+
personal: "personal";
|
|
351
|
+
workspace: "workspace";
|
|
352
|
+
}>;
|
|
353
|
+
collectionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
354
|
+
}, z.core.$strip>>;
|
|
355
|
+
targetScope: z.ZodOptional<z.ZodEnum<{
|
|
303
356
|
organization: "organization";
|
|
304
357
|
user: "user";
|
|
305
358
|
workspace: "workspace";
|
|
306
|
-
}
|
|
359
|
+
}>>;
|
|
307
360
|
syncCadence: z.ZodDefault<z.ZodEnum<{
|
|
308
361
|
daily: "daily";
|
|
309
362
|
hourly: "hourly";
|
package/dist/google-drive.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectionMetadata
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WVE7RAHN.js";
|
|
4
|
+
import {
|
|
5
|
+
ConnectorDocumentDestination,
|
|
6
|
+
ConnectorDocumentDestinationSelection
|
|
7
|
+
} from "./chunk-WYBDERIY.js";
|
|
4
8
|
import "./chunk-7JZMI22I.js";
|
|
5
9
|
|
|
6
10
|
// src/google-drive.ts
|
|
@@ -93,7 +97,9 @@ var GoogleDriveSelectedSource = z.object({
|
|
|
93
97
|
name: z.string().min(1).max(1024),
|
|
94
98
|
mimeType: z.string().min(1).max(256),
|
|
95
99
|
driveId: z.string().min(1).max(256).nullable().default(null),
|
|
96
|
-
|
|
100
|
+
destination: ConnectorDocumentDestination.optional(),
|
|
101
|
+
/** @deprecated Missing destinations resolve to the current workspace boundary. */
|
|
102
|
+
targetScope: GoogleDriveTargetScope.optional(),
|
|
97
103
|
syncCadence: GoogleDriveSyncCadence.default("hourly"),
|
|
98
104
|
readPolicy: GoogleDriveReadPolicy.default("allow"),
|
|
99
105
|
selectedAt: z.string().datetime({ offset: true })
|
|
@@ -107,6 +113,7 @@ var GoogleDriveConnectionMetadata = z.object({
|
|
|
107
113
|
verifiedAt: z.string().datetime({ offset: true }),
|
|
108
114
|
accessMode: z.enum(["metadata_readonly", "readonly"]),
|
|
109
115
|
lifecycle: GoogleDriveConnectionLifecycle.optional(),
|
|
116
|
+
documentDestination: ConnectorDocumentDestination.optional(),
|
|
110
117
|
selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),
|
|
111
118
|
/** @deprecated Read `selectedSources`; retained while existing connections migrate. */
|
|
112
119
|
selectedSource: GoogleDriveSelectedSource.nullable().optional()
|
|
@@ -155,9 +162,13 @@ var SaveGoogleDriveSourceRequest = z.object({
|
|
|
155
162
|
).max(100).refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {
|
|
156
163
|
message: "Google Drive sources must be unique"
|
|
157
164
|
}),
|
|
158
|
-
|
|
165
|
+
destination: ConnectorDocumentDestinationSelection.optional(),
|
|
166
|
+
/** @deprecated Legacy requests are accepted but resolve to workspace authority. */
|
|
167
|
+
targetScope: GoogleDriveTargetScope.optional(),
|
|
159
168
|
syncCadence: GoogleDriveSyncCadence.default("hourly"),
|
|
160
169
|
readPolicy: GoogleDriveReadPolicy.default("allow")
|
|
170
|
+
}).refine((request) => request.destination !== void 0 || request.targetScope !== void 0, {
|
|
171
|
+
message: "Google Drive document destination is required"
|
|
161
172
|
});
|
|
162
173
|
export {
|
|
163
174
|
GOOGLE_DRIVE_CREDENTIAL_LABEL,
|
package/dist/google-drive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const GOOGLE_DRIVE_PROVIDER_DOMAIN = \"googleapis.com\" as const;\nexport const GOOGLE_DRIVE_FULL_SCOPE = \"https://www.googleapis.com/auth/drive\" as const;\nexport const GOOGLE_DRIVE_FILE_SCOPE = \"https://www.googleapis.com/auth/drive.file\" as const;\nexport const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.metadata.readonly\" as const;\nexport const GOOGLE_DRIVE_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.readonly\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive metadata browser\" as const;\n\nexport const GoogleDriveOAuthCapability = z.enum([\n \"picker_file_read\",\n \"source_metadata_discovery\",\n \"source_content_read\",\n \"recursive_source_sync\",\n]);\nexport type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;\n\nexport type GoogleDriveOAuthScopeDecision = {\n accessMode: \"metadata_readonly\" | \"readonly\" | null;\n capabilities: GoogleDriveOAuthCapability[];\n};\n\n/**\n * Converts exact Google OAuth grants into the Drive capabilities OpenGeni may\n * rely on. Unknown or malformed grants add no authority. In particular,\n * drive.file covers only files explicitly opened or shared with the app and\n * never authorizes arbitrary recursive descendant discovery.\n */\nexport function googleDriveOAuthScopeDecision(\n grantedScopes: readonly string[],\n): GoogleDriveOAuthScopeDecision {\n const granted = new Set(grantedScopes);\n const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);\n const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);\n const hasSourceMetadataDiscovery =\n hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);\n const hasPickerFileRead = hasSourceContentRead || granted.has(GOOGLE_DRIVE_FILE_SCOPE);\n const capabilities: GoogleDriveOAuthCapability[] = [];\n if (hasPickerFileRead) capabilities.push(\"picker_file_read\");\n if (hasSourceMetadataDiscovery) capabilities.push(\"source_metadata_discovery\");\n if (hasSourceContentRead) {\n capabilities.push(\"source_content_read\", \"recursive_source_sync\");\n }\n return {\n accessMode: hasSourceContentRead\n ? \"readonly\"\n : hasSourceMetadataDiscovery\n ? \"metadata_readonly\"\n : null,\n capabilities,\n };\n}\n\nexport function googleDriveScopesAllowCapability(\n grantedScopes: readonly string[],\n capability: GoogleDriveOAuthCapability,\n): boolean {\n return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);\n}\n\nexport const GoogleDriveTargetScope = z.enum([\"user\", \"workspace\", \"organization\"]);\nexport type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;\n\nexport const GoogleDriveSyncCadence = z.enum([\"manual\", \"hourly\", \"daily\"]);\nexport type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;\n\nexport const GoogleDriveReadPolicy = z.enum([\"allow\", \"ask\", \"block\"]);\nexport type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;\n\nexport const GoogleDriveConnectionLifecycleState = z.enum([\n \"active\",\n \"paused\",\n \"token_revoked\",\n \"app_removed\",\n \"disconnected\",\n \"reconnect_required\",\n \"reconsent_required\",\n]);\nexport type GoogleDriveConnectionLifecycleState = z.infer<\n typeof GoogleDriveConnectionLifecycleState\n>;\n\nconst GoogleDriveLifecycleObservedAt = z.string().datetime({ offset: true });\nexport const GoogleDriveConnectionLifecycle = z.discriminatedUnion(\"state\", [\n z.object({\n state: z.literal(\"active\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"paused\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"token_revoked\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"app_removed\"),\n recoverable: z.literal(false),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"disconnected\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconnect_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconsent_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n]);\nexport type GoogleDriveConnectionLifecycle = z.infer<typeof GoogleDriveConnectionLifecycle>;\n\nexport const GoogleDriveSelectedSource = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(256).nullable().default(null),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n selectedAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;\n\nexport const GoogleDriveConnectionMetadata = z\n .object({\n credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),\n credentialLabel: z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n googlePermissionId: z.string().min(1).max(256),\n googleEmail: z.string().email().max(320),\n googleDisplayName: z.string().min(1).max(512).nullable(),\n verifiedAt: z.string().datetime({ offset: true }),\n accessMode: z.enum([\"metadata_readonly\", \"readonly\"]),\n lifecycle: GoogleDriveConnectionLifecycle.optional(),\n selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),\n /** @deprecated Read `selectedSources`; retained while existing connections migrate. */\n selectedSource: GoogleDriveSelectedSource.nullable().optional(),\n })\n .passthrough();\nexport type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;\n\nexport const GoogleDriveOAuthStartRequest = z.object({\n connectionId: z.string().uuid().optional(),\n});\nexport type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;\n\nexport const GoogleDriveOAuthStartResponse = z.object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;\n\nexport const GoogleDriveLifecycleActionRequest = z.object({\n action: z.enum([\"pause\", \"resume\"]),\n expectedVersion: z.number().int().positive(),\n});\nexport type GoogleDriveLifecycleActionRequest = z.infer<typeof GoogleDriveLifecycleActionRequest>;\n\nexport const GoogleDriveDisconnectRequest = z.object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n});\nexport type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;\n\nexport const GoogleDriveBrowseItem = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n kind: z.enum([\"folder\", \"file\"]),\n driveId: z.string().min(1).max(256).nullable(),\n modifiedTime: z.string().datetime({ offset: true }).nullable(),\n size: z.string().regex(/^\\d+$/).nullable(),\n webViewLink: z.string().url().nullable(),\n});\nexport type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;\n\nexport const GoogleDriveBrowseResponse = z.object({\n connection: z.lazy(() => ConnectionMetadata),\n parentId: z.string().min(1).max(256),\n current: GoogleDriveBrowseItem.nullable(),\n items: z.array(GoogleDriveBrowseItem),\n nextPageToken: z.string().min(1).max(4096).nullable(),\n incompleteSearch: z.boolean(),\n});\nexport type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;\n\nexport const SaveGoogleDriveSourceRequest = z.object({\n sources: z\n .array(\n GoogleDriveBrowseItem.pick({\n id: true,\n name: true,\n mimeType: true,\n driveId: true,\n }),\n )\n .max(100)\n .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {\n message: \"Google Drive sources must be unique\",\n }),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n});\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n"],"mappings":";;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,+BAA+B;AACrC,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAChC,IAAM,uCACX;AACK,IAAM,8BACX;AACK,IAAM,+BAA+B;AACrC,IAAM,gCAAgC;AAEtC,IAAM,6BAA6B,EAAE,KAAK;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAcM,SAAS,8BACd,eAC+B;AAC/B,QAAM,UAAU,IAAI,IAAI,aAAa;AACrC,QAAM,eAAe,QAAQ,IAAI,uBAAuB;AACxD,QAAM,uBAAuB,gBAAgB,QAAQ,IAAI,2BAA2B;AACpF,QAAM,6BACJ,wBAAwB,QAAQ,IAAI,oCAAoC;AAC1E,QAAM,oBAAoB,wBAAwB,QAAQ,IAAI,uBAAuB;AACrF,QAAM,eAA6C,CAAC;AACpD,MAAI,kBAAmB,cAAa,KAAK,kBAAkB;AAC3D,MAAI,2BAA4B,cAAa,KAAK,2BAA2B;AAC7E,MAAI,sBAAsB;AACxB,iBAAa,KAAK,uBAAuB,uBAAuB;AAAA,EAClE;AACA,SAAO;AAAA,IACL,YAAY,uBACR,aACA,6BACE,sBACA;AAAA,IACN;AAAA,EACF;AACF;AAEO,SAAS,iCACd,eACA,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,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACzC,CAAC;AAGM,IAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,YAAY,EAAE,KAAK,MAAM,kBAAkB;AAAA,EAC3C,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACnC,SAAS,sBAAsB,SAAS;AAAA,EACxC,OAAO,EAAE,MAAM,qBAAqB;AAAA,EACpC,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI,EAAE,SAAS;AAAA,EACpD,kBAAkB,EAAE,QAAQ;AAC9B,CAAC;AAGM,IAAM,+BAA+B,EAAE,OAAO;AAAA,EACnD,SAAS,EACN;AAAA,IACC,sBAAsB,KAAK;AAAA,MACzB,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACX,CAAC;AAAA,EACH,EACC,IAAI,GAAG,EACP,OAAO,CAAC,YAAY,IAAI,IAAI,QAAQ,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,SAAS,QAAQ,QAAQ;AAAA,IACxF,SAAS;AAAA,EACX,CAAC;AAAA,EACH,aAAa;AAAA,EACb,aAAa,uBAAuB,QAAQ,QAAQ;AAAA,EACpD,YAAY,sBAAsB,QAAQ,OAAO;AACnD,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\nimport {\n ConnectorDocumentDestination,\n ConnectorDocumentDestinationSelection,\n} from \"./connector-destinations\";\n\nexport const GOOGLE_DRIVE_PROVIDER_DOMAIN = \"googleapis.com\" as const;\nexport const GOOGLE_DRIVE_FULL_SCOPE = \"https://www.googleapis.com/auth/drive\" as const;\nexport const GOOGLE_DRIVE_FILE_SCOPE = \"https://www.googleapis.com/auth/drive.file\" as const;\nexport const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.metadata.readonly\" as const;\nexport const GOOGLE_DRIVE_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.readonly\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive metadata browser\" as const;\n\nexport const GoogleDriveOAuthCapability = z.enum([\n \"picker_file_read\",\n \"source_metadata_discovery\",\n \"source_content_read\",\n \"recursive_source_sync\",\n]);\nexport type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;\n\nexport type GoogleDriveOAuthScopeDecision = {\n accessMode: \"metadata_readonly\" | \"readonly\" | null;\n capabilities: GoogleDriveOAuthCapability[];\n};\n\n/**\n * Converts exact Google OAuth grants into the Drive capabilities OpenGeni may\n * rely on. Unknown or malformed grants add no authority. In particular,\n * drive.file covers only files explicitly opened or shared with the app and\n * never authorizes arbitrary recursive descendant discovery.\n */\nexport function googleDriveOAuthScopeDecision(\n grantedScopes: readonly string[],\n): GoogleDriveOAuthScopeDecision {\n const granted = new Set(grantedScopes);\n const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);\n const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);\n const hasSourceMetadataDiscovery =\n hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);\n const hasPickerFileRead = hasSourceContentRead || granted.has(GOOGLE_DRIVE_FILE_SCOPE);\n const capabilities: GoogleDriveOAuthCapability[] = [];\n if (hasPickerFileRead) capabilities.push(\"picker_file_read\");\n if (hasSourceMetadataDiscovery) capabilities.push(\"source_metadata_discovery\");\n if (hasSourceContentRead) {\n capabilities.push(\"source_content_read\", \"recursive_source_sync\");\n }\n return {\n accessMode: hasSourceContentRead\n ? \"readonly\"\n : hasSourceMetadataDiscovery\n ? \"metadata_readonly\"\n : null,\n capabilities,\n };\n}\n\nexport function googleDriveScopesAllowCapability(\n grantedScopes: readonly string[],\n capability: GoogleDriveOAuthCapability,\n): boolean {\n return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);\n}\n\n/** @deprecated Connector document destinations use organization/workspace/personal authority. */\nexport const GoogleDriveTargetScope = z.enum([\"user\", \"workspace\", \"organization\"]);\nexport type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;\n\nexport const GoogleDriveSyncCadence = z.enum([\"manual\", \"hourly\", \"daily\"]);\nexport type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;\n\nexport const GoogleDriveReadPolicy = z.enum([\"allow\", \"ask\", \"block\"]);\nexport type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;\n\nexport const GoogleDriveConnectionLifecycleState = z.enum([\n \"active\",\n \"paused\",\n \"token_revoked\",\n \"app_removed\",\n \"disconnected\",\n \"reconnect_required\",\n \"reconsent_required\",\n]);\nexport type GoogleDriveConnectionLifecycleState = z.infer<\n typeof GoogleDriveConnectionLifecycleState\n>;\n\nconst GoogleDriveLifecycleObservedAt = z.string().datetime({ offset: true });\nexport const GoogleDriveConnectionLifecycle = z.discriminatedUnion(\"state\", [\n z.object({\n state: z.literal(\"active\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"paused\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"token_revoked\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"app_removed\"),\n recoverable: z.literal(false),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"disconnected\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconnect_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconsent_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n]);\nexport type GoogleDriveConnectionLifecycle = z.infer<typeof GoogleDriveConnectionLifecycle>;\n\nexport const GoogleDriveSelectedSource = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(256).nullable().default(null),\n destination: ConnectorDocumentDestination.optional(),\n /** @deprecated Missing destinations resolve to the current workspace boundary. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n selectedAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;\n\nexport const GoogleDriveConnectionMetadata = z\n .object({\n credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),\n credentialLabel: z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n googlePermissionId: z.string().min(1).max(256),\n googleEmail: z.string().email().max(320),\n googleDisplayName: z.string().min(1).max(512).nullable(),\n verifiedAt: z.string().datetime({ offset: true }),\n accessMode: z.enum([\"metadata_readonly\", \"readonly\"]),\n lifecycle: GoogleDriveConnectionLifecycle.optional(),\n documentDestination: ConnectorDocumentDestination.optional(),\n selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),\n /** @deprecated Read `selectedSources`; retained while existing connections migrate. */\n selectedSource: GoogleDriveSelectedSource.nullable().optional(),\n })\n .passthrough();\nexport type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;\n\nexport const GoogleDriveOAuthStartRequest = z.object({\n connectionId: z.string().uuid().optional(),\n});\nexport type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;\n\nexport const GoogleDriveOAuthStartResponse = z.object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;\n\nexport const GoogleDriveLifecycleActionRequest = z.object({\n action: z.enum([\"pause\", \"resume\"]),\n expectedVersion: z.number().int().positive(),\n});\nexport type GoogleDriveLifecycleActionRequest = z.infer<typeof GoogleDriveLifecycleActionRequest>;\n\nexport const GoogleDriveDisconnectRequest = z.object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n});\nexport type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;\n\nexport const GoogleDriveBrowseItem = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n kind: z.enum([\"folder\", \"file\"]),\n driveId: z.string().min(1).max(256).nullable(),\n modifiedTime: z.string().datetime({ offset: true }).nullable(),\n size: z.string().regex(/^\\d+$/).nullable(),\n webViewLink: z.string().url().nullable(),\n});\nexport type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;\n\nexport const GoogleDriveBrowseResponse = z.object({\n connection: z.lazy(() => ConnectionMetadata),\n parentId: z.string().min(1).max(256),\n current: GoogleDriveBrowseItem.nullable(),\n items: z.array(GoogleDriveBrowseItem),\n nextPageToken: z.string().min(1).max(4096).nullable(),\n incompleteSearch: z.boolean(),\n});\nexport type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;\n\nexport const SaveGoogleDriveSourceRequest = z\n .object({\n sources: z\n .array(\n GoogleDriveBrowseItem.pick({\n id: true,\n name: true,\n mimeType: true,\n driveId: true,\n }),\n )\n .max(100)\n .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {\n message: \"Google Drive sources must be unique\",\n }),\n destination: ConnectorDocumentDestinationSelection.optional(),\n /** @deprecated Legacy requests are accepted but resolve to workspace authority. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n })\n .refine((request) => request.destination !== undefined || request.targetScope !== undefined, {\n message: \"Google Drive document destination is required\",\n });\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n"],"mappings":";;;;;;;;;;AAAA,SAAS,SAAS;AAQX,IAAM,+BAA+B;AACrC,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAChC,IAAM,uCACX;AACK,IAAM,8BACX;AACK,IAAM,+BAA+B;AACrC,IAAM,gCAAgC;AAEtC,IAAM,6BAA6B,EAAE,KAAK;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAcM,SAAS,8BACd,eAC+B;AAC/B,QAAM,UAAU,IAAI,IAAI,aAAa;AACrC,QAAM,eAAe,QAAQ,IAAI,uBAAuB;AACxD,QAAM,uBAAuB,gBAAgB,QAAQ,IAAI,2BAA2B;AACpF,QAAM,6BACJ,wBAAwB,QAAQ,IAAI,oCAAoC;AAC1E,QAAM,oBAAoB,wBAAwB,QAAQ,IAAI,uBAAuB;AACrF,QAAM,eAA6C,CAAC;AACpD,MAAI,kBAAmB,cAAa,KAAK,kBAAkB;AAC3D,MAAI,2BAA4B,cAAa,KAAK,2BAA2B;AAC7E,MAAI,sBAAsB;AACxB,iBAAa,KAAK,uBAAuB,uBAAuB;AAAA,EAClE;AACA,SAAO;AAAA,IACL,YAAY,uBACR,aACA,6BACE,sBACA;AAAA,IACN;AAAA,EACF;AACF;AAEO,SAAS,iCACd,eACA,YACS;AACT,SAAO,8BAA8B,aAAa,EAAE,aAAa,SAAS,UAAU;AACtF;AAGO,IAAM,yBAAyB,EAAE,KAAK,CAAC,QAAQ,aAAa,cAAc,CAAC;AAG3E,IAAM,yBAAyB,EAAE,KAAK,CAAC,UAAU,UAAU,OAAO,CAAC;AAGnE,IAAM,wBAAwB,EAAE,KAAK,CAAC,SAAS,OAAO,OAAO,CAAC;AAG9D,IAAM,sCAAsC,EAAE,KAAK;AA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AAA,EACnC,SAAS,sBAAsB,SAAS;AAAA,EACxC,OAAO,EAAE,MAAM,qBAAqB;AAAA,EACpC,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI,EAAE,SAAS;AAAA,EACpD,kBAAkB,EAAE,QAAQ;AAC9B,CAAC;AAGM,IAAM,+BAA+B,EACzC,OAAO;AAAA,EACN,SAAS,EACN;AAAA,IACC,sBAAsB,KAAK;AAAA,MACzB,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACX,CAAC;AAAA,EACH,EACC,IAAI,GAAG,EACP,OAAO,CAAC,YAAY,IAAI,IAAI,QAAQ,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,SAAS,QAAQ,QAAQ;AAAA,IACxF,SAAS;AAAA,EACX,CAAC;AAAA,EACH,aAAa,sCAAsC,SAAS;AAAA;AAAA,EAE5D,aAAa,uBAAuB,SAAS;AAAA,EAC7C,aAAa,uBAAuB,QAAQ,QAAQ;AAAA,EACpD,YAAY,sBAAsB,QAAQ,OAAO;AACnD,CAAC,EACA,OAAO,CAAC,YAAY,QAAQ,gBAAgB,UAAa,QAAQ,gBAAgB,QAAW;AAAA,EAC3F,SAAS;AACX,CAAC;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type SessionEventBoundarySurface } from "./event-preview";
|
|
3
3
|
export * from "./slack-bot-scopes";
|
|
4
|
+
export * from "./connector-destinations";
|
|
4
5
|
export { CreateWorkspaceArtifactRequest, PublishWorkspaceArtifactVersionRequest, RollbackWorkspaceArtifactRequest, WorkspaceArtifact, WorkspaceArtifactContentResponse, WorkspaceArtifactDetailResponse, WorkspaceArtifactEvent, WorkspaceArtifactEventType, WorkspaceArtifactHtml, WorkspaceArtifactListQuery, WorkspaceArtifactListResponse, WorkspaceArtifactMutationResponse, WorkspaceArtifactSlug, WorkspaceArtifactStatus, WorkspaceArtifactVersion, WORKSPACE_ARTIFACT_CURSOR_MAX_CHARS, WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS, WORKSPACE_ARTIFACT_HTML_MAX_UTF8_BYTES, WORKSPACE_ARTIFACT_LIST_DEFAULT, WORKSPACE_ARTIFACT_LIST_MAX, WORKSPACE_ARTIFACT_TITLE_MAX_CHARS, normalizeWorkspaceArtifactSlug, } from "./artifacts";
|
|
5
6
|
export { SESSION_EVENT_PAYLOAD_MAX_BYTES, approximateSessionEventTokens, boundSessionEventPayload, measureSessionEventJson, sessionEventJsonBytes, sessionEventMediaPreview, sessionEventMediaPreviewFromDataUrl, sessionEventPayloadTruncation, type BoundSessionEventPayloadOptions, type SessionEventBoundarySurface, type SessionEventMediaPreview, type SessionEventJsonMeasurement, type SessionEventPayloadTruncation, } from "./event-preview";
|
|
6
7
|
export { RETAINED_OUTPUT_DEFAULT_PAGE_BYTES, RETAINED_OUTPUT_MAX_PAGE_BYTES, RETAINED_OUTPUT_RECEIPT_MAX_BYTES, RetainedArtifactMetadataSchema, RetainedArtifactReferenceSchema, RetainedArtifactUnavailableSchema, RetainedOutputEvidenceSchema, RetainedOutputKind, RetainedOutputUnavailableReason, retainedArtifactReferenceFromFile, retainedOutputUnavailable, resolveRetainedOutputRange, validateRetainedOutputEvidence, type RetainedArtifactFileInput, type RetainedArtifactMetadata, type RetainedArtifactReference, type RetainedArtifactUnavailable, type RetainedOutputAvailableEvidence, type RetainedOutputEvidence, type RetainedOutputRangeResolution, type RetainedOutputResolvedRange, } from "./retained-output";
|
|
@@ -693,7 +694,7 @@ export declare const TranscribeAudioResponse: z.ZodObject<{
|
|
|
693
694
|
languages: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
694
695
|
}, z.core.$strict>;
|
|
695
696
|
export type TranscribeAudioResponse = z.infer<typeof TranscribeAudioResponse>;
|
|
696
|
-
/** Default
|
|
697
|
+
/** Default safety ceiling for one-shot native voice input (60 seconds). */
|
|
697
698
|
export declare const VOICE_INPUT_MAX_DURATION_SECONDS: 60;
|
|
698
699
|
export declare const VOICE_INPUT_MAX_SIZE_BYTES: number;
|
|
699
700
|
export declare const VOICE_INPUT_ACCEPTED_MIME_TYPES: readonly ["audio/webm", "audio/webm;codecs=opus", "audio/mp4", "audio/ogg", "audio/ogg;codecs=opus", "audio/mpeg", "audio/wav", "audio/x-wav", "audio/mp3", "audio/m4a"];
|
package/dist/index.js
CHANGED
|
@@ -760,7 +760,17 @@ import {
|
|
|
760
760
|
verifyStreamToken,
|
|
761
761
|
workspaceControlUtf8Bytes,
|
|
762
762
|
workspaceSlackReactionChannelAllowed
|
|
763
|
-
} from "./chunk-
|
|
763
|
+
} from "./chunk-WVE7RAHN.js";
|
|
764
|
+
import {
|
|
765
|
+
ConnectorDocumentDestination,
|
|
766
|
+
ConnectorDocumentDestinationAuthority,
|
|
767
|
+
ConnectorDocumentDestinationSelection,
|
|
768
|
+
bindConnectorDocumentDestination,
|
|
769
|
+
connectorDestinationDocumentAuthority,
|
|
770
|
+
connectorDocumentDestinationCollectionId,
|
|
771
|
+
legacyWorkspaceConnectorDocumentDestination,
|
|
772
|
+
resolveConnectorDocumentDestination
|
|
773
|
+
} from "./chunk-WYBDERIY.js";
|
|
764
774
|
import {
|
|
765
775
|
OPENGENI_MANAGED_PUBLIC_BASE_URL,
|
|
766
776
|
OPENGENI_SLACK_BOT_EVENTS,
|
|
@@ -838,6 +848,9 @@ export {
|
|
|
838
848
|
ConnectionOwnership,
|
|
839
849
|
ConnectionResponse,
|
|
840
850
|
ConnectionStatus,
|
|
851
|
+
ConnectorDocumentDestination,
|
|
852
|
+
ConnectorDocumentDestinationAuthority,
|
|
853
|
+
ConnectorDocumentDestinationSelection,
|
|
841
854
|
CorrectPreferenceRegistryRequest,
|
|
842
855
|
CreateApiKeyRequest,
|
|
843
856
|
CreateApiKeyResponse,
|
|
@@ -1468,6 +1481,7 @@ export {
|
|
|
1468
1481
|
areOpenGeniSlackBotScopesAccepted,
|
|
1469
1482
|
assertUniqueResourceMountPaths,
|
|
1470
1483
|
backendForNativeSnapshotProvider,
|
|
1484
|
+
bindConnectorDocumentDestination,
|
|
1471
1485
|
boundSessionEvent,
|
|
1472
1486
|
boundSessionEventPayload,
|
|
1473
1487
|
boundWorkspaceControlEvent,
|
|
@@ -1478,6 +1492,8 @@ export {
|
|
|
1478
1492
|
compactSessionEventResult,
|
|
1479
1493
|
compareCodexFleetCanonicalStringsV1,
|
|
1480
1494
|
comparePersonalSlackCanonicalConnections,
|
|
1495
|
+
connectorDestinationDocumentAuthority,
|
|
1496
|
+
connectorDocumentDestinationCollectionId,
|
|
1481
1497
|
createCodexFleetReplayRecordV1,
|
|
1482
1498
|
createSecretRedactor,
|
|
1483
1499
|
decodeNativeSnapshotRef,
|
|
@@ -1494,6 +1510,7 @@ export {
|
|
|
1494
1510
|
isCredentialHeaderName,
|
|
1495
1511
|
isSensitiveFieldName,
|
|
1496
1512
|
latencyModeForMetadata,
|
|
1513
|
+
legacyWorkspaceConnectorDocumentDestination,
|
|
1497
1514
|
measureSessionEventJson,
|
|
1498
1515
|
mergeResourceRefs,
|
|
1499
1516
|
mergeToolRefs,
|
|
@@ -1514,6 +1531,7 @@ export {
|
|
|
1514
1531
|
redactSerializedJson,
|
|
1515
1532
|
renderSessionSystemUpdateBatch,
|
|
1516
1533
|
replayCodexFleetDecisionV1,
|
|
1534
|
+
resolveConnectorDocumentDestination,
|
|
1517
1535
|
resolveRetainedOutputRange,
|
|
1518
1536
|
resolveSessionEventTypeFilters,
|
|
1519
1537
|
resolveWorkspaceCodexCompactionDefault,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Shared zod schemas and wire-contract types for the OpenGeni API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"./google-drive": {
|
|
30
30
|
"types": "./dist/google-drive.d.ts",
|
|
31
31
|
"import": "./dist/google-drive.js"
|
|
32
|
+
},
|
|
33
|
+
"./connector-destinations": {
|
|
34
|
+
"types": "./dist/connector-destinations.d.ts",
|
|
35
|
+
"import": "./dist/connector-destinations.js"
|
|
32
36
|
}
|
|
33
37
|
},
|
|
34
38
|
"publishConfig": {
|