@lark-base-open/base-database-toolchain 1.5.1 → 1.6.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 +7 -0
- package/dist/go-adapter.mjs +11 -1
- package/dist/trigger-validation.d.ts +16 -0
- package/dist/trigger-validation.js +16 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.6.0] - 2026-12-02
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
- 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.
|
|
9
|
+
|
|
3
10
|
## [1.5.1] - 2026-12-01
|
|
4
11
|
|
|
5
12
|
### Fixed
|
package/dist/go-adapter.mjs
CHANGED
|
@@ -53,6 +53,7 @@ export async function runCompiler(request) {
|
|
|
53
53
|
const localSQLSources = Object.create(null);
|
|
54
54
|
const triggerLocations = [];
|
|
55
55
|
let triggerCount = 0;
|
|
56
|
+
let webhookCount = 0;
|
|
56
57
|
const permissionFlag = process.allowedNodeEnvironmentFlags.has('--permission')
|
|
57
58
|
? '--permission'
|
|
58
59
|
: '--experimental-permission';
|
|
@@ -410,6 +411,7 @@ export async function runCompiler(request) {
|
|
|
410
411
|
validateTriggerDeclarations(value, input, directory + '/meta.json', triggerIDs);
|
|
411
412
|
if (value?.length) {
|
|
412
413
|
triggerCount += value.length;
|
|
414
|
+
webhookCount += value.filter(({ type }) => type === 'webhook').length;
|
|
413
415
|
triggerLocations.push(path.relative(root, directory) + '/meta.json');
|
|
414
416
|
}
|
|
415
417
|
}
|
|
@@ -505,6 +507,7 @@ export async function runCompiler(request) {
|
|
|
505
507
|
triggerIDs.clear();
|
|
506
508
|
triggerLocations.length = 0;
|
|
507
509
|
triggerCount = 0;
|
|
510
|
+
webhookCount = 0;
|
|
508
511
|
const changes = [];
|
|
509
512
|
const failures = [];
|
|
510
513
|
for (const kind of ['functions', 'durable'])
|
|
@@ -629,6 +632,11 @@ export async function runCompiler(request) {
|
|
|
629
632
|
contractFailure(failures, path.join('server', kind, id), error);
|
|
630
633
|
}
|
|
631
634
|
}
|
|
635
|
+
// Keep the existing deployment-only quota check for Timer/Record projects.
|
|
636
|
+
if (webhookCount > 0 && triggerCount > 20)
|
|
637
|
+
throw Error(`TRIGGER_LIMIT_EXCEEDED: Trigger declarations exceed the environment limit of 20 (declared ${triggerCount})`);
|
|
638
|
+
if (webhookCount > 10)
|
|
639
|
+
throw Error(`TRIGGER_LIMIT_EXCEEDED: Webhook trigger declarations exceed the site limit of 10 (declared ${webhookCount})`);
|
|
632
640
|
collectDatabaseContracts(functions, inputs, !!(request.batchSnapshot || previous), failures);
|
|
633
641
|
throwContractFailures(failures);
|
|
634
642
|
let batchSnapshot;
|
|
@@ -654,7 +662,9 @@ export async function runCompiler(request) {
|
|
|
654
662
|
status: 'not_run',
|
|
655
663
|
declarations: triggerCount,
|
|
656
664
|
locations: triggerLocations,
|
|
657
|
-
reason:
|
|
665
|
+
reason: webhookCount > 0
|
|
666
|
+
? '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.'
|
|
667
|
+
: '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
668
|
});
|
|
659
669
|
const clientPath = safe('page/src/generated/functions.ts');
|
|
660
670
|
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)
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-base-open/base-database-toolchain",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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.
|
|
9
|
+
"version": "1.6.0",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/parser": "7.28.5",
|
package/package.json
CHANGED