@kubun/store-graph 0.13.0 → 0.13.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/lib/api.d.ts +1 -2
- package/lib/api.js +0 -4
- package/lib/index.d.ts +1 -1
- package/lib/migrations.js +0 -3
- package/lib/tables.d.ts +0 -8
- package/package.json +6 -6
package/lib/api.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Adapter } from '@kubun/db-adapter';
|
|
|
2
2
|
import { DocumentID, DocumentModelID } from '@kubun/id';
|
|
3
3
|
import type { AggregateDocumentsParams, AggregateValues, DocumentModel, DocumentNode, GroupedAggregateDocumentsParams, GroupedAggregateValue } from '@kubun/protocol';
|
|
4
4
|
import type { Kysely } from 'kysely';
|
|
5
|
-
import type { AccessLevel, Catalog, ClusterDefinitionRow, ClusterModel, CreateDocumentParams, CreateGraphParams, GraphModel, GraphModelWithRecord, GraphTables, InsertCatalog, InsertClusterModel,
|
|
5
|
+
import type { AccessLevel, Catalog, ClusterDefinitionRow, ClusterModel, CreateDocumentParams, CreateGraphParams, GraphModel, GraphModelWithRecord, GraphTables, InsertCatalog, InsertClusterModel, InsertMutationLogEntry, ListDocumentsParams, MutationLogEntry, QueryDocumentsParams, QueryDocumentsResult, SaveDocumentParams, SearchDocumentResult, SearchDocumentsParams } from './tables.js';
|
|
6
6
|
/**
|
|
7
7
|
* Persisted access rule shape as stored in `user_model_access_defaults`.
|
|
8
8
|
*/
|
|
@@ -83,7 +83,6 @@ export type GraphStoreAPI = {
|
|
|
83
83
|
saveCluster(id: string, definition: unknown): Promise<void>;
|
|
84
84
|
getCluster(id: string): Promise<ClusterDefinitionRow | undefined>;
|
|
85
85
|
getClusters(ids: Array<string>): Promise<Record<string, unknown>>;
|
|
86
|
-
addAttachments(attachments: Array<InsertDocumentAttachment>): Promise<void>;
|
|
87
86
|
createSearchIndex(modelID: string, fields: Array<string>): Promise<void>;
|
|
88
87
|
dropSearchIndex(modelID: string): Promise<void>;
|
|
89
88
|
updateSearchEntry(modelID: string, documentID: string, data: Record<string, unknown>, fields: Array<string>): Promise<void>;
|
package/lib/api.js
CHANGED
|
@@ -860,10 +860,6 @@ export function createGraphStore(db, adapter) {
|
|
|
860
860
|
}
|
|
861
861
|
return result;
|
|
862
862
|
},
|
|
863
|
-
// --- Attachments ---
|
|
864
|
-
async addAttachments (attachments) {
|
|
865
|
-
await db.insertInto('kubun_graph_document_attachments').values(attachments).onConflict((oc)=>oc.doNothing()).execute();
|
|
866
|
-
},
|
|
867
863
|
// --- Search ---
|
|
868
864
|
async createSearchIndex (modelID, fields) {
|
|
869
865
|
await adapter.createSearchIndex(db, {
|
package/lib/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { graphStoreDefinition } from './definition.js';
|
|
|
6
6
|
export { ModelNotDeployedError } from './errors.js';
|
|
7
7
|
export declare const GRAPH_STORE: "graph";
|
|
8
8
|
export declare function getGraphStore(provider: StoreProvider): Promise<GraphStoreAPI>;
|
|
9
|
-
export type { AccessLevel, AccessPermissions, AddDocumentModelParams, Catalog, ClusterDefinitionRow, ClusterModel, ConnectionArguments, CreateDocumentParams, CreateGraphParams, CursorDocument, Document,
|
|
9
|
+
export type { AccessLevel, AccessPermissions, AddDocumentModelParams, Catalog, ClusterDefinitionRow, ClusterModel, ConnectionArguments, CreateDocumentParams, CreateGraphParams, CursorDocument, Document, DocumentData, DocumentModelRow, DocumentParams, GraphModel, GraphModelWithRecord, GraphTables, InsertCatalog, InsertClusterModel, InsertDocument, InsertDocumentModel, InsertDocumentModelInterface, InsertMutationLogEntry, ListDocumentsParams, MutationLogEntry, PaginatedResult, PaginationParams, QueryDocumentsParams, QueryDocumentsResult, SaveDocumentParams, SearchConfig, SearchDocumentResult, SearchDocumentsParams, UpdateDocument, UpdateDocumentModel, ViewerReadAccess, } from './tables.js';
|
package/lib/migrations.js
CHANGED
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
const now = ctx.functions.now;
|
|
16
16
|
const init = {
|
|
17
17
|
async up (db) {
|
|
18
|
-
// Document attachments
|
|
19
|
-
await db.schema.createTable('kubun_graph_document_attachments').ifNotExists().addColumn('id', t.text, (col)=>col.notNull().primaryKey()).addColumn('data', t.binary, (col)=>col.notNull()).addColumn('created_at', t.timestamp, (col)=>col.defaultTo(now).notNull()).execute();
|
|
20
18
|
// Document models
|
|
21
19
|
await db.schema.createTable('kubun_graph_document_models').ifNotExists().addColumn('id', t.text, (col)=>col.notNull().primaryKey()).addColumn('version', t.text, (col)=>col.notNull()).addColumn('name', t.text, (col)=>col.notNull()).addColumn('behavior', t.text, (col)=>col.notNull()).addColumn('unique_fields', t.json).addColumn('interfaces', t.json, (col)=>col.notNull()).addColumn('schema', t.json, (col)=>col.notNull()).addColumn('fields_meta', t.json, (col)=>col.notNull()).addColumn('created_at', t.timestamp, (col)=>col.defaultTo(now).notNull()).execute();
|
|
22
20
|
// Document model interfaces
|
|
@@ -91,7 +89,6 @@
|
|
|
91
89
|
await db.schema.dropTable('kubun_graph_models').ifExists().execute();
|
|
92
90
|
await db.schema.dropTable('kubun_graph_document_model_interfaces').ifExists().execute();
|
|
93
91
|
await db.schema.dropTable('kubun_graph_document_models').ifExists().execute();
|
|
94
|
-
await db.schema.dropTable('kubun_graph_document_attachments').ifExists().execute();
|
|
95
92
|
}
|
|
96
93
|
};
|
|
97
94
|
return {
|
package/lib/tables.d.ts
CHANGED
|
@@ -18,13 +18,6 @@ export type DocumentTable<Data extends DocumentData = DocumentData> = {
|
|
|
18
18
|
export type Document<Data extends DocumentData = DocumentData> = Selectable<DocumentTable<Data>>;
|
|
19
19
|
export type InsertDocument<Data extends DocumentData = DocumentData> = Insertable<DocumentTable<Data>>;
|
|
20
20
|
export type UpdateDocument<Data extends DocumentData = DocumentData> = Updateable<DocumentTable<Data>>;
|
|
21
|
-
export type DocumentAttachmentTable = {
|
|
22
|
-
id: string;
|
|
23
|
-
data: Uint8Array;
|
|
24
|
-
created_at: CreatedAtColumn;
|
|
25
|
-
};
|
|
26
|
-
export type DocumentAttachment = Selectable<DocumentAttachmentTable>;
|
|
27
|
-
export type InsertDocumentAttachment = Insertable<DocumentAttachmentTable>;
|
|
28
21
|
export type DocumentModelTable = {
|
|
29
22
|
id: string;
|
|
30
23
|
version: string;
|
|
@@ -150,7 +143,6 @@ export type GraphTables = {
|
|
|
150
143
|
kubun_graph_catalogs: CatalogTable;
|
|
151
144
|
kubun_graph_cluster_models: ClusterModelTable;
|
|
152
145
|
kubun_graph_clusters: ClusterDefinitionTable;
|
|
153
|
-
kubun_graph_document_attachments: DocumentAttachmentTable;
|
|
154
146
|
kubun_graph_document_models: DocumentModelTable;
|
|
155
147
|
kubun_graph_document_model_interfaces: DocumentModelInterfaceTable;
|
|
156
148
|
kubun_graph_document_model_links: GraphDocumentModelTable;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/store-graph",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "see LICENSE.md",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@sozai/codec": "^0.4.0",
|
|
19
19
|
"kysely": "^0.29.5",
|
|
20
|
-
"@kubun/db": "^0.12.1",
|
|
21
|
-
"@kubun/protocol": "^0.13.0",
|
|
22
20
|
"@kubun/db-adapter": "^0.13.0",
|
|
23
|
-
"@kubun/id": "^0.
|
|
21
|
+
"@kubun/id": "^0.13.0",
|
|
22
|
+
"@kubun/protocol": "^0.13.1",
|
|
23
|
+
"@kubun/db": "^0.13.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@testcontainers/postgresql": "^12.1.0",
|
|
27
|
-
"@kubun/db-better-sqlite": "^0.
|
|
28
|
-
"@kubun/db-postgres": "^0.
|
|
27
|
+
"@kubun/db-better-sqlite": "^0.13.0",
|
|
28
|
+
"@kubun/db-postgres": "^0.13.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|