@vercel/build-utils 14.19.0 → 14.20.1

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.
@@ -12,9 +12,10 @@ export type ScheduleTargetKey = (typeof SCHEDULE_TARGET_KEYS)[number];
12
12
  * Name for a schedule without one: a hex hash of `type|ref|expression`, which
13
13
  * always satisfies the schedule name pattern. Build Output omits these names
14
14
  * (except for entrypoint schedules) and the API derives its own; using the
15
- * same hash keeps `vercel dev` names the same as deployed ones.
15
+ * same hash keeps `vercel dev` names the same as deployed ones. A function
16
+ * target's service is appended as `|service`, matching the API.
16
17
  */
17
- export declare function defaultScheduleName(type: ScheduleTargetKey, ref: string, expression: string): string;
18
+ export declare function defaultScheduleName(type: ScheduleTargetKey, ref: string, expression: string, service?: string): string;
18
19
  /** The schedule's `name`, or its default name when it has none. */
19
20
  export declare function getScheduleName(schedule: VercelJsonSchedule): string;
20
21
  export {};
package/dist/schedules.js CHANGED
@@ -30,8 +30,9 @@ const SCHEDULE_TARGET_KEYS = [
30
30
  "entrypoint"
31
31
  ];
32
32
  const DEFAULT_NAME_HASH_LENGTH = 12;
33
- function defaultScheduleName(type, ref, expression) {
34
- return (0, import_crypto.createHash)("sha1").update(`${type}|${ref}|${expression}`).digest("hex").slice(0, DEFAULT_NAME_HASH_LENGTH);
33
+ function defaultScheduleName(type, ref, expression, service) {
34
+ const input = `${type}|${ref}|${expression}`;
35
+ return (0, import_crypto.createHash)("sha1").update(service === void 0 ? input : `${input}|${service}`).digest("hex").slice(0, DEFAULT_NAME_HASH_LENGTH);
35
36
  }
36
37
  function getScheduleName(schedule) {
37
38
  if (schedule.name !== void 0)
@@ -43,7 +44,8 @@ function getScheduleName(schedule) {
43
44
  );
44
45
  }
45
46
  const ref = schedule[type];
46
- return defaultScheduleName(type, ref ?? "", schedule.schedule);
47
+ const service = type === "function" && "service" in schedule ? schedule.service : void 0;
48
+ return defaultScheduleName(type, ref ?? "", schedule.schedule, service);
47
49
  }
48
50
  // Annotate the CommonJS export names for ESM import in node:
49
51
  0 && (module.exports = {
package/dist/types.d.ts CHANGED
@@ -673,8 +673,13 @@ export type Schedule = {
673
673
  /** HTTP method used to invoke `path`. Defaults to `POST`. */
674
674
  requestMethod?: ScheduleRequestMethod;
675
675
  } | {
676
- /** Build output path of the function to invoke, e.g. "api/cron" */
676
+ /**
677
+ * Build output path of the function to invoke, e.g. "api/cron". With
678
+ * `service`, the path within that service.
679
+ */
677
680
  function: string;
681
+ /** Service that owns `function`, from `services` (OPTIONAL) */
682
+ service?: string;
678
683
  } | {
679
684
  /** Name of the queue topic to publish to */
680
685
  topic: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "14.19.0",
3
+ "version": "14.20.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",