@im-nobsidian/core 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -28
- package/dist/index.js +28 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,21 +9,15 @@ declare const DEFAULT_TITLE_PROPERTY = "Name";
|
|
|
9
9
|
declare const DatabaseSyncSchema: z.ZodObject<{
|
|
10
10
|
databaseId: z.ZodString;
|
|
11
11
|
localFolder: z.ZodString;
|
|
12
|
-
propertyMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
13
12
|
pullFilter: z.ZodOptional<z.ZodUnknown>;
|
|
14
|
-
titleProperty: z.ZodDefault<z.ZodString>;
|
|
15
13
|
}, "strip", z.ZodTypeAny, {
|
|
16
14
|
databaseId: string;
|
|
17
15
|
localFolder: string;
|
|
18
|
-
titleProperty: string;
|
|
19
|
-
propertyMapping?: Record<string, string> | undefined;
|
|
20
16
|
pullFilter?: unknown;
|
|
21
17
|
}, {
|
|
22
18
|
databaseId: string;
|
|
23
19
|
localFolder: string;
|
|
24
|
-
propertyMapping?: Record<string, string> | undefined;
|
|
25
20
|
pullFilter?: unknown;
|
|
26
|
-
titleProperty?: string | undefined;
|
|
27
21
|
}>;
|
|
28
22
|
type DatabaseSyncConfig = z.infer<typeof DatabaseSyncSchema>;
|
|
29
23
|
declare const ConfigSchema: z.ZodObject<{
|
|
@@ -36,46 +30,36 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
36
30
|
databases: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
37
31
|
databaseId: z.ZodString;
|
|
38
32
|
localFolder: z.ZodString;
|
|
39
|
-
propertyMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
40
33
|
pullFilter: z.ZodOptional<z.ZodUnknown>;
|
|
41
|
-
titleProperty: z.ZodDefault<z.ZodString>;
|
|
42
34
|
}, "strip", z.ZodTypeAny, {
|
|
43
35
|
databaseId: string;
|
|
44
36
|
localFolder: string;
|
|
45
|
-
titleProperty: string;
|
|
46
|
-
propertyMapping?: Record<string, string> | undefined;
|
|
47
37
|
pullFilter?: unknown;
|
|
48
38
|
}, {
|
|
49
39
|
databaseId: string;
|
|
50
40
|
localFolder: string;
|
|
51
|
-
propertyMapping?: Record<string, string> | undefined;
|
|
52
41
|
pullFilter?: unknown;
|
|
53
|
-
titleProperty?: string | undefined;
|
|
54
42
|
}>, "many">>;
|
|
55
43
|
}, "strip", z.ZodTypeAny, {
|
|
56
|
-
token: string;
|
|
57
|
-
rootPageId: string;
|
|
58
|
-
parentMode: "page" | "database";
|
|
59
44
|
databases: {
|
|
60
45
|
databaseId: string;
|
|
61
46
|
localFolder: string;
|
|
62
|
-
titleProperty: string;
|
|
63
|
-
propertyMapping?: Record<string, string> | undefined;
|
|
64
47
|
pullFilter?: unknown;
|
|
65
48
|
}[];
|
|
49
|
+
token: string;
|
|
50
|
+
rootPageId: string;
|
|
51
|
+
parentMode: "page" | "database";
|
|
66
52
|
databaseId?: string | undefined;
|
|
67
53
|
}, {
|
|
68
54
|
token: string;
|
|
69
55
|
rootPageId: string;
|
|
70
56
|
databaseId?: string | undefined;
|
|
71
|
-
parentMode?: "page" | "database" | undefined;
|
|
72
57
|
databases?: {
|
|
73
58
|
databaseId: string;
|
|
74
59
|
localFolder: string;
|
|
75
|
-
propertyMapping?: Record<string, string> | undefined;
|
|
76
60
|
pullFilter?: unknown;
|
|
77
|
-
titleProperty?: string | undefined;
|
|
78
61
|
}[] | undefined;
|
|
62
|
+
parentMode?: "page" | "database" | undefined;
|
|
79
63
|
}>;
|
|
80
64
|
sync: z.ZodObject<{
|
|
81
65
|
direction: z.ZodDefault<z.ZodEnum<["push", "pull", "both"]>>;
|
|
@@ -197,16 +181,14 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
197
181
|
}>;
|
|
198
182
|
}, "strip", z.ZodTypeAny, {
|
|
199
183
|
notion: {
|
|
200
|
-
token: string;
|
|
201
|
-
rootPageId: string;
|
|
202
|
-
parentMode: "page" | "database";
|
|
203
184
|
databases: {
|
|
204
185
|
databaseId: string;
|
|
205
186
|
localFolder: string;
|
|
206
|
-
titleProperty: string;
|
|
207
|
-
propertyMapping?: Record<string, string> | undefined;
|
|
208
187
|
pullFilter?: unknown;
|
|
209
188
|
}[];
|
|
189
|
+
token: string;
|
|
190
|
+
rootPageId: string;
|
|
191
|
+
parentMode: "page" | "database";
|
|
210
192
|
databaseId?: string | undefined;
|
|
211
193
|
};
|
|
212
194
|
conversion: {
|
|
@@ -257,14 +239,12 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
257
239
|
token: string;
|
|
258
240
|
rootPageId: string;
|
|
259
241
|
databaseId?: string | undefined;
|
|
260
|
-
parentMode?: "page" | "database" | undefined;
|
|
261
242
|
databases?: {
|
|
262
243
|
databaseId: string;
|
|
263
244
|
localFolder: string;
|
|
264
|
-
propertyMapping?: Record<string, string> | undefined;
|
|
265
245
|
pullFilter?: unknown;
|
|
266
|
-
titleProperty?: string | undefined;
|
|
267
246
|
}[] | undefined;
|
|
247
|
+
parentMode?: "page" | "database" | undefined;
|
|
268
248
|
};
|
|
269
249
|
conversion: {
|
|
270
250
|
timeZone?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -196,9 +196,7 @@ var DEFAULT_TITLE_PROPERTY = "Name";
|
|
|
196
196
|
var DatabaseSyncSchema = z.object({
|
|
197
197
|
databaseId: z.string(),
|
|
198
198
|
localFolder: z.string(),
|
|
199
|
-
|
|
200
|
-
pullFilter: z.unknown().optional(),
|
|
201
|
-
titleProperty: z.string().default(DEFAULT_TITLE_PROPERTY)
|
|
199
|
+
pullFilter: z.unknown().optional()
|
|
202
200
|
});
|
|
203
201
|
var DEFAULTS = {
|
|
204
202
|
version: 1,
|
|
@@ -268,12 +266,36 @@ var RETIRED_SETTINGS = [
|
|
|
268
266
|
note: "\uAEBC\uB3C4 \uBC14\uB010 \uAC83\uC774 \uC5C6\uC5C8\uC2B5\uB2C8\uB2E4 \u2014 frontmatter \uB294 \uB298 Notion \uC18D\uC131\uC73C\uB85C \uC8FC\uACE0\uBC1B\uC2B5\uB2C8\uB2E4"
|
|
269
267
|
}
|
|
270
268
|
];
|
|
269
|
+
var RETIRED_DATABASE_SETTINGS = [
|
|
270
|
+
{
|
|
271
|
+
key: "propertyMapping",
|
|
272
|
+
meant: (value) => value !== void 0,
|
|
273
|
+
note: "\uC5B4\uB514\uC5D0\uB3C4 \uC4F0\uC774\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4 \u2014 \uC18D\uC131\uC740 frontmatter \uC758 \uC774\uB984 \uADF8\uB300\uB85C Notion \uC18D\uC131\uACFC \uC9DD\uC9D3\uC2B5\uB2C8\uB2E4"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: "titleProperty",
|
|
277
|
+
meant: (value) => value !== void 0 && value !== DEFAULT_TITLE_PROPERTY,
|
|
278
|
+
note: "\uC5B4\uB514\uC5D0\uB3C4 \uC4F0\uC774\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4 \u2014 \uC81C\uBAA9 \uC18D\uC131\uC740 Notion DB \uC758 title \uC18D\uC131\uC744 \uC77D\uC5B4 \uCC3E\uC2B5\uB2C8\uB2E4"
|
|
279
|
+
}
|
|
280
|
+
];
|
|
271
281
|
function retiredSettings(raw) {
|
|
272
|
-
|
|
273
|
-
|
|
282
|
+
const root = raw;
|
|
283
|
+
const lines = RETIRED_SETTINGS.flatMap(({ path: [section, key], meant, note }) => {
|
|
284
|
+
const group2 = root?.[section];
|
|
274
285
|
const value = group2 && typeof group2 === "object" ? group2[key] : void 0;
|
|
275
286
|
return meant(value) ? [`${section}.${key}: ${note}`] : [];
|
|
276
287
|
});
|
|
288
|
+
const notion = root?.notion;
|
|
289
|
+
const databases = Array.isArray(notion?.databases) ? notion.databases : [];
|
|
290
|
+
databases.forEach((database, index) => {
|
|
291
|
+
if (!database || typeof database !== "object") return;
|
|
292
|
+
for (const { key, meant, note } of RETIRED_DATABASE_SETTINGS) {
|
|
293
|
+
if (meant(database[key])) {
|
|
294
|
+
lines.push(`notion.databases[${index}].${key}: ${note}`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
return lines;
|
|
277
299
|
}
|
|
278
300
|
var ConfigSchema = z.object({
|
|
279
301
|
version: z.literal(1),
|
|
@@ -23354,8 +23376,7 @@ var DatabaseDiscovery = class {
|
|
|
23354
23376
|
kind: "ok",
|
|
23355
23377
|
config: {
|
|
23356
23378
|
databaseId: dbId,
|
|
23357
|
-
localFolder: `${parentFolder}/${safeName}
|
|
23358
|
-
titleProperty: DEFAULT_TITLE_PROPERTY
|
|
23379
|
+
localFolder: `${parentFolder}/${safeName}`
|
|
23359
23380
|
}
|
|
23360
23381
|
};
|
|
23361
23382
|
}
|