run402 4.131.0 → 4.133.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/cli.mjs +6 -0
- package/lib/app-repos.mjs +444 -0
- package/lib/billing.mjs +155 -1
- package/lib/command-manifest.mjs +16 -0
- package/lib/path-lookup.mjs +9 -4
- package/package.json +1 -1
- package/sdk/dist/index.d.ts +11 -0
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +11 -0
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/namespaces/app-repos.d.ts +69 -0
- package/sdk/dist/namespaces/app-repos.d.ts.map +1 -0
- package/sdk/dist/namespaces/app-repos.js +312 -0
- package/sdk/dist/namespaces/app-repos.js.map +1 -0
- package/sdk/dist/namespaces/app-repos.types.d.ts +188 -0
- package/sdk/dist/namespaces/app-repos.types.d.ts.map +1 -0
- package/sdk/dist/namespaces/app-repos.types.js +12 -0
- package/sdk/dist/namespaces/app-repos.types.js.map +1 -0
- package/sdk/dist/namespaces/billing.d.ts +131 -0
- package/sdk/dist/namespaces/billing.d.ts.map +1 -1
- package/sdk/dist/namespaces/billing.js +83 -1
- package/sdk/dist/namespaces/billing.js.map +1 -1
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.js +68 -3
- package/sdk/dist/namespaces/deploy.js.map +1 -1
- package/sdk/dist/namespaces/deploy.types.d.ts +34 -2
- package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/deploy.types.js.map +1 -1
- package/sdk/dist/namespaces/projects.types.d.ts +18 -0
- package/sdk/dist/namespaces/projects.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/snapshots.types.d.ts +2 -0
- package/sdk/dist/namespaces/snapshots.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/tier.d.ts +17 -0
- package/sdk/dist/namespaces/tier.d.ts.map +1 -1
- package/sdk/dist/namespaces/tier.js.map +1 -1
- package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
- package/sdk/dist/node/deploy-manifest.js +28 -2
- package/sdk/dist/node/deploy-manifest.js.map +1 -1
- package/sdk/dist/scoped.d.ts +28 -0
- package/sdk/dist/scoped.d.ts.map +1 -1
- package/sdk/dist/scoped.js +51 -0
- package/sdk/dist/scoped.js.map +1 -1
- package/vault-surface.json +1 -1
|
@@ -2474,7 +2474,7 @@ const FUNCTION_SPEC_FIELDS = new Set([
|
|
|
2474
2474
|
"capabilities",
|
|
2475
2475
|
]);
|
|
2476
2476
|
const FUNCTION_CONFIG_FIELDS = new Set(["timeoutSeconds", "memoryMb"]);
|
|
2477
|
-
const FUNCTION_TRIGGER_FIELDS = new Set(["id", "type", "cron", "timezone", "misfire_policy", "overlap_policy", "mailbox", "events", "run"]);
|
|
2477
|
+
const FUNCTION_TRIGGER_FIELDS = new Set(["id", "type", "cron", "timezone", "misfire_policy", "overlap_policy", "mailbox", "events", "repo", "paths", "run"]);
|
|
2478
2478
|
const FUNCTION_TRIGGER_RUN_FIELDS = new Set(["event_type", "payload", "retry", "expires_after_seconds"]);
|
|
2479
2479
|
const SITE_SPEC_FIELDS = new Set(["replace", "patch", "public_paths", "embedding", "sign_in_path", "noindex"]);
|
|
2480
2480
|
const SITE_PATCH_FIELDS = new Set(["put", "delete"]);
|
|
@@ -2485,6 +2485,7 @@ const ROUTES_SPEC_FIELDS = new Set(["replace"]);
|
|
|
2485
2485
|
const ROUTE_ENTRY_FIELDS = new Set(["pattern", "methods", "target", "pricing"]);
|
|
2486
2486
|
const FUNCTION_ROUTE_TARGET_FIELDS = new Set(["type", "name"]);
|
|
2487
2487
|
const STATIC_ROUTE_TARGET_FIELDS = new Set(["type", "file"]);
|
|
2488
|
+
const REPO_ROUTE_TARGET_FIELDS = new Set(["type", "repo", "path", "requireAuth", "requireRole"]);
|
|
2488
2489
|
const ROUTE_METHOD_SET = new Set(ROUTE_HTTP_METHODS);
|
|
2489
2490
|
const ROUTE_PRICING_FIELDS = new Set([
|
|
2490
2491
|
"mode",
|
|
@@ -2662,6 +2663,9 @@ function validateFunctionTriggers(value, resource) {
|
|
|
2662
2663
|
if (seen.has(obj.id))
|
|
2663
2664
|
throw invalidSpec(`ReleaseSpec.${path}.id duplicates ${JSON.stringify(obj.id)}`, `${path}.id`);
|
|
2664
2665
|
seen.add(obj.id);
|
|
2666
|
+
if (obj.type !== "app_repo" && (obj.repo !== undefined || obj.paths !== undefined)) {
|
|
2667
|
+
throw invalidSpec(`ReleaseSpec.${path} ${String(obj.type)} triggers cannot include repo or paths`, path);
|
|
2668
|
+
}
|
|
2665
2669
|
if (obj.type === "schedule") {
|
|
2666
2670
|
if (obj.mailbox !== undefined || obj.events !== undefined) {
|
|
2667
2671
|
throw invalidSpec(`ReleaseSpec.${path} schedule triggers cannot include mailbox or events`, path);
|
|
@@ -2698,8 +2702,31 @@ function validateFunctionTriggers(value, resource) {
|
|
|
2698
2702
|
}
|
|
2699
2703
|
}
|
|
2700
2704
|
}
|
|
2705
|
+
else if (obj.type === "app_repo") {
|
|
2706
|
+
if (obj.cron !== undefined ||
|
|
2707
|
+
obj.timezone !== undefined ||
|
|
2708
|
+
obj.misfire_policy !== undefined ||
|
|
2709
|
+
obj.overlap_policy !== undefined ||
|
|
2710
|
+
obj.mailbox !== undefined ||
|
|
2711
|
+
obj.events !== undefined) {
|
|
2712
|
+
throw invalidSpec(`ReleaseSpec.${path} app_repo triggers take only repo, paths and run`, path);
|
|
2713
|
+
}
|
|
2714
|
+
if (typeof obj.repo !== "string" || obj.repo.trim() === "") {
|
|
2715
|
+
throw invalidSpec(`ReleaseSpec.${path}.repo is required (an app repo name, e.g. "default")`, `${path}.repo`);
|
|
2716
|
+
}
|
|
2717
|
+
if (obj.paths !== undefined) {
|
|
2718
|
+
if (!Array.isArray(obj.paths) || obj.paths.length === 0) {
|
|
2719
|
+
throw invalidSpec(`ReleaseSpec.${path}.paths must be a non-empty array of path prefixes; omit it for every commit`, `${path}.paths`);
|
|
2720
|
+
}
|
|
2721
|
+
for (const [pathIndex, prefix] of obj.paths.entries()) {
|
|
2722
|
+
if (typeof prefix !== "string" || prefix === "") {
|
|
2723
|
+
throw invalidSpec(`ReleaseSpec.${path}.paths.${pathIndex} must be a non-empty string`, `${path}.paths.${pathIndex}`);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2701
2728
|
else {
|
|
2702
|
-
throw invalidSpec(`ReleaseSpec.${path}.type must be "schedule" or "
|
|
2729
|
+
throw invalidSpec(`ReleaseSpec.${path}.type must be "schedule", "email" or "app_repo"`, `${path}.type`);
|
|
2703
2730
|
}
|
|
2704
2731
|
const run = requireObject(obj.run, `${path}.run`);
|
|
2705
2732
|
validateKnownFields(run, `${path}.run`, FUNCTION_TRIGGER_RUN_FIELDS);
|
|
@@ -2964,6 +2991,19 @@ function validateRouteEntry(route, resource) {
|
|
|
2964
2991
|
if (targetType === "static") {
|
|
2965
2992
|
validateStaticRouteEntry(entry, resource);
|
|
2966
2993
|
}
|
|
2994
|
+
if (targetType === "repo") {
|
|
2995
|
+
validateRepoRouteEntry(entry, resource);
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
/** Shape only: the gateway checks that the repo exists and the path is valid. */
|
|
2999
|
+
function validateRepoRouteEntry(entry, resource) {
|
|
3000
|
+
if (entry.methods === undefined)
|
|
3001
|
+
return;
|
|
3002
|
+
const methodSet = new Set(entry.methods);
|
|
3003
|
+
const valid = methodSet.has("GET") && (methodSet.size === 1 || (methodSet.size === 2 && methodSet.has("HEAD")));
|
|
3004
|
+
if (!valid) {
|
|
3005
|
+
throw invalidRouteSpec(`ReleaseSpec.${resource}.methods for repo route targets must be ["GET"] or ["GET", "HEAD"] (or omitted); a repo target serves GET and HEAD only`, `${resource}.methods`);
|
|
3006
|
+
}
|
|
2967
3007
|
}
|
|
2968
3008
|
function validateRoutePricing(pricing, resource, targetType) {
|
|
2969
3009
|
if (pricing === undefined)
|
|
@@ -3056,7 +3096,23 @@ function validateRouteTarget(target, resource) {
|
|
|
3056
3096
|
validateStaticTargetFile(obj.file, `${resource}.file`);
|
|
3057
3097
|
return "static";
|
|
3058
3098
|
}
|
|
3059
|
-
|
|
3099
|
+
if (obj.type === "repo") {
|
|
3100
|
+
validateKnownFields(obj, resource, REPO_ROUTE_TARGET_FIELDS);
|
|
3101
|
+
if (typeof obj.repo !== "string" || obj.repo.length === 0) {
|
|
3102
|
+
throw invalidRouteSpec(`ReleaseSpec.${resource}.repo is required for repo route targets (an app repo name, e.g. "default")`, `${resource}.repo`);
|
|
3103
|
+
}
|
|
3104
|
+
if (obj.path !== undefined && typeof obj.path !== "string") {
|
|
3105
|
+
throw invalidRouteSpec(`ReleaseSpec.${resource}.path must be a string`, `${resource}.path`);
|
|
3106
|
+
}
|
|
3107
|
+
if (obj.requireAuth !== undefined && typeof obj.requireAuth !== "boolean") {
|
|
3108
|
+
throw invalidRouteSpec(`ReleaseSpec.${resource}.requireAuth must be a boolean`, `${resource}.requireAuth`);
|
|
3109
|
+
}
|
|
3110
|
+
if (obj.requireRole !== undefined && obj.requireRole !== null) {
|
|
3111
|
+
requireObject(obj.requireRole, `${resource}.requireRole`);
|
|
3112
|
+
}
|
|
3113
|
+
return "repo";
|
|
3114
|
+
}
|
|
3115
|
+
throw invalidRouteSpec(`Unsupported route target type ${JSON.stringify(obj.type)} at ReleaseSpec.${resource}.type; route targets support "function", "static" and "repo"`, `${resource}.type`);
|
|
3060
3116
|
}
|
|
3061
3117
|
function validateStaticRouteEntry(entry, resource) {
|
|
3062
3118
|
const pattern = entry.pattern;
|
|
@@ -3809,6 +3865,15 @@ function normalizeFunctionTriggers(triggers) {
|
|
|
3809
3865
|
run,
|
|
3810
3866
|
};
|
|
3811
3867
|
}
|
|
3868
|
+
if (trigger.type === "app_repo") {
|
|
3869
|
+
return {
|
|
3870
|
+
id: trigger.id,
|
|
3871
|
+
type: "app_repo",
|
|
3872
|
+
repo: trigger.repo,
|
|
3873
|
+
...(trigger.paths !== undefined ? { paths: [...trigger.paths] } : {}),
|
|
3874
|
+
run,
|
|
3875
|
+
};
|
|
3876
|
+
}
|
|
3812
3877
|
return {
|
|
3813
3878
|
id: trigger.id,
|
|
3814
3879
|
type: "schedule",
|