@lark-base-open/base-database-toolchain 0.0.0-stage → 1.0.0
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/CHANGELOG.md +8 -0
- package/LICENSE +6 -0
- package/README.md +48 -2
- package/bin/base-database-toolchain.mjs +22 -0
- package/dist/app-builder/core.d.mts +37 -0
- package/dist/app-builder/core.mjs +716 -0
- package/dist/app-builder/package.json +1 -0
- package/dist/app-builder/schema.d.ts +3 -0
- package/dist/app-builder/schema.js +71 -0
- package/dist/contract-conversion.d.ts +41 -0
- package/dist/contract-conversion.js +116 -0
- package/dist/contract-extractor.d.ts +23 -0
- package/dist/contract-extractor.js +245 -0
- package/dist/durable-runner.d.ts +102 -0
- package/dist/durable-runner.js +128 -0
- package/dist/go-adapter.d.mts +4 -0
- package/dist/go-adapter.mjs +776 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/sdk-codegen.d.ts +16 -0
- package/dist/sdk-codegen.js +208 -0
- package/dist/trigger-validation.d.ts +75 -0
- package/dist/trigger-validation.js +73 -0
- package/npm-shrinkwrap.json +1167 -0
- package/package.json +73 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.0] - 2026-11-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Shared contract conversion, SDK code generation, server compilation, Timer validation and local Durable execution for Base Database application CLIs.
|
|
8
|
+
- A Node API and a versioned JSON subprocess interface for Go callers.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
©Lark Technologies Pte. Ltd. All rights reserved. Use is subject to the Legal Agreements outlined here:
|
|
2
|
+
[Feishu User Terms of Service](https://www.feishu.cn/terms)
|
|
3
|
+
[Feishu Privacy Policy](https://www.feishu.cn/privacy)
|
|
4
|
+
[Feishu Open Platform App Service Provider Security Management Specifications](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/management-practice/app-service-provider-security-management-specifications)
|
|
5
|
+
[Lark User Terms of Service](https://www.larksuite.com/user-terms-of-service)
|
|
6
|
+
[Lark Privacy Policy](https://www.larksuite.com/privacy-policy)
|
package/README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Base Database toolchain
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Local development tools for Base Database applications: contract extraction and conversion, SDK code generation, server compilation, Timer declaration validation and local Durable execution. Requires Node.js 20.19 or newer; subprocess callers should use Node.js 22.12 or newer.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --save-exact @lark-base-open/base-database-toolchain --registry=https://registry.npmjs.org/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Authentication, platform API calls, project dependency installation, source uploads and publication belong to the calling application. Local validation does not establish cloud validation or publication. Only compile and execute projects you trust: local compilation and contract evaluation execute project code.
|
|
12
|
+
|
|
13
|
+
## Node API
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import {
|
|
17
|
+
extractContract,
|
|
18
|
+
convertContract,
|
|
19
|
+
} from '@lark-base-open/base-database-toolchain';
|
|
20
|
+
import { buildProject } from '@lark-base-open/base-database-toolchain/builder';
|
|
21
|
+
|
|
22
|
+
const contract = await convertContract(
|
|
23
|
+
extractContract('/absolute/project/server/functions/hello/index.ts'),
|
|
24
|
+
);
|
|
25
|
+
const result = await buildProject('/absolute/project');
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Additional exports are `convertLoadedContract`, `runSDKCodegen`, `validateTriggerDeclarations`, `parseDurableEvents` and `driveLocalDurable`. The caller supplies project dependencies, explicit runtime context and compatibility checks; the compiler never supplies a user identity.
|
|
29
|
+
|
|
30
|
+
## JSON subprocess protocol
|
|
31
|
+
|
|
32
|
+
Run `base-database-toolchain` with one JSON object on stdin. It exits after one operation:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"protocolVersion": 1,
|
|
37
|
+
"operation": "contracts",
|
|
38
|
+
"root": "/absolute/project",
|
|
39
|
+
"server": "server",
|
|
40
|
+
"stateDirectory": ".lark-cli/base-site",
|
|
41
|
+
"brand": "feishu"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Supported operations: `contracts`, `verify-contracts`, `build`, `durable-dev`. `inputMode`, `runtimeOnly`, `legacyBuild` and `durableDev` select project compatibility options. Page builds remain the caller's responsibility.
|
|
46
|
+
|
|
47
|
+
Success emits `{"ok":true,"operation":"contracts"}` on stdout. Failure emits a bounded JSON error on stderr and exits nonzero. Callers must not pass access tokens or application secrets to the process. SQL is not executed here; local Timer checks do not establish platform quota or calendar semantics. Durable local execution cannot invoke hosted Functions without a real host context.
|
|
48
|
+
|
|
49
|
+
For `1.x`, compatible fixes increment patch, compatible features increment minor and incompatible APIs/protocols increment major. Published versions are immutable.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runCompiler } from '../dist/index.js';
|
|
3
|
+
try {
|
|
4
|
+
const chunks = [];
|
|
5
|
+
let bytes = 0;
|
|
6
|
+
for await (const chunk of process.stdin) {
|
|
7
|
+
bytes += chunk.length;
|
|
8
|
+
if (bytes > 4 * 1024 * 1024)
|
|
9
|
+
throw new Error('Compiler request exceeds 4 MiB');
|
|
10
|
+
chunks.push(chunk);
|
|
11
|
+
}
|
|
12
|
+
const request = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
13
|
+
process.stdout.write(JSON.stringify(await runCompiler(request)) + '\n');
|
|
14
|
+
} catch (error) {
|
|
15
|
+
process.stderr.write(
|
|
16
|
+
JSON.stringify({
|
|
17
|
+
ok: false,
|
|
18
|
+
error: { message: String(error?.message ?? error).slice(0, 8192) },
|
|
19
|
+
}) + '\n',
|
|
20
|
+
);
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare function defineFunctionCall(ast: any, definitionName?: string): any;
|
|
2
|
+
export declare function classifyFunctionAST(ast: any): "handler" | "sdk" | "unknown";
|
|
3
|
+
export declare function isDefineFunctionSource(source: any): boolean;
|
|
4
|
+
export declare function parseProjectConfig(source: any, label?: string): any;
|
|
5
|
+
export declare const BUILDER_VERSION: any;
|
|
6
|
+
export declare const ERROR_MARKER = "BASE_DATABASE_BUILD_ERROR:";
|
|
7
|
+
export declare function diagnostic(error: any, stage?: string, functionId?: null): {
|
|
8
|
+
builderVersion: any;
|
|
9
|
+
stage: string;
|
|
10
|
+
functionId: null;
|
|
11
|
+
file: any;
|
|
12
|
+
line: any;
|
|
13
|
+
column: any;
|
|
14
|
+
message: string;
|
|
15
|
+
hint: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function layout(root: any): {
|
|
18
|
+
version: any;
|
|
19
|
+
server: string;
|
|
20
|
+
config: any;
|
|
21
|
+
};
|
|
22
|
+
export declare function safePath(root: any, name: any): any;
|
|
23
|
+
export declare function inventory(root: any, exclude?: any[]): any[];
|
|
24
|
+
export declare function functionInventory(directory: any, requiredFiles?: any[]): string[];
|
|
25
|
+
export declare function ids(root: any, server: any): string[];
|
|
26
|
+
export declare function durableIds(root: any, server: any): string[];
|
|
27
|
+
export declare function run(command: any, args: any, cwd: any): void;
|
|
28
|
+
export declare function buildProject(root: any, options?: {}): Promise<{
|
|
29
|
+
ok: boolean;
|
|
30
|
+
functions: number;
|
|
31
|
+
rebuilt: number;
|
|
32
|
+
output: string;
|
|
33
|
+
builderVersion: any;
|
|
34
|
+
stubbedModules: any[];
|
|
35
|
+
}>;
|
|
36
|
+
/** Local cache integrity only; deployment policy belongs to the platform. */
|
|
37
|
+
export declare function readBuildCache(output: any, expectedIds: any, expectedDurableIds: any): any;
|