@lark-base-open/base-database-toolchain 1.5.1 → 1.7.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.0] - 2026-12-02
4
+
5
+ ### Added
6
+
7
+ - Expose `verify-locked-contracts` in the JSON subprocess so hosts can validate dependency locks and verify contracts in a single worker when reusing an installation.
8
+ - Share the App SDK 0.11.x server and shared modules across eligible Functions in the same site build.
9
+
10
+ ## [1.6.0] - 2026-12-02
11
+
12
+ ### Added
13
+
14
+ - Accept Durable Trigger declarations with `type: "webhook"` in the Node API and JSON subprocess. Declare an `id` and optionally `enabled`. The Webhook POST body supplies the Function input, so the declaration does not accept static `input` or `map` fields.
15
+ - For projects that declare Webhooks, check a local limit of 10 Webhook declarations and 20 total Trigger declarations. Effective quotas are still checked at deployment. Local validation for projects with only Timer and Record triggers is unchanged.
16
+
3
17
  ## [1.5.1] - 2026-12-01
4
18
 
5
19
  ### Fixed
package/README.md CHANGED
@@ -46,7 +46,9 @@ Run `base-database-toolchain` with one JSON object on stdin. It exits after one
46
46
  }
47
47
  ```
48
48
 
49
- Supported operations: `contracts`, `verify-contracts`, `build`, `build-server`, `durable-dev`, `validate-locks`, `validate-dependencies` and `inspect-page`. `validate-dependencies` requires the caller-provided `dependencyPolicy`; `build-server` skips Page builds. `runtimeOnly` selects runtime metadata generation and `durableDev` carries local debug options. The worker requires template.version 2, page/server workspaces and named Page inputs; legacy server layouts, sql/ directories, legacyBuild=true and positional inputs are rejected before compilation. Page builds remain the caller's responsibility.
49
+ Supported operations: `contracts`, `verify-contracts`, `verify-locked-contracts`, `build`, `build-server`, `durable-dev`, `validate-locks`, `validate-dependencies` and `inspect-page`. `validate-dependencies` requires the caller-provided `dependencyPolicy`; `build-server` skips Page builds. `runtimeOnly` selects runtime metadata generation and `durableDev` carries local debug options. The worker requires template.version 2, page/server workspaces and named Page inputs; legacy server layouts, sql/ directories, legacyBuild=true and positional inputs are rejected before compilation. Page builds remain the caller's responsibility.
50
+
51
+ On an installation cache hit, a host may call `verify-locked-contracts` when it appears in the installed package’s `siteCompilerOperations`. It validates the locks before verifying contracts in the same worker. Without that capability, use separate operations.
50
52
 
51
53
  For SQL batch clients, supply an authenticated, consistently discovered `batchSnapshot` with the siteToken, environment, versionId, skillHash and per-Function detail. The toolchain binds it to the actual project token, `runtimeProfile` (default online), and current local SQL source hashes. Verification reuses that bound observation; edited declarations lose the cached capability until a new discovery. An execution view is provenance, not a future lock. An older SDK can still generate single-call clients and returns a `BATCH_SDK_UNSUPPORTED` warning; no batch types are synthesized.
52
54
 
@@ -278,7 +278,7 @@ export function isSupportedSharedVersion(packageName, version) {
278
278
  if (packageName === 'zod')
279
279
  return major === 4;
280
280
  if (packageName === '@lark-base-open/base-database-app-sdk')
281
- return major === 0 && minor >= 8 && minor <= 10;
281
+ return major === 0 && minor >= 8 && minor <= 11;
282
282
  return false;
283
283
  }
284
284
  function canonicalInput(root, file) {
@@ -1 +1 @@
1
- {"type":"module","version":"1.0.13"}
1
+ {"type":"module","version":"1.0.14"}
@@ -1,11 +1 @@
1
- export declare function runCompiler(request: any): Promise<{
2
- protocolVersion: 1;
3
- bootstrap: import("./page-bootstrap.js").DevBootstrapStatus;
4
- warnings: import("./page-link-guard.js").LinkGuardWarning[];
5
- ok: boolean;
6
- operation: any;
7
- } | {
8
- ok: boolean;
9
- operation: any;
10
- warnings?: any[] | undefined;
11
- } | undefined>;
1
+ export declare function runCompiler(request: any): any;
@@ -35,6 +35,14 @@ export async function runCompiler(request) {
35
35
  request.server !== 'server' ||
36
36
  request.legacyBuild === true)
37
37
  throw Error('PROJECT_LAYOUT_UNSUPPORTED: compiler requires a version 2 workspace with named inputs');
38
+ if (request.operation === 'verify-locked-contracts') {
39
+ await runCompiler({ ...request, operation: 'validate-locks' });
40
+ const verified = await runCompiler({
41
+ ...request,
42
+ operation: 'verify-contracts',
43
+ });
44
+ return { ...verified, operation: request.operation };
45
+ }
38
46
  projectLayout(request.root);
39
47
  if (request.operation === 'validate-dependencies') {
40
48
  const policy = parsePackageDependencyPolicy(request.dependencyPolicy);
@@ -53,6 +61,7 @@ export async function runCompiler(request) {
53
61
  const localSQLSources = Object.create(null);
54
62
  const triggerLocations = [];
55
63
  let triggerCount = 0;
64
+ let webhookCount = 0;
56
65
  const permissionFlag = process.allowedNodeEnvironmentFlags.has('--permission')
57
66
  ? '--permission'
58
67
  : '--experimental-permission';
@@ -410,6 +419,7 @@ export async function runCompiler(request) {
410
419
  validateTriggerDeclarations(value, input, directory + '/meta.json', triggerIDs);
411
420
  if (value?.length) {
412
421
  triggerCount += value.length;
422
+ webhookCount += value.filter(({ type }) => type === 'webhook').length;
413
423
  triggerLocations.push(path.relative(root, directory) + '/meta.json');
414
424
  }
415
425
  }
@@ -505,6 +515,7 @@ export async function runCompiler(request) {
505
515
  triggerIDs.clear();
506
516
  triggerLocations.length = 0;
507
517
  triggerCount = 0;
518
+ webhookCount = 0;
508
519
  const changes = [];
509
520
  const failures = [];
510
521
  for (const kind of ['functions', 'durable'])
@@ -629,6 +640,11 @@ export async function runCompiler(request) {
629
640
  contractFailure(failures, path.join('server', kind, id), error);
630
641
  }
631
642
  }
643
+ // Keep the existing deployment-only quota check for Timer/Record projects.
644
+ if (webhookCount > 0 && triggerCount > 20)
645
+ throw Error(`TRIGGER_LIMIT_EXCEEDED: Trigger declarations exceed the environment limit of 20 (declared ${triggerCount})`);
646
+ if (webhookCount > 10)
647
+ throw Error(`TRIGGER_LIMIT_EXCEEDED: Webhook trigger declarations exceed the site limit of 10 (declared ${webhookCount})`);
632
648
  collectDatabaseContracts(functions, inputs, !!(request.batchSnapshot || previous), failures);
633
649
  throwContractFailures(failures);
634
650
  let batchSnapshot;
@@ -654,7 +670,9 @@ export async function runCompiler(request) {
654
670
  status: 'not_run',
655
671
  declarations: triggerCount,
656
672
  locations: triggerLocations,
657
- reason: 'Local shape, IDs, static input and map target contracts checked. Source bindings and Owner permissions, source field Schema, condition operators/values, actual map source types, calendar/timezone semantics, platform minimum interval and Trigger quota are checked during deployment. The server validates the final merged Record input at startup; Function server validation does not cover these rules.',
673
+ reason: webhookCount > 0
674
+ ? 'Local shape, IDs, declaration limits, static input and map target contracts checked. Source bindings and Owner permissions, source field Schema, condition operators/values, actual map source types, calendar/timezone semantics, platform minimum interval and effective Trigger quota are checked during deployment. The server validates merged Record input and Webhook POST input at startup; Function server validation does not cover these rules.'
675
+ : 'Local shape, IDs, static input and map target contracts checked. Source bindings and Owner permissions, source field Schema, condition operators/values, actual map source types, calendar/timezone semantics, platform minimum interval and Trigger quota are checked during deployment. The server validates the final merged Record input at startup; Function server validation does not cover these rules.',
658
676
  });
659
677
  const clientPath = safe('page/src/generated/functions.ts');
660
678
  const pageSDK = true;
@@ -216,6 +216,22 @@ export declare const triggerDeclarationsSchema: {
216
216
  };
217
217
  };
218
218
  };
219
+ } | {
220
+ type: string;
221
+ additionalProperties: boolean;
222
+ required: string[];
223
+ properties: {
224
+ id: {
225
+ type: string;
226
+ pattern: string;
227
+ };
228
+ type: {
229
+ const: string;
230
+ };
231
+ enabled: {
232
+ type: string;
233
+ };
234
+ };
219
235
  })[];
220
236
  };
221
237
  };
@@ -163,6 +163,16 @@ export const triggerDeclarationsSchema = {
163
163
  },
164
164
  },
165
165
  },
166
+ {
167
+ type: 'object',
168
+ additionalProperties: false,
169
+ required: ['id', 'type'],
170
+ properties: {
171
+ id: identifier,
172
+ type: { const: 'webhook' },
173
+ enabled: { type: 'boolean' },
174
+ },
175
+ },
166
176
  ],
167
177
  },
168
178
  };
@@ -182,6 +192,12 @@ export function validateTriggerDeclarations(value, inputSchema, path, seen) {
182
192
  if (seen.has(trigger.id))
183
193
  throw new Error(`TRIGGER_ID_DUPLICATE: ${location}/id: ${trigger.id}`);
184
194
  seen.add(trigger.id);
195
+ if (trigger.type === 'webhook') {
196
+ // The POST supplies the entire input. Validate the contract, not a
197
+ // synthetic empty input.
198
+ ajv.compile(inputSchema);
199
+ continue;
200
+ }
185
201
  let staticSchema = inputSchema;
186
202
  if (trigger.type === 'record') {
187
203
  if (Buffer.byteLength(JSON.stringify(trigger)) > 64 * 1024)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@lark-base-open/base-database-toolchain",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@lark-base-open/base-database-toolchain",
9
- "version": "1.5.1",
9
+ "version": "1.7.0",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@babel/parser": "7.28.5",
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@lark-base-open/base-database-toolchain",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "description": "Shared local development toolchain for Base Database application CLIs",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "engines": {
8
8
  "node": ">=20.19.0"
9
9
  },
10
+ "siteCompilerOperations": [
11
+ "verify-locked-contracts"
12
+ ],
10
13
  "bin": {
11
14
  "base-database-toolchain": "bin/base-database-toolchain.mjs",
12
15
  "base-database-dev": "bin/base-database-dev.mjs"