mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 02:15:12 +00:00
fix: build corrections and dependencies
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"vue": "latest",
|
||||
"typescript": "~5.4.5",
|
||||
"typescript": "latest",
|
||||
"ajv@<6.12.3": ">=6.12.3",
|
||||
"node.extend@<1.1.7": ">=1.1.7",
|
||||
"tough-cookie@<4.1.3": ">=4.1.3",
|
||||
|
||||
40
packages/nocodb-sdk-v2/package.json
Normal file
40
packages/nocodb-sdk-v2/package.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "nocodb-sdk-v2",
|
||||
"version": "0.0.1",
|
||||
"description": "NocoDB SDK",
|
||||
"type": "module",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"author": {
|
||||
"name": "NocoDB Inc",
|
||||
"url": "https://nocodb.com/"
|
||||
},
|
||||
"homepage": "https://github.com/nocodb/nocodb",
|
||||
"files": ["dist"],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"generate:sdk": "node script/build.js",
|
||||
"build": "rslib build",
|
||||
"check": "biome check --write",
|
||||
"dev": "rslib build --watch",
|
||||
"format": "biome format --write"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"swagger-typescript-api": "13.1.3",
|
||||
"@rslib/core": "^0.7.1",
|
||||
"@types/node": "^22.8.1",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "1.9.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { cwd } from 'node:process';
|
||||
import { generateApi } from 'swagger-typescript-api';
|
||||
import { resolve, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { generateApi } from 'swagger-typescript-api';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
@@ -12,4 +12,4 @@ await generateApi({
|
||||
apiClassName: 'InternalApi',
|
||||
unwrapResponseData: true,
|
||||
httpClientType: 'axios',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from './lib/Api';
|
||||
export * from './lib/Api';
|
||||
|
||||
@@ -930,6 +930,9 @@ export interface FieldOptionsLinkToAnotherRecord {
|
||||
|
||||
export type Field = FieldBase &
|
||||
(
|
||||
| {
|
||||
type?: "SingleLineText";
|
||||
}
|
||||
| {
|
||||
type?: "LongText";
|
||||
options?: FieldOptionsLongText;
|
||||
@@ -1876,7 +1879,7 @@ export class InternalApi<
|
||||
}),
|
||||
|
||||
/**
|
||||
* @description This API endpoint allows you to retrieve records from a specified table. You can customize the response by applying various query parameters for filtering, sorting, and formatting. **Pagination**: The response is paginated by default, with the first page being returned initially. The response includes the following additional information in the `pageInfo` JSON block: - **next**: Contains the URL to retrieve the next page of records. For example, `"https://staging.noco.ws/api/v3/tables/medhonywr18cysz/records?page=2"` points to the next page of records. - If there are no more records available (you are on the last page), this attribute will be _null_. The `pageInfo` attribute is particularly valuable when working with large datasets divided into multiple pages. It provides the necessary URL to seamlessly fetch subsequent pages, enabling efficient navigation through the dataset.
|
||||
* @description This API endpoint allows you to retrieve records from a specified table. You can customize the response by applying various query parameters for filtering, sorting, and formatting. **Pagination**: The response is paginated by default, with the first page being returned initially. The response includes the following additional information in the `pageInfo` JSON block: - **next**: Contains the URL to retrieve the next page of records. For example, `"https://staging.noco.to/api/v3/tables/medhonywr18cysz/records?page=2"` points to the next page of records. - If there are no more records available (you are on the last page), this attribute will be _null_. The `pageInfo` attribute is particularly valuable when working with large datasets divided into multiple pages. It provides the necessary URL to seamlessly fetch subsequent pages, enabling efficient navigation through the dataset.
|
||||
*
|
||||
* @tags Table Records
|
||||
* @name DbDataTableRowList
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Base } from '../lib/Api';
|
||||
import type { InternalAPI } from './types';
|
||||
import type { Workspace } from './workspace';
|
||||
import { Base } from './lib/Api';
|
||||
|
||||
export class NocoDBBase extends Base {
|
||||
export class NocoDBBase implements Base {
|
||||
readonly id: string;
|
||||
private workspace: Workspace;
|
||||
private readonly internalAPI: InternalAPI;
|
||||
@@ -12,7 +12,4 @@ export class NocoDBBase extends Base {
|
||||
this.id = id;
|
||||
this.workspace = workspace;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
import { InternalAPI, NocoDBOptions } from './types';
|
||||
import { InternalApi } from './lib/Api.ts'
|
||||
import { InternalApi } from './lib/Api.ts';
|
||||
import type { InternalAPI, NocoDBOptions } from './types';
|
||||
import { Workspace } from './workspace';
|
||||
|
||||
class NocoDB {
|
||||
private static _endPointURL: string = 'https://app.nocodb.com';
|
||||
private static _endPointURL = 'https://app.nocodb.com';
|
||||
private static _apiKey: string;
|
||||
private readonly internalAPI: InternalAPI;
|
||||
|
||||
|
||||
constructor(options: NocoDBOptions = {
|
||||
endPointURL: 'https://app.nocodb.com',
|
||||
}) {
|
||||
constructor(
|
||||
options: NocoDBOptions = {
|
||||
endPointURL: 'https://app.nocodb.com',
|
||||
},
|
||||
) {
|
||||
const endPointURL = options.endPointURL || NocoDB._endPointURL;
|
||||
const apiKey = options.apiKey || NocoDB._apiKey;
|
||||
|
||||
|
||||
if (!apiKey) {
|
||||
throw new Error('apiKey is required. Provide it in the constructor options or use NocoDB.configure().');
|
||||
throw new Error(
|
||||
'apiKey is required. Provide it in the constructor options or use NocoDB.configure().',
|
||||
);
|
||||
}
|
||||
|
||||
this.internalAPI = new InternalApi({
|
||||
@@ -29,11 +31,15 @@ class NocoDB {
|
||||
|
||||
static configure(options: NocoDBOptions): void {
|
||||
if (!options) {
|
||||
throw new Error('options is required. Provide it in the constructor options or use NocoDB.configure().');
|
||||
throw new Error(
|
||||
'options is required. Provide it in the constructor options or use NocoDB.configure().',
|
||||
);
|
||||
}
|
||||
|
||||
if (!options.apiKey) {
|
||||
throw new Error('apiKey is required. Provide it in the constructor options or use NocoDB.configure().');
|
||||
throw new Error(
|
||||
'apiKey is required. Provide it in the constructor options or use NocoDB.configure().',
|
||||
);
|
||||
}
|
||||
|
||||
NocoDB._endPointURL = options.endPointURL || NocoDB._endPointURL;
|
||||
@@ -43,4 +49,4 @@ class NocoDB {
|
||||
workspace(id: string): Workspace {
|
||||
return new Workspace(this.internalAPI, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { InternalApi as Api } from './lib/Api';
|
||||
|
||||
import type { InternalApi as Api } from './lib/Api';
|
||||
|
||||
export interface NocoDBOptions {
|
||||
endPointURL?: string;
|
||||
apiKey?: string;
|
||||
}
|
||||
|
||||
|
||||
export type InternalAPI = Api<unknown>['api']
|
||||
export type InternalAPI = Api<unknown>['api'];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { InternalAPI } from './types';
|
||||
import type { Base, BaseCreate, BaseUpdate } from './lib/Api';
|
||||
import { NocoDBBase } from './base';
|
||||
import type { Base, BaseCreate, BaseUpdate } from './lib/Api';
|
||||
import type { InternalAPI } from './types';
|
||||
|
||||
export class Workspace {
|
||||
readonly id: string;
|
||||
@@ -15,7 +15,6 @@ export class Workspace {
|
||||
return this.internalAPI.v3MetaBasesDetail(this.id);
|
||||
}
|
||||
|
||||
|
||||
async listBases(): Promise<Base[]> {
|
||||
return this.internalAPI.v3MetaWorkspacesBasesList(this.id);
|
||||
}
|
||||
@@ -35,4 +34,4 @@ export class Workspace {
|
||||
base(baseId: string): NocoDBBase {
|
||||
return new NocoDBBase(this.internalAPI, baseId, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1866
pnpm-lock.yaml
generated
1866
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
packages:
|
||||
- "packages/nocodb-sdk"
|
||||
- "packages/nocodb-sdk-v2"
|
||||
- "packages/nc-gui"
|
||||
- "packages/nc-mail-templates"
|
||||
- "packages/nocodb"
|
||||
|
||||
Reference in New Issue
Block a user