@dreamlake/dreamlake-cli 0.125.2 → 0.125.4
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/api/bindrs.d.ts +7 -1
- package/dist/api/bindrs.js +16 -1
- package/dist/api/content.d.ts +19 -1
- package/dist/api/content.js +12 -0
- package/dist/api/folder-visibility.d.ts +15 -0
- package/dist/api/folder-visibility.js +34 -0
- package/dist/api/index.d.ts +47 -10
- package/dist/api/index.js +3 -0
- package/dist/api/workspace.d.ts +12 -2
- package/dist/api/workspace.js +2 -0
- package/dist/cli/create/index.d.ts +1 -0
- package/dist/cli/create/index.js +13 -1
- package/dist/cli/folders/index.d.ts +3 -0
- package/dist/cli/folders/index.js +36 -1
- package/dist/cli/help-examples.generated.js +6 -0
- package/dist/cli/source/index.d.ts +3 -0
- package/dist/cli/source/index.js +13 -0
- package/dist/cli/source/write.d.ts +4 -0
- package/dist/cli/source/write.js +36 -3
- package/dist/cli/update/index.d.ts +1 -0
- package/dist/cli/update/index.js +25 -4
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
package/dist/api/bindrs.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { type FolderVisibility } from './folder-visibility.js';
|
|
1
2
|
import { type Transport } from "./client.js";
|
|
2
3
|
import { type Query, type Resource } from "./common.js";
|
|
3
4
|
export interface Bindr extends Resource {
|
|
5
|
+
visibility?: FolderVisibility | null;
|
|
6
|
+
updatedAt?: string;
|
|
4
7
|
name: string;
|
|
5
8
|
parent: string | null;
|
|
6
9
|
projectNodeId: string;
|
|
@@ -9,6 +12,7 @@ export interface Bindr extends Resource {
|
|
|
9
12
|
memberCount?: number;
|
|
10
13
|
}
|
|
11
14
|
export interface BindrInput {
|
|
15
|
+
visibility?: FolderVisibility;
|
|
12
16
|
name: string;
|
|
13
17
|
description?: string | null;
|
|
14
18
|
tags?: string[];
|
|
@@ -51,7 +55,9 @@ export declare function bindrsApi(t: Transport, namespace: string, project: stri
|
|
|
51
55
|
summary: (nameOrId: string) => Promise<{
|
|
52
56
|
bindr: Bindr;
|
|
53
57
|
}>;
|
|
54
|
-
update: (nameOrId: string, input: Partial<Omit<BindrInput, "member" | "members">>
|
|
58
|
+
update: (nameOrId: string, input: Partial<Omit<BindrInput, "member" | "members">> & {
|
|
59
|
+
expectedUpdatedAt?: string;
|
|
60
|
+
}) => Promise<{
|
|
55
61
|
bindr: Bindr;
|
|
56
62
|
}>;
|
|
57
63
|
delete: (nameOrId: string) => Promise<{
|
package/dist/api/bindrs.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertFolderVisibility, assertVisibilityVersion } from './folder-visibility.js';
|
|
1
2
|
import { seg } from "./client.js";
|
|
2
3
|
import { call, namespacePath } from "./common.js";
|
|
3
4
|
/** Earlier requests succeeded; the failed request may have reached the server. */
|
|
@@ -48,6 +49,8 @@ export function bindrsApi(t, namespace, project) {
|
|
|
48
49
|
return {
|
|
49
50
|
list,
|
|
50
51
|
create: async (input) => {
|
|
52
|
+
if (input.visibility !== undefined)
|
|
53
|
+
assertFolderVisibility(input.visibility);
|
|
51
54
|
const { members: legacyMembers = [], ...body } = input;
|
|
52
55
|
if (!Array.isArray(legacyMembers) || legacyMembers.some(id => typeof id !== "string" || !id.trim()))
|
|
53
56
|
throw new Error("Bindr members must be node IDs");
|
|
@@ -58,6 +61,8 @@ export function bindrsApi(t, namespace, project) {
|
|
|
58
61
|
});
|
|
59
62
|
if (!result?.bindr || typeof result.bindr.id !== "string" || !result.bindr.id.trim())
|
|
60
63
|
throw new Error("Bindr creation returned success without a usable ID; creation outcome is unknown. Inspect the project before retrying; no further membership requests were sent.");
|
|
64
|
+
if (input.visibility !== undefined && result.bindr.visibility !== input.visibility)
|
|
65
|
+
throw new Error('Bindr visibility was not confirmed; inspect the created Bindr before retrying');
|
|
61
66
|
if (rest.length) {
|
|
62
67
|
try {
|
|
63
68
|
const progress = await members("POST", result.bindr.id, rest);
|
|
@@ -73,7 +78,17 @@ export function bindrsApi(t, namespace, project) {
|
|
|
73
78
|
},
|
|
74
79
|
get: async (nameOrId, query = {}) => call(t, "GET", path(await resolveId(nameOrId)), undefined, query),
|
|
75
80
|
summary: async (nameOrId) => call(t, "GET", path(await resolveId(nameOrId)) + "/summary"),
|
|
76
|
-
update: async (nameOrId, input) =>
|
|
81
|
+
update: async (nameOrId, input) => {
|
|
82
|
+
if (input.visibility !== undefined) {
|
|
83
|
+
assertFolderVisibility(input.visibility);
|
|
84
|
+
assertVisibilityVersion(input.expectedUpdatedAt);
|
|
85
|
+
}
|
|
86
|
+
const id = await resolveId(nameOrId);
|
|
87
|
+
const result = await call(t, "PATCH", path(id), input);
|
|
88
|
+
if (input.visibility !== undefined && (result?.bindr?.id !== id || result.bindr.visibility !== input.visibility))
|
|
89
|
+
throw new Error('Bindr visibility was not confirmed; read current metadata before retrying');
|
|
90
|
+
return result;
|
|
91
|
+
},
|
|
77
92
|
delete: async (nameOrId) => call(t, "DELETE", path(await resolveId(nameOrId))),
|
|
78
93
|
addMember: async (nameOrId, nodeId) => call(t, "POST", path(await resolveId(nameOrId)) + "/members", { nodeId }),
|
|
79
94
|
removeMember: async (nameOrId, nodeId) => call(t, "DELETE", path(await resolveId(nameOrId)) + "/members", { nodeId }),
|
package/dist/api/content.d.ts
CHANGED
|
@@ -176,6 +176,20 @@ export declare function librariesApi(t: Transport, namespace: string): {
|
|
|
176
176
|
filesPresign: (name: string, paths: string[], ttlSeconds?: number) => Promise<unknown>;
|
|
177
177
|
register: (name: string, input: JsonObject) => Promise<unknown>;
|
|
178
178
|
};
|
|
179
|
+
export type SourceVisibility = "private" | "unlisted" | "public";
|
|
180
|
+
export interface SourceMetadata {
|
|
181
|
+
id: string;
|
|
182
|
+
namespaceId: string;
|
|
183
|
+
name: string;
|
|
184
|
+
visibility: SourceVisibility;
|
|
185
|
+
settingsRevision: number;
|
|
186
|
+
capabilities: {
|
|
187
|
+
use: boolean;
|
|
188
|
+
editManagedObjects: boolean;
|
|
189
|
+
manageSettings: boolean;
|
|
190
|
+
deleteSource: boolean;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
179
193
|
export declare function sourcesApi(t: Transport, namespace: string): {
|
|
180
194
|
list: (query?: {
|
|
181
195
|
cursor?: string;
|
|
@@ -184,20 +198,24 @@ export declare function sourcesApi(t: Transport, namespace: string): {
|
|
|
184
198
|
provider?: string;
|
|
185
199
|
hasExternal?: boolean;
|
|
186
200
|
lifecycle?: string;
|
|
201
|
+
visibility?: "private" | "unlisted" | "public";
|
|
187
202
|
}) => Promise<unknown>;
|
|
188
|
-
get: (id: string) => Promise<
|
|
203
|
+
get: (id: string) => Promise<SourceMetadata>;
|
|
189
204
|
byName: (name: string) => Promise<unknown>;
|
|
190
205
|
connectors: () => Promise<unknown>;
|
|
191
206
|
create: (input: {
|
|
192
207
|
name: string;
|
|
193
208
|
description?: string;
|
|
209
|
+
visibility?: "private" | "unlisted" | "public";
|
|
194
210
|
}, requestId: string) => Promise<unknown>;
|
|
195
211
|
import: (input: JsonObject, requestId: string) => Promise<unknown>;
|
|
196
212
|
metadata: (id: string, input: {
|
|
197
213
|
expectedSettingsRevision: number;
|
|
214
|
+
visibility?: "private" | "unlisted" | "public";
|
|
198
215
|
name?: string;
|
|
199
216
|
description?: string | null;
|
|
200
217
|
}) => Promise<unknown>;
|
|
218
|
+
setVisibility: (id: string, visibility: "private" | "unlisted" | "public", expectedSettingsRevision: number) => Promise<SourceMetadata>;
|
|
201
219
|
browse: (id: string, query?: {
|
|
202
220
|
path?: string;
|
|
203
221
|
cursor?: string;
|
package/dist/api/content.js
CHANGED
|
@@ -139,6 +139,18 @@ export function sourcesApi(t, namespace) {
|
|
|
139
139
|
create: (input, requestId) => call(t, "POST", base + ":create-empty", input, undefined, key(requestId)),
|
|
140
140
|
import: (input, requestId) => call(t, "POST", base + ":import-external", input, undefined, key(requestId)),
|
|
141
141
|
metadata: (id, input) => call(t, "PATCH", path(id) + "/metadata", input),
|
|
142
|
+
setVisibility: (id, visibility, expectedSettingsRevision) => {
|
|
143
|
+
if (!["private", "unlisted", "public"].includes(visibility))
|
|
144
|
+
throw new Error("Invalid Source visibility");
|
|
145
|
+
if (!Number.isSafeInteger(expectedSettingsRevision) || expectedSettingsRevision < 0)
|
|
146
|
+
throw new Error("A current settings revision is required");
|
|
147
|
+
return call(t, "PATCH", path(id) + "/metadata", { visibility, expectedSettingsRevision }).then(saved => {
|
|
148
|
+
if (!saved || saved.id !== id || saved.visibility !== visibility || !Number.isSafeInteger(saved.settingsRevision)) {
|
|
149
|
+
throw new Error("Source visibility update was not confirmed. Read the Source before retrying; outcome may be unknown.");
|
|
150
|
+
}
|
|
151
|
+
return saved;
|
|
152
|
+
});
|
|
153
|
+
},
|
|
142
154
|
browse: (id, query = {}) => call(t, "GET", path(id) + "/browse", undefined, query),
|
|
143
155
|
readCapability: (id, input) => call(t, "POST", path(id) + "/read-capabilities", input),
|
|
144
156
|
uploadAuthorizations: (id, input, requestId) => call(t, "POST", path(id) + "/upload-authorizations", input, undefined, key(requestId)),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Transport } from './client.js';
|
|
2
|
+
export type FolderVisibility = 'private' | 'unlisted' | 'public';
|
|
3
|
+
export interface FolderVisibilityState {
|
|
4
|
+
id: string;
|
|
5
|
+
visibility: FolderVisibility | null;
|
|
6
|
+
updatedAt: string;
|
|
7
|
+
explicitVisibility?: FolderVisibility | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function assertFolderVisibility(value: unknown): asserts value is FolderVisibility;
|
|
10
|
+
export declare function assertVisibilityVersion(value: unknown): asserts value is string;
|
|
11
|
+
/** ID-based visibility APIs do not require a public Project catalog entry. */
|
|
12
|
+
export declare function folderVisibilityApi(t: Transport, kind: 'folder' | 'bindr'): {
|
|
13
|
+
get: (id: string) => Promise<FolderVisibilityState>;
|
|
14
|
+
set(id: string, visibility: FolderVisibility, expectedUpdatedAt: string): Promise<FolderVisibilityState>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { call } from './common.js';
|
|
2
|
+
export function assertFolderVisibility(value) {
|
|
3
|
+
if (!['private', 'unlisted', 'public'].includes(value))
|
|
4
|
+
throw new TypeError('visibility must be private, unlisted or public');
|
|
5
|
+
}
|
|
6
|
+
export function assertVisibilityVersion(value) {
|
|
7
|
+
if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(value) || !Number.isFinite(Date.parse(value)))
|
|
8
|
+
throw new TypeError('expectedUpdatedAt must be the timestamp from a fresh read');
|
|
9
|
+
}
|
|
10
|
+
/** ID-based visibility APIs do not require a public Project catalog entry. */
|
|
11
|
+
export function folderVisibilityApi(t, kind) {
|
|
12
|
+
const path = (id, read = false) => {
|
|
13
|
+
if (!/^[a-f0-9]{24}$/i.test(id))
|
|
14
|
+
throw new TypeError('expected a 24-hex folder or Bindr ID');
|
|
15
|
+
return kind === 'folder' ? `/nodes/${id}/visibility` : `/bindrs/${id}${read ? '/summary' : ''}`;
|
|
16
|
+
};
|
|
17
|
+
function confirmed(body, id, expected) {
|
|
18
|
+
const row = kind === 'folder' ? body : body?.bindr;
|
|
19
|
+
if (row?.id !== id || typeof row.updatedAt !== 'string' || !Number.isFinite(Date.parse(row.updatedAt)) ||
|
|
20
|
+
row.visibility != null && !['private', 'unlisted', 'public'].includes(row.visibility) ||
|
|
21
|
+
expected !== undefined && row.visibility !== expected)
|
|
22
|
+
throw new Error('Server did not confirm folder visibility; read current metadata before retrying');
|
|
23
|
+
return { id, visibility: row.visibility ?? null, updatedAt: row.updatedAt,
|
|
24
|
+
...(kind === 'folder' ? { explicitVisibility: row.explicitVisibility ?? null } : {}) };
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
get: async (id) => confirmed(await call(t, 'GET', path(id, true)), id),
|
|
28
|
+
async set(id, visibility, expectedUpdatedAt) {
|
|
29
|
+
assertFolderVisibility(visibility);
|
|
30
|
+
assertVisibilityVersion(expectedUpdatedAt);
|
|
31
|
+
return confirmed(await call(t, 'PATCH', path(id), { visibility, expectedUpdatedAt }), id, visibility);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { folderVisibilityApi, type FolderVisibility, type FolderVisibilityState } from './folder-visibility.js';
|
|
1
2
|
export * from './annotations.js';
|
|
2
3
|
import { FileWorkspace } from "./file-workspace.js";
|
|
3
4
|
export * from "./file-workspace.js";
|
|
@@ -470,7 +471,7 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
|
|
|
470
471
|
generate: (input: {
|
|
471
472
|
name: string;
|
|
472
473
|
entryId?: string;
|
|
473
|
-
expectedRevision
|
|
474
|
+
expectedRevision?: number;
|
|
474
475
|
requestId?: string;
|
|
475
476
|
}) => Promise<unknown>;
|
|
476
477
|
};
|
|
@@ -777,7 +778,9 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
|
|
|
777
778
|
summary: (nameOrId: string) => Promise<{
|
|
778
779
|
bindr: import("./bindrs.js").Bindr;
|
|
779
780
|
}>;
|
|
780
|
-
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>
|
|
781
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">> & {
|
|
782
|
+
expectedUpdatedAt?: string;
|
|
783
|
+
}) => Promise<{
|
|
781
784
|
bindr: import("./bindrs.js").Bindr;
|
|
782
785
|
}>;
|
|
783
786
|
delete: (nameOrId: string) => Promise<{
|
|
@@ -819,7 +822,9 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
|
|
|
819
822
|
summary: (nameOrId: string) => Promise<{
|
|
820
823
|
bindr: import("./bindrs.js").Bindr;
|
|
821
824
|
}>;
|
|
822
|
-
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>
|
|
825
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">> & {
|
|
826
|
+
expectedUpdatedAt?: string;
|
|
827
|
+
}) => Promise<{
|
|
823
828
|
bindr: import("./bindrs.js").Bindr;
|
|
824
829
|
}>;
|
|
825
830
|
delete: (nameOrId: string) => Promise<{
|
|
@@ -866,6 +871,10 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
|
|
|
866
871
|
delete: (id: string) => Promise<unknown>;
|
|
867
872
|
};
|
|
868
873
|
nodes: {
|
|
874
|
+
visibility: {
|
|
875
|
+
get: (id: string) => Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
876
|
+
set(id: string, visibility: import("./folder-visibility.js").FolderVisibility, expectedUpdatedAt: string): Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
877
|
+
};
|
|
869
878
|
move: (nodes: {
|
|
870
879
|
id: string;
|
|
871
880
|
expectedPath: string;
|
|
@@ -897,11 +906,17 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
|
|
|
897
906
|
url: string;
|
|
898
907
|
}>;
|
|
899
908
|
};
|
|
909
|
+
bindrVisibility: {
|
|
910
|
+
get: (id: string) => Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
911
|
+
set(id: string, visibility: import("./folder-visibility.js").FolderVisibility, expectedUpdatedAt: string): Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
912
|
+
};
|
|
900
913
|
tasks: (namespace: string, project: string) => {
|
|
901
914
|
list: (query?: {
|
|
902
915
|
prefix?: string;
|
|
903
916
|
includeDeleted?: boolean;
|
|
904
|
-
limit
|
|
917
|
+
limit
|
|
918
|
+
/** @deprecated Use memoOutline. */
|
|
919
|
+
? /** @deprecated Use memoOutline. */: number;
|
|
905
920
|
cursor?: string;
|
|
906
921
|
}) => Promise<unknown>;
|
|
907
922
|
get: (id: string, includeDeleted?: boolean) => Promise<unknown>;
|
|
@@ -1147,20 +1162,24 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
|
|
|
1147
1162
|
provider?: string;
|
|
1148
1163
|
hasExternal?: boolean;
|
|
1149
1164
|
lifecycle?: string;
|
|
1165
|
+
visibility?: "private" | "unlisted" | "public";
|
|
1150
1166
|
}) => Promise<unknown>;
|
|
1151
|
-
get: (id: string) => Promise<
|
|
1167
|
+
get: (id: string) => Promise<import("./content.js").SourceMetadata>;
|
|
1152
1168
|
byName: (name: string) => Promise<unknown>;
|
|
1153
1169
|
connectors: () => Promise<unknown>;
|
|
1154
1170
|
create: (input: {
|
|
1155
1171
|
name: string;
|
|
1156
1172
|
description?: string;
|
|
1173
|
+
visibility?: "private" | "unlisted" | "public";
|
|
1157
1174
|
}, requestId: string) => Promise<unknown>;
|
|
1158
1175
|
import: (input: import("./common.js").JsonObject, requestId: string) => Promise<unknown>;
|
|
1159
1176
|
metadata: (id: string, input: {
|
|
1160
1177
|
expectedSettingsRevision: number;
|
|
1178
|
+
visibility?: "private" | "unlisted" | "public";
|
|
1161
1179
|
name?: string;
|
|
1162
1180
|
description?: string | null;
|
|
1163
1181
|
}) => Promise<unknown>;
|
|
1182
|
+
setVisibility: (id: string, visibility: "private" | "unlisted" | "public", expectedSettingsRevision: number) => Promise<import("./content.js").SourceMetadata>;
|
|
1164
1183
|
browse: (id: string, query?: {
|
|
1165
1184
|
path?: string;
|
|
1166
1185
|
cursor?: string;
|
|
@@ -1916,7 +1935,7 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1916
1935
|
generate: (input: {
|
|
1917
1936
|
name: string;
|
|
1918
1937
|
entryId?: string;
|
|
1919
|
-
expectedRevision
|
|
1938
|
+
expectedRevision?: number;
|
|
1920
1939
|
requestId?: string;
|
|
1921
1940
|
}) => Promise<unknown>;
|
|
1922
1941
|
};
|
|
@@ -2223,7 +2242,9 @@ export declare function createClient(options: ClientOptions): {
|
|
|
2223
2242
|
summary: (nameOrId: string) => Promise<{
|
|
2224
2243
|
bindr: import("./bindrs.js").Bindr;
|
|
2225
2244
|
}>;
|
|
2226
|
-
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>
|
|
2245
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">> & {
|
|
2246
|
+
expectedUpdatedAt?: string;
|
|
2247
|
+
}) => Promise<{
|
|
2227
2248
|
bindr: import("./bindrs.js").Bindr;
|
|
2228
2249
|
}>;
|
|
2229
2250
|
delete: (nameOrId: string) => Promise<{
|
|
@@ -2265,7 +2286,9 @@ export declare function createClient(options: ClientOptions): {
|
|
|
2265
2286
|
summary: (nameOrId: string) => Promise<{
|
|
2266
2287
|
bindr: import("./bindrs.js").Bindr;
|
|
2267
2288
|
}>;
|
|
2268
|
-
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>
|
|
2289
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">> & {
|
|
2290
|
+
expectedUpdatedAt?: string;
|
|
2291
|
+
}) => Promise<{
|
|
2269
2292
|
bindr: import("./bindrs.js").Bindr;
|
|
2270
2293
|
}>;
|
|
2271
2294
|
delete: (nameOrId: string) => Promise<{
|
|
@@ -2312,6 +2335,10 @@ export declare function createClient(options: ClientOptions): {
|
|
|
2312
2335
|
delete: (id: string) => Promise<unknown>;
|
|
2313
2336
|
};
|
|
2314
2337
|
nodes: {
|
|
2338
|
+
visibility: {
|
|
2339
|
+
get: (id: string) => Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
2340
|
+
set(id: string, visibility: import("./folder-visibility.js").FolderVisibility, expectedUpdatedAt: string): Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
2341
|
+
};
|
|
2315
2342
|
move: (nodes: {
|
|
2316
2343
|
id: string;
|
|
2317
2344
|
expectedPath: string;
|
|
@@ -2343,11 +2370,17 @@ export declare function createClient(options: ClientOptions): {
|
|
|
2343
2370
|
url: string;
|
|
2344
2371
|
}>;
|
|
2345
2372
|
};
|
|
2373
|
+
bindrVisibility: {
|
|
2374
|
+
get: (id: string) => Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
2375
|
+
set(id: string, visibility: import("./folder-visibility.js").FolderVisibility, expectedUpdatedAt: string): Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
2376
|
+
};
|
|
2346
2377
|
tasks: (namespace: string, project: string) => {
|
|
2347
2378
|
list: (query?: {
|
|
2348
2379
|
prefix?: string;
|
|
2349
2380
|
includeDeleted?: boolean;
|
|
2350
|
-
limit
|
|
2381
|
+
limit
|
|
2382
|
+
/** @deprecated Use memoOutline. */
|
|
2383
|
+
? /** @deprecated Use memoOutline. */: number;
|
|
2351
2384
|
cursor?: string;
|
|
2352
2385
|
}) => Promise<unknown>;
|
|
2353
2386
|
get: (id: string, includeDeleted?: boolean) => Promise<unknown>;
|
|
@@ -2593,20 +2626,24 @@ export declare function createClient(options: ClientOptions): {
|
|
|
2593
2626
|
provider?: string;
|
|
2594
2627
|
hasExternal?: boolean;
|
|
2595
2628
|
lifecycle?: string;
|
|
2629
|
+
visibility?: "private" | "unlisted" | "public";
|
|
2596
2630
|
}) => Promise<unknown>;
|
|
2597
|
-
get: (id: string) => Promise<
|
|
2631
|
+
get: (id: string) => Promise<import("./content.js").SourceMetadata>;
|
|
2598
2632
|
byName: (name: string) => Promise<unknown>;
|
|
2599
2633
|
connectors: () => Promise<unknown>;
|
|
2600
2634
|
create: (input: {
|
|
2601
2635
|
name: string;
|
|
2602
2636
|
description?: string;
|
|
2637
|
+
visibility?: "private" | "unlisted" | "public";
|
|
2603
2638
|
}, requestId: string) => Promise<unknown>;
|
|
2604
2639
|
import: (input: import("./common.js").JsonObject, requestId: string) => Promise<unknown>;
|
|
2605
2640
|
metadata: (id: string, input: {
|
|
2606
2641
|
expectedSettingsRevision: number;
|
|
2642
|
+
visibility?: "private" | "unlisted" | "public";
|
|
2607
2643
|
name?: string;
|
|
2608
2644
|
description?: string | null;
|
|
2609
2645
|
}) => Promise<unknown>;
|
|
2646
|
+
setVisibility: (id: string, visibility: "private" | "unlisted" | "public", expectedSettingsRevision: number) => Promise<import("./content.js").SourceMetadata>;
|
|
2610
2647
|
browse: (id: string, query?: {
|
|
2611
2648
|
path?: string;
|
|
2612
2649
|
cursor?: string;
|
package/dist/api/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { folderVisibilityApi } from './folder-visibility.js';
|
|
2
|
+
export { folderVisibilityApi } from './folder-visibility.js';
|
|
1
3
|
import { annotationsApi } from './annotations.js';
|
|
2
4
|
export * from './annotations.js';
|
|
3
5
|
import { FileWorkspace } from "./file-workspace.js";
|
|
@@ -97,6 +99,7 @@ export function createApi(transport, storageFetch = fetch) {
|
|
|
97
99
|
skills: skillsApi(transport),
|
|
98
100
|
projects: (namespace) => projectsApi(transport, namespace),
|
|
99
101
|
nodes: nodesApi(transport),
|
|
102
|
+
bindrVisibility: folderVisibilityApi(transport, 'bindr'),
|
|
100
103
|
tasks: (namespace, project) => tasksApi(transport, namespace, project),
|
|
101
104
|
connections: (namespace) => connectionsApi(transport, namespace),
|
|
102
105
|
annotations: (namespace) => annotationsApi(transport, namespace),
|
package/dist/api/workspace.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FolderVisibility } from './folder-visibility.js';
|
|
1
2
|
import { type ProjectIdentityPatch } from './project-identity.js';
|
|
2
3
|
export * from './project-identity.js';
|
|
3
4
|
export * from "./bindrs.js";
|
|
@@ -58,7 +59,9 @@ export declare function projectsApi(t: Transport, namespace: string): {
|
|
|
58
59
|
summary: (nameOrId: string) => Promise<{
|
|
59
60
|
bindr: import("./bindrs.js").Bindr;
|
|
60
61
|
}>;
|
|
61
|
-
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>
|
|
62
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">> & {
|
|
63
|
+
expectedUpdatedAt?: string;
|
|
64
|
+
}) => Promise<{
|
|
62
65
|
bindr: import("./bindrs.js").Bindr;
|
|
63
66
|
}>;
|
|
64
67
|
delete: (nameOrId: string) => Promise<{
|
|
@@ -100,7 +103,9 @@ export declare function projectsApi(t: Transport, namespace: string): {
|
|
|
100
103
|
summary: (nameOrId: string) => Promise<{
|
|
101
104
|
bindr: import("./bindrs.js").Bindr;
|
|
102
105
|
}>;
|
|
103
|
-
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>
|
|
106
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">> & {
|
|
107
|
+
expectedUpdatedAt?: string;
|
|
108
|
+
}) => Promise<{
|
|
104
109
|
bindr: import("./bindrs.js").Bindr;
|
|
105
110
|
}>;
|
|
106
111
|
delete: (nameOrId: string) => Promise<{
|
|
@@ -154,6 +159,7 @@ export interface ProjectResourceRow {
|
|
|
154
159
|
[key: string]: unknown;
|
|
155
160
|
}
|
|
156
161
|
export interface NodeRow extends Resource {
|
|
162
|
+
folderVisibility?: FolderVisibility | null;
|
|
157
163
|
name?: string;
|
|
158
164
|
kind?: string;
|
|
159
165
|
archivedAt?: string | null;
|
|
@@ -173,6 +179,10 @@ export interface NodeChildrenPage {
|
|
|
173
179
|
searchMode?: string;
|
|
174
180
|
}
|
|
175
181
|
export declare function nodesApi(t: Transport): {
|
|
182
|
+
visibility: {
|
|
183
|
+
get: (id: string) => Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
184
|
+
set(id: string, visibility: FolderVisibility, expectedUpdatedAt: string): Promise<import("./folder-visibility.js").FolderVisibilityState>;
|
|
185
|
+
};
|
|
176
186
|
move: (nodes: {
|
|
177
187
|
id: string;
|
|
178
188
|
expectedPath: string;
|
package/dist/api/workspace.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { folderVisibilityApi } from './folder-visibility.js';
|
|
1
2
|
import { updateProjectIdentity } from './project-identity.js';
|
|
2
3
|
export * from './project-identity.js';
|
|
3
4
|
import { projectAudienceApi } from "./project-audience.js";
|
|
@@ -69,6 +70,7 @@ export function projectsApi(t, namespace) {
|
|
|
69
70
|
}
|
|
70
71
|
export function nodesApi(t) {
|
|
71
72
|
return {
|
|
73
|
+
visibility: folderVisibilityApi(t, 'folder'),
|
|
72
74
|
move: (nodes, parentId) => call(t, "POST", "/nodes/move", { nodes, parentId }),
|
|
73
75
|
list: (query = {}) => call(t, "GET", "/nodes", undefined, query),
|
|
74
76
|
children: (query) => call(t, "GET", "/nodes/children", undefined, query),
|
package/dist/cli/create/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertFolderVisibility } from '../../api/folder-visibility.js';
|
|
1
2
|
import { bindrsApi, BindrMembersError } from "../../api/bindrs.js";
|
|
2
3
|
import { createTransport, namespaceSeg, seg } from "../../api/client.js";
|
|
3
4
|
// `dl create bindr|dataset <name> --project <target> ...`.
|
|
@@ -10,6 +11,14 @@ import { confirm } from "../prompt.js";
|
|
|
10
11
|
import { fetchAllEpisodes, matchEpisodes, resolveProjectCtx, } from "../resources.js";
|
|
11
12
|
import { formatProject } from "../target.js";
|
|
12
13
|
export async function runCreateBindr(name, opts) {
|
|
14
|
+
try {
|
|
15
|
+
if (opts.visibility !== undefined)
|
|
16
|
+
assertFolderVisibility(opts.visibility);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
fail(error.message);
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
13
22
|
if (!opts.project) {
|
|
14
23
|
fail("--project is required");
|
|
15
24
|
return 1;
|
|
@@ -37,7 +46,7 @@ export async function runCreateBindr(name, opts) {
|
|
|
37
46
|
}
|
|
38
47
|
members = matched.map((ep) => ep.id);
|
|
39
48
|
}
|
|
40
|
-
const body = { name };
|
|
49
|
+
const body = { name, ...(opts.visibility !== undefined ? { visibility: opts.visibility } : {}) };
|
|
41
50
|
if (opts.description)
|
|
42
51
|
body.description = opts.description;
|
|
43
52
|
const tags = splitCsv(opts.tags);
|
|
@@ -50,6 +59,8 @@ export async function runCreateBindr(name, opts) {
|
|
|
50
59
|
fail(`Bindr creation returned success without a usable Bindr ID. '${name}' may have been created in ${formatProject(s)}; inspect the project before retrying. No episode tagging requests were sent.`);
|
|
51
60
|
return 1;
|
|
52
61
|
}
|
|
62
|
+
if (opts.visibility !== undefined && created.bindr.visibility !== opts.visibility)
|
|
63
|
+
throw new Error('Bindr visibility was not confirmed; inspect the created Bindr before retrying. No episode tagging was sent.');
|
|
53
64
|
bindrId = created.bindr.id;
|
|
54
65
|
}
|
|
55
66
|
catch (err) {
|
|
@@ -219,6 +230,7 @@ export function registerCreateCommand(program) {
|
|
|
219
230
|
create
|
|
220
231
|
.command("bindr")
|
|
221
232
|
.description("create a bindr (optionally seeded with episodes by glob)")
|
|
233
|
+
.option("--visibility <visibility>", "private, unlisted or public; requires Project ADMIN")
|
|
222
234
|
.argument("<name>", "bindr name")
|
|
223
235
|
.requiredOption("--project <target>", "project scope: space[@namespace]")
|
|
224
236
|
.option("--episode <glob>", "glob to match episodes by node path")
|
|
@@ -11,6 +11,9 @@ type Options = ConnOpts & {
|
|
|
11
11
|
};
|
|
12
12
|
export declare function runFoldersList(opts: Options): Promise<number>;
|
|
13
13
|
export declare function runFoldersArchive(id: string, archived: boolean, opts: Options): Promise<number>;
|
|
14
|
+
export declare function runFolderVisibility(kind: 'folder' | 'bindr', id: string, visibility: string | undefined, opts: Options & {
|
|
15
|
+
expectedUpdatedAt?: string;
|
|
16
|
+
}): Promise<number>;
|
|
14
17
|
export declare function registerFoldersCommand(program: Command): void;
|
|
15
18
|
/** File and folder moves share an atomic endpoint; no recursive client copies. */
|
|
16
19
|
export declare function runNodesMove(ids: string[], opts: ConnOpts & {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { folderVisibilityApi, assertFolderVisibility } from '../../api/folder-visibility.js';
|
|
1
2
|
import { nodesApi } from '../../api/workspace.js';
|
|
2
3
|
import { resolveCtx } from '../compat/ctx.js';
|
|
3
4
|
import { requireToken, requireNamespace } from '../compat/http.js';
|
|
@@ -59,8 +60,42 @@ export async function runFoldersArchive(id, archived, opts) {
|
|
|
59
60
|
return report(error);
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
export async function runFolderVisibility(kind, id, visibility, opts) {
|
|
64
|
+
try {
|
|
65
|
+
if (visibility !== undefined)
|
|
66
|
+
assertFolderVisibility(visibility);
|
|
67
|
+
if (!/^[a-f0-9]{24}$/i.test(id))
|
|
68
|
+
throw new Error('expected a 24-hex folder or Bindr ID');
|
|
69
|
+
const c = resolveCtx(opts), token = requireToken(c);
|
|
70
|
+
if (!token)
|
|
71
|
+
return 1;
|
|
72
|
+
const api = folderVisibilityApi(memoTransport({ remote: c.remote, token }), kind);
|
|
73
|
+
const current = await api.get(id);
|
|
74
|
+
if (opts.expectedUpdatedAt !== undefined && Date.parse(opts.expectedUpdatedAt) !== Date.parse(current.updatedAt))
|
|
75
|
+
throw new Error('Folder changed; read current visibility before retrying');
|
|
76
|
+
const result = visibility === undefined ? current : await api.set(id, visibility, current.updatedAt);
|
|
77
|
+
if (opts.json)
|
|
78
|
+
emitJson(result);
|
|
79
|
+
else
|
|
80
|
+
process.stdout.write(`${kind} ${id}: ${result.visibility ?? 'inherited'}\n`);
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
return report(error);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function registerVisibilityCommand(parent, kind) {
|
|
88
|
+
withConnFlags(parent.command('visibility').allowExcessArguments(false))
|
|
89
|
+
.description('read visibility or set private, unlisted or public (Project ADMIN)')
|
|
90
|
+
.argument('<id>', 'folder or Bindr ID').argument('[visibility]', 'private, unlisted or public')
|
|
91
|
+
.option('--expected-updated-at <timestamp>', 'refuse if the object changed since this version')
|
|
92
|
+
.option('--json', 'emit confirmed visibility and current version')
|
|
93
|
+
.action(async (id, visibility, opts) => { process.exitCode = await runFolderVisibility(kind, id, visibility, opts); });
|
|
94
|
+
}
|
|
62
95
|
export function registerFoldersCommand(program) {
|
|
63
|
-
const folders = program.command('folders').description('browse
|
|
96
|
+
const folders = program.command('folders').description('browse folders and manage visibility or archival');
|
|
97
|
+
registerVisibilityCommand(folders, 'folder');
|
|
98
|
+
registerVisibilityCommand(program.command('bindrs').description('manage Bindr visibility by ID'), 'bindr');
|
|
64
99
|
registerNodeMoveCommand(folders);
|
|
65
100
|
registerNodeMoveCommand(program.command('files').description('move project files without copying stored bytes'));
|
|
66
101
|
withConnFlags(folders.command('list').allowExcessArguments(false))
|
|
@@ -219,6 +219,9 @@ export const helpExamples = {
|
|
|
219
219
|
"project permissions": "# Choose organization and Project with the keyboard.\ndl project permissions\n# Or select the owning namespace and exact Project up front.\ndl project permissions research --namespace acme",
|
|
220
220
|
"project audience": "dl project audience research --namespace acme --json",
|
|
221
221
|
"project rename": "dl project rename research \"Research Results\" --namespace my-team\ndl project rename research --namespace my-team --slug stable-research\ndl project rename stable-research --namespace my-team --auto-slug",
|
|
222
|
+
"folders visibility": "# Read the current folder visibility and version.\ndl folders visibility FOLDER_ID --json\n# Share this folder by link without listing it publicly.\ndl folders visibility FOLDER_ID unlisted",
|
|
223
|
+
"bindrs visibility": "dl bindrs visibility BINDR_ID --json\ndl bindrs visibility BINDR_ID unlisted",
|
|
224
|
+
"update bindr": "dl update bindr research --project my-robots --visibility unlisted",
|
|
222
225
|
"provider create": "dl provider create -n aws-demo --provider aws-jump-worker --json\n# Read the generated AGENT.md and terraform/ENROLLMENT.md.\n# Fill terraform/terraform.tfvars.json and terraform/backend.json explicitly.\ndl provider create -n aws-demo --continue --json",
|
|
223
226
|
"provider plan": "# Requires the selected backend and authorized AWS read access.\ndl provider plan -n aws-demo --json",
|
|
224
227
|
"provider machine": "dl provider machine status -n aws-dev --account 123456789012 --json\ndl provider machine start -n aws-dev --account 123456789012 --yes\ndl provider machine terminal -n aws-dev --account 123456789012\ndl provider machine stop -n aws-dev --account 123456789012 --yes",
|
|
@@ -296,6 +299,9 @@ export const helpExamples = {
|
|
|
296
299
|
"skill install": "# The embedded dreamlake-cli skill; offline when it matches the release\ndl skill install dreamlake-cli\n# A catalog skill plus whatever it requires, from the latest release\ndl skill install dreamlake-memos --agent codex\n# One copy for Claude Code and one for Codex\ndl skill install dreamlake-memos --agent all --global\n# Replace files you edited with the release copies\ndl skill install dreamlake-memos --force",
|
|
297
300
|
"skill update": "# Every skill with a manifest in the selected scope\ndl skill update\ndl skill update dreamlake-cli --global\n# Overwrite edited files; retired files you edited are still kept\ndl skill update dreamlake-memos --force\n# Go back to an older release, or replace a copy whose version cannot be ordered\ndl skill update dreamlake-memos --allow-downgrade",
|
|
298
301
|
"skill remove": "dl skill remove dreamlake-memos\ndl skill remove dreamlake-memos --agent codex --global --json",
|
|
302
|
+
"source visibility": "dl source visibility unlisted --source research-data\ndl source visibility private --source research-data",
|
|
303
|
+
"source create": "dl source create research-data --visibility unlisted",
|
|
304
|
+
"source list": "dl source list --visibility unlisted --json",
|
|
299
305
|
"source files write": "dl source files write --source my-workspace --prefix workspaces/v1/demo --path scene/manifest.json --file ./manifest.json --create --json",
|
|
300
306
|
"source files read": "dl source files read --source my-workspace --prefix workspaces/v1/demo --path scene/manifest.json --json",
|
|
301
307
|
"source files list": "dl source files list --source my-workspace --prefix workspaces/v1/demo --path '' --json",
|
|
@@ -20,6 +20,7 @@ export interface ProviderIdentity {
|
|
|
20
20
|
label: string;
|
|
21
21
|
}
|
|
22
22
|
interface Source {
|
|
23
|
+
visibility?: "private" | "unlisted" | "public";
|
|
23
24
|
id: string;
|
|
24
25
|
name: string;
|
|
25
26
|
description: string | null;
|
|
@@ -178,6 +179,7 @@ export declare function asProviderIdentity(v: unknown): ProviderIdentity | null;
|
|
|
178
179
|
export declare function readSourceProvider(res: Record<string, unknown>, where: string): ProviderIdentity | null;
|
|
179
180
|
/** The filters `GET /namespaces/:ns/sources` declares. Nothing else is sent. */
|
|
180
181
|
export interface SourceListFilters {
|
|
182
|
+
visibility?: "private" | "unlisted" | "public";
|
|
181
183
|
nameContains?: string;
|
|
182
184
|
provider?: string;
|
|
183
185
|
hasExternal?: boolean;
|
|
@@ -239,6 +241,7 @@ declare function pool<T, R>(items: T[], limit: number, worker: (item: T, index:
|
|
|
239
241
|
error: Error;
|
|
240
242
|
})[]>;
|
|
241
243
|
export interface SourceListOptions {
|
|
244
|
+
visibility?: string;
|
|
242
245
|
namespace?: string;
|
|
243
246
|
limit?: string;
|
|
244
247
|
cursor?: string;
|
package/dist/cli/source/index.js
CHANGED
|
@@ -323,6 +323,8 @@ function assertSourceListPage(res) {
|
|
|
323
323
|
// readSourceProvider. Written back onto the item so the cast below hands
|
|
324
324
|
// every consumer `provider: ProviderIdentity | null`.
|
|
325
325
|
item.provider = readSourceProvider(item, "a source list item");
|
|
326
|
+
if (item.visibility !== undefined && !["private", "unlisted", "public"].includes(item.visibility))
|
|
327
|
+
bad("a source list item has invalid visibility");
|
|
326
328
|
checkBooleans(item.capabilities, ["use"], `source '${String(item.name)}'`);
|
|
327
329
|
}
|
|
328
330
|
return res;
|
|
@@ -435,6 +437,7 @@ async function listPage(c, query) {
|
|
|
435
437
|
provider: query.provider,
|
|
436
438
|
hasExternal: query.hasExternal,
|
|
437
439
|
lifecycle: query.lifecycle,
|
|
440
|
+
visibility: query.visibility,
|
|
438
441
|
},
|
|
439
442
|
}));
|
|
440
443
|
}
|
|
@@ -678,11 +681,17 @@ function listContinuation(ns, opts, cursor) {
|
|
|
678
681
|
parts.push(`--provider ${shellQuote(opts.provider)}`);
|
|
679
682
|
if (opts.hasExternal !== undefined)
|
|
680
683
|
parts.push(opts.hasExternal ? "--external" : "--no-external");
|
|
684
|
+
if (opts.visibility !== undefined)
|
|
685
|
+
parts.push(`--visibility ${shellQuote(opts.visibility)}`);
|
|
681
686
|
if (opts.lifecycle !== undefined)
|
|
682
687
|
parts.push(`--lifecycle ${opts.lifecycle}`);
|
|
683
688
|
return `${parts.join(" ")} --cursor ${cursor}`;
|
|
684
689
|
}
|
|
685
690
|
export async function runSourceList(opts) {
|
|
691
|
+
if (opts.visibility !== undefined && !["private", "unlisted", "public"].includes(opts.visibility)) {
|
|
692
|
+
fail("--visibility must be private, unlisted, or public");
|
|
693
|
+
return 1;
|
|
694
|
+
}
|
|
686
695
|
const limit = parseListLimit(opts.limit);
|
|
687
696
|
if (limit === null)
|
|
688
697
|
return 1;
|
|
@@ -716,6 +725,7 @@ export async function runSourceList(opts) {
|
|
|
716
725
|
provider: opts.provider,
|
|
717
726
|
hasExternal: opts.hasExternal,
|
|
718
727
|
lifecycle: opts.lifecycle,
|
|
728
|
+
visibility: opts.visibility,
|
|
719
729
|
});
|
|
720
730
|
// The v1 projection, under v1's own field names. The legacy trio
|
|
721
731
|
// (kind/status/access) is NOT reconstructed: `access` in particular would
|
|
@@ -730,6 +740,7 @@ export async function runSourceList(opts) {
|
|
|
730
740
|
provider: x.provider?.label ?? null,
|
|
731
741
|
providerId: x.provider?.id ?? null,
|
|
732
742
|
lifecycle: x.lifecycle,
|
|
743
|
+
visibility: x.visibility ?? "private",
|
|
733
744
|
use: x.capabilities.use,
|
|
734
745
|
});
|
|
735
746
|
if (opts.json) {
|
|
@@ -771,6 +782,7 @@ export async function runSourceList(opts) {
|
|
|
771
782
|
// an invented word like "dreamlake" would read as a provider name.
|
|
772
783
|
provider: x.provider?.label ?? "-",
|
|
773
784
|
lifecycle: x.lifecycle,
|
|
785
|
+
visibility: x.visibility ?? "private",
|
|
774
786
|
use: x.capabilities.use ? "yes" : "no",
|
|
775
787
|
}));
|
|
776
788
|
process.stdout.write(renderTable(rows, ["name", "provider", "lifecycle", "use"]));
|
|
@@ -1290,6 +1302,7 @@ export function registerSourceCommand(program) {
|
|
|
1290
1302
|
.option("--provider <id>", "only sources pointing at this provider (the product id, e.g. 'huggingface')")
|
|
1291
1303
|
.option("--external", "only sources that have an external layer")
|
|
1292
1304
|
.option("--no-external", "only sources with no external layer")
|
|
1305
|
+
.option("--visibility <visibility>", "private, unlisted, or public")
|
|
1293
1306
|
.option("--lifecycle <state>", "only 'active' or only 'disabled'")
|
|
1294
1307
|
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
1295
1308
|
.option("--json", "emit JSON")
|
|
@@ -20,6 +20,7 @@ import { type ProviderIdentity } from "./index.js";
|
|
|
20
20
|
* and it would have to be edited every time the server adds something.
|
|
21
21
|
*/
|
|
22
22
|
interface SourceDetail {
|
|
23
|
+
visibility?: "private" | "unlisted" | "public";
|
|
23
24
|
id: string;
|
|
24
25
|
name: string;
|
|
25
26
|
description: string | null;
|
|
@@ -49,6 +50,7 @@ export declare function explainWrite(err: unknown): string;
|
|
|
49
50
|
export declare function runSourceCreate(opts: {
|
|
50
51
|
name: string;
|
|
51
52
|
description?: string;
|
|
53
|
+
visibility?: string;
|
|
52
54
|
namespace?: string;
|
|
53
55
|
idempotencyKey?: string;
|
|
54
56
|
json?: boolean;
|
|
@@ -58,6 +60,7 @@ export declare function runSourceImport(opts: {
|
|
|
58
60
|
target: string;
|
|
59
61
|
name?: string;
|
|
60
62
|
description?: string;
|
|
63
|
+
visibility?: string;
|
|
61
64
|
connection?: string;
|
|
62
65
|
scope?: string;
|
|
63
66
|
config?: string;
|
|
@@ -69,6 +72,7 @@ export declare function runSourceMetadata(opts: {
|
|
|
69
72
|
source: string;
|
|
70
73
|
rename?: string;
|
|
71
74
|
description?: string;
|
|
75
|
+
visibility?: string;
|
|
72
76
|
clearDescription?: boolean;
|
|
73
77
|
namespace?: string;
|
|
74
78
|
json?: boolean;
|
package/dist/cli/source/write.js
CHANGED
|
@@ -17,6 +17,8 @@ import { bad, checkBooleans, ctx, isObject, nullableString, readSourceProvider,
|
|
|
17
17
|
export function assertSourceDetail(res, where) {
|
|
18
18
|
if (!isObject(res))
|
|
19
19
|
bad(`${where}: expected an object`);
|
|
20
|
+
if (res.visibility !== undefined && !["private", "unlisted", "public"].includes(res.visibility))
|
|
21
|
+
bad(`${where}: unexpected visibility`);
|
|
20
22
|
if (typeof res.id !== "string" || res.id === "")
|
|
21
23
|
bad(`${where}: missing id`);
|
|
22
24
|
if (typeof res.name !== "string" || res.name === "")
|
|
@@ -136,6 +138,7 @@ function project(detail) {
|
|
|
136
138
|
return {
|
|
137
139
|
name: detail.name,
|
|
138
140
|
description: detail.description,
|
|
141
|
+
visibility: detail.visibility ?? "private",
|
|
139
142
|
lifecycle: detail.lifecycle,
|
|
140
143
|
// The display label, as this output has always carried — the id is the
|
|
141
144
|
// list's business, where the `--provider` filter consumes it.
|
|
@@ -162,6 +165,10 @@ function report(detail, json, what) {
|
|
|
162
165
|
}
|
|
163
166
|
// ── source create ─────────────────────────────────────────────────────────────
|
|
164
167
|
export async function runSourceCreate(opts) {
|
|
168
|
+
if (opts.visibility !== undefined && !["private", "unlisted", "public"].includes(opts.visibility)) {
|
|
169
|
+
fail("--visibility must be private, unlisted, or public");
|
|
170
|
+
return 1;
|
|
171
|
+
}
|
|
165
172
|
const c = await ctx(opts.namespace);
|
|
166
173
|
if (!c)
|
|
167
174
|
return 1;
|
|
@@ -176,6 +183,7 @@ export async function runSourceCreate(opts) {
|
|
|
176
183
|
json: {
|
|
177
184
|
name: opts.name,
|
|
178
185
|
...(opts.description === undefined ? {} : { description: opts.description }),
|
|
186
|
+
...(opts.visibility === undefined ? {} : { visibility: opts.visibility }),
|
|
179
187
|
},
|
|
180
188
|
});
|
|
181
189
|
report(assertSourceDetail(res, "create-empty"), opts.json === true, "Created");
|
|
@@ -212,6 +220,10 @@ function parseJsonArg(value, flag) {
|
|
|
212
220
|
}
|
|
213
221
|
}
|
|
214
222
|
export async function runSourceImport(opts) {
|
|
223
|
+
if (opts.visibility !== undefined && !["private", "unlisted", "public"].includes(opts.visibility)) {
|
|
224
|
+
fail("--visibility must be private, unlisted, or public");
|
|
225
|
+
return 1;
|
|
226
|
+
}
|
|
215
227
|
const c = await ctx(opts.namespace);
|
|
216
228
|
if (!c)
|
|
217
229
|
return 1;
|
|
@@ -231,6 +243,7 @@ export async function runSourceImport(opts) {
|
|
|
231
243
|
json: {
|
|
232
244
|
...(opts.name === undefined ? {} : { name: opts.name }),
|
|
233
245
|
...(opts.description === undefined ? {} : { description: opts.description }),
|
|
246
|
+
...(opts.visibility === undefined ? {} : { visibility: opts.visibility }),
|
|
234
247
|
external: {
|
|
235
248
|
connectorKind: opts.connector,
|
|
236
249
|
...(opts.connection === undefined ? {} : { connectionId: opts.connection }),
|
|
@@ -254,6 +267,10 @@ export async function runSourceImport(opts) {
|
|
|
254
267
|
}
|
|
255
268
|
// ── source metadata ───────────────────────────────────────────────────────────
|
|
256
269
|
export async function runSourceMetadata(opts) {
|
|
270
|
+
if (opts.visibility !== undefined && !["private", "unlisted", "public"].includes(opts.visibility)) {
|
|
271
|
+
fail("--visibility must be private, unlisted, or public");
|
|
272
|
+
return 1;
|
|
273
|
+
}
|
|
257
274
|
const c = await ctx(opts.namespace);
|
|
258
275
|
if (!c)
|
|
259
276
|
return 1;
|
|
@@ -261,8 +278,8 @@ export async function runSourceMetadata(opts) {
|
|
|
261
278
|
fail("--description and --clear-description ask for different things");
|
|
262
279
|
return 1;
|
|
263
280
|
}
|
|
264
|
-
if (opts.rename === undefined && opts.description === undefined && !opts.clearDescription) {
|
|
265
|
-
fail("nothing to change — pass --rename, --description or --clear-description");
|
|
281
|
+
if (opts.rename === undefined && opts.description === undefined && !opts.clearDescription && opts.visibility === undefined) {
|
|
282
|
+
fail("nothing to change — pass --visibility, --rename, --description or --clear-description");
|
|
266
283
|
return 1;
|
|
267
284
|
}
|
|
268
285
|
try {
|
|
@@ -290,9 +307,15 @@ export async function runSourceMetadata(opts) {
|
|
|
290
307
|
// description, not an instruction to remove it.
|
|
291
308
|
...(opts.clearDescription ? { description: null } : {}),
|
|
292
309
|
...(opts.description === undefined ? {} : { description: opts.description }),
|
|
310
|
+
...(opts.visibility === undefined ? {} : { visibility: opts.visibility }),
|
|
293
311
|
},
|
|
294
312
|
});
|
|
295
|
-
|
|
313
|
+
const saved = assertSourceDetail(res, "metadata");
|
|
314
|
+
if (opts.visibility !== undefined && (saved.id !== source.id || saved.visibility !== opts.visibility)) {
|
|
315
|
+
fail("Visibility update was not confirmed. Read the Source before retrying; no automatic retry was sent.");
|
|
316
|
+
return 1;
|
|
317
|
+
}
|
|
318
|
+
report(saved, opts.json === true, "Updated");
|
|
296
319
|
return 0;
|
|
297
320
|
}
|
|
298
321
|
catch (err) {
|
|
@@ -305,6 +328,7 @@ export function registerSourceWriteCommands(source) {
|
|
|
305
328
|
strictArgs(source.command("create"))
|
|
306
329
|
.description("create an empty source in a namespace")
|
|
307
330
|
.argument("<name>", "source name")
|
|
331
|
+
.option("--visibility <visibility>", "private, unlisted (link only), or public")
|
|
308
332
|
.option("--description <text>", "human description")
|
|
309
333
|
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
310
334
|
.option("--idempotency-key <key>", "reuse a key from a previous attempt that never answered")
|
|
@@ -315,6 +339,7 @@ export function registerSourceWriteCommands(source) {
|
|
|
315
339
|
.requiredOption("--connector <kind>", "connector kind (e.g. s3, huggingface)")
|
|
316
340
|
.requiredOption("--target <json>", "connector target, as JSON")
|
|
317
341
|
.option("--name <name>", "source name (default: derived by the server)")
|
|
342
|
+
.option("--visibility <visibility>", "private, unlisted (link only), or public")
|
|
318
343
|
.option("--description <text>", "human description")
|
|
319
344
|
.option("--connection <id>", "connection to authenticate with")
|
|
320
345
|
.option("--scope <json>", "scope within the target, as JSON")
|
|
@@ -323,10 +348,18 @@ export function registerSourceWriteCommands(source) {
|
|
|
323
348
|
.option("--idempotency-key <key>", "reuse a key from a previous attempt that never answered")
|
|
324
349
|
.option("--json", "emit JSON")
|
|
325
350
|
.action(async (opts) => process.exit(await runSourceImport(opts)));
|
|
351
|
+
strictArgs(source.command("visibility"))
|
|
352
|
+
.description("set direct-link visibility without changing signed-in sharing")
|
|
353
|
+
.argument("<visibility>", "private, unlisted, or public")
|
|
354
|
+
.requiredOption("--source <name>", "source name")
|
|
355
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
356
|
+
.option("--json", "emit JSON")
|
|
357
|
+
.action(async (visibility, opts) => process.exit(await runSourceMetadata({ ...opts, visibility })));
|
|
326
358
|
strictArgs(source.command("metadata"))
|
|
327
359
|
.description("rename a source, or change its description")
|
|
328
360
|
.requiredOption("--source <name>", "source name (see 'dl source list')")
|
|
329
361
|
.option("--rename <name>", "new name; the old one is released immediately")
|
|
362
|
+
.option("--visibility <visibility>", "private, unlisted (link only), or public")
|
|
330
363
|
.option("--description <text>", "replace the description")
|
|
331
364
|
.option("--clear-description", "remove the description entirely")
|
|
332
365
|
.option("--namespace <slug>", "namespace slug (default: active login)")
|
package/dist/cli/update/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertFolderVisibility } from '../../api/folder-visibility.js';
|
|
1
2
|
import { bindrsApi } from "../../api/bindrs.js";
|
|
2
3
|
import { createTransport } from "../../api/client.js";
|
|
3
4
|
import { HttpError, requestJson } from "../client.js";
|
|
@@ -8,10 +9,10 @@ import { memoProjectNode } from "../memos/move-command.js";
|
|
|
8
9
|
import { fetchAllBindrs, fetchAllEpisodes, matchBindrs, matchEpisodes, resolveProjectCtx, resolveBindr, } from "../resources.js";
|
|
9
10
|
import { formatProject } from "../target.js";
|
|
10
11
|
function nothingToDo(opts) {
|
|
11
|
-
return !opts.add && !opts.remove && !opts.addNote && opts.description === undefined && opts.tags === undefined;
|
|
12
|
+
return !opts.add && !opts.remove && !opts.addNote && opts.description === undefined && opts.tags === undefined && opts.visibility === undefined;
|
|
12
13
|
}
|
|
13
14
|
async function patchMetadata(remote, base, token, opts, kind, name, project) {
|
|
14
|
-
if (opts.description === undefined && opts.tags === undefined)
|
|
15
|
+
if (opts.description === undefined && opts.tags === undefined && opts.visibility === undefined)
|
|
15
16
|
return true;
|
|
16
17
|
const body = {};
|
|
17
18
|
if (opts.description !== undefined)
|
|
@@ -19,7 +20,18 @@ async function patchMetadata(remote, base, token, opts, kind, name, project) {
|
|
|
19
20
|
if (opts.tags !== undefined)
|
|
20
21
|
body.tags = splitCsv(opts.tags);
|
|
21
22
|
try {
|
|
22
|
-
|
|
23
|
+
if (kind === 'bindr' && opts.visibility !== undefined) {
|
|
24
|
+
const current = await requestJson(remote, base + '/summary', { token });
|
|
25
|
+
if (!current?.bindr?.updatedAt || !Number.isFinite(Date.parse(current.bindr.updatedAt)))
|
|
26
|
+
throw new Error('Server did not provide a current Bindr version');
|
|
27
|
+
body.visibility = opts.visibility;
|
|
28
|
+
body.expectedUpdatedAt = current.bindr.updatedAt;
|
|
29
|
+
const saved = await requestJson(remote, base, { method: 'PATCH', token, json: body });
|
|
30
|
+
if (saved?.bindr?.id !== current.bindr.id || saved.bindr.visibility !== opts.visibility)
|
|
31
|
+
throw new Error('Bindr visibility was not confirmed; read current metadata before retrying');
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
await requestJson(remote, base, { method: "PATCH", token, json: body });
|
|
23
35
|
ok(`Updated ${kind}: ${name}`);
|
|
24
36
|
return true;
|
|
25
37
|
}
|
|
@@ -33,12 +45,20 @@ async function patchMetadata(remote, base, token, opts, kind, name, project) {
|
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
export async function runUpdateBindr(name, opts) {
|
|
48
|
+
try {
|
|
49
|
+
if (opts.visibility !== undefined)
|
|
50
|
+
assertFolderVisibility(opts.visibility);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
fail(error.message);
|
|
54
|
+
return 1;
|
|
55
|
+
}
|
|
36
56
|
if (!opts.project) {
|
|
37
57
|
fail("--project is required");
|
|
38
58
|
return 1;
|
|
39
59
|
}
|
|
40
60
|
if (nothingToDo(opts)) {
|
|
41
|
-
fail("nothing to update. use --add, --remove, --add-note, --description, or --tags");
|
|
61
|
+
fail("nothing to update. use --visibility, --add, --remove, --add-note, --description, or --tags");
|
|
42
62
|
return 1;
|
|
43
63
|
}
|
|
44
64
|
const ctx = await resolveProjectCtx(opts.project);
|
|
@@ -223,6 +243,7 @@ export function registerUpdateCommand(program) {
|
|
|
223
243
|
update
|
|
224
244
|
.command("bindr")
|
|
225
245
|
.description("add/remove episodes (by glob), tag a memo, or update metadata")
|
|
246
|
+
.option("--visibility <visibility>", "private, unlisted or public; requires Project ADMIN")
|
|
226
247
|
.argument("<name>", "bindr name")
|
|
227
248
|
.requiredOption("--project <target>", "project scope: space[@namespace]")
|
|
228
249
|
.option("--add <glob>", "glob to add matching episodes")
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.125.
|
|
1
|
+
export declare const VERSION = "0.125.4";
|
package/dist/cli/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamlake/dreamlake-cli",
|
|
3
|
-
"version": "0.125.
|
|
3
|
+
"version": "0.125.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"node": ">=18"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@dreamlake/dreamlake-cli-darwin-arm64": "0.125.
|
|
41
|
-
"@dreamlake/dreamlake-cli-darwin-x64": "0.125.
|
|
42
|
-
"@dreamlake/dreamlake-cli-linux-x64": "0.125.
|
|
43
|
-
"@dreamlake/dreamlake-cli-linux-arm64": "0.125.
|
|
44
|
-
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.125.
|
|
45
|
-
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.125.
|
|
46
|
-
"@dreamlake/dreamlake-cli-win32-x64": "0.125.
|
|
47
|
-
"@dreamlake/dreamlake-cli-win32-arm64": "0.125.
|
|
40
|
+
"@dreamlake/dreamlake-cli-darwin-arm64": "0.125.4",
|
|
41
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.125.4",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.125.4",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.125.4",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.125.4",
|
|
45
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.125.4",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.125.4",
|
|
47
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.125.4"
|
|
48
48
|
}
|
|
49
49
|
}
|