@anchrd/colab-sdk 0.1.3 → 0.1.5
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/files/files.d.ts +7 -3
- package/dist/files/files.js +42 -4
- package/dist/grammar/grammar.d.ts +1 -1
- package/dist/grammar/grammar.js +6 -0
- package/dist/runs/runs.d.ts +9 -0
- package/dist/runs/runs.js +4 -0
- package/package.json +1 -1
package/dist/files/files.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ export declare const fileFormatExtensions: Record<FileFormat, readonly string[]>
|
|
|
7
7
|
export declare function fileFormatOf(name: string): FileFormat | null;
|
|
8
8
|
export declare const uploadTicketHeader = "x-colab-upload-ticket";
|
|
9
9
|
export declare const uploadTicketLifetimeMs: number;
|
|
10
|
+
export declare const SourceUrl: z.ZodString;
|
|
10
11
|
export declare const FileCreateInput: z.ZodObject<{
|
|
11
12
|
parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
|
|
12
|
-
name: z.ZodString
|
|
13
|
-
mediaType: z.ZodString
|
|
14
|
-
size: z.ZodNumber
|
|
13
|
+
name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
15
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
sourceUrl: z.ZodOptional<z.ZodString>;
|
|
15
17
|
idempotencyKey: z.ZodString;
|
|
16
18
|
}, z.core.$strict>;
|
|
17
19
|
export type FileCreateInput = z.infer<typeof FileCreateInput>;
|
|
@@ -56,5 +58,7 @@ export declare const FileDetail: z.ZodObject<{
|
|
|
56
58
|
rev: z.ZodNumber;
|
|
57
59
|
text: z.ZodNullable<z.ZodString>;
|
|
58
60
|
contentUrl: z.ZodURL;
|
|
61
|
+
sourceUrl: z.ZodOptional<z.ZodString>;
|
|
62
|
+
fetchedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
59
63
|
}, z.core.$strict>;
|
|
60
64
|
export type FileDetail = z.infer<typeof FileDetail>;
|
package/dist/files/files.js
CHANGED
|
@@ -92,13 +92,48 @@ const FileName = z
|
|
|
92
92
|
.string()
|
|
93
93
|
.max(200)
|
|
94
94
|
.describe("The file's name with its extension, like Preisliste.pdf. It is the name the download carries; on a new file it is also the node's name.");
|
|
95
|
-
|
|
95
|
+
// The address Colab fetches a file from itself (#556, E105). Only its shape is checked here; which
|
|
96
|
+
// addresses are allowed (https, public hosts, no redirect elsewhere) is decided where it is fetched.
|
|
97
|
+
export const SourceUrl = z
|
|
98
|
+
.string()
|
|
99
|
+
.trim()
|
|
100
|
+
.min(1)
|
|
101
|
+
.max(2048)
|
|
102
|
+
.describe("The https address of a public document on the web, like a PDF of a study. Colab downloads it itself and stores it like an upload; leave name optional and send no mediaType or size, Colab reads both from the answer. Only public hosts, at most 100 MB.");
|
|
103
|
+
export const FileCreateInput = z
|
|
104
|
+
.strictObject({
|
|
96
105
|
// ⚠️ Required and nullable (trap C015): null is the top level of Shared, like a folder.
|
|
97
106
|
parentId: NodeId.nullable().describe("The folder to put the file in, one you can write to; null puts it on the top level of Shared, visible to you until you share it."),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
107
|
+
// Required for an upload, optional with `sourceUrl`; the refinement below says so.
|
|
108
|
+
name: FileName.optional(),
|
|
109
|
+
mediaType: MediaType.optional(),
|
|
110
|
+
size: Size.optional(),
|
|
111
|
+
sourceUrl: SourceUrl.optional(),
|
|
101
112
|
idempotencyKey: IdempotencyKey,
|
|
113
|
+
})
|
|
114
|
+
// An upload names its file, type and size; a file from an address is measured by Colab (#556).
|
|
115
|
+
.superRefine((input, ctx) => {
|
|
116
|
+
if (input.sourceUrl === undefined) {
|
|
117
|
+
for (const field of ["name", "mediaType", "size"]) {
|
|
118
|
+
if (input[field] === undefined) {
|
|
119
|
+
ctx.addIssue({
|
|
120
|
+
code: "custom",
|
|
121
|
+
path: [field],
|
|
122
|
+
message: `An upload needs ${field}; or send sourceUrl and Colab fetches the file itself.`,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
for (const field of ["mediaType", "size"]) {
|
|
129
|
+
if (input[field] !== undefined) {
|
|
130
|
+
ctx.addIssue({
|
|
131
|
+
code: "custom",
|
|
132
|
+
path: [field],
|
|
133
|
+
message: `With sourceUrl Colab reads ${field} from the answer; leave it out.`,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
102
137
|
});
|
|
103
138
|
export const FileUpdateInput = z.strictObject({
|
|
104
139
|
fileId: FileId.describe("The file to upload a new version of."),
|
|
@@ -136,4 +171,7 @@ export const FileDetail = z.strictObject({
|
|
|
136
171
|
text: z.string().nullable(),
|
|
137
172
|
// Where the bytes are read, with a session or a token and the right to read the file.
|
|
138
173
|
contentUrl: z.url(),
|
|
174
|
+
// Only on a version Colab fetched from an address (#556): the address asked for and when.
|
|
175
|
+
sourceUrl: z.string().optional(),
|
|
176
|
+
fetchedAt: z.iso.datetime().optional(),
|
|
139
177
|
});
|
|
@@ -34,7 +34,7 @@ export declare const resources: {
|
|
|
34
34
|
readonly secret: "secrets";
|
|
35
35
|
};
|
|
36
36
|
export declare const actions: readonly ["list", "get", "create", "update", "archive", "restore", "purge"];
|
|
37
|
-
export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock"];
|
|
37
|
+
export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock", "publish", "schedule", "unpublish"];
|
|
38
38
|
export type Package = (typeof packages)[number];
|
|
39
39
|
export type Resource = keyof typeof resources;
|
|
40
40
|
export type Action = (typeof actions)[number] | (typeof verbs)[number];
|
package/dist/grammar/grammar.js
CHANGED
|
@@ -78,6 +78,12 @@ export const verbs = [
|
|
|
78
78
|
// (#357, E94), decided by the orchestrator: `intelligence_node_unlock`. Not `get` (it changes who
|
|
79
79
|
// may read) and not `create` of a resource (the release is no thing anybody lists or names).
|
|
80
80
|
"unlock",
|
|
81
|
+
// A connector's post at a CMS goes live, goes live later, or goes back off the site (#557, named by
|
|
82
|
+
// the ticket): `emdash_post_publish`, `_schedule`, `_unpublish`. Not `update`: each is its own right,
|
|
83
|
+
// so a role may write drafts without being able to publish them.
|
|
84
|
+
"publish",
|
|
85
|
+
"schedule",
|
|
86
|
+
"unpublish",
|
|
81
87
|
];
|
|
82
88
|
export function isPackage(word) {
|
|
83
89
|
return packages.includes(word);
|
package/dist/runs/runs.d.ts
CHANGED
|
@@ -108,6 +108,9 @@ export declare const RunItem: z.ZodObject<{
|
|
|
108
108
|
values: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodNull]>>>;
|
|
109
109
|
summaries: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
110
110
|
reports: z.ZodNullable<z.ZodNumber>;
|
|
111
|
+
rights: z.ZodObject<{
|
|
112
|
+
complete: z.ZodBoolean;
|
|
113
|
+
}, z.core.$strict>;
|
|
111
114
|
}, z.core.$strict>;
|
|
112
115
|
export type RunItem = z.infer<typeof RunItem>;
|
|
113
116
|
export declare const RunList: z.ZodObject<{
|
|
@@ -148,6 +151,9 @@ export declare const RunList: z.ZodObject<{
|
|
|
148
151
|
values: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodNull]>>>;
|
|
149
152
|
summaries: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
150
153
|
reports: z.ZodNullable<z.ZodNumber>;
|
|
154
|
+
rights: z.ZodObject<{
|
|
155
|
+
complete: z.ZodBoolean;
|
|
156
|
+
}, z.core.$strict>;
|
|
151
157
|
}, z.core.$strict>>;
|
|
152
158
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
153
159
|
}, z.core.$strict>;
|
|
@@ -240,5 +246,8 @@ export declare const RunDetail: z.ZodObject<{
|
|
|
240
246
|
values: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodNull]>>>;
|
|
241
247
|
summaries: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
242
248
|
reports: z.ZodNullable<z.ZodNumber>;
|
|
249
|
+
rights: z.ZodObject<{
|
|
250
|
+
complete: z.ZodBoolean;
|
|
251
|
+
}, z.core.$strict>;
|
|
243
252
|
}, z.core.$strict>;
|
|
244
253
|
export type RunDetail = z.infer<typeof RunDetail>;
|
package/dist/runs/runs.js
CHANGED
|
@@ -105,6 +105,10 @@ export const RunItem = z.strictObject({
|
|
|
105
105
|
summaries: z.record(z.string(), z.string().nullable()).nullable(),
|
|
106
106
|
// A dashboard's count of values and summaries that carry a report; null for a process (#164).
|
|
107
107
|
reports: z.number().int().nullable(),
|
|
108
|
+
// `complete`: whether the caller may close this run with intelligence_run_complete, by the same
|
|
109
|
+
// check the tool makes (E107): write on a process board or dashboard; on the validation the holder
|
|
110
|
+
// of validator or an admin in admin mode. The UI shows "Lauf beenden" by it.
|
|
111
|
+
rights: z.strictObject({ complete: z.boolean() }),
|
|
108
112
|
});
|
|
109
113
|
export const RunList = z.strictObject({
|
|
110
114
|
items: z.array(RunItem),
|
package/package.json
CHANGED