@stagware/nocodb-sdk 0.1.1 → 0.1.3
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 +48 -1
- package/dist/index.js +30 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -786,6 +786,53 @@ declare class ConflictError extends NocoDBError {
|
|
|
786
786
|
constructor(message: string, data?: unknown);
|
|
787
787
|
}
|
|
788
788
|
|
|
789
|
+
type ViewTypeV3 = 'grid' | 'gallery' | 'kanban' | 'calendar' | 'form';
|
|
790
|
+
interface ViewV3 {
|
|
791
|
+
id: string;
|
|
792
|
+
title: string;
|
|
793
|
+
type: ViewTypeV3;
|
|
794
|
+
table_id: string;
|
|
795
|
+
order?: number;
|
|
796
|
+
lock_type?: 'collaborative' | 'personal' | 'locked';
|
|
797
|
+
options?: Record<string, any>;
|
|
798
|
+
}
|
|
799
|
+
interface WorkspaceV3 {
|
|
800
|
+
id: string;
|
|
801
|
+
title: string;
|
|
802
|
+
org_id?: string;
|
|
803
|
+
}
|
|
804
|
+
interface BaseV3 {
|
|
805
|
+
id: string;
|
|
806
|
+
title: string;
|
|
807
|
+
workspace_id: string;
|
|
808
|
+
meta?: any;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
declare class MetaApiV3 {
|
|
812
|
+
private client;
|
|
813
|
+
constructor(client: NocoClient);
|
|
814
|
+
listWorkspaces(): Promise<{
|
|
815
|
+
list: WorkspaceV3[];
|
|
816
|
+
}>;
|
|
817
|
+
listBases(workspaceId: string): Promise<{
|
|
818
|
+
list: BaseV3[];
|
|
819
|
+
}>;
|
|
820
|
+
createView(baseId: string, tableId: string, view: Partial<ViewV3> & {
|
|
821
|
+
type: ViewTypeV3;
|
|
822
|
+
title: string;
|
|
823
|
+
}): Promise<ViewV3>;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
type index_BaseV3 = BaseV3;
|
|
827
|
+
type index_MetaApiV3 = MetaApiV3;
|
|
828
|
+
declare const index_MetaApiV3: typeof MetaApiV3;
|
|
829
|
+
type index_ViewTypeV3 = ViewTypeV3;
|
|
830
|
+
type index_ViewV3 = ViewV3;
|
|
831
|
+
type index_WorkspaceV3 = WorkspaceV3;
|
|
832
|
+
declare namespace index {
|
|
833
|
+
export { type index_BaseV3 as BaseV3, index_MetaApiV3 as MetaApiV3, type index_ViewTypeV3 as ViewTypeV3, type index_ViewV3 as ViewV3, type index_WorkspaceV3 as WorkspaceV3 };
|
|
834
|
+
}
|
|
835
|
+
|
|
789
836
|
/**
|
|
790
837
|
* Map of HTTP header names to values.
|
|
791
838
|
*/
|
|
@@ -2115,4 +2162,4 @@ declare function normalizeBaseUrl(input: string): string;
|
|
|
2115
2162
|
*/
|
|
2116
2163
|
declare function parseHeader(input: string): [string, string];
|
|
2117
2164
|
|
|
2118
|
-
export { type ApiToken, type AppInfo, AuthenticationError, type Base, type BaseRef, type BaseUser, type BulkCreateResponse, type BulkCreateResponseWithErrors, type BulkDeleteResponse, type BulkDeleteResponseWithErrors, type BulkOperationError, type BulkUpdateResponse, type BulkUpdateResponseWithErrors, type ClientOptions, type Column, type ColumnRef, type ColumnType, type Comment, type ComparisonOperator, ConflictError, DataApi, type DuplicateOptions, type ErrorResponse, type Filter, type FilterRef, type FormView, type GalleryView, type GridView, type HeadersMap, type Hook, type KanbanView, type ListResponse, MetaApi, type NcWorkspace, type NcWorkspaceUser, NetworkError, NocoClient, NocoDBError, NotFoundError, type PageInfo, type RequestOptions, type RetryOptions, type Row, type SharedBase, type SharedView, type Sort, type SortRef, type Source, type SourceType, type Table, type TableRef, ValidationError, type View, type ViewColumn, type ViewRef, type ViewType, type VisibilityRule, normalizeBaseUrl, parseHeader };
|
|
2165
|
+
export { type ApiToken, type AppInfo, AuthenticationError, type Base, type BaseRef, type BaseUser, type BulkCreateResponse, type BulkCreateResponseWithErrors, type BulkDeleteResponse, type BulkDeleteResponseWithErrors, type BulkOperationError, type BulkUpdateResponse, type BulkUpdateResponseWithErrors, type ClientOptions, type Column, type ColumnRef, type ColumnType, type Comment, type ComparisonOperator, ConflictError, DataApi, type DuplicateOptions, type ErrorResponse, type Filter, type FilterRef, type FormView, type GalleryView, type GridView, type HeadersMap, type Hook, type KanbanView, type ListResponse, MetaApi, type NcWorkspace, type NcWorkspaceUser, NetworkError, NocoClient, NocoDBError, NotFoundError, type PageInfo, type RequestOptions, type RetryOptions, type Row, type SharedBase, type SharedView, type Sort, type SortRef, type Source, type SourceType, type Table, type TableRef, ValidationError, type View, type ViewColumn, type ViewRef, type ViewType, type VisibilityRule, normalizeBaseUrl, parseHeader, index as v3 };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/index.ts
|
|
2
8
|
import fs from "fs";
|
|
3
9
|
import path from "path";
|
|
@@ -118,6 +124,28 @@ var ConflictError = class extends NocoDBError {
|
|
|
118
124
|
}
|
|
119
125
|
};
|
|
120
126
|
|
|
127
|
+
// src/v3/index.ts
|
|
128
|
+
var v3_exports = {};
|
|
129
|
+
__export(v3_exports, {
|
|
130
|
+
MetaApiV3: () => MetaApiV3
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// src/v3/MetaApiV3.ts
|
|
134
|
+
var MetaApiV3 = class {
|
|
135
|
+
constructor(client) {
|
|
136
|
+
this.client = client;
|
|
137
|
+
}
|
|
138
|
+
async listWorkspaces() {
|
|
139
|
+
return this.client.request("GET", "/api/v3/meta/workspaces");
|
|
140
|
+
}
|
|
141
|
+
async listBases(workspaceId) {
|
|
142
|
+
return this.client.request("GET", `/api/v3/meta/workspaces/${workspaceId}/bases`);
|
|
143
|
+
}
|
|
144
|
+
async createView(baseId, tableId, view) {
|
|
145
|
+
return this.client.request("POST", `/api/v3/meta/bases/${baseId}/tables/${tableId}/views`, { body: view });
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
121
149
|
// src/index.ts
|
|
122
150
|
var NocoClient = class {
|
|
123
151
|
baseUrl;
|
|
@@ -1636,5 +1664,6 @@ export {
|
|
|
1636
1664
|
NotFoundError,
|
|
1637
1665
|
ValidationError,
|
|
1638
1666
|
normalizeBaseUrl,
|
|
1639
|
-
parseHeader
|
|
1667
|
+
parseHeader,
|
|
1668
|
+
v3_exports as v3
|
|
1640
1669
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stagware/nocodb-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "TypeScript SDK for the NocoDB v2 API — typed clients for metadata, data, and admin operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,4 +53,4 @@
|
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
54
|
"vitest": "^4.0.18"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|