@wildo-ai/platform-config-lib 1.1.14 → 1.1.15
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/dist/esm/bootstrap/application-scheduled-jobs.contracts.d.ts +187 -0
- package/dist/esm/bootstrap/application-scheduled-jobs.contracts.d.ts.map +1 -0
- package/dist/esm/bootstrap/application-scheduled-jobs.contracts.js +250 -0
- package/dist/esm/bootstrap/application-scheduled-jobs.contracts.js.map +1 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +12 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js +12 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +23 -2
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.js +23 -4
- package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js +12 -1
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.js +8 -1
- package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +1 -0
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts +13 -0
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js +39 -0
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.d.ts +7 -3
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.js +10 -4
- package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts +18 -4
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js +26 -4
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* # Running one of an application's scheduled jobs NOW (#4006)
|
|
4
|
+
*
|
|
5
|
+
* A scheduled job runs at its next tick. A developer, or the finalization verifier, who needs what a job writes (a
|
|
6
|
+
* recurring todo's occurrences, written hourly by `todosRecurringOccurrences.run_recurring_generation`) would otherwise
|
|
7
|
+
* wait up to an hour. The crontabs manager already has a manual trigger, but only apps-manager may call it, so the door is
|
|
8
|
+
* an apps-manager ADMIN route behind `PLATFORM_ADMIN_SECRET`, and the CLI verb is `wildo local jobs run <selector>`.
|
|
9
|
+
*
|
|
10
|
+
* Decided by practice: a "run this scheduled job now" door is standard (`kubectl create job --from=cronjob/<name>`,
|
|
11
|
+
* Laravel's `schedule:test`, the Run button on Vercel cron jobs). It runs the job's ordinary execution once and does not
|
|
12
|
+
* change its schedule.
|
|
13
|
+
*
|
|
14
|
+
* ## Who owns a job
|
|
15
|
+
*
|
|
16
|
+
* The crontabs manager keys every job on the application's platform id (the `wildoapplication` ROW id, which is what
|
|
17
|
+
* `cronjobs.applicationId` holds) as the first segment of its `jobId`:
|
|
18
|
+
*
|
|
19
|
+
* | kind | `jobId` | selector |
|
|
20
|
+
* |---|---|---|
|
|
21
|
+
* | resource cron operation | `<applicationId>:<resourceType>:<operationId>:<variantKey>` | `<resourceType>.<operationId>:<variantKey>` |
|
|
22
|
+
* | custom batch | `<applicationId>:batch:<batchRef>` | `batch:<batchRef>` |
|
|
23
|
+
* | minion tick | `<applicationId>:minion-tick:<minionName>:<variantKey>` | `minion-tick:<minionName>:<variantKey>` |
|
|
24
|
+
*
|
|
25
|
+
* (`buildJobId` in the crontabs manager's `application-jobs-sync.crontab.controller.ts` is the producer.) So ownership is
|
|
26
|
+
* the prefix `<applicationId>:`, and apps-manager refuses to trigger a job outside it
|
|
27
|
+
* ({@link ApplicationScheduledJobRunRefusal.NOT_OWNED_BY_APPLICATION}): the admin route names ONE application, and a job of
|
|
28
|
+
* another must not be reachable through it.
|
|
29
|
+
*
|
|
30
|
+
* The SELECTOR is the application-relative name a person types. Nobody builds `<applicationId>:…` by hand: the CLI
|
|
31
|
+
* resolves a selector against the listing ({@link resolveApplicationScheduledJobSelector}) and sends the `jobId` the
|
|
32
|
+
* listing named.
|
|
33
|
+
*/
|
|
34
|
+
/** What kind of schedule a job is, read from the shape of its `jobId`. */
|
|
35
|
+
export declare enum ApplicationScheduledJobKind {
|
|
36
|
+
/** A resource operation declared with a cron schedule: `<app>:<resourceType>:<operationId>:<variantKey>`. */
|
|
37
|
+
RESOURCE_OPERATION = "resource_operation",
|
|
38
|
+
/** A custom batch the application registered: `<app>:batch:<batchRef>`. */
|
|
39
|
+
BATCH = "batch",
|
|
40
|
+
/** A minion's periodic tick: `<app>:minion-tick:<minionName>:<variantKey>`. */
|
|
41
|
+
MINION_TICK = "minion_tick",
|
|
42
|
+
/**
|
|
43
|
+
* A job of this application whose remainder fits none of the shapes above. Listed and runnable by its exact selector
|
|
44
|
+
* (the remainder after `<applicationId>:`) rather than hidden: a new job shape in the crontabs manager must not make a
|
|
45
|
+
* job disappear from the listing.
|
|
46
|
+
*/
|
|
47
|
+
UNRECOGNIZED = "unrecognized"
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The reserved second segments of a job id. ONE source for the producer (the crontabs manager's `buildJobId`, which
|
|
51
|
+
* builds through the functions below) and the parser ({@link parseApplicationScheduledJobId}), so the two cannot drift:
|
|
52
|
+
* ownership and the selector both depend on this format.
|
|
53
|
+
*/
|
|
54
|
+
export declare enum ApplicationScheduledJobSegment {
|
|
55
|
+
/** A custom batch: `<app>:batch:<batchRef>`. */
|
|
56
|
+
BATCH = "batch",
|
|
57
|
+
/** A minion's tick: `<app>:minion-tick:<minionName>:<variantKey>`. Reserved, so it cannot collide with a resource type. */
|
|
58
|
+
MINION_TICK = "minion-tick"
|
|
59
|
+
}
|
|
60
|
+
/** The id of an application's custom batch job. */
|
|
61
|
+
export declare function buildApplicationBatchJobId(applicationId: string, batchRef: string): string;
|
|
62
|
+
/** The id of a minion's tick job. */
|
|
63
|
+
export declare function buildApplicationMinionTickJobId(applicationId: string, minionName: string, variantKey: string): string;
|
|
64
|
+
/** The id of a resource operation declared with a cron schedule. */
|
|
65
|
+
export declare function buildApplicationResourceOperationJobId(applicationId: string, resourceType: string, operationId: string, variantKey: string): string;
|
|
66
|
+
/** Why apps-manager refuses to run a scheduled job. Sent as `code` on the refusal, which survives the client sanitizer. */
|
|
67
|
+
export declare enum ApplicationScheduledJobRunRefusal {
|
|
68
|
+
/** The `jobId` does not start with the named application's `<applicationId>:`: it is another application's job, or none. */
|
|
69
|
+
NOT_OWNED_BY_APPLICATION = "scheduled_job_not_owned_by_application",
|
|
70
|
+
/**
|
|
71
|
+
* The job is this application's by its id, and the crontabs manager's store holds no such job: it is not scheduled now
|
|
72
|
+
* (typically the backend stopped declaring it after the listing was read). Nothing ran.
|
|
73
|
+
*/
|
|
74
|
+
UNKNOWN_TO_SCHEDULER = "scheduled_job_unknown_to_scheduler"
|
|
75
|
+
}
|
|
76
|
+
/** The admin path that lists an application's scheduled jobs. */
|
|
77
|
+
export declare function buildAdminApplicationScheduledJobsPath(appSlug: string): string;
|
|
78
|
+
/** The admin path that runs one of an application's scheduled jobs now. The `jobId` travels in the body: it contains `:`. */
|
|
79
|
+
export declare function buildAdminApplicationScheduledJobRunPath(appSlug: string): string;
|
|
80
|
+
export declare const ApplicationScheduledJobSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
81
|
+
resourceType: z.ZodString;
|
|
82
|
+
operationId: z.ZodString;
|
|
83
|
+
variantKey: z.ZodString;
|
|
84
|
+
jobId: z.ZodString;
|
|
85
|
+
selector: z.ZodString;
|
|
86
|
+
armed: z.ZodBoolean;
|
|
87
|
+
kind: z.ZodLiteral<ApplicationScheduledJobKind.RESOURCE_OPERATION>;
|
|
88
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
89
|
+
batchRef: z.ZodString;
|
|
90
|
+
jobId: z.ZodString;
|
|
91
|
+
selector: z.ZodString;
|
|
92
|
+
armed: z.ZodBoolean;
|
|
93
|
+
kind: z.ZodLiteral<ApplicationScheduledJobKind.BATCH>;
|
|
94
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
95
|
+
minionName: z.ZodString;
|
|
96
|
+
variantKey: z.ZodString;
|
|
97
|
+
jobId: z.ZodString;
|
|
98
|
+
selector: z.ZodString;
|
|
99
|
+
armed: z.ZodBoolean;
|
|
100
|
+
kind: z.ZodLiteral<ApplicationScheduledJobKind.MINION_TICK>;
|
|
101
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
102
|
+
jobId: z.ZodString;
|
|
103
|
+
selector: z.ZodString;
|
|
104
|
+
armed: z.ZodBoolean;
|
|
105
|
+
kind: z.ZodLiteral<ApplicationScheduledJobKind.UNRECOGNIZED>;
|
|
106
|
+
}, z.core.$strict>], "kind">;
|
|
107
|
+
export type ApplicationScheduledJob = z.infer<typeof ApplicationScheduledJobSchema>;
|
|
108
|
+
/** The answer of `GET /admin/apps/:appSlug/scheduled-jobs`. */
|
|
109
|
+
export declare const ApplicationScheduledJobsResponseSchema: z.ZodObject<{
|
|
110
|
+
appSlug: z.ZodString;
|
|
111
|
+
applicationId: z.ZodString;
|
|
112
|
+
platformScheduledTotal: z.ZodNumber;
|
|
113
|
+
schedulerRunning: z.ZodBoolean;
|
|
114
|
+
jobs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
115
|
+
resourceType: z.ZodString;
|
|
116
|
+
operationId: z.ZodString;
|
|
117
|
+
variantKey: z.ZodString;
|
|
118
|
+
jobId: z.ZodString;
|
|
119
|
+
selector: z.ZodString;
|
|
120
|
+
armed: z.ZodBoolean;
|
|
121
|
+
kind: z.ZodLiteral<ApplicationScheduledJobKind.RESOURCE_OPERATION>;
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
batchRef: z.ZodString;
|
|
124
|
+
jobId: z.ZodString;
|
|
125
|
+
selector: z.ZodString;
|
|
126
|
+
armed: z.ZodBoolean;
|
|
127
|
+
kind: z.ZodLiteral<ApplicationScheduledJobKind.BATCH>;
|
|
128
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
129
|
+
minionName: z.ZodString;
|
|
130
|
+
variantKey: z.ZodString;
|
|
131
|
+
jobId: z.ZodString;
|
|
132
|
+
selector: z.ZodString;
|
|
133
|
+
armed: z.ZodBoolean;
|
|
134
|
+
kind: z.ZodLiteral<ApplicationScheduledJobKind.MINION_TICK>;
|
|
135
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
136
|
+
jobId: z.ZodString;
|
|
137
|
+
selector: z.ZodString;
|
|
138
|
+
armed: z.ZodBoolean;
|
|
139
|
+
kind: z.ZodLiteral<ApplicationScheduledJobKind.UNRECOGNIZED>;
|
|
140
|
+
}, z.core.$strict>], "kind">>;
|
|
141
|
+
}, z.core.$strict>;
|
|
142
|
+
export type ApplicationScheduledJobsResponse = z.infer<typeof ApplicationScheduledJobsResponseSchema>;
|
|
143
|
+
export declare const ApplicationScheduledJobRunRequestSchema: z.ZodObject<{
|
|
144
|
+
jobId: z.ZodString;
|
|
145
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
export type ApplicationScheduledJobRunRequest = z.input<typeof ApplicationScheduledJobRunRequestSchema>;
|
|
148
|
+
/** The answer of `POST /admin/apps/:appSlug/scheduled-jobs/run`. */
|
|
149
|
+
export declare const ApplicationScheduledJobRunResponseSchema: z.ZodObject<{
|
|
150
|
+
appSlug: z.ZodString;
|
|
151
|
+
applicationId: z.ZodString;
|
|
152
|
+
jobId: z.ZodString;
|
|
153
|
+
selector: z.ZodString;
|
|
154
|
+
triggeredAt: z.ZodISODateTime;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
export type ApplicationScheduledJobRunResponse = z.infer<typeof ApplicationScheduledJobRunResponseSchema>;
|
|
157
|
+
/** Whether `jobId` is one of this application's jobs: it carries the application's prefix and something after it. */
|
|
158
|
+
export declare function applicationOwnsScheduledJobId(applicationId: string, jobId: string): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Read one of this application's jobs from its `jobId`, or `null` when the job is not this application's.
|
|
161
|
+
*
|
|
162
|
+
* The batch segment is checked BEFORE the resource-operation shape, mirroring the producer: `buildJobId` writes
|
|
163
|
+
* `<app>:batch:<ref>` for any job with a `batchRef`, and a batch ref may itself contain `:`.
|
|
164
|
+
*/
|
|
165
|
+
export declare function parseApplicationScheduledJobId(applicationId: string, jobId: string, armed: boolean): ApplicationScheduledJob | null;
|
|
166
|
+
/** How a selector resolved against a listing. */
|
|
167
|
+
export declare enum ApplicationScheduledJobSelectorResolution {
|
|
168
|
+
/** Exactly one job matches. */
|
|
169
|
+
RESOLVED = "resolved",
|
|
170
|
+
/** No job matches. `candidates` is the whole listing, so the caller can show what exists. */
|
|
171
|
+
NOT_FOUND = "not_found",
|
|
172
|
+
/** Several jobs match (a resource operation scheduled under several variants, named without one). */
|
|
173
|
+
AMBIGUOUS = "ambiguous"
|
|
174
|
+
}
|
|
175
|
+
export type ApplicationScheduledJobSelectorResult = {
|
|
176
|
+
resolution: ApplicationScheduledJobSelectorResolution.RESOLVED;
|
|
177
|
+
job: ApplicationScheduledJob;
|
|
178
|
+
} | {
|
|
179
|
+
resolution: ApplicationScheduledJobSelectorResolution.NOT_FOUND;
|
|
180
|
+
candidates: ApplicationScheduledJob[];
|
|
181
|
+
} | {
|
|
182
|
+
resolution: ApplicationScheduledJobSelectorResolution.AMBIGUOUS;
|
|
183
|
+
matches: ApplicationScheduledJob[];
|
|
184
|
+
};
|
|
185
|
+
/** Resolve what a person typed to exactly one job of the listing, or say why it cannot be. */
|
|
186
|
+
export declare function resolveApplicationScheduledJobSelector(jobs: readonly ApplicationScheduledJob[], selector: string): ApplicationScheduledJobSelectorResult;
|
|
187
|
+
//# sourceMappingURL=application-scheduled-jobs.contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application-scheduled-jobs.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/application-scheduled-jobs.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,0EAA0E;AAC1E,oBAAY,2BAA2B;IACrC,6GAA6G;IAC7G,kBAAkB,uBAAuB;IACzC,2EAA2E;IAC3E,KAAK,UAAU;IACf,+EAA+E;IAC/E,WAAW,gBAAgB;IAC3B;;;;OAIG;IACH,YAAY,iBAAiB;CAC9B;AAED;;;;GAIG;AACH,oBAAY,8BAA8B;IACxC,gDAAgD;IAChD,KAAK,UAAU;IACf,2HAA2H;IAC3H,WAAW,gBAAgB;CAC5B;AAKD,mDAAmD;AACnD,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1F;AAED,qCAAqC;AACrC,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAErH;AAED,oEAAoE;AACpE,wBAAgB,sCAAsC,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,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AQ,aAAa;IACrB,6FAA6F;IAC7F,SAAS,cAAc;IACvB,qGAAqG;IACrG,SAAS,cAAc;CACxB;AAED,MAAM,MAAM,qCAAqC,GAC7C;IAAE,UAAU,EAAE,yCAAyC,CAAC,QAAQ,CAAC;IAAC,GAAG,EAAE,uBAAuB,CAAA;CAAE,GAChG;IAAE,UAAU,EAAE,yCAAyC,CAAC,SAAS,CAAC;IAAC,UAAU,EAAE,uBAAuB,EAAE,CAAA;CAAE,GAC1G;IAAE,UAAU,EAAE,yCAAyC,CAAC,SAAS,CAAC;IAAC,OAAO,EAAE,uBAAuB,EAAE,CAAA;CAAE,CAAC;AAqB5G,8FAA8F;AAC9F,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,SAAS,uBAAuB,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,qCAAqC,CAMxJ"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* # Running one of an application's scheduled jobs NOW (#4006)
|
|
4
|
+
*
|
|
5
|
+
* A scheduled job runs at its next tick. A developer, or the finalization verifier, who needs what a job writes (a
|
|
6
|
+
* recurring todo's occurrences, written hourly by `todosRecurringOccurrences.run_recurring_generation`) would otherwise
|
|
7
|
+
* wait up to an hour. The crontabs manager already has a manual trigger, but only apps-manager may call it, so the door is
|
|
8
|
+
* an apps-manager ADMIN route behind `PLATFORM_ADMIN_SECRET`, and the CLI verb is `wildo local jobs run <selector>`.
|
|
9
|
+
*
|
|
10
|
+
* Decided by practice: a "run this scheduled job now" door is standard (`kubectl create job --from=cronjob/<name>`,
|
|
11
|
+
* Laravel's `schedule:test`, the Run button on Vercel cron jobs). It runs the job's ordinary execution once and does not
|
|
12
|
+
* change its schedule.
|
|
13
|
+
*
|
|
14
|
+
* ## Who owns a job
|
|
15
|
+
*
|
|
16
|
+
* The crontabs manager keys every job on the application's platform id (the `wildoapplication` ROW id, which is what
|
|
17
|
+
* `cronjobs.applicationId` holds) as the first segment of its `jobId`:
|
|
18
|
+
*
|
|
19
|
+
* | kind | `jobId` | selector |
|
|
20
|
+
* |---|---|---|
|
|
21
|
+
* | resource cron operation | `<applicationId>:<resourceType>:<operationId>:<variantKey>` | `<resourceType>.<operationId>:<variantKey>` |
|
|
22
|
+
* | custom batch | `<applicationId>:batch:<batchRef>` | `batch:<batchRef>` |
|
|
23
|
+
* | minion tick | `<applicationId>:minion-tick:<minionName>:<variantKey>` | `minion-tick:<minionName>:<variantKey>` |
|
|
24
|
+
*
|
|
25
|
+
* (`buildJobId` in the crontabs manager's `application-jobs-sync.crontab.controller.ts` is the producer.) So ownership is
|
|
26
|
+
* the prefix `<applicationId>:`, and apps-manager refuses to trigger a job outside it
|
|
27
|
+
* ({@link ApplicationScheduledJobRunRefusal.NOT_OWNED_BY_APPLICATION}): the admin route names ONE application, and a job of
|
|
28
|
+
* another must not be reachable through it.
|
|
29
|
+
*
|
|
30
|
+
* The SELECTOR is the application-relative name a person types. Nobody builds `<applicationId>:…` by hand: the CLI
|
|
31
|
+
* resolves a selector against the listing ({@link resolveApplicationScheduledJobSelector}) and sends the `jobId` the
|
|
32
|
+
* listing named.
|
|
33
|
+
*/
|
|
34
|
+
/** What kind of schedule a job is, read from the shape of its `jobId`. */
|
|
35
|
+
export var ApplicationScheduledJobKind;
|
|
36
|
+
(function (ApplicationScheduledJobKind) {
|
|
37
|
+
/** A resource operation declared with a cron schedule: `<app>:<resourceType>:<operationId>:<variantKey>`. */
|
|
38
|
+
ApplicationScheduledJobKind["RESOURCE_OPERATION"] = "resource_operation";
|
|
39
|
+
/** A custom batch the application registered: `<app>:batch:<batchRef>`. */
|
|
40
|
+
ApplicationScheduledJobKind["BATCH"] = "batch";
|
|
41
|
+
/** A minion's periodic tick: `<app>:minion-tick:<minionName>:<variantKey>`. */
|
|
42
|
+
ApplicationScheduledJobKind["MINION_TICK"] = "minion_tick";
|
|
43
|
+
/**
|
|
44
|
+
* A job of this application whose remainder fits none of the shapes above. Listed and runnable by its exact selector
|
|
45
|
+
* (the remainder after `<applicationId>:`) rather than hidden: a new job shape in the crontabs manager must not make a
|
|
46
|
+
* job disappear from the listing.
|
|
47
|
+
*/
|
|
48
|
+
ApplicationScheduledJobKind["UNRECOGNIZED"] = "unrecognized";
|
|
49
|
+
})(ApplicationScheduledJobKind || (ApplicationScheduledJobKind = {}));
|
|
50
|
+
/**
|
|
51
|
+
* The reserved second segments of a job id. ONE source for the producer (the crontabs manager's `buildJobId`, which
|
|
52
|
+
* builds through the functions below) and the parser ({@link parseApplicationScheduledJobId}), so the two cannot drift:
|
|
53
|
+
* ownership and the selector both depend on this format.
|
|
54
|
+
*/
|
|
55
|
+
export var ApplicationScheduledJobSegment;
|
|
56
|
+
(function (ApplicationScheduledJobSegment) {
|
|
57
|
+
/** A custom batch: `<app>:batch:<batchRef>`. */
|
|
58
|
+
ApplicationScheduledJobSegment["BATCH"] = "batch";
|
|
59
|
+
/** A minion's tick: `<app>:minion-tick:<minionName>:<variantKey>`. Reserved, so it cannot collide with a resource type. */
|
|
60
|
+
ApplicationScheduledJobSegment["MINION_TICK"] = "minion-tick";
|
|
61
|
+
})(ApplicationScheduledJobSegment || (ApplicationScheduledJobSegment = {}));
|
|
62
|
+
const BATCH_JOB_SEGMENT = ApplicationScheduledJobSegment.BATCH;
|
|
63
|
+
const MINION_TICK_JOB_SEGMENT = ApplicationScheduledJobSegment.MINION_TICK;
|
|
64
|
+
/** The id of an application's custom batch job. */
|
|
65
|
+
export function buildApplicationBatchJobId(applicationId, batchRef) {
|
|
66
|
+
return `${applicationId}:${BATCH_JOB_SEGMENT}:${batchRef}`;
|
|
67
|
+
}
|
|
68
|
+
/** The id of a minion's tick job. */
|
|
69
|
+
export function buildApplicationMinionTickJobId(applicationId, minionName, variantKey) {
|
|
70
|
+
return `${applicationId}:${MINION_TICK_JOB_SEGMENT}:${minionName}:${variantKey}`;
|
|
71
|
+
}
|
|
72
|
+
/** The id of a resource operation declared with a cron schedule. */
|
|
73
|
+
export function buildApplicationResourceOperationJobId(applicationId, resourceType, operationId, variantKey) {
|
|
74
|
+
return `${applicationId}:${resourceType}:${operationId}:${variantKey}`;
|
|
75
|
+
}
|
|
76
|
+
/** Why apps-manager refuses to run a scheduled job. Sent as `code` on the refusal, which survives the client sanitizer. */
|
|
77
|
+
export var ApplicationScheduledJobRunRefusal;
|
|
78
|
+
(function (ApplicationScheduledJobRunRefusal) {
|
|
79
|
+
/** The `jobId` does not start with the named application's `<applicationId>:`: it is another application's job, or none. */
|
|
80
|
+
ApplicationScheduledJobRunRefusal["NOT_OWNED_BY_APPLICATION"] = "scheduled_job_not_owned_by_application";
|
|
81
|
+
/**
|
|
82
|
+
* The job is this application's by its id, and the crontabs manager's store holds no such job: it is not scheduled now
|
|
83
|
+
* (typically the backend stopped declaring it after the listing was read). Nothing ran.
|
|
84
|
+
*/
|
|
85
|
+
ApplicationScheduledJobRunRefusal["UNKNOWN_TO_SCHEDULER"] = "scheduled_job_unknown_to_scheduler";
|
|
86
|
+
})(ApplicationScheduledJobRunRefusal || (ApplicationScheduledJobRunRefusal = {}));
|
|
87
|
+
/** The admin path that lists an application's scheduled jobs. */
|
|
88
|
+
export function buildAdminApplicationScheduledJobsPath(appSlug) {
|
|
89
|
+
return `/admin/apps/${encodeURIComponent(appSlug)}/scheduled-jobs`;
|
|
90
|
+
}
|
|
91
|
+
/** The admin path that runs one of an application's scheduled jobs now. The `jobId` travels in the body: it contains `:`. */
|
|
92
|
+
export function buildAdminApplicationScheduledJobRunPath(appSlug) {
|
|
93
|
+
return `${buildAdminApplicationScheduledJobsPath(appSlug)}/run`;
|
|
94
|
+
}
|
|
95
|
+
const ScheduledJobCommonShape = {
|
|
96
|
+
/** The crontabs manager's id, `<applicationId>:…`. */
|
|
97
|
+
jobId: z.string().min(1),
|
|
98
|
+
/** The application-relative name a person types (see the table above). */
|
|
99
|
+
selector: z.string().min(1),
|
|
100
|
+
/** Whether the crontabs replica that answered has the job armed (a standby replica holds jobs it does not arm). */
|
|
101
|
+
armed: z.boolean(),
|
|
102
|
+
};
|
|
103
|
+
export const ApplicationScheduledJobSchema = z.discriminatedUnion('kind', [
|
|
104
|
+
z.strictObject({
|
|
105
|
+
kind: z.literal(ApplicationScheduledJobKind.RESOURCE_OPERATION),
|
|
106
|
+
...ScheduledJobCommonShape,
|
|
107
|
+
resourceType: z.string().min(1),
|
|
108
|
+
operationId: z.string().min(1),
|
|
109
|
+
variantKey: z.string().min(1),
|
|
110
|
+
}),
|
|
111
|
+
z.strictObject({
|
|
112
|
+
kind: z.literal(ApplicationScheduledJobKind.BATCH),
|
|
113
|
+
...ScheduledJobCommonShape,
|
|
114
|
+
batchRef: z.string().min(1),
|
|
115
|
+
}),
|
|
116
|
+
z.strictObject({
|
|
117
|
+
kind: z.literal(ApplicationScheduledJobKind.MINION_TICK),
|
|
118
|
+
...ScheduledJobCommonShape,
|
|
119
|
+
minionName: z.string().min(1),
|
|
120
|
+
variantKey: z.string().min(1),
|
|
121
|
+
}),
|
|
122
|
+
z.strictObject({
|
|
123
|
+
kind: z.literal(ApplicationScheduledJobKind.UNRECOGNIZED),
|
|
124
|
+
...ScheduledJobCommonShape,
|
|
125
|
+
}),
|
|
126
|
+
]);
|
|
127
|
+
/** The answer of `GET /admin/apps/:appSlug/scheduled-jobs`. */
|
|
128
|
+
export const ApplicationScheduledJobsResponseSchema = z.strictObject({
|
|
129
|
+
appSlug: z.string().min(1),
|
|
130
|
+
/** The application's platform id: the prefix of every `jobId` below. */
|
|
131
|
+
applicationId: z.string().min(1),
|
|
132
|
+
/**
|
|
133
|
+
* POSITIVE CONTROL beside an empty `jobs`: how many jobs the crontabs manager holds for EVERY application. Zero jobs for
|
|
134
|
+
* this application beside a platform total of zero says the scheduler holds nothing at all (it has not loaded, or no
|
|
135
|
+
* application has booted), not that this application declares nothing.
|
|
136
|
+
*/
|
|
137
|
+
platformScheduledTotal: z.number().int().min(0),
|
|
138
|
+
/** Whether the scheduler is running on the replica that answered. */
|
|
139
|
+
schedulerRunning: z.boolean(),
|
|
140
|
+
jobs: z.array(ApplicationScheduledJobSchema),
|
|
141
|
+
});
|
|
142
|
+
export const ApplicationScheduledJobRunRequestSchema = z.strictObject({
|
|
143
|
+
/** The crontabs manager's id, exactly as the listing named it. Must belong to the application in the path. */
|
|
144
|
+
jobId: z.string().min(1),
|
|
145
|
+
/** Why, in the operator's words. Optional; recorded on the audit row. */
|
|
146
|
+
reason: z.string().trim().min(1).max(1000).optional(),
|
|
147
|
+
});
|
|
148
|
+
/** The answer of `POST /admin/apps/:appSlug/scheduled-jobs/run`. */
|
|
149
|
+
export const ApplicationScheduledJobRunResponseSchema = z.strictObject({
|
|
150
|
+
appSlug: z.string().min(1),
|
|
151
|
+
applicationId: z.string().min(1),
|
|
152
|
+
jobId: z.string().min(1),
|
|
153
|
+
selector: z.string().min(1),
|
|
154
|
+
/**
|
|
155
|
+
* When the crontabs manager accepted the trigger (ISO 8601). Accepting is not finishing: the occurrence is delivered to
|
|
156
|
+
* the application backend and runs there, asynchronously, exactly as a scheduled tick does.
|
|
157
|
+
*/
|
|
158
|
+
triggeredAt: z.iso.datetime({ offset: true }),
|
|
159
|
+
});
|
|
160
|
+
/** The prefix every job of one application carries. */
|
|
161
|
+
function applicationJobIdPrefix(applicationId) {
|
|
162
|
+
return `${applicationId}:`;
|
|
163
|
+
}
|
|
164
|
+
/** Whether `jobId` is one of this application's jobs: it carries the application's prefix and something after it. */
|
|
165
|
+
export function applicationOwnsScheduledJobId(applicationId, jobId) {
|
|
166
|
+
const prefix = applicationJobIdPrefix(applicationId);
|
|
167
|
+
return applicationId.length > 0 && jobId.startsWith(prefix) && jobId.length > prefix.length;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Read one of this application's jobs from its `jobId`, or `null` when the job is not this application's.
|
|
171
|
+
*
|
|
172
|
+
* The batch segment is checked BEFORE the resource-operation shape, mirroring the producer: `buildJobId` writes
|
|
173
|
+
* `<app>:batch:<ref>` for any job with a `batchRef`, and a batch ref may itself contain `:`.
|
|
174
|
+
*/
|
|
175
|
+
export function parseApplicationScheduledJobId(applicationId, jobId, armed) {
|
|
176
|
+
if (!applicationOwnsScheduledJobId(applicationId, jobId))
|
|
177
|
+
return null;
|
|
178
|
+
const remainder = jobId.slice(applicationJobIdPrefix(applicationId).length);
|
|
179
|
+
const segments = remainder.split(':');
|
|
180
|
+
if (segments[0] === BATCH_JOB_SEGMENT && segments.length >= 2) {
|
|
181
|
+
const batchRef = segments.slice(1).join(':');
|
|
182
|
+
if (batchRef.length > 0) {
|
|
183
|
+
return { kind: ApplicationScheduledJobKind.BATCH, jobId, selector: `${BATCH_JOB_SEGMENT}:${batchRef}`, armed, batchRef };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const [first, second, third] = segments;
|
|
187
|
+
const threeSegments = segments.length === 3 && Boolean(first) && Boolean(second) && Boolean(third);
|
|
188
|
+
if (threeSegments && first === MINION_TICK_JOB_SEGMENT) {
|
|
189
|
+
return {
|
|
190
|
+
kind: ApplicationScheduledJobKind.MINION_TICK,
|
|
191
|
+
jobId,
|
|
192
|
+
selector: `${MINION_TICK_JOB_SEGMENT}:${second}:${third}`,
|
|
193
|
+
armed,
|
|
194
|
+
minionName: second,
|
|
195
|
+
variantKey: third,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if (threeSegments && first !== BATCH_JOB_SEGMENT) {
|
|
199
|
+
return {
|
|
200
|
+
kind: ApplicationScheduledJobKind.RESOURCE_OPERATION,
|
|
201
|
+
jobId,
|
|
202
|
+
selector: `${first}.${second}:${third}`,
|
|
203
|
+
armed,
|
|
204
|
+
resourceType: first,
|
|
205
|
+
operationId: second,
|
|
206
|
+
variantKey: third,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return { kind: ApplicationScheduledJobKind.UNRECOGNIZED, jobId, selector: remainder, armed };
|
|
210
|
+
}
|
|
211
|
+
/** How a selector resolved against a listing. */
|
|
212
|
+
export var ApplicationScheduledJobSelectorResolution;
|
|
213
|
+
(function (ApplicationScheduledJobSelectorResolution) {
|
|
214
|
+
/** Exactly one job matches. */
|
|
215
|
+
ApplicationScheduledJobSelectorResolution["RESOLVED"] = "resolved";
|
|
216
|
+
/** No job matches. `candidates` is the whole listing, so the caller can show what exists. */
|
|
217
|
+
ApplicationScheduledJobSelectorResolution["NOT_FOUND"] = "not_found";
|
|
218
|
+
/** Several jobs match (a resource operation scheduled under several variants, named without one). */
|
|
219
|
+
ApplicationScheduledJobSelectorResolution["AMBIGUOUS"] = "ambiguous";
|
|
220
|
+
})(ApplicationScheduledJobSelectorResolution || (ApplicationScheduledJobSelectorResolution = {}));
|
|
221
|
+
/**
|
|
222
|
+
* Whether `job` answers `selector`. A job's full selector always matches. The variant may be left out: `<resourceType>.<op>`
|
|
223
|
+
* matches that operation under every variant, and `minion-tick:<name>` that minion's tick, so the common case (one
|
|
224
|
+
* variant, usually `default`) needs no variant typed. Matching is exact otherwise: no case folding and no prefix guessing,
|
|
225
|
+
* so a selector never runs a job other than the one named.
|
|
226
|
+
*/
|
|
227
|
+
function jobAnswersSelector(job, selector) {
|
|
228
|
+
if (job.selector === selector)
|
|
229
|
+
return true;
|
|
230
|
+
switch (job.kind) {
|
|
231
|
+
case ApplicationScheduledJobKind.RESOURCE_OPERATION:
|
|
232
|
+
return selector === `${job.resourceType}.${job.operationId}`;
|
|
233
|
+
case ApplicationScheduledJobKind.MINION_TICK:
|
|
234
|
+
return selector === `${MINION_TICK_JOB_SEGMENT}:${job.minionName}`;
|
|
235
|
+
case ApplicationScheduledJobKind.BATCH:
|
|
236
|
+
case ApplicationScheduledJobKind.UNRECOGNIZED:
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** Resolve what a person typed to exactly one job of the listing, or say why it cannot be. */
|
|
241
|
+
export function resolveApplicationScheduledJobSelector(jobs, selector) {
|
|
242
|
+
const wanted = selector.trim();
|
|
243
|
+
const matches = jobs.filter((job) => jobAnswersSelector(job, wanted));
|
|
244
|
+
if (matches.length === 1)
|
|
245
|
+
return { resolution: ApplicationScheduledJobSelectorResolution.RESOLVED, job: matches[0] };
|
|
246
|
+
if (matches.length === 0)
|
|
247
|
+
return { resolution: ApplicationScheduledJobSelectorResolution.NOT_FOUND, candidates: [...jobs] };
|
|
248
|
+
return { resolution: ApplicationScheduledJobSelectorResolution.AMBIGUOUS, matches };
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=application-scheduled-jobs.contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application-scheduled-jobs.contracts.js","sourceRoot":"","sources":["../../../src/bootstrap/application-scheduled-jobs.contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,0EAA0E;AAC1E,MAAM,CAAN,IAAY,2BAaX;AAbD,WAAY,2BAA2B;IACrC,6GAA6G;IAC7G,wEAAyC,CAAA;IACzC,2EAA2E;IAC3E,8CAAe,CAAA;IACf,+EAA+E;IAC/E,0DAA2B,CAAA;IAC3B;;;;OAIG;IACH,4DAA6B,CAAA;AAC/B,CAAC,EAbW,2BAA2B,KAA3B,2BAA2B,QAatC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,8BAKX;AALD,WAAY,8BAA8B;IACxC,gDAAgD;IAChD,iDAAe,CAAA;IACf,2HAA2H;IAC3H,6DAA2B,CAAA;AAC7B,CAAC,EALW,8BAA8B,KAA9B,8BAA8B,QAKzC;AAED,MAAM,iBAAiB,GAAG,8BAA8B,CAAC,KAAK,CAAC;AAC/D,MAAM,uBAAuB,GAAG,8BAA8B,CAAC,WAAW,CAAC;AAE3E,mDAAmD;AACnD,MAAM,UAAU,0BAA0B,CAAC,aAAqB,EAAE,QAAgB;IAChF,OAAO,GAAG,aAAa,IAAI,iBAAiB,IAAI,QAAQ,EAAE,CAAC;AAC7D,CAAC;A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IACjB,CAAC;AACH,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,sCAAsC,CAAC,IAAwC,EAAE,QAAgB;IAC/G,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,yCAAyC,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACrH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,yCAAyC,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAC5H,OAAO,EAAE,UAAU,EAAE,yCAAyC,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;AACtF,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * # Running one of an application's scheduled jobs NOW (#4006)\n *\n * A scheduled job runs at its next tick. A developer, or the finalization verifier, who needs what a job writes (a\n * recurring todo's occurrences, written hourly by `todosRecurringOccurrences.run_recurring_generation`) would otherwise\n * wait up to an hour. The crontabs manager already has a manual trigger, but only apps-manager may call it, so the door is\n * an apps-manager ADMIN route behind `PLATFORM_ADMIN_SECRET`, and the CLI verb is `wildo local jobs run <selector>`.\n *\n * Decided by practice: a \"run this scheduled job now\" door is standard (`kubectl create job --from=cronjob/<name>`,\n * Laravel's `schedule:test`, the Run button on Vercel cron jobs). It runs the job's ordinary execution once and does not\n * change its schedule.\n *\n * ## Who owns a job\n *\n * The crontabs manager keys every job on the application's platform id (the `wildoapplication` ROW id, which is what\n * `cronjobs.applicationId` holds) as the first segment of its `jobId`:\n *\n * | kind | `jobId` | selector |\n * |---|---|---|\n * | resource cron operation | `<applicationId>:<resourceType>:<operationId>:<variantKey>` | `<resourceType>.<operationId>:<variantKey>` |\n * | custom batch | `<applicationId>:batch:<batchRef>` | `batch:<batchRef>` |\n * | minion tick | `<applicationId>:minion-tick:<minionName>:<variantKey>` | `minion-tick:<minionName>:<variantKey>` |\n *\n * (`buildJobId` in the crontabs manager's `application-jobs-sync.crontab.controller.ts` is the producer.) So ownership is\n * the prefix `<applicationId>:`, and apps-manager refuses to trigger a job outside it\n * ({@link ApplicationScheduledJobRunRefusal.NOT_OWNED_BY_APPLICATION}): the admin route names ONE application, and a job of\n * another must not be reachable through it.\n *\n * The SELECTOR is the application-relative name a person types. Nobody builds `<applicationId>:…` by hand: the CLI\n * resolves a selector against the listing ({@link resolveApplicationScheduledJobSelector}) and sends the `jobId` the\n * listing named.\n */\n\n/** What kind of schedule a job is, read from the shape of its `jobId`. */\nexport enum ApplicationScheduledJobKind {\n /** A resource operation declared with a cron schedule: `<app>:<resourceType>:<operationId>:<variantKey>`. */\n RESOURCE_OPERATION = 'resource_operation',\n /** A custom batch the application registered: `<app>:batch:<batchRef>`. */\n BATCH = 'batch',\n /** A minion's periodic tick: `<app>:minion-tick:<minionName>:<variantKey>`. */\n MINION_TICK = 'minion_tick',\n /**\n * A job of this application whose remainder fits none of the shapes above. Listed and runnable by its exact selector\n * (the remainder after `<applicationId>:`) rather than hidden: a new job shape in the crontabs manager must not make a\n * job disappear from the listing.\n */\n UNRECOGNIZED = 'unrecognized',\n}\n\n/**\n * The reserved second segments of a job id. ONE source for the producer (the crontabs manager's `buildJobId`, which\n * builds through the functions below) and the parser ({@link parseApplicationScheduledJobId}), so the two cannot drift:\n * ownership and the selector both depend on this format.\n */\nexport enum ApplicationScheduledJobSegment {\n /** A custom batch: `<app>:batch:<batchRef>`. */\n BATCH = 'batch',\n /** A minion's tick: `<app>:minion-tick:<minionName>:<variantKey>`. Reserved, so it cannot collide with a resource type. */\n MINION_TICK = 'minion-tick',\n}\n\nconst BATCH_JOB_SEGMENT = ApplicationScheduledJobSegment.BATCH;\nconst MINION_TICK_JOB_SEGMENT = ApplicationScheduledJobSegment.MINION_TICK;\n\n/** The id of an application's custom batch job. */\nexport function buildApplicationBatchJobId(applicationId: string, batchRef: string): string {\n return `${applicationId}:${BATCH_JOB_SEGMENT}:${batchRef}`;\n}\n\n/** The id of a minion's tick job. */\nexport function buildApplicationMinionTickJobId(applicationId: string, minionName: string, variantKey: string): string {\n return `${applicationId}:${MINION_TICK_JOB_SEGMENT}:${minionName}:${variantKey}`;\n}\n\n/** The id of a resource operation declared with a cron schedule. */\nexport function buildApplicationResourceOperationJobId(applicationId: string, resourceType: string, operationId: string, variantKey: string): string {\n return `${applicationId}:${resourceType}:${operationId}:${variantKey}`;\n}\n\n/** Why apps-manager refuses to run a scheduled job. Sent as `code` on the refusal, which survives the client sanitizer. */\nexport enum ApplicationScheduledJobRunRefusal {\n /** The `jobId` does not start with the named application's `<applicationId>:`: it is another application's job, or none. */\n NOT_OWNED_BY_APPLICATION = 'scheduled_job_not_owned_by_application',\n /**\n * The job is this application's by its id, and the crontabs manager's store holds no such job: it is not scheduled now\n * (typically the backend stopped declaring it after the listing was read). Nothing ran.\n */\n UNKNOWN_TO_SCHEDULER = 'scheduled_job_unknown_to_scheduler',\n}\n\n/** The admin path that lists an application's scheduled jobs. */\nexport function buildAdminApplicationScheduledJobsPath(appSlug: string): string {\n return `/admin/apps/${encodeURIComponent(appSlug)}/scheduled-jobs`;\n}\n\n/** The admin path that runs one of an application's scheduled jobs now. The `jobId` travels in the body: it contains `:`. */\nexport function buildAdminApplicationScheduledJobRunPath(appSlug: string): string {\n return `${buildAdminApplicationScheduledJobsPath(appSlug)}/run`;\n}\n\nconst ScheduledJobCommonShape = {\n /** The crontabs manager's id, `<applicationId>:…`. */\n jobId: z.string().min(1),\n /** The application-relative name a person types (see the table above). */\n selector: z.string().min(1),\n /** Whether the crontabs replica that answered has the job armed (a standby replica holds jobs it does not arm). */\n armed: z.boolean(),\n};\n\nexport const ApplicationScheduledJobSchema = z.discriminatedUnion('kind', [\n z.strictObject({\n kind: z.literal(ApplicationScheduledJobKind.RESOURCE_OPERATION),\n ...ScheduledJobCommonShape,\n resourceType: z.string().min(1),\n operationId: z.string().min(1),\n variantKey: z.string().min(1),\n }),\n z.strictObject({\n kind: z.literal(ApplicationScheduledJobKind.BATCH),\n ...ScheduledJobCommonShape,\n batchRef: z.string().min(1),\n }),\n z.strictObject({\n kind: z.literal(ApplicationScheduledJobKind.MINION_TICK),\n ...ScheduledJobCommonShape,\n minionName: z.string().min(1),\n variantKey: z.string().min(1),\n }),\n z.strictObject({\n kind: z.literal(ApplicationScheduledJobKind.UNRECOGNIZED),\n ...ScheduledJobCommonShape,\n }),\n]);\nexport type ApplicationScheduledJob = z.infer<typeof ApplicationScheduledJobSchema>;\n\n/** The answer of `GET /admin/apps/:appSlug/scheduled-jobs`. */\nexport const ApplicationScheduledJobsResponseSchema = z.strictObject({\n appSlug: z.string().min(1),\n /** The application's platform id: the prefix of every `jobId` below. */\n applicationId: z.string().min(1),\n /**\n * POSITIVE CONTROL beside an empty `jobs`: how many jobs the crontabs manager holds for EVERY application. Zero jobs for\n * this application beside a platform total of zero says the scheduler holds nothing at all (it has not loaded, or no\n * application has booted), not that this application declares nothing.\n */\n platformScheduledTotal: z.number().int().min(0),\n /** Whether the scheduler is running on the replica that answered. */\n schedulerRunning: z.boolean(),\n jobs: z.array(ApplicationScheduledJobSchema),\n});\nexport type ApplicationScheduledJobsResponse = z.infer<typeof ApplicationScheduledJobsResponseSchema>;\n\nexport const ApplicationScheduledJobRunRequestSchema = z.strictObject({\n /** The crontabs manager's id, exactly as the listing named it. Must belong to the application in the path. */\n jobId: z.string().min(1),\n /** Why, in the operator's words. Optional; recorded on the audit row. */\n reason: z.string().trim().min(1).max(1000).optional(),\n});\nexport type ApplicationScheduledJobRunRequest = z.input<typeof ApplicationScheduledJobRunRequestSchema>;\n\n/** The answer of `POST /admin/apps/:appSlug/scheduled-jobs/run`. */\nexport const ApplicationScheduledJobRunResponseSchema = z.strictObject({\n appSlug: z.string().min(1),\n applicationId: z.string().min(1),\n jobId: z.string().min(1),\n selector: z.string().min(1),\n /**\n * When the crontabs manager accepted the trigger (ISO 8601). Accepting is not finishing: the occurrence is delivered to\n * the application backend and runs there, asynchronously, exactly as a scheduled tick does.\n */\n triggeredAt: z.iso.datetime({ offset: true }),\n});\nexport type ApplicationScheduledJobRunResponse = z.infer<typeof ApplicationScheduledJobRunResponseSchema>;\n\n/** The prefix every job of one application carries. */\nfunction applicationJobIdPrefix(applicationId: string): string {\n return `${applicationId}:`;\n}\n\n/** Whether `jobId` is one of this application's jobs: it carries the application's prefix and something after it. */\nexport function applicationOwnsScheduledJobId(applicationId: string, jobId: string): boolean {\n const prefix = applicationJobIdPrefix(applicationId);\n return applicationId.length > 0 && jobId.startsWith(prefix) && jobId.length > prefix.length;\n}\n\n/**\n * Read one of this application's jobs from its `jobId`, or `null` when the job is not this application's.\n *\n * The batch segment is checked BEFORE the resource-operation shape, mirroring the producer: `buildJobId` writes\n * `<app>:batch:<ref>` for any job with a `batchRef`, and a batch ref may itself contain `:`.\n */\nexport function parseApplicationScheduledJobId(applicationId: string, jobId: string, armed: boolean): ApplicationScheduledJob | null {\n if (!applicationOwnsScheduledJobId(applicationId, jobId)) return null;\n const remainder = jobId.slice(applicationJobIdPrefix(applicationId).length);\n const segments = remainder.split(':');\n\n if (segments[0] === BATCH_JOB_SEGMENT && segments.length >= 2) {\n const batchRef = segments.slice(1).join(':');\n if (batchRef.length > 0) {\n return { kind: ApplicationScheduledJobKind.BATCH, jobId, selector: `${BATCH_JOB_SEGMENT}:${batchRef}`, armed, batchRef };\n }\n }\n\n const [first, second, third] = segments;\n const threeSegments = segments.length === 3 && Boolean(first) && Boolean(second) && Boolean(third);\n\n if (threeSegments && first === MINION_TICK_JOB_SEGMENT) {\n return {\n kind: ApplicationScheduledJobKind.MINION_TICK,\n jobId,\n selector: `${MINION_TICK_JOB_SEGMENT}:${second}:${third}`,\n armed,\n minionName: second,\n variantKey: third,\n };\n }\n\n if (threeSegments && first !== BATCH_JOB_SEGMENT) {\n return {\n kind: ApplicationScheduledJobKind.RESOURCE_OPERATION,\n jobId,\n selector: `${first}.${second}:${third}`,\n armed,\n resourceType: first,\n operationId: second,\n variantKey: third,\n };\n }\n\n return { kind: ApplicationScheduledJobKind.UNRECOGNIZED, jobId, selector: remainder, armed };\n}\n\n/** How a selector resolved against a listing. */\nexport enum ApplicationScheduledJobSelectorResolution {\n /** Exactly one job matches. */\n RESOLVED = 'resolved',\n /** No job matches. `candidates` is the whole listing, so the caller can show what exists. */\n NOT_FOUND = 'not_found',\n /** Several jobs match (a resource operation scheduled under several variants, named without one). */\n AMBIGUOUS = 'ambiguous',\n}\n\nexport type ApplicationScheduledJobSelectorResult =\n | { resolution: ApplicationScheduledJobSelectorResolution.RESOLVED; job: ApplicationScheduledJob }\n | { resolution: ApplicationScheduledJobSelectorResolution.NOT_FOUND; candidates: ApplicationScheduledJob[] }\n | { resolution: ApplicationScheduledJobSelectorResolution.AMBIGUOUS; matches: ApplicationScheduledJob[] };\n\n/**\n * Whether `job` answers `selector`. A job's full selector always matches. The variant may be left out: `<resourceType>.<op>`\n * matches that operation under every variant, and `minion-tick:<name>` that minion's tick, so the common case (one\n * variant, usually `default`) needs no variant typed. Matching is exact otherwise: no case folding and no prefix guessing,\n * so a selector never runs a job other than the one named.\n */\nfunction jobAnswersSelector(job: ApplicationScheduledJob, selector: string): boolean {\n if (job.selector === selector) return true;\n switch (job.kind) {\n case ApplicationScheduledJobKind.RESOURCE_OPERATION:\n return selector === `${job.resourceType}.${job.operationId}`;\n case ApplicationScheduledJobKind.MINION_TICK:\n return selector === `${MINION_TICK_JOB_SEGMENT}:${job.minionName}`;\n case ApplicationScheduledJobKind.BATCH:\n case ApplicationScheduledJobKind.UNRECOGNIZED:\n return false;\n }\n}\n\n/** Resolve what a person typed to exactly one job of the listing, or say why it cannot be. */\nexport function resolveApplicationScheduledJobSelector(jobs: readonly ApplicationScheduledJob[], selector: string): ApplicationScheduledJobSelectorResult {\n const wanted = selector.trim();\n const matches = jobs.filter((job) => jobAnswersSelector(job, wanted));\n if (matches.length === 1) return { resolution: ApplicationScheduledJobSelectorResolution.RESOLVED, job: matches[0] };\n if (matches.length === 0) return { resolution: ApplicationScheduledJobSelectorResolution.NOT_FOUND, candidates: [...jobs] };\n return { resolution: ApplicationScheduledJobSelectorResolution.AMBIGUOUS, matches };\n}\n"]}
|
|
@@ -56,6 +56,18 @@ export declare enum PlatformInfrastructureEnvKey {
|
|
|
56
56
|
RABBITMQ_VHOST = "RABBITMQ_VHOST",
|
|
57
57
|
RABBITMQ_ADMIN_USERNAME = "RABBITMQ_ADMIN_USERNAME",
|
|
58
58
|
RABBITMQ_ADMIN_PASSWORD = "RABBITMQ_ADMIN_PASSWORD",
|
|
59
|
+
/**
|
|
60
|
+
* The environment's service profile (`EnvironmentServiceProfile`), as the PLATFORM services read it (#2303 slice D).
|
|
61
|
+
* apps-manager derives from it whether the platform runs a message broker
|
|
62
|
+
* (`environmentServiceProfileRunsMessageBroker`), so under a profile whose queue lives in each application's database
|
|
63
|
+
* it initializes no RabbitMQ admin client and mints no vhost or credentials. Absent ⇒ FULL; emitted only when not the
|
|
64
|
+
* default.
|
|
65
|
+
*
|
|
66
|
+
* A key of its own, not the application backend's `ENVIRONMENT_SERVICE_PROFILE`: platform services boot through the
|
|
67
|
+
* engine's `StartApplicationBackendService`, whose APPLICATION refusals (a Layer-2 audit trail, MongoDB search, a
|
|
68
|
+
* required scan, all keyed on that key) describe what an application may declare, not what a platform service runs.
|
|
69
|
+
*/
|
|
70
|
+
PLATFORM_ENVIRONMENT_SERVICE_PROFILE = "PLATFORM_ENVIRONMENT_SERVICE_PROFILE",
|
|
59
71
|
STORAGE_PROVIDER = "STORAGE_PROVIDER",
|
|
60
72
|
/**
|
|
61
73
|
* S3-compatible endpoint **hostname** (NOT a URL); see the matching
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-runtime-env.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAY,qBAAqB;IAC/B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B;;;;;;;;;;OAUG;IACH,gBAAgB,qBAAqB;IACrC,uBAAuB,4BAA4B;IACnD,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;CACxC;AAED,oBAAY,wBAAwB;IAClC,yBAAyB,8BAA8B;IACvD,qCAAqC,0CAA0C;IAC/E,4BAA4B,iCAAiC;CAC9D;AAED,oBAAY,4BAA4B;IACtC,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IACzC,qBAAqB,0BAA0B;IAC/C,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB;;;;OAIG;IACH,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC,oBAAoB,yBAAyB;IAC7C,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,wBAAwB,6BAA6B;IACrD;;;;OAIG;IACH,cAAc,mBAAmB;IACjC,uBAAuB,4BAA4B;IACnD,uBAAuB,4BAA4B;IACnD,gBAAgB,qBAAqB;IACrC;;;;;;OAMG;IACH,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,cAAc,mBAAmB;IACjC,kBAAkB,uBAAuB;IACzC,kBAAkB,uBAAuB;IACzC;;;;;OAKG;IACH,oBAAoB,yBAAyB;IAC7C,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,aAAa,kBAAkB;IAC/B,iBAAiB,sBAAsB;IACvC;;;;;;OAMG;IACH,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B;;;;;;;;;;;;;OAaG;IACH,cAAc,mBAAmB;IACjC;;;;;;;OAOG;IACH,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,qB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BAAoB,4BAAsB,CAAC;AACxD,eAAO,MAAM,yBAAyB,iCAA2B,CAAC;AAClE,eAAO,MAAM,sBAAsB,8BAAwB,CAAC;AAC5D,eAAO,MAAM,sBAAsB,8BAAwB,CAAC;AAC5D,eAAO,MAAM,4BAA4B,oCAA8B,CAAC;AACxE,eAAO,MAAM,gCAAgC,wCAAkC,CAAC;AAChF,eAAO,MAAM,oBAAoB,4BAAsB,CAAC;AACxD,eAAO,MAAM,2BAA2B,mCAA6B,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAU3E;AAED,eAAO,MAAM,mCAAmC,aA4B9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"platform-runtime-env.contracts.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAY,qBAAqB;IAC/B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B;;;;;;;;;;OAUG;IACH,gBAAgB,qBAAqB;IACrC,uBAAuB,4BAA4B;IACnD,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;CACxC;AAED,oBAAY,wBAAwB;IAClC,yBAAyB,8BAA8B;IACvD,qCAAqC,0CAA0C;IAC/E,4BAA4B,iCAAiC;CAC9D;AAED,oBAAY,4BAA4B;IACtC,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IACzC,qBAAqB,0BAA0B;IAC/C,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB;;;;OAIG;IACH,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC,oBAAoB,yBAAyB;IAC7C,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,wBAAwB,6BAA6B;IACrD;;;;OAIG;IACH,cAAc,mBAAmB;IACjC,uBAAuB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ERNAME";
|
|
61
61
|
PlatformInfrastructureEnvKey["RABBITMQ_ADMIN_PASSWORD"] = "RABBITMQ_ADMIN_PASSWORD";
|
|
62
|
+
/**
|
|
63
|
+
* The environment's service profile (`EnvironmentServiceProfile`), as the PLATFORM services read it (#2303 slice D).
|
|
64
|
+
* apps-manager derives from it whether the platform runs a message broker
|
|
65
|
+
* (`environmentServiceProfileRunsMessageBroker`), so under a profile whose queue lives in each application's database
|
|
66
|
+
* it initializes no RabbitMQ admin client and mints no vhost or credentials. Absent ⇒ FULL; emitted only when not the
|
|
67
|
+
* default.
|
|
68
|
+
*
|
|
69
|
+
* A key of its own, not the application backend's `ENVIRONMENT_SERVICE_PROFILE`: platform services boot through the
|
|
70
|
+
* engine's `StartApplicationBackendService`, whose APPLICATION refusals (a Layer-2 audit trail, MongoDB search, a
|
|
71
|
+
* required scan, all keyed on that key) describe what an application may declare, not what a platform service runs.
|
|
72
|
+
*/
|
|
73
|
+
PlatformInfrastructureEnvKey["PLATFORM_ENVIRONMENT_SERVICE_PROFILE"] = "PLATFORM_ENVIRONMENT_SERVICE_PROFILE";
|
|
62
74
|
PlatformInfrastructureEnvKey["STORAGE_PROVIDER"] = "STORAGE_PROVIDER";
|
|
63
75
|
/**
|
|
64
76
|
* S3-compatible endpoint **hostname** (NOT a URL); see the matching
|