@graview/core 0.1.57 → 0.1.58

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.
Files changed (71) hide show
  1. package/README.md +12 -4
  2. package/dist/cli/document-schema.js +1 -1
  3. package/dist/cli/document-schema.js.map +1 -1
  4. package/dist/document/compile.d.ts.map +1 -1
  5. package/dist/document/compile.js +4 -0
  6. package/dist/document/compile.js.map +1 -1
  7. package/dist/document/compiled.d.ts +2 -0
  8. package/dist/document/compiled.d.ts.map +1 -1
  9. package/dist/document/compiled.js +2 -0
  10. package/dist/document/compiled.js.map +1 -1
  11. package/dist/document/connection-findings.d.ts.map +1 -1
  12. package/dist/document/connection-findings.js +189 -25
  13. package/dist/document/connection-findings.js.map +1 -1
  14. package/dist/document/connection-spec.d.ts +42 -2
  15. package/dist/document/connection-spec.d.ts.map +1 -1
  16. package/dist/document/connection-spec.js +64 -19
  17. package/dist/document/connection-spec.js.map +1 -1
  18. package/dist/document/kept-in-step.d.ts +7 -0
  19. package/dist/document/kept-in-step.d.ts.map +1 -0
  20. package/dist/document/kept-in-step.js +28 -0
  21. package/dist/document/kept-in-step.js.map +1 -0
  22. package/dist/document/schema.d.ts +5 -5
  23. package/dist/document.schema.json +243 -98
  24. package/dist/mutations/derive-edits.d.ts +4 -2
  25. package/dist/mutations/derive-edits.d.ts.map +1 -1
  26. package/dist/mutations/derive-edits.js +13 -4
  27. package/dist/mutations/derive-edits.js.map +1 -1
  28. package/dist/scaffold/from-template.d.ts.map +1 -1
  29. package/dist/scaffold/from-template.js +2 -1
  30. package/dist/scaffold/from-template.js.map +1 -1
  31. package/dist/schema/types.d.ts +10 -0
  32. package/dist/schema/types.d.ts.map +1 -1
  33. package/dist/sync/connection-filter.d.ts +2 -2
  34. package/dist/sync/connection-filter.d.ts.map +1 -1
  35. package/dist/sync/connection-filter.js.map +1 -1
  36. package/dist/sync/connection.d.ts +72 -28
  37. package/dist/sync/connection.d.ts.map +1 -1
  38. package/dist/sync/connection.js +255 -43
  39. package/dist/sync/connection.js.map +1 -1
  40. package/dist/sync/creating-act.d.ts +20 -0
  41. package/dist/sync/creating-act.d.ts.map +1 -0
  42. package/dist/sync/creating-act.js +29 -0
  43. package/dist/sync/creating-act.js.map +1 -0
  44. package/dist/sync/engine.d.ts +83 -1
  45. package/dist/sync/engine.d.ts.map +1 -1
  46. package/dist/sync/engine.js +269 -32
  47. package/dist/sync/engine.js.map +1 -1
  48. package/dist/sync/google-calendar.d.ts +3 -0
  49. package/dist/sync/google-calendar.d.ts.map +1 -1
  50. package/dist/sync/index.d.ts +10 -4
  51. package/dist/sync/index.d.ts.map +1 -1
  52. package/dist/sync/index.js +6 -2
  53. package/dist/sync/index.js.map +1 -1
  54. package/dist/sync/notion-stub.d.ts +81 -0
  55. package/dist/sync/notion-stub.d.ts.map +1 -0
  56. package/dist/sync/notion-stub.js +467 -0
  57. package/dist/sync/notion-stub.js.map +1 -0
  58. package/dist/sync/notion-types.d.ts +23 -0
  59. package/dist/sync/notion-types.d.ts.map +1 -0
  60. package/dist/sync/notion-types.js +49 -0
  61. package/dist/sync/notion-types.js.map +1 -0
  62. package/dist/sync/notion.d.ts +98 -0
  63. package/dist/sync/notion.d.ts.map +1 -0
  64. package/dist/sync/notion.js +477 -0
  65. package/dist/sync/notion.js.map +1 -0
  66. package/dist/sync/types.d.ts +38 -0
  67. package/dist/sync/types.d.ts.map +1 -1
  68. package/dist/sync/types.js.map +1 -1
  69. package/dist/version.d.ts +1 -1
  70. package/dist/version.js +1 -1
  71. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { ConnectionSpec } from "../document/connection-spec.js";
1
+ import type { GoogleCalendarConnectionSpec } from "../document/connection-spec.js";
2
2
  /** Google's event colors by the names its calendar shows, and the `colorId` each one is. */
3
3
  export declare const GOOGLE_COLORS: Readonly<Record<string, string>>;
4
4
  /** A tag is one word, `#` and letters, digits or hyphens: `#graview`, `#team-sync`. */
@@ -8,5 +8,5 @@ export declare const MADE_BY_GRAVIEW = "graview";
8
8
  /** A title tag, matched as a whole word anywhere in a title, in any case. */
9
9
  export declare const tagPattern: (tag: string) => RegExp;
10
10
  /** Whether a Google event is one this connection keeps: its color, or its title's tag. */
11
- export declare function inConnectionFilter(declaration: ConnectionSpec, item: Readonly<Record<string, unknown>>): boolean;
11
+ export declare function inConnectionFilter(declaration: GoogleCalendarConnectionSpec, item: Readonly<Record<string, unknown>>): boolean;
12
12
  //# sourceMappingURL=connection-filter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection-filter.d.ts","sourceRoot":"","sources":["../../src/sync/connection-filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAOrE,4FAA4F;AAC5F,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAY1D,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,cAAc,QAAiC,CAAC;AAE7D,mFAAmF;AACnF,eAAO,MAAM,eAAe,YAAY,CAAC;AAEzC,6EAA6E;AAC7E,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,WAAsF,CAAC;AAE7H,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAKhH"}
1
+ {"version":3,"file":"connection-filter.d.ts","sourceRoot":"","sources":["../../src/sync/connection-filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAOnF,4FAA4F;AAC5F,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAY1D,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,cAAc,QAAiC,CAAC;AAE7D,mFAAmF;AACnF,eAAO,MAA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AM,EAAE,GAAG;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACnF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,35 +1,49 @@
1
1
  import type { GraviewApp } from "../app.js";
2
2
  import type { AnySchema } from "../schema/schema.js";
3
3
  import type { Store } from "../store.js";
4
- import type { ConnectionSpec } from "../document/connection-spec.js";
5
- import { SyncEngine } from "./engine.js";
4
+ import type { ConnectionSpec, NotionConnectionSpec } from "../document/connection-spec.js";
5
+ import { SyncEngine, type SharedLinks } from "./engine.js";
6
6
  import { type Fetcher, type GoogleTokenRequest } from "./google-calendar.js";
7
7
  import type { RemoteSystem, SyncMapping, SyncState } from "./types.js";
8
8
  /**
9
9
  * A DECLARED CONNECTION, RUN.
10
10
  *
11
- * `connections.<name>` in a declaration says which calendar, which kind,
12
- * which fields, which of its events and which way; this turns that into the
13
- * engine, the mapping and the transport, so a host (`graview serve`, the
14
- * preview, Graview Cloud) supplies only a token and a place to keep the
15
- * engine's state. Everything it decides is said here once:
11
+ * `connections.<name>` in a declaration says which calendar or database,
12
+ * which kind, which fields and which way; this turns that into the engine,
13
+ * the mapping and the transport, so a host (`graview serve`, the preview,
14
+ * Graview Cloud) supplies only a token and a place to keep the engine's
15
+ * state. Everything it decides is said here once:
16
16
  *
17
- * - A field's TYPE says what kind of event it is: a `date` field is an
18
- * all-day event's day (`start.date`; the end day is inclusive here and
19
- * exclusive at Google, so it is moved by one each way), a `datetime`
20
- * field a timed event's instant (`start.dateTime`, read back as one UTC
21
- * instant however Google says it).
22
- * - A FILTER is applied as events arrive, because Google refuses a sync
23
- * token beside a search: an event outside it is not news, and one that
24
- * leaves it is gone here. An event made here is given what the filter
25
- * needs (the color; the tag in its title) so it stays in it, and a
26
- * private extended property naming the app.
27
- * - READ means the calendar owns the kind: an act here that would change a
28
- * record of it is refused with a sentence saying so (`SyncEngine.guard`),
17
+ * - A GOOGLE CALENDAR's field types say what kind of event it is: a `date`
18
+ * field is an all-day event's day (`start.date`; the end day is inclusive
19
+ * here and exclusive at Google, so it is moved by one each way), a
20
+ * `datetime` field a timed event's instant (`start.dateTime`, read back as
21
+ * one UTC instant however Google says it). A FILTER is applied as events
22
+ * arrive, because Google refuses a sync token beside a search: an event
23
+ * outside it is not news, and one that leaves it is gone here. An event
24
+ * made here is given what the filter needs (the color; the tag in its
25
+ * title) so it stays in it, and a private extended property naming the app.
26
+ * - A NOTION DATABASE's properties are the fields the declaration maps, or,
27
+ * when it maps none, every field whose name a property has, the kind's name
28
+ * field being the database's title. A `date` field holds a date property's
29
+ * day, a `datetime` field its instant; an `enum` field a select or status,
30
+ * matched to its options ignoring case and punctuation.
31
+ * - A NOTION RELATION is one of the kind's relations, when `properties`
32
+ * maps it (or, matched by name, when a relation property has its name and
33
+ * every kind it reaches is kept by a Notion connection of the app): a link
34
+ * in Notion is a link here, made and taken away through
35
+ * `connect-<kind>-<relation>` and `disconnect-<kind>-<relation>`. The page
36
+ * it reaches is found through `links`, shared by every connection of the
37
+ * app (`sharedLinks()`), so it may be another connection's record; one
38
+ * not linked yet is held until it is. A relation of one takes the first
39
+ * page Notion lists, and says the rest once.
40
+ * - READ means the other system owns the kind: an act here that would change
41
+ * a record of it is refused with a sentence saying so (`SyncEngine.guard`),
29
42
  * rather than accepted and never sent.
30
- * - Inbound changes land through the app's own acts — the one that creates
31
- * the kind, `edit-<kind>` and `remove-<kind>` — authored by the system
32
- * `google-calendar`, so Activity credits the calendar and undo works.
43
+ * - Inbound changes land through the app's own acts — one that creates the
44
+ * kind from the fields mapped alone (`creatingAct`), `edit-<kind>` and
45
+ * `remove-<kind>` — authored by the system
46
+ * (`google-calendar`, `notion`), so Activity credits it and undo works.
33
47
  */
34
48
  export { CONNECTION_TAG, GOOGLE_COLORS, MADE_BY_GRAVIEW, inConnectionFilter } from "./connection-filter.js";
35
49
  export type ConnectionDeclaration = ConnectionSpec;
@@ -39,13 +53,30 @@ export interface ConnectionRun<S extends AnySchema> {
39
53
  readonly declaration: ConnectionDeclaration;
40
54
  readonly app: GraviewApp<S>;
41
55
  readonly store: Store<S>;
42
- /** The calendar's id, resolved from the declaration (its `env`, when it names one). */
43
- readonly calendarId: string;
44
- /** An access token; asked again with `{ refresh: true }` when Google refuses the last one. */
56
+ /** A Google connection's calendar id, resolved from the declaration (its `env`, when it names one). */
57
+ readonly calendarId?: string;
58
+ /** A Notion connection's database id, resolved likewise. */
59
+ readonly databaseId?: string;
60
+ /**
61
+ * An access token for Google, asked again with `{ refresh: true }` when
62
+ * Google refuses the last one; for Notion, the internal integration's
63
+ * secret.
64
+ */
45
65
  token(request?: GoogleTokenRequest): Promise<string> | string;
66
+ /** What the secret is called where the host keeps it (`NOTION_TOKEN`), for the sentence a refusal says. Never its value. */
67
+ readonly secretName?: string;
46
68
  readonly fetch?: Fetcher;
47
69
  /** What the engine kept from the last run: its cursor, its links. */
48
70
  readonly state?: SyncState;
71
+ /** A note the transport says once: a property it found no field for, one it leaves alone. */
72
+ say?(line: string): void;
73
+ /**
74
+ * THE APP'S LINKS, shared by every connection it runs (`sharedLinks()`):
75
+ * where a relation finds the record a Notion page is, whichever
76
+ * connection linked it. This connection's engine is added to it. Absent:
77
+ * the connection's own links alone.
78
+ */
79
+ readonly links?: SharedLinks;
49
80
  }
50
81
  export interface Connection<S extends AnySchema> {
51
82
  readonly engine: SyncEngine<S>;
@@ -56,10 +87,23 @@ export interface Connection<S extends AnySchema> {
56
87
  }
57
88
  /** Whether a field of the kind is a `date` (an all-day event's day) rather than a `datetime`. */
58
89
  export declare function isDayField(app: GraviewApp, kind: string, field: string): boolean;
59
- /** The mapping a declaration says: field types decide the paths, the filter's tag is kept or stripped. */
90
+ /** The mapping a declaration says. */
60
91
  export declare function connectionMapping(app: GraviewApp, declaration: ConnectionDeclaration): SyncMapping;
61
- /** The act that makes a record of the kind: `add-<kind>` when there is one, else the first that creates it. */
62
- export declare function creatingAct(app: GraviewApp, kind: string): string | undefined;
92
+ /** What a Notion connection maps: the engine's mapping, the property names the transport resolves with their field types, the name that is the title, and the relations matched by name that need not be there. */
93
+ export declare function notionConnectionMapping(app: GraviewApp, declaration: NotionConnectionSpec, say?: (line: string) => void): {
94
+ readonly mapping: SyncMapping;
95
+ readonly refs: Readonly<Record<string, string | undefined>>;
96
+ readonly titleRef?: string;
97
+ readonly quiet: readonly string[];
98
+ };
99
+ /**
100
+ * The act a record of the kind from another system is made through: one
101
+ * that creates it, takes no subject and asks for nothing the connection
102
+ * does not map (`mapped`, our field names) — `add-<kind>` when it fits, else
103
+ * the first declared act that does (`creatingActFor`). Undefined when none
104
+ * fits, which `graview check` says at `connections.<name>`.
105
+ */
106
+ export declare function creatingAct(app: GraviewApp, kind: string, mapped: readonly string[]): string | undefined;
63
107
  /** The engine, the mapping and the transport for one declared connection. */
64
108
  export declare function connection<S extends AnySchema>(run: ConnectionRun<S>): Connection<S>;
65
109
  //# sourceMappingURL=connection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/sync/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAkB,KAAK,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAmB,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,cAAc,E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AQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAsF/J;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAExG;AAeD,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAGpF"}
@@ -1,39 +1,57 @@
1
- import { fieldOf } from "../document/field-spec.js";
1
+ import { fieldSpecOf } from "../document/field-spec.js";
2
2
  import { GOOGLE_COLORS, MADE_BY_GRAVIEW, inConnectionFilter, tagPattern } from "./connection-filter.js";
3
+ import { relationActName } from "../mutations/derived-names.js";
4
+ import { creatingActFor } from "./creating-act.js";
3
5
  import { SyncEngine } from "./engine.js";
4
6
  import { googleCalendar } from "./google-calendar.js";
7
+ import { notion, notionKey } from "./notion.js";
8
+ import { NOTION_EDGE, NOTION_INFERABLE } from "./notion-types.js";
5
9
  /**
6
10
  * A DECLARED CONNECTION, RUN.
7
11
  *
8
- * `connections.<name>` in a declaration says which calendar, which kind,
9
- * which fields, which of its events and which way; this turns that into the
10
- * engine, the mapping and the transport, so a host (`graview serve`, the
11
- * preview, Graview Cloud) supplies only a token and a place to keep the
12
- * engine's state. Everything it decides is said here once:
12
+ * `connections.<name>` in a declaration says which calendar or database,
13
+ * which kind, which fields and which way; this turns that into the engine,
14
+ * the mapping and the transport, so a host (`graview serve`, the preview,
15
+ * Graview Cloud) supplies only a token and a place to keep the engine's
16
+ * state. Everything it decides is said here once:
13
17
  *
14
- * - A field's TYPE says what kind of event it is: a `date` field is an
15
- * all-day event's day (`start.date`; the end day is inclusive here and
16
- * exclusive at Google, so it is moved by one each way), a `datetime`
17
- * field a timed event's instant (`start.dateTime`, read back as one UTC
18
- * instant however Google says it).
19
- * - A FILTER is applied as events arrive, because Google refuses a sync
20
- * token beside a search: an event outside it is not news, and one that
21
- * leaves it is gone here. An event made here is given what the filter
22
- * needs (the color; the tag in its title) so it stays in it, and a
23
- * private extended property naming the app.
24
- * - READ means the calendar owns the kind: an act here that would change a
25
- * record of it is refused with a sentence saying so (`SyncEngine.guard`),
18
+ * - A GOOGLE CALENDAR's field types say what kind of event it is: a `date`
19
+ * field is an all-day event's day (`start.date`; the end day is inclusive
20
+ * here and exclusive at Google, so it is moved by one each way), a
21
+ * `datetime` field a timed event's instant (`start.dateTime`, read back as
22
+ * one UTC instant however Google says it). A FILTER is applied as events
23
+ * arrive, because Google refuses a sync token beside a search: an event
24
+ * outside it is not news, and one that leaves it is gone here. An event
25
+ * made here is given what the filter needs (the color; the tag in its
26
+ * title) so it stays in it, and a private extended property naming the app.
27
+ * - A NOTION DATABASE's properties are the fields the declaration maps, or,
28
+ * when it maps none, every field whose name a property has, the kind's name
29
+ * field being the database's title. A `date` field holds a date property's
30
+ * day, a `datetime` field its instant; an `enum` field a select or status,
31
+ * matched to its options ignoring case and punctuation.
32
+ * - A NOTION RELATION is one of the kind's relations, when `properties`
33
+ * maps it (or, matched by name, when a relation property has its name and
34
+ * every kind it reaches is kept by a Notion connection of the app): a link
35
+ * in Notion is a link here, made and taken away through
36
+ * `connect-<kind>-<relation>` and `disconnect-<kind>-<relation>`. The page
37
+ * it reaches is found through `links`, shared by every connection of the
38
+ * app (`sharedLinks()`), so it may be another connection's record; one
39
+ * not linked yet is held until it is. A relation of one takes the first
40
+ * page Notion lists, and says the rest once.
41
+ * - READ means the other system owns the kind: an act here that would change
42
+ * a record of it is refused with a sentence saying so (`SyncEngine.guard`),
26
43
  * rather than accepted and never sent.
27
- * - Inbound changes land through the app's own acts — the one that creates
28
- * the kind, `edit-<kind>` and `remove-<kind>` — authored by the system
29
- * `google-calendar`, so Activity credits the calendar and undo works.
44
+ * - Inbound changes land through the app's own acts — one that creates the
45
+ * kind from the fields mapped alone (`creatingAct`), `edit-<kind>` and
46
+ * `remove-<kind>` — authored by the system
47
+ * (`google-calendar`, `notion`), so Activity credits it and undo works.
30
48
  */
31
49
  export { CONNECTION_TAG, GOOGLE_COLORS, MADE_BY_GRAVIEW, inConnectionFilter } from "./connection-filter.js";
32
50
  const DAY_MS = 24 * 60 * 60 * 1000;
33
51
  const instant = (value) => {
34
52
  if (typeof value !== "string" || !value)
35
53
  return value;
36
- const time = Date.parse(value);
54
+ const time = Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? `${value}T00:00:00Z` : value);
37
55
  return Number.isNaN(time) ? value : new Date(time).toISOString().replace(/\.000Z$/, "Z");
38
56
  };
39
57
  const shiftDay = (value, days) => {
@@ -41,14 +59,27 @@ const shiftDay = (value, days) => {
41
59
  return value;
42
60
  return new Date(Date.parse(`${value}T00:00:00Z`) + days * DAY_MS).toISOString().slice(0, 10);
43
61
  };
62
+ /** A kind's fields as a document says them, by name. */
63
+ function fieldSpecs(app, kind) {
64
+ const shape = app.schema.tryDefinition(kind)?.fields?.shape ?? {};
65
+ const out = {};
66
+ for (const [field, schema] of Object.entries(shape)) {
67
+ const spec = fieldSpecOf(schema);
68
+ if (spec)
69
+ out[field] = spec;
70
+ }
71
+ return out;
72
+ }
44
73
  /** Whether a field of the kind is a `date` (an all-day event's day) rather than a `datetime`. */
45
74
  export function isDayField(app, kind, field) {
46
- const shape = app.schema.tryDefinition(kind)?.fields?.shape;
47
- const read = shape?.[field] === undefined ? undefined : fieldOf(shape[field]);
48
- return read !== undefined && "spec" in read && read.spec.type === "date";
75
+ return fieldSpecs(app, kind)[field]?.type === "date";
49
76
  }
50
- /** The mapping a declaration says: field types decide the paths, the filter's tag is kept or stripped. */
77
+ /** The mapping a declaration says. */
51
78
  export function connectionMapping(app, declaration) {
79
+ return declaration.system === "notion" ? notionConnectionMapping(app, declaration).mapping : googleConnectionMapping(app, declaration);
80
+ }
81
+ /** A Google connection's mapping: field types decide the paths, the filter's tag is kept or stripped. */
82
+ function googleConnectionMapping(app, declaration) {
52
83
  const { kind, fields } = declaration;
53
84
  const day = isDayField(app, kind, fields.start);
54
85
  const when = day ? "date" : "dateTime";
@@ -93,15 +124,147 @@ export function connectionMapping(app, declaration) {
93
124
  };
94
125
  return { system: "google-calendar", resources: [resource] };
95
126
  }
96
- /** The act that makes a record of the kind: `add-<kind>` when there is one, else the first that creates it. */
97
- export function creatingAct(app, kind) {
98
- const creating = (app.mutations ?? []).filter((mutation) => (mutation.creates ?? []).includes(kind));
99
- return (creating.find((mutation) => mutation.name === `add-${kind}`) ?? creating[0])?.name;
127
+ /** Words compared loosely: "In progress", "in-progress" and "inProgress" are one. */
128
+ const loose = (word) => word.toLowerCase().replace(/[^a-z0-9]/g, "");
129
+ /** The field a kind is named by: one called name or title, else its first required words, else its first words. */
130
+ function nameField(specs) {
131
+ const words = Object.entries(specs).filter(([, spec]) => spec.type === "string" || spec.type === "text");
132
+ return (words.find(([field]) => field === "name" || field === "title") ?? words.find(([, spec]) => spec.required) ?? words[0])?.[0];
133
+ }
134
+ /** A kind's relations as its definition declares them, by name. */
135
+ function edgeSpecs(app, kind) {
136
+ return (app.schema.tryDefinition(kind)?.edges ?? {});
137
+ }
138
+ /** The kinds a Notion connection of the app keeps. */
139
+ function notionKinds(app) {
140
+ return new Set(Object.values(app.connections ?? {}).flatMap((declared) => (declared.system === "notion" ? [declared.kind] : [])));
141
+ }
142
+ /** What a Notion connection maps: the engine's mapping, the property names the transport resolves with their field types, the name that is the title, and the relations matched by name that need not be there. */
143
+ export function notionConnectionMapping(app, declaration, say) {
144
+ const { kind } = declaration;
145
+ const specs = fieldSpecs(app, kind);
146
+ const relations = edgeSpecs(app, kind);
147
+ const fields = {};
148
+ const edges = {};
149
+ const refs = {};
150
+ const quiet = [];
151
+ let titleRef;
152
+ if (declaration.properties) {
153
+ for (const [field, property] of Object.entries(declaration.properties)) {
154
+ const ref = typeof property === "string" ? property : property.name;
155
+ if (!specs[field] && relations[field]) {
156
+ edges[field] = ref;
157
+ refs[ref] = NOTION_EDGE;
158
+ continue;
159
+ }
160
+ fields[field] = ref;
161
+ refs[ref] = specs[field]?.type;
162
+ }
163
+ }
164
+ else {
165
+ for (const [field, spec] of Object.entries(specs)) {
166
+ if (!NOTION_INFERABLE.has(spec.type))
167
+ continue;
168
+ fields[field] = field;
169
+ refs[field] = spec.type;
170
+ }
171
+ titleRef = nameField(specs);
172
+ // A relation is kept by name only when every kind it reaches is another Notion connection's: a relation property of its name may not be there.
173
+ const kept = notionKinds(app);
174
+ for (const [edge, spec] of Object.entries(relations)) {
175
+ if (spec.to === "*" || spec.to.length === 0 || !spec.to.every((target) => kept.has(target)))
176
+ continue;
177
+ edges[edge] = edge;
178
+ refs[edge] = NOTION_EDGE;
179
+ quiet.push(edge);
180
+ }
181
+ }
182
+ const encode = {};
183
+ const decode = {};
184
+ for (const field of Object.keys(fields)) {
185
+ const spec = specs[field];
186
+ switch (spec?.type) {
187
+ case "date":
188
+ encode[field] = (value) => (typeof value === "string" ? value.slice(0, 10) : value);
189
+ decode[field] = (value) => (typeof value === "string" ? value.slice(0, 10) : value);
190
+ break;
191
+ case "datetime":
192
+ encode[field] = instant;
193
+ decode[field] = instant;
194
+ break;
195
+ case "enum": {
196
+ const options = spec.options ?? [];
197
+ decode[field] = (value) => (typeof value === "string" ? (options.find((option) => option === value) ?? options.find((option) => loose(option) === loose(value)) ?? value) : value);
198
+ break;
199
+ }
200
+ case "list":
201
+ decode[field] = (value) => (typeof value === "string" ? [value] : value);
202
+ break;
203
+ case "string":
204
+ case "text":
205
+ case "url":
206
+ case "email":
207
+ case "phone":
208
+ // People arrive as a list of names.
209
+ decode[field] = (value) => (Array.isArray(value) ? value.join(", ") : value);
210
+ break;
211
+ }
212
+ }
213
+ for (const edge of Object.keys(edges)) {
214
+ if (relations[edge]?.cardinality !== "one")
215
+ continue;
216
+ // A relation of one holds the first page Notion lists; the rest are said once and left there.
217
+ decode[edge] = (value) => {
218
+ if (!Array.isArray(value) || value.length <= 1)
219
+ return value;
220
+ say?.(`${edge}: each ${kind} links one page, and a page in Notion links ${value.length}, so the first is kept here and the rest are left in Notion`);
221
+ return [value[0]];
222
+ };
223
+ }
224
+ const resource = {
225
+ kind,
226
+ resource: "pages",
227
+ fields,
228
+ ...(Object.keys(edges).length > 0 ? { edges } : {}),
229
+ encode,
230
+ decode,
231
+ ...(declaration.direction === "read" ? { readonly: true, because: `Each ${kind} comes from a Notion database this app only reads: change it there.` } : {}),
232
+ };
233
+ return { mapping: { system: "notion", resources: [resource] }, refs, ...(titleRef ? { titleRef } : {}), quiet };
234
+ }
235
+ /**
236
+ * The act a record of the kind from another system is made through: one
237
+ * that creates it, takes no subject and asks for nothing the connection
238
+ * does not map (`mapped`, our field names) — `add-<kind>` when it fits, else
239
+ * the first declared act that does (`creatingActFor`). Undefined when none
240
+ * fits, which `graview check` says at `connections.<name>`.
241
+ */
242
+ export function creatingAct(app, kind, mapped) {
243
+ return creatingActFor((app.mutations ?? []), kind, mapped).act;
244
+ }
245
+ /** Our fields from a remote record's, decoded: what a record made from it holds. */
246
+ function decodedBy(resource) {
247
+ return (fields) => {
248
+ const out = {};
249
+ for (const [ours, theirs] of Object.entries(resource.fields)) {
250
+ if (!(theirs in fields))
251
+ continue;
252
+ const decode = resource.decode?.[ours];
253
+ out[ours] = decode ? decode(fields[theirs]) : fields[theirs];
254
+ }
255
+ return out;
256
+ };
100
257
  }
101
258
  /** The engine, the mapping and the transport for one declared connection. */
102
259
  export function connection(run) {
103
- const { declaration, app, store } = run;
104
- const mapping = connectionMapping(app, declaration);
260
+ const { declaration } = run;
261
+ return declaration.system === "notion" ? notionConnection(run, declaration) : googleConnection(run, declaration);
262
+ }
263
+ function googleConnection(run, declaration) {
264
+ const { app, store } = run;
265
+ if (!run.calendarId)
266
+ throw new Error(`connection ${run.name}: a Google connection needs its calendar's id`);
267
+ const mapping = googleConnectionMapping(app, declaration);
105
268
  const resource = mapping.resources[0];
106
269
  const color = declaration.filter?.color ? GOOGLE_COLORS[declaration.filter.color] : undefined;
107
270
  const remote = googleCalendar({
@@ -114,17 +277,8 @@ export function connection(run) {
114
277
  extendedProperties: { private: { [MADE_BY_GRAVIEW]: app.name } },
115
278
  },
116
279
  });
117
- const creates = creatingAct(app, declaration.kind);
118
- const decoded = (fields) => {
119
- const out = {};
120
- for (const [ours, theirs] of Object.entries(resource.fields)) {
121
- if (!(theirs in fields))
122
- continue;
123
- const decode = resource.decode?.[ours];
124
- out[ours] = decode ? decode(fields[theirs]) : fields[theirs];
125
- }
126
- return out;
127
- };
280
+ const creates = creatingAct(app, declaration.kind, Object.keys(resource.fields));
281
+ const decoded = decodedBy(resource);
128
282
  let made = 0;
129
283
  const engine = new SyncEngine({
130
284
  store,
@@ -145,4 +299,62 @@ export function connection(run) {
145
299
  const unguard = declaration.direction === "read" ? engine.guard() : undefined;
146
300
  return { engine, mapping, remote, ...(unguard ? { unguard } : {}) };
147
301
  }
302
+ function notionConnection(run, declaration) {
303
+ const { app, store } = run;
304
+ if (!run.databaseId)
305
+ throw new Error(`connection ${run.name}: a Notion connection needs its database's id`);
306
+ const { mapping, refs, titleRef, quiet } = notionConnectionMapping(app, declaration, run.say);
307
+ const resource = mapping.resources[0];
308
+ let engine;
309
+ const remote = notion({
310
+ databaseId: run.databaseId,
311
+ ...(declaration.source ? { source: declaration.source } : {}),
312
+ token: () => run.token(),
313
+ ...(run.secretName ? { secretName: run.secretName } : {}),
314
+ ...(run.fetch ? { fetch: run.fetch } : {}),
315
+ refs,
316
+ ...(titleRef ? { titleRef } : {}),
317
+ ...(quiet.length > 0 ? { quiet } : {}),
318
+ // The pages linked when the pass began: a whole read that no longer lists one finds out whether it is gone.
319
+ known: () => Object.values(engine?.snapshot.links ?? {}).map((link) => link.id),
320
+ ...(run.say ? { say: run.say } : {}),
321
+ });
322
+ const creates = creatingAct(app, declaration.kind, Object.keys(resource.fields));
323
+ const decoded = decodedBy(resource);
324
+ // A relation's link lands through its derived pair, when the app has it (the checker says when it has not).
325
+ const has = (name) => {
326
+ try {
327
+ store.mutation(name);
328
+ return true;
329
+ }
330
+ catch {
331
+ return false;
332
+ }
333
+ };
334
+ const relationAct = (act) => ({ localId, edge, to }) => {
335
+ const name = relationActName(act, declaration.kind, edge);
336
+ return has(name) ? { name, args: { id: localId, to } } : null;
337
+ };
338
+ engine = new SyncEngine({
339
+ store,
340
+ mapping,
341
+ remote,
342
+ ...(run.links ? { links: run.links } : {}),
343
+ connectInbound: relationAct("connect"),
344
+ disconnectInbound: relationAct("disconnect"),
345
+ conflicts: declaration.conflicts ?? "report",
346
+ applyInbound: ({ localId, fields }) => ({ name: `edit-${declaration.kind}`, args: { id: localId, ...fields } }),
347
+ removeInbound: ({ localId }) => ({ name: `remove-${declaration.kind}`, args: { id: localId } }),
348
+ createInbound: ({ id, fields }) => {
349
+ if (!creates)
350
+ return null;
351
+ // An empty property is no value for a record being made; the page's own id names it, so a full read makes it once.
352
+ const values = Object.fromEntries(Object.entries(decoded(fields)).filter(([, value]) => value !== null && value !== undefined));
353
+ return { name: creates, args: { id: `${declaration.kind}:${run.name}-${notionKey(id)}`, ...values } };
354
+ },
355
+ }, run.state);
356
+ run.links?.add(engine);
357
+ const unguard = declaration.direction === "read" ? engine.guard() : undefined;
358
+ return { engine, mapping, remote, ...(unguard ? { unguard } : {}) };
359
+ }
148
360
  //# sourceMappingURL=connection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/sync/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,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AAW,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC;QAC/F,aAAa,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YAChC,IAAI,CAAC,OAAO;gBAAE,OAAO,IAAI,CAAC;YAC1B,mHAAmH;YACnH,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;YAChI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,WAAW,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QACxG,CAAC;KACF,EACD,GAAG,CAAC,KAAK,CACV,CAAC;IACF,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,OAAO,GAAG,WAAW,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACtE,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { AnyMutationDefinition } from "../mutations/types.js";
2
+ /** Why an act that creates the kind cannot make a record from another system's fields alone. */
3
+ export interface UnfitCreatingAct {
4
+ readonly name: string;
5
+ /** The kinds it acts on, when it takes a subject. */
6
+ readonly on?: readonly string[];
7
+ /** The arguments it requires that the connection does not map. */
8
+ readonly asks?: readonly string[];
9
+ }
10
+ export interface CreatingActChoice {
11
+ /** The act a record is made through, when one fits. */
12
+ readonly act?: string;
13
+ /** Every act that creates the kind and does not fit, and why. Empty when none creates it. */
14
+ readonly unfit: readonly UnfitCreatingAct[];
15
+ /** Whether any declared act creates the kind at all. */
16
+ readonly creates: boolean;
17
+ }
18
+ /** The act a record of `kind` from another system is made through, given the fields the connection maps. */
19
+ export declare function creatingActFor(mutations: readonly AnyMutationDefinition[], kind: string, mapped: readonly string[]): CreatingActChoice;
20
+ //# sourceMappingURL=creating-act.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creating-act.d.ts","sourceRoot":"","sources":["../../src/sync/creating-act.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAiBnE,gGAAgG;AAChG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,6FAA6F;IAC7F,QAAQ,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC5C,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AASD,4GAA4G;AAC5G,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,qBAAqB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,iBAAiB,CAiBtI"}