alinea 2.0.0-preview.7 → 2.0.0-preview.9
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/.init/content/pages/welcome.json +1 -1
- package/dist/LICENSES.md +103 -103
- package/dist/adapter/next/cms.d.ts +18 -4
- package/dist/adapter/next/cms.js +141 -36
- package/dist/adapter/next/handler.d.ts +5 -1
- package/dist/adapter/next/handler.js +77 -17
- package/dist/adapter/next/node.d.ts +5 -0
- package/dist/adapter/next/node.js +16 -0
- package/dist/adapter/next/previews.d.ts +4 -1
- package/dist/adapter/next/previews.js +13 -1
- package/dist/adapter/next/renderStats.d.ts +45 -0
- package/dist/adapter/next/renderStats.js +142 -0
- package/dist/adapter/next/syncCheck.d.ts +8 -2
- package/dist/adapter/next/syncCheck.js +5 -11
- package/dist/adapter/next/with-alinea.js +6 -20
- package/dist/backend/HandleAction.d.ts +1 -1
- package/dist/backend/HandleAction.js +1 -1
- package/dist/backend/Handler.d.ts +2 -2
- package/dist/backend/Handler.js +45 -47
- package/dist/backend/api/CreateBackend.js +15 -3
- package/dist/backend/api/DatabaseApi.js +22 -135
- package/dist/backend/api/ProxyMedia.d.ts +2 -3
- package/dist/backend/api/ProxyMedia.js +7 -22
- package/dist/backend/api/database.js +15 -3
- package/dist/backend/resolver/ParsePreview.d.ts +2 -2
- package/dist/backend/router/NodeHandler.js +2 -0
- package/dist/backend/store/GeneratedDatabase.d.ts +8 -0
- package/dist/backend/store/GeneratedDatabase.js +33 -0
- package/dist/backend/store/GeneratedDatabaseNode.d.ts +4 -0
- package/dist/backend/store/GeneratedDatabaseNode.js +35 -0
- package/dist/backend/util/ORM.js +4 -2
- package/dist/bundled.d.ts +1565 -468
- package/dist/chunks/bun-sqlite-5SHXN3AT.js +18 -0
- package/dist/chunks/chunk-2BJ2IFQM.js +1085 -0
- package/dist/chunks/chunk-2PIFHEYR.js +364 -0
- package/dist/chunks/chunk-66YZ47TY.js +94 -0
- package/dist/chunks/chunk-76VMZTLN.js +55 -0
- package/dist/chunks/chunk-AIU6CMVT.js +495 -0
- package/dist/chunks/chunk-ASYKC6IE.js +103 -0
- package/dist/chunks/chunk-ATF42T2B.js +35 -0
- package/dist/chunks/{chunk-6P4UVRPH.js → chunk-DWR5A5KL.js} +6 -1
- package/dist/chunks/{chunk-NWQXN4SB.js → chunk-ETBQTP2S.js} +40 -29
- package/dist/chunks/chunk-ETWOY4AL.js +100 -0
- package/dist/chunks/chunk-K62JP6HR.js +22 -0
- package/dist/chunks/chunk-MOWR65LM.js +610 -0
- package/dist/chunks/chunk-N47Y62CI.js +396 -0
- package/dist/chunks/chunk-QBPYWU6C.js +24 -0
- package/dist/chunks/{chunk-X47OVDF3.js → chunk-QJGGYF6E.js} +356 -1000
- package/dist/chunks/chunk-QSN6RH6X.js +94 -0
- package/dist/chunks/{chunk-I4GC3E65.js → chunk-UPY2RUZF.js} +0 -1
- package/dist/chunks/chunk-XCZXR3C2.js +112 -0
- package/dist/chunks/chunk-XTWYBWP2.js +81 -0
- package/dist/chunks/node-sqlite-XVNTNMCY.js +18 -0
- package/dist/cli/Generate.js +74 -64
- package/dist/cli/Serve.js +1 -1
- package/dist/cli/bin.js +6 -1
- package/dist/cli/generate/CopyStaticFiles.js +17 -14
- package/dist/cli/generate/DevDB.d.ts +22 -5
- package/dist/cli/generate/DevDB.js +138 -24
- package/dist/cli/serve/CreateLocalServer.js +22 -4
- package/dist/cli/serve/DevServer.d.ts +2 -0
- package/dist/cli/serve/DevServer.js +7 -2
- package/dist/cli/serve/LiveReload.d.ts +1 -1
- package/dist/cli/serve/LiveReload.js +3 -0
- package/dist/cloud/CloudRemote.js +2 -1
- package/dist/components/Breadcrumbs.js +2 -2
- package/dist/components/Calendar.js +7 -7
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/ColorSwatchPicker.js +2 -2
- package/dist/components/ComboBox.js +14 -14
- package/dist/components/DateField.js +1 -1
- package/dist/components/DatePicker.js +6 -6
- package/dist/components/DateRangePicker.js +4 -4
- package/dist/components/Disclosure.js +8 -8
- package/dist/components/Label.js +6 -6
- package/dist/components/List.js +33 -33
- package/dist/components/Menu.js +2 -2
- package/dist/components/Modal.js +2 -2
- package/dist/components/MultipleSelect.js +23 -23
- package/dist/components/NumberField.js +6 -6
- package/dist/components/ProgressCircle.js +3 -3
- package/dist/components/SearchField.js +8 -8
- package/dist/components/Select.js +8 -8
- package/dist/components/Surface.js +3 -3
- package/dist/components/Switch.js +2 -2
- package/dist/components/Table.js +7 -7
- package/dist/components/Tabs.js +2 -2
- package/dist/components/TagGroup.js +2 -2
- package/dist/components/TextField.js +2 -2
- package/dist/components/TimeField.js +3 -3
- package/dist/components/Toolbar.js +2 -2
- package/dist/components/Tooltip.js +4 -4
- package/dist/components/Tree.d.ts +2 -1
- package/dist/components/Tree.js +6 -6
- package/dist/core/Client.d.ts +1 -4
- package/dist/core/Client.js +5 -7
- package/dist/core/Connection.d.ts +4 -1
- package/dist/core/Connection.js +3 -1
- package/dist/core/Document.js +15 -3
- package/dist/core/Entry.d.ts +3 -0
- package/dist/core/Entry.js +4 -0
- package/dist/core/EntrySeed.d.ts +19 -0
- package/dist/core/EntrySeed.js +136 -0
- package/dist/core/Field.d.ts +7 -0
- package/dist/core/Field.js +4 -0
- package/dist/core/Filter.d.ts +40 -2
- package/dist/core/Filter.js +145 -0
- package/dist/core/Graph.d.ts +9 -0
- package/dist/core/ListRow.d.ts +1 -0
- package/dist/core/ListRow.js +1 -0
- package/dist/core/Reference.d.ts +1 -0
- package/dist/core/Root.js +1 -1
- package/dist/core/Scope.d.ts +2 -0
- package/dist/core/Scope.js +16 -1
- package/dist/core/Type.d.ts +2 -1
- package/dist/core/Type.js +13 -1
- package/dist/core/db/EntryAliases.js +1 -11
- package/dist/core/db/EntryReference.d.ts +0 -6
- package/dist/core/db/IndexEvent.d.ts +2 -1
- package/dist/core/db/IndexEvent.js +11 -3
- package/dist/core/db/LinkResolver.d.ts +6 -6
- package/dist/core/db/LinkResolver.js +0 -52
- package/dist/core/db/LocalStore.d.ts +27 -0
- package/dist/core/field/ListField.js +19 -0
- package/dist/core/field/RecordField.js +8 -0
- package/dist/core/field/RichTextField.js +42 -0
- package/dist/core/field/UnionField.js +8 -0
- package/dist/core/source/FSSource.d.ts +14 -2
- package/dist/core/source/FSSource.js +58 -13
- package/dist/core/source/GitUtils.d.ts +4 -0
- package/dist/core/source/GitUtils.js +9 -10
- package/dist/core/source/GithubSource.js +60 -21
- package/dist/core/source/IndexedDBSource.d.ts +2 -1
- package/dist/core/source/IndexedDBSource.js +67 -53
- package/dist/core/source/MemorySource.js +5 -3
- package/dist/core/source/OverlaySource.d.ts +5 -2
- package/dist/core/source/OverlaySource.js +31 -3
- package/dist/core/source/Source.d.ts +3 -0
- package/dist/core/source/Source.js +15 -2
- package/dist/core/source/Tree.d.ts +10 -7
- package/dist/core/source/Tree.js +118 -70
- package/dist/core/source/Utils.js +6 -3
- package/dist/core/util/Arrays.d.ts +1 -0
- package/dist/core/util/Arrays.js +10 -0
- package/dist/core/util/Async.d.ts +7 -0
- package/dist/core/util/Async.js +15 -0
- package/dist/core/util/Checks.js +1 -1
- package/dist/core/util/EntryFilenames.d.ts +22 -1
- package/dist/core/util/EntryFilenames.js +56 -2
- package/dist/core/util/IndexedDB.d.ts +4 -0
- package/dist/core/util/IndexedDB.js +20 -0
- package/dist/core/util/Paths.js +5 -1
- package/dist/dashboard/App.js +3 -3
- package/dist/dashboard/ViewKeys.d.ts +1 -0
- package/dist/dashboard/ViewKeys.js +1 -0
- package/dist/dashboard/app/AccessDenied.js +2 -2
- package/dist/dashboard/app/ActivityStatus.js +14 -14
- package/dist/dashboard/app/AppShell.js +2 -2
- package/dist/dashboard/app/AuthView.js +12 -12
- package/dist/dashboard/app/CompactField.js +11 -11
- package/dist/dashboard/app/DashboardErrorBoundary.js +6 -6
- package/dist/dashboard/app/DashboardLayout.js +3 -3
- package/dist/dashboard/app/EntryHeader.js +8 -8
- package/dist/dashboard/app/EntryReferences.js +8 -8
- package/dist/dashboard/app/EntrySidebar.js +15 -15
- package/dist/dashboard/app/EntrySidebarPreview.js +7 -7
- package/dist/dashboard/app/EntryTranslationBanner.js +5 -5
- package/dist/dashboard/app/Explorer.js +39 -39
- package/dist/dashboard/app/ExplorerCards.js +31 -31
- package/dist/dashboard/app/ExplorerFileCard.js +19 -19
- package/dist/dashboard/app/ExplorerList.js +10 -10
- package/dist/dashboard/app/ExplorerModal.js +5 -5
- package/dist/dashboard/app/ExplorerTable.js +47 -47
- package/dist/dashboard/app/LinkPicker.js +5 -5
- package/dist/dashboard/app/LocaleMenu.js +4 -4
- package/dist/dashboard/app/SidebarTree.js +76 -40
- package/dist/dashboard/app/WorkspaceMenu.js +9 -9
- package/dist/dashboard/app/WorkspaceRoots.js +22 -22
- package/dist/dashboard/app/editor/FileEditor.js +28 -28
- package/dist/dashboard/app/editor/FilePreview.js +6 -6
- package/dist/dashboard/app/modals/CreateEntry.js +3 -3
- package/dist/dashboard/app/pages/EntryPage.js +18 -18
- package/dist/dashboard/app/pages/RootPage.js +3 -3
- package/dist/dashboard/app/pages/SplashPage.js +45 -45
- package/dist/dashboard/app/pages/UsersPage.js +34 -34
- package/dist/dashboard/app/ui/DashboardModal.js +18 -18
- package/dist/dashboard/app/ui/Rail.js +5 -5
- package/dist/dashboard/app/ui/Sidebar.js +2 -2
- package/dist/dashboard/atoms/config.d.ts +4 -4
- package/dist/dashboard/atoms/entry.d.ts +8 -9
- package/dist/dashboard/atoms/entry.js +34 -4
- package/dist/dashboard/atoms/explorer.d.ts +2 -0
- package/dist/dashboard/atoms/explorer.js +7 -2
- package/dist/dashboard/boot/Boot.js +2 -3
- package/dist/dashboard/boot/DashboardWorker.d.ts +3 -3
- package/dist/dashboard/boot/DashboardWorker.js +82 -27
- package/dist/dashboard/boot/LoadWorker.js +2 -3
- package/dist/dashboard/boot/WorkerDB.d.ts +2 -2
- package/dist/dashboard/icons.d.ts +2 -0
- package/dist/dashboard/icons.js +40 -0
- package/dist/dashboard/plugins/alineaFixturePlugin.js +14 -3
- package/dist/database/BrowserEntryStore.d.ts +42 -0
- package/dist/database/BrowserEntryStore.js +182 -0
- package/dist/database/DatabaseSource.d.ts +13 -0
- package/dist/database/DatabaseSource.js +25 -0
- package/dist/database/DatabaseTables.d.ts +38 -0
- package/dist/database/DatabaseTables.js +53 -0
- package/dist/database/EntryDatabase.d.ts +97 -0
- package/dist/database/EntryDatabase.js +528 -0
- package/dist/database/EntryStore.d.ts +58 -0
- package/dist/database/EntryStore.js +230 -0
- package/dist/database/EntryTransaction.d.ts +33 -0
- package/dist/database/EntryTransaction.js +907 -0
- package/dist/database/EntryUrlAliases.d.ts +2 -0
- package/dist/database/EntryUrlAliases.js +69 -0
- package/dist/database/LocalDB.d.ts +39 -0
- package/dist/database/LocalDB.js +79 -0
- package/dist/database/Version.d.ts +9 -0
- package/dist/database/Version.js +13 -0
- package/dist/database/driver/DatabaseHandle.d.ts +17 -0
- package/dist/database/driver/DatabaseHandle.js +0 -0
- package/dist/database/driver/OverlayExtension.browser.d.ts +2 -0
- package/dist/database/driver/OverlayExtension.browser.js +9 -0
- package/dist/database/driver/OverlayExtension.d.ts +1 -0
- package/dist/database/driver/OverlayExtension.js +7 -0
- package/dist/database/driver/RuntimeDatabase.d.ts +13 -0
- package/dist/database/driver/RuntimeDatabase.js +77 -0
- package/dist/database/driver/WasmDatabase.d.ts +29 -0
- package/dist/database/driver/WasmDatabase.js +46 -0
- package/dist/database/entry/EntryData.d.ts +13 -0
- package/dist/database/entry/EntryData.js +51 -0
- package/dist/database/entry/EntryTable.d.ts +189 -0
- package/dist/database/entry/EntryTable.js +186 -0
- package/dist/database/query/Condition.d.ts +8 -0
- package/dist/database/query/Condition.js +117 -0
- package/dist/database/query/EntryQuery.d.ts +44 -0
- package/dist/database/query/EntryQuery.js +412 -0
- package/dist/database/query/EntryReferences.d.ts +5 -0
- package/dist/database/query/EntryReferences.js +70 -0
- package/dist/database/query/Relation.d.ts +11 -0
- package/dist/database/query/Relation.js +113 -0
- package/dist/database/query/ResolveQuery.d.ts +12 -0
- package/dist/database/query/ResolveQuery.js +189 -0
- package/dist/database/query/Search.d.ts +38 -0
- package/dist/database/query/Search.js +149 -0
- package/dist/database/sync/Derive.d.ts +8 -0
- package/dist/database/sync/Derive.js +270 -0
- package/dist/database/sync/EntryParser.d.ts +8 -0
- package/dist/database/sync/EntryParser.js +90 -0
- package/dist/database/sync/EntrySyncer.d.ts +25 -0
- package/dist/database/sync/EntrySyncer.js +89 -0
- package/dist/database/sync/Ingest.d.ts +21 -0
- package/dist/database/sync/Ingest.js +145 -0
- package/dist/database/sync/SyncQueries.d.ts +160 -0
- package/dist/database/sync/SyncQueries.js +216 -0
- package/dist/field/check/CheckField.view.js +2 -2
- package/dist/field/code/CodeField.view.js +10 -10
- package/dist/field/link/LinkField.js +23 -0
- package/dist/field/link/LinkField.view.js +42 -41
- package/dist/field/list/ListField.view.js +172 -150
- package/dist/field/metadata/MetadataField.d.ts +28 -3
- package/dist/field/metadata/MetadataField.js +44 -7
- package/dist/field/metadata/MetadataField.view.d.ts +5 -0
- package/dist/field/metadata/MetadataField.view.js +31 -16
- package/dist/field/richtext/RichTextDocument.js +4 -3
- package/dist/field/richtext/RichTextExtensions.d.ts +1 -1
- package/dist/field/richtext/RichTextExtensions.js +33 -29
- package/dist/field/richtext/RichTextField.view.js +17 -8
- package/dist/field/richtext/RichTextInsertMenu.js +2 -2
- package/dist/field/views.js +2 -0
- package/dist/next.cjs +6 -20
- package/dist/next.d.ts +4 -3
- package/dist/next.edge.d.ts +1 -1
- package/dist/next.js +1 -2
- package/dist/picker/entry/EntryPicker.js +2 -1
- package/dist/picker/url/UrlPicker.js +1 -0
- package/dist/preview/widget.d.ts +45 -0
- package/dist/preview/widget.js +96 -1
- package/dist/query.d.ts +28 -0
- package/package.json +6 -1
- package/dist/adapter/next/DevRemote.d.ts +0 -3
- package/dist/adapter/next/DevRemote.js +0 -45
- package/dist/backend/store/GeneratedSource.d.ts +0 -2
- package/dist/backend/store/GeneratedSource.js +0 -21
- package/dist/chunks/chunk-G6E35DMJ.js +0 -1997
- package/dist/core/db/EntryDB.d.ts +0 -19
- package/dist/core/db/EntryDB.js +0 -48
- package/dist/core/db/EntryIndex.d.ts +0 -143
- package/dist/core/db/EntryIndex.js +0 -2773
- package/dist/core/db/EntryReferenceIndex.d.ts +0 -21
- package/dist/core/db/EntryReferenceIndex.js +0 -131
- package/dist/core/db/EntryResolver.d.ts +0 -56
- package/dist/core/db/EntryResolver.js +0 -699
- package/dist/core/db/EntryTarget.d.ts +0 -5
- package/dist/core/db/EntryTransaction.d.ts +0 -31
- package/dist/core/db/EntryTransaction.js +0 -956
- package/dist/core/db/LocalDB.d.ts +0 -42
- package/dist/core/db/LocalDB.js +0 -127
- package/dist/core/db/TestDB.d.ts +0 -19
- package/dist/core/db/TestDB.js +0 -50
- /package/dist/core/db/{EntryTarget.js → LocalStore.js} +0 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Rollback,
|
|
3
|
+
txGenerator
|
|
4
|
+
} from "./chunk-N47Y62CI.js";
|
|
5
|
+
import {
|
|
6
|
+
eq
|
|
7
|
+
} from "./chunk-XCZXR3C2.js";
|
|
8
|
+
import {
|
|
9
|
+
Column,
|
|
10
|
+
JsonColumn,
|
|
11
|
+
column,
|
|
12
|
+
columnConfig,
|
|
13
|
+
formatColumn,
|
|
14
|
+
table
|
|
15
|
+
} from "./chunk-MOWR65LM.js";
|
|
16
|
+
import {
|
|
17
|
+
Sql,
|
|
18
|
+
getData,
|
|
19
|
+
getQuery,
|
|
20
|
+
getSql,
|
|
21
|
+
getTable,
|
|
22
|
+
hasQuery,
|
|
23
|
+
sql
|
|
24
|
+
} from "./chunk-ETBQTP2S.js";
|
|
25
|
+
|
|
26
|
+
// node_modules/rado/dist/core/Dialect.js
|
|
27
|
+
var Dialect = class {
|
|
28
|
+
runtime;
|
|
29
|
+
#createEmitter;
|
|
30
|
+
constructor(runtime, createEmitter) {
|
|
31
|
+
this.runtime = runtime;
|
|
32
|
+
this.#createEmitter = createEmitter;
|
|
33
|
+
}
|
|
34
|
+
emit = (input) => {
|
|
35
|
+
const sql2 = hasQuery(input) ? getQuery(input) : getSql(input);
|
|
36
|
+
const emitter = new this.#createEmitter(this.runtime);
|
|
37
|
+
sql2.emit(emitter);
|
|
38
|
+
return emitter;
|
|
39
|
+
};
|
|
40
|
+
inline = (input) => {
|
|
41
|
+
const sql2 = hasQuery(input) ? getQuery(input) : getSql(input);
|
|
42
|
+
const emitter = new this.#createEmitter(this.runtime);
|
|
43
|
+
sql2.inlineValues().emit(emitter);
|
|
44
|
+
return emitter.sql;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// node_modules/rado/dist/core/Param.js
|
|
49
|
+
var NamedParam = class {
|
|
50
|
+
constructor(name) {
|
|
51
|
+
this.name = name;
|
|
52
|
+
}
|
|
53
|
+
name;
|
|
54
|
+
};
|
|
55
|
+
var ValueParam = class {
|
|
56
|
+
constructor(value) {
|
|
57
|
+
this.value = value;
|
|
58
|
+
}
|
|
59
|
+
value;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// node_modules/rado/dist/core/Emitter.js
|
|
63
|
+
var Emitter = class {
|
|
64
|
+
#runtime;
|
|
65
|
+
sql = "";
|
|
66
|
+
params = [];
|
|
67
|
+
constructor(runtime) {
|
|
68
|
+
this.#runtime = runtime;
|
|
69
|
+
}
|
|
70
|
+
get hasParams() {
|
|
71
|
+
return this.params.length > 0;
|
|
72
|
+
}
|
|
73
|
+
bind(inputs) {
|
|
74
|
+
return this.params.map((param) => {
|
|
75
|
+
if (param instanceof ValueParam) return this.processValue(param.value);
|
|
76
|
+
if (inputs && param.name in inputs)
|
|
77
|
+
return this.processValue(inputs[param.name]);
|
|
78
|
+
throw new Error(`Missing input for named parameter: ${param.name}`);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
processValue(value) {
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
emitIdentifierOrSelf(value) {
|
|
85
|
+
if (value === Sql.SELF_TARGET) {
|
|
86
|
+
if (!this.#selfName) throw new Error("Self target not defined");
|
|
87
|
+
this.emitIdentifier(this.#selfName);
|
|
88
|
+
} else {
|
|
89
|
+
this.emitIdentifier(value);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
emitUnsafe(value) {
|
|
93
|
+
this.sql += value;
|
|
94
|
+
}
|
|
95
|
+
#selfName;
|
|
96
|
+
emitSelf(inner, name) {
|
|
97
|
+
this.#selfName = name;
|
|
98
|
+
inner.emit(this);
|
|
99
|
+
this.#selfName = void 0;
|
|
100
|
+
}
|
|
101
|
+
#inlineFields = false;
|
|
102
|
+
inlineFields(inner, withTableName) {
|
|
103
|
+
const previous = this.#inlineFields;
|
|
104
|
+
this.#inlineFields = !withTableName;
|
|
105
|
+
inner.emit(this);
|
|
106
|
+
this.#inlineFields = previous;
|
|
107
|
+
}
|
|
108
|
+
#inlineValues = false;
|
|
109
|
+
inlineValues(inner) {
|
|
110
|
+
const previous = this.#inlineValues;
|
|
111
|
+
this.#inlineValues = true;
|
|
112
|
+
inner.emit(this);
|
|
113
|
+
this.#inlineValues = previous;
|
|
114
|
+
}
|
|
115
|
+
emitField({ targetName, fieldName }) {
|
|
116
|
+
if (this.#inlineFields) return this.emitIdentifier(fieldName);
|
|
117
|
+
this.emitIdentifierOrSelf(targetName);
|
|
118
|
+
this.emitUnsafe(".");
|
|
119
|
+
this.emitIdentifier(fieldName);
|
|
120
|
+
}
|
|
121
|
+
emitValueOrInline(value) {
|
|
122
|
+
if (this.#inlineValues) this.emitInline(value);
|
|
123
|
+
else this.emitValue(value);
|
|
124
|
+
}
|
|
125
|
+
emitUniversal(runtimes) {
|
|
126
|
+
const sql2 = runtimes[this.#runtime] ?? runtimes.default;
|
|
127
|
+
if (!sql2) throw new Error("Unsupported runtime");
|
|
128
|
+
getSql(sql2).emit(this);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// node_modules/rado/dist/sqlite/dialect.js
|
|
133
|
+
var DOUBLE_QUOTE = '"';
|
|
134
|
+
var ESCAPE_DOUBLE_QUOTE = '""';
|
|
135
|
+
var MATCH_DOUBLE_QUOTE = /"/g;
|
|
136
|
+
var SINGLE_QUOTE = "'";
|
|
137
|
+
var ESCAPE_SINGLE_QUOTE = "''";
|
|
138
|
+
var MATCH_SINGLE_QUOTE = /'/g;
|
|
139
|
+
var sqliteDialect = new Dialect(
|
|
140
|
+
"sqlite",
|
|
141
|
+
class extends Emitter {
|
|
142
|
+
processValue(value) {
|
|
143
|
+
return typeof value === "boolean" ? value ? 1 : 0 : value;
|
|
144
|
+
}
|
|
145
|
+
emitValue(value) {
|
|
146
|
+
this.params.push(new ValueParam(value));
|
|
147
|
+
this.sql += "?";
|
|
148
|
+
}
|
|
149
|
+
emitPlaceholder(name) {
|
|
150
|
+
this.params.push(new NamedParam(name));
|
|
151
|
+
this.sql += "?";
|
|
152
|
+
}
|
|
153
|
+
emitJsonPath({ target, asSql, segments }) {
|
|
154
|
+
target.emit(this);
|
|
155
|
+
this.sql += asSql ? "->>" : "->";
|
|
156
|
+
this.sql += this.quoteString(
|
|
157
|
+
`$${segments.map(
|
|
158
|
+
(p) => typeof p === "number" ? `[${p}]` : `.${JSON.stringify(p)}`
|
|
159
|
+
).join("")}`
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
emitInline(value) {
|
|
163
|
+
if (value === null || value === void 0) return this.sql += "null";
|
|
164
|
+
if (typeof value === "number") return this.sql += value;
|
|
165
|
+
if (typeof value === "string")
|
|
166
|
+
return this.sql += this.quoteString(value);
|
|
167
|
+
if (typeof value === "boolean") return this.sql += value ? "1" : "0";
|
|
168
|
+
this.sql += `json(${this.quoteString(JSON.stringify(value))})`;
|
|
169
|
+
}
|
|
170
|
+
emitIdentifier(identifier) {
|
|
171
|
+
this.sql += DOUBLE_QUOTE + identifier.replace(MATCH_DOUBLE_QUOTE, ESCAPE_DOUBLE_QUOTE) + DOUBLE_QUOTE;
|
|
172
|
+
}
|
|
173
|
+
quoteString(input) {
|
|
174
|
+
return SINGLE_QUOTE + input.replace(MATCH_SINGLE_QUOTE, ESCAPE_SINGLE_QUOTE) + SINGLE_QUOTE;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
// node_modules/rado/dist/sqlite/columns.js
|
|
180
|
+
function boolean(name) {
|
|
181
|
+
return new Column({
|
|
182
|
+
name,
|
|
183
|
+
type: column.integer(),
|
|
184
|
+
mapFromDriverValue(value) {
|
|
185
|
+
return value === 1;
|
|
186
|
+
},
|
|
187
|
+
mapToDriverValue(value) {
|
|
188
|
+
return value ? 1 : 0;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function integer(...args) {
|
|
193
|
+
const { name, options } = columnConfig(args);
|
|
194
|
+
if (options?.mode === "timestamp" || options?.mode === "timestamp_ms") {
|
|
195
|
+
const scale = options.mode === "timestamp" ? 1e3 : 1;
|
|
196
|
+
return new Column({
|
|
197
|
+
name,
|
|
198
|
+
type: column.integer(),
|
|
199
|
+
mapFromDriverValue(value) {
|
|
200
|
+
if (value === null) return null;
|
|
201
|
+
return new Date(value * scale);
|
|
202
|
+
},
|
|
203
|
+
mapToDriverValue(value) {
|
|
204
|
+
return Math.floor(value.getTime() / scale);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (options?.mode === "boolean") return boolean();
|
|
209
|
+
return new Column({ name, type: column.integer() });
|
|
210
|
+
}
|
|
211
|
+
function text(...args) {
|
|
212
|
+
const { name, options } = columnConfig(args);
|
|
213
|
+
if (options?.mode === "json")
|
|
214
|
+
return new JsonColumn({
|
|
215
|
+
name,
|
|
216
|
+
type: column.text(options?.length),
|
|
217
|
+
mapToDriverValue(value) {
|
|
218
|
+
return JSON.stringify(value);
|
|
219
|
+
},
|
|
220
|
+
mapFromDriverValue(value) {
|
|
221
|
+
return JSON.parse(value);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
return new Column({ name, type: column.text(options?.length) });
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// node_modules/rado/dist/sqlite/diff.js
|
|
228
|
+
var TableInfo = table("TableInfo", {
|
|
229
|
+
cid: integer().notNull(),
|
|
230
|
+
name: text().notNull(),
|
|
231
|
+
type: text().notNull(),
|
|
232
|
+
notnull: boolean().notNull(),
|
|
233
|
+
dflt_value: text(),
|
|
234
|
+
pk: integer().notNull()
|
|
235
|
+
});
|
|
236
|
+
var SqliteMaster = table("SqliteMaster", {
|
|
237
|
+
type: text().notNull(),
|
|
238
|
+
name: text().notNull(),
|
|
239
|
+
tbl_name: text().notNull(),
|
|
240
|
+
rootpage: integer().notNull(),
|
|
241
|
+
sql: text().notNull()
|
|
242
|
+
});
|
|
243
|
+
var inline = (sql2) => sqliteDialect.inline(sql2);
|
|
244
|
+
var sqliteDiff = (targetTable) => {
|
|
245
|
+
return txGenerator(function* (tx) {
|
|
246
|
+
const tableApi = getTable(targetTable);
|
|
247
|
+
const columnInfo = yield* tx.select(TableInfo).from(sql`pragma_table_info(${sql.inline(tableApi.name)}) as "TableInfo"`);
|
|
248
|
+
if (columnInfo.length === 0) return tableApi.create().map(inline);
|
|
249
|
+
const indexInfo = yield* tx.select(SqliteMaster).from(sql`sqlite_master as "SqliteMaster"`).where(
|
|
250
|
+
eq(SqliteMaster.tbl_name, tableApi.name),
|
|
251
|
+
eq(SqliteMaster.type, "index")
|
|
252
|
+
);
|
|
253
|
+
const hasSinglePrimaryKey = columnInfo.reduce((acc, column2) => acc + column2.pk, 0) === 1;
|
|
254
|
+
const localColumns = new Map(
|
|
255
|
+
columnInfo.map((column2) => {
|
|
256
|
+
return [
|
|
257
|
+
column2.name,
|
|
258
|
+
inline(
|
|
259
|
+
formatColumn({
|
|
260
|
+
type: sql.unsafe(column2.type.toLowerCase()),
|
|
261
|
+
notNull: column2.notnull,
|
|
262
|
+
primary: hasSinglePrimaryKey && column2.pk === 1,
|
|
263
|
+
defaultValue: column2.dflt_value !== null ? sql.unsafe(column2.dflt_value) : void 0
|
|
264
|
+
})
|
|
265
|
+
)
|
|
266
|
+
];
|
|
267
|
+
})
|
|
268
|
+
);
|
|
269
|
+
const schemaColumns = new Map(
|
|
270
|
+
Object.entries(tableApi.columns).map(([name, column2]) => {
|
|
271
|
+
const columnApi = getData(column2);
|
|
272
|
+
return [columnApi.name ?? name, inline(formatColumn(columnApi))];
|
|
273
|
+
})
|
|
274
|
+
);
|
|
275
|
+
const localIndexes = new Map(
|
|
276
|
+
indexInfo.filter((index) => !index.name.startsWith("sqlite_autoindex_")).map((index) => [index.name, index.sql])
|
|
277
|
+
);
|
|
278
|
+
const schemaIndexes = new Map(
|
|
279
|
+
Object.entries(tableApi.indexes()).map(([name, index]) => {
|
|
280
|
+
const indexApi = getData(index);
|
|
281
|
+
return [name, inline(indexApi.toSql(tableApi.name, name, false))];
|
|
282
|
+
})
|
|
283
|
+
);
|
|
284
|
+
const stmts = [];
|
|
285
|
+
const columnNames = /* @__PURE__ */ new Set([
|
|
286
|
+
...localColumns.keys(),
|
|
287
|
+
...schemaColumns.keys()
|
|
288
|
+
]);
|
|
289
|
+
for (const columnName of columnNames) {
|
|
290
|
+
const localInstruction = localColumns.get(columnName);
|
|
291
|
+
const schemaInstruction = schemaColumns.get(columnName);
|
|
292
|
+
if (!schemaInstruction) {
|
|
293
|
+
stmts.push(
|
|
294
|
+
sql.query({
|
|
295
|
+
alterTable: sql.identifier(tableApi.name),
|
|
296
|
+
dropColumn: sql.identifier(columnName)
|
|
297
|
+
})
|
|
298
|
+
);
|
|
299
|
+
} else if (!localInstruction) {
|
|
300
|
+
stmts.push(
|
|
301
|
+
sql.query({
|
|
302
|
+
alterTable: sql.identifier(tableApi.name),
|
|
303
|
+
addColumn: [
|
|
304
|
+
sql.identifier(columnName),
|
|
305
|
+
sql.unsafe(schemaInstruction)
|
|
306
|
+
]
|
|
307
|
+
})
|
|
308
|
+
);
|
|
309
|
+
} else if (localInstruction !== schemaInstruction) {
|
|
310
|
+
return recreate();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const indexNames = /* @__PURE__ */ new Set([
|
|
314
|
+
...localIndexes.keys(),
|
|
315
|
+
...schemaIndexes.keys()
|
|
316
|
+
]);
|
|
317
|
+
for (const indexName of indexNames) {
|
|
318
|
+
const localInstruction = localIndexes.get(indexName);
|
|
319
|
+
const schemaInstruction = schemaIndexes.get(indexName);
|
|
320
|
+
const dropLocal = sql.query({
|
|
321
|
+
dropIndex: sql.identifier(indexName)
|
|
322
|
+
});
|
|
323
|
+
if (!schemaInstruction) {
|
|
324
|
+
stmts.unshift(dropLocal);
|
|
325
|
+
} else if (schemaInstruction && !localInstruction) {
|
|
326
|
+
stmts.push(sql.unsafe(schemaInstruction));
|
|
327
|
+
} else if (schemaInstruction && localInstruction !== schemaInstruction) {
|
|
328
|
+
stmts.unshift(dropLocal);
|
|
329
|
+
stmts.push(sql.unsafe(schemaInstruction));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
try {
|
|
333
|
+
yield* txGenerator(function* (sp) {
|
|
334
|
+
yield* sp.batch(stmts);
|
|
335
|
+
const [tableInfo] = yield* sp.select(SqliteMaster.sql).from(sql`sqlite_master as "SqliteMaster"`).where(
|
|
336
|
+
eq(SqliteMaster.tbl_name, tableApi.name),
|
|
337
|
+
eq(SqliteMaster.type, "table")
|
|
338
|
+
);
|
|
339
|
+
sp.rollback(tableInfo);
|
|
340
|
+
});
|
|
341
|
+
} catch (err) {
|
|
342
|
+
if (!(err instanceof Rollback)) throw err;
|
|
343
|
+
const localInstruction = err.data;
|
|
344
|
+
const schemaInstruction = inline(tableApi.createTable());
|
|
345
|
+
const stripStmt = (q) => q.slice("create table ".length);
|
|
346
|
+
if (stripStmt(localInstruction) !== stripStmt(schemaInstruction)) {
|
|
347
|
+
return recreate();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return stmts.map(inline);
|
|
351
|
+
function recreate() {
|
|
352
|
+
const tempName = `new_${tableApi.name}`;
|
|
353
|
+
const tempTable = table(tempName, tableApi.columns);
|
|
354
|
+
const missingColumns = new Set(
|
|
355
|
+
Array.from(columnNames).filter((name) => !localColumns.has(name))
|
|
356
|
+
);
|
|
357
|
+
const selection = Object.fromEntries(
|
|
358
|
+
Object.entries(tableApi.columns).map(([name, column2]) => {
|
|
359
|
+
const columnApi = getData(column2);
|
|
360
|
+
const key = columnApi.name ?? name;
|
|
361
|
+
if (missingColumns.has(key))
|
|
362
|
+
return [name, columnApi.defaultValue ?? sql`null`];
|
|
363
|
+
return [name, targetTable[name]];
|
|
364
|
+
})
|
|
365
|
+
);
|
|
366
|
+
return [
|
|
367
|
+
// Create a new temporary table with the new definition
|
|
368
|
+
tableApi.createTable(tempName),
|
|
369
|
+
// Copy the data from the old table to the new table
|
|
370
|
+
getQuery(
|
|
371
|
+
tx.insert(tempTable).select(tx.select(selection).from(targetTable))
|
|
372
|
+
),
|
|
373
|
+
// Drop the old table
|
|
374
|
+
sql.query({ dropTable: sql.identifier(tableApi.name) }),
|
|
375
|
+
// Rename the temporary table to the old table name
|
|
376
|
+
sql.query({
|
|
377
|
+
alterTable: sql.identifier(tempName),
|
|
378
|
+
renameTo: sql.identifier(tableApi.name)
|
|
379
|
+
}),
|
|
380
|
+
// Create missing indexes
|
|
381
|
+
...tableApi.createIndexes()
|
|
382
|
+
].map(inline);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
// node_modules/rado/dist/sqlite/statements.js
|
|
388
|
+
var changesSchema = /^\s*(create|drop|alter|attach|detach|rollback)\b/i;
|
|
389
|
+
var StatementCache = class {
|
|
390
|
+
#statements = /* @__PURE__ */ new Map();
|
|
391
|
+
#prepare;
|
|
392
|
+
#finalize;
|
|
393
|
+
#size;
|
|
394
|
+
constructor(prepare, finalize, size = 256) {
|
|
395
|
+
this.#prepare = prepare;
|
|
396
|
+
this.#finalize = finalize;
|
|
397
|
+
this.#size = size;
|
|
398
|
+
}
|
|
399
|
+
acquire(sql2) {
|
|
400
|
+
if (changesSchema.test(sql2)) {
|
|
401
|
+
this.clear();
|
|
402
|
+
return { statement: this.#prepare(sql2), users: 1, evicted: true };
|
|
403
|
+
}
|
|
404
|
+
let cached = this.#statements.get(sql2);
|
|
405
|
+
if (cached) {
|
|
406
|
+
this.#statements.delete(sql2);
|
|
407
|
+
} else {
|
|
408
|
+
cached = { statement: this.#prepare(sql2), users: 0, evicted: false };
|
|
409
|
+
if (this.#statements.size >= this.#size) {
|
|
410
|
+
const [oldest, entry] = this.#statements.entries().next().value;
|
|
411
|
+
this.#statements.delete(oldest);
|
|
412
|
+
this.#evict(entry);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
this.#statements.set(sql2, cached);
|
|
416
|
+
cached.users++;
|
|
417
|
+
return cached;
|
|
418
|
+
}
|
|
419
|
+
release(cached) {
|
|
420
|
+
cached.users--;
|
|
421
|
+
if (cached.evicted && cached.users === 0) this.#finalize(cached.statement);
|
|
422
|
+
}
|
|
423
|
+
invalidate(sql2) {
|
|
424
|
+
if (changesSchema.test(sql2)) this.clear();
|
|
425
|
+
}
|
|
426
|
+
clear() {
|
|
427
|
+
for (const cached of this.#statements.values()) this.#evict(cached);
|
|
428
|
+
this.#statements.clear();
|
|
429
|
+
}
|
|
430
|
+
#evict(cached) {
|
|
431
|
+
cached.evicted = true;
|
|
432
|
+
if (cached.users === 0) this.#finalize(cached.statement);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
var ReusedStatement = class {
|
|
436
|
+
stmt;
|
|
437
|
+
#statements;
|
|
438
|
+
#cached;
|
|
439
|
+
constructor(statements, sql2) {
|
|
440
|
+
this.#statements = statements;
|
|
441
|
+
this.#cached = statements.acquire(sql2);
|
|
442
|
+
this.stmt = this.#cached.statement;
|
|
443
|
+
}
|
|
444
|
+
free() {
|
|
445
|
+
if (!this.#cached) return;
|
|
446
|
+
this.#statements.release(this.#cached);
|
|
447
|
+
this.#cached = void 0;
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
// node_modules/rado/dist/sqlite/transactions.js
|
|
452
|
+
var locks = /* @__PURE__ */ new WeakMap();
|
|
453
|
+
function execTransaction(driver, depth, wrap, run, options) {
|
|
454
|
+
const needsLock = options.async;
|
|
455
|
+
const behavior = options.behavior ?? "deferred";
|
|
456
|
+
if (!needsLock) return transact();
|
|
457
|
+
let trigger;
|
|
458
|
+
const lock = new Promise((resolve) => trigger = resolve);
|
|
459
|
+
const current = Promise.resolve(locks.get(driver));
|
|
460
|
+
locks.set(driver, lock);
|
|
461
|
+
return current.then(transact).finally(trigger);
|
|
462
|
+
function transact() {
|
|
463
|
+
try {
|
|
464
|
+
driver.exec(depth > 0 ? `savepoint d${depth}` : `begin ${behavior}`);
|
|
465
|
+
const result = run(wrap(depth + 1));
|
|
466
|
+
if (result instanceof Promise) return result.then(release, rollback);
|
|
467
|
+
return release(result);
|
|
468
|
+
} catch (error) {
|
|
469
|
+
return rollback(error);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function release(result) {
|
|
473
|
+
driver.exec(depth > 0 ? `release d${depth}` : "commit");
|
|
474
|
+
return result;
|
|
475
|
+
}
|
|
476
|
+
function rollback(error) {
|
|
477
|
+
try {
|
|
478
|
+
driver.exec(depth > 0 ? `rollback to d${depth}` : "rollback");
|
|
479
|
+
} catch {
|
|
480
|
+
}
|
|
481
|
+
throw error;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export {
|
|
486
|
+
Dialect,
|
|
487
|
+
NamedParam,
|
|
488
|
+
ValueParam,
|
|
489
|
+
Emitter,
|
|
490
|
+
sqliteDialect,
|
|
491
|
+
sqliteDiff,
|
|
492
|
+
StatementCache,
|
|
493
|
+
ReusedStatement,
|
|
494
|
+
execTransaction
|
|
495
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
ColumnType,
|
|
4
|
+
JsonColumn,
|
|
5
|
+
column
|
|
6
|
+
} from "./chunk-MOWR65LM.js";
|
|
7
|
+
import {
|
|
8
|
+
sql
|
|
9
|
+
} from "./chunk-ETBQTP2S.js";
|
|
10
|
+
|
|
11
|
+
// node_modules/rado/dist/universal/columns.js
|
|
12
|
+
var idType = new ColumnType(
|
|
13
|
+
"id",
|
|
14
|
+
[],
|
|
15
|
+
sql.universal({
|
|
16
|
+
sqlite: sql`integer`,
|
|
17
|
+
postgres: sql`integer generated always as identity`,
|
|
18
|
+
mysql: sql`int not null auto_increment`
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
var blobType = new ColumnType(
|
|
22
|
+
"blob",
|
|
23
|
+
[],
|
|
24
|
+
sql.universal({
|
|
25
|
+
postgres: sql`bytea`,
|
|
26
|
+
default: sql`blob`
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
var numberType = new ColumnType(
|
|
30
|
+
"number",
|
|
31
|
+
[],
|
|
32
|
+
sql.universal({
|
|
33
|
+
mysql: sql`double`,
|
|
34
|
+
default: sql`numeric`
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
var jsonbType = new ColumnType(
|
|
38
|
+
"json",
|
|
39
|
+
[],
|
|
40
|
+
sql.universal({
|
|
41
|
+
mysql: sql`json`,
|
|
42
|
+
default: sql`jsonb`
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
function id(name) {
|
|
46
|
+
return new Column({
|
|
47
|
+
name,
|
|
48
|
+
type: idType,
|
|
49
|
+
primary: true,
|
|
50
|
+
notNull: true
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function text(name) {
|
|
54
|
+
return new Column({ name, type: column.text() });
|
|
55
|
+
}
|
|
56
|
+
function varchar(name, options) {
|
|
57
|
+
return new Column({ name, type: column.varchar(options?.length) });
|
|
58
|
+
}
|
|
59
|
+
function integer(name) {
|
|
60
|
+
return new Column({ name, type: column.integer() });
|
|
61
|
+
}
|
|
62
|
+
function number(name) {
|
|
63
|
+
return new Column({ name, type: numberType, mapFromDriverValue: Number });
|
|
64
|
+
}
|
|
65
|
+
function boolean(name) {
|
|
66
|
+
return new Column({
|
|
67
|
+
name,
|
|
68
|
+
type: column.boolean(),
|
|
69
|
+
mapFromDriverValue: Boolean
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function json(name) {
|
|
73
|
+
return new JsonColumn({
|
|
74
|
+
name,
|
|
75
|
+
type: column.json(),
|
|
76
|
+
mapToDriverValue(value) {
|
|
77
|
+
return JSON.stringify(value);
|
|
78
|
+
},
|
|
79
|
+
mapFromDriverValue(value, { parsesJson }) {
|
|
80
|
+
return parsesJson ? value : JSON.parse(value);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function blob(name) {
|
|
85
|
+
return new Column({
|
|
86
|
+
name,
|
|
87
|
+
type: blobType,
|
|
88
|
+
mapFromDriverValue(value) {
|
|
89
|
+
return new Uint8Array(value);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
id,
|
|
96
|
+
text,
|
|
97
|
+
varchar,
|
|
98
|
+
integer,
|
|
99
|
+
number,
|
|
100
|
+
boolean,
|
|
101
|
+
json,
|
|
102
|
+
blob
|
|
103
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getField,
|
|
3
|
+
getSql,
|
|
4
|
+
getTable,
|
|
5
|
+
hasField,
|
|
6
|
+
hasSql,
|
|
7
|
+
hasTable,
|
|
8
|
+
sql
|
|
9
|
+
} from "./chunk-ETBQTP2S.js";
|
|
10
|
+
|
|
11
|
+
// node_modules/rado/dist/core/expr/Input.js
|
|
12
|
+
function input(value, maybeField) {
|
|
13
|
+
const isObject = value && typeof value === "object";
|
|
14
|
+
if (isObject && hasTable(value))
|
|
15
|
+
return sql.identifier(getTable(value).aliased);
|
|
16
|
+
if (isObject && hasSql(value)) return getSql(value);
|
|
17
|
+
const fieldSource = maybeField && typeof maybeField === "object" && hasField(maybeField) && getField(maybeField).source;
|
|
18
|
+
return fieldSource && "mapToDriverValue" in fieldSource ? mapToColumn(fieldSource, value) : sql.value(value);
|
|
19
|
+
}
|
|
20
|
+
function mapToColumn({ mapToDriverValue, type }, expr) {
|
|
21
|
+
const isObject = expr && typeof expr === "object";
|
|
22
|
+
if (isObject && hasSql(expr)) return getSql(expr);
|
|
23
|
+
if (Array.isArray(expr) && type.kind === "array") {
|
|
24
|
+
if (!mapToDriverValue) return input(expr);
|
|
25
|
+
return input(mapToDriverValue(expr));
|
|
26
|
+
}
|
|
27
|
+
return input(
|
|
28
|
+
expr !== null && mapToDriverValue ? mapToDriverValue(expr) : expr
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
input,
|
|
34
|
+
mapToColumn
|
|
35
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json with { type: 'json' }
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "alinea",
|
|
4
|
-
version: "2.0.0-preview.
|
|
4
|
+
version: "2.0.0-preview.9",
|
|
5
5
|
description: "Headless git-based CMS",
|
|
6
6
|
repository: "github:alineacms/alinea",
|
|
7
7
|
license: "MIT",
|
|
@@ -28,6 +28,10 @@ var package_default = {
|
|
|
28
28
|
},
|
|
29
29
|
"./*.cjs": "./dist/*.cjs",
|
|
30
30
|
"./*": "./dist/*.js",
|
|
31
|
+
"./database/driver/OverlayExtension": {
|
|
32
|
+
browser: "./dist/database/driver/OverlayExtension.browser.js",
|
|
33
|
+
default: "./dist/database/driver/OverlayExtension.js"
|
|
34
|
+
},
|
|
31
35
|
"./core/media/CreatePreview": {
|
|
32
36
|
"edge-light": "./dist/core/media/CreatePreview.js",
|
|
33
37
|
worker: "./dist/core/media/CreatePreview.js",
|
|
@@ -69,6 +73,7 @@ var package_default = {
|
|
|
69
73
|
},
|
|
70
74
|
dependencies: {
|
|
71
75
|
"@alinea/iso": "^0.3.3",
|
|
76
|
+
"@alinea/sqlite-wasm": "0.3.0",
|
|
72
77
|
esbuild: "^0.28.0"
|
|
73
78
|
},
|
|
74
79
|
peerDependencies: {
|