@sanity/blueprints 0.9.0 → 0.11.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/README.md +326 -14
- package/dist/definers/blueprints.d.ts +2 -0
- package/dist/definers/blueprints.js +2 -0
- package/dist/definers/blueprints.js.map +1 -1
- package/dist/definers/cors.d.ts +4 -0
- package/dist/definers/cors.js +4 -0
- package/dist/definers/cors.js.map +1 -1
- package/dist/definers/datasets.d.ts +5 -0
- package/dist/definers/datasets.js +5 -0
- package/dist/definers/datasets.js.map +1 -1
- package/dist/definers/functions.d.ts +41 -12
- package/dist/definers/functions.js +60 -16
- package/dist/definers/functions.js.map +1 -1
- package/dist/definers/resources.d.ts +2 -0
- package/dist/definers/resources.js +2 -0
- package/dist/definers/resources.js.map +1 -1
- package/dist/definers/robots.d.ts +4 -0
- package/dist/definers/robots.js +4 -0
- package/dist/definers/robots.js.map +1 -1
- package/dist/definers/roles.d.ts +6 -0
- package/dist/definers/roles.js +6 -0
- package/dist/definers/roles.js.map +1 -1
- package/dist/definers/webhooks.d.ts +4 -0
- package/dist/definers/webhooks.js +4 -0
- package/dist/definers/webhooks.js.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/types/blueprints.d.ts +16 -4
- package/dist/types/cors.d.ts +4 -0
- package/dist/types/datasets.d.ts +14 -2
- package/dist/types/errors.d.ts +4 -1
- package/dist/types/functions.d.ts +81 -16
- package/dist/types/functions.js +5 -1
- package/dist/types/functions.js.map +1 -1
- package/dist/types/resources.d.ts +16 -1
- package/dist/types/robots.d.ts +12 -3
- package/dist/types/roles.d.ts +11 -3
- package/dist/types/webhooks.d.ts +18 -6
- package/dist/utils/schedule-parser.d.ts +42 -0
- package/dist/utils/schedule-parser.js +450 -0
- package/dist/utils/schedule-parser.js.map +1 -0
- package/dist/utils/validation.d.ts +1 -0
- package/dist/utils/validation.js +1 -0
- package/dist/utils/validation.js.map +1 -1
- package/dist/validation/blueprints.d.ts +1 -0
- package/dist/validation/blueprints.js +1 -0
- package/dist/validation/blueprints.js.map +1 -1
- package/dist/validation/cors.d.ts +1 -0
- package/dist/validation/cors.js +1 -0
- package/dist/validation/cors.js.map +1 -1
- package/dist/validation/datasets.d.ts +2 -0
- package/dist/validation/datasets.js +2 -0
- package/dist/validation/datasets.js.map +1 -1
- package/dist/validation/functions.d.ts +11 -0
- package/dist/validation/functions.js +37 -1
- package/dist/validation/functions.js.map +1 -1
- package/dist/validation/resources.d.ts +7 -1
- package/dist/validation/resources.js +23 -16
- package/dist/validation/resources.js.map +1 -1
- package/dist/validation/robots.d.ts +7 -0
- package/dist/validation/robots.js +7 -0
- package/dist/validation/robots.js.map +1 -1
- package/dist/validation/roles.d.ts +3 -1
- package/dist/validation/roles.js +3 -1
- package/dist/validation/roles.js.map +1 -1
- package/dist/validation/webhooks.d.ts +1 -0
- package/dist/validation/webhooks.js +1 -0
- package/dist/validation/webhooks.js.map +1 -1
- package/package.json +4 -1
- package/src/definers/blueprints.ts +2 -0
- package/src/definers/cors.ts +4 -0
- package/src/definers/datasets.ts +5 -0
- package/src/definers/functions.ts +65 -18
- package/src/definers/resources.ts +2 -0
- package/src/definers/robots.ts +4 -0
- package/src/definers/roles.ts +6 -0
- package/src/definers/webhooks.ts +4 -0
- package/src/index.ts +22 -0
- package/src/types/blueprints.ts +16 -4
- package/src/types/cors.ts +4 -0
- package/src/types/datasets.ts +14 -2
- package/src/types/errors.ts +4 -1
- package/src/types/functions.ts +93 -15
- package/src/types/resources.ts +16 -1
- package/src/types/robots.ts +12 -3
- package/src/types/roles.ts +11 -3
- package/src/types/webhooks.ts +18 -6
- package/src/utils/schedule-parser.ts +502 -0
- package/src/utils/validation.ts +1 -0
- package/src/validation/blueprints.ts +1 -0
- package/src/validation/cors.ts +1 -0
- package/src/validation/datasets.ts +2 -0
- package/src/validation/functions.ts +37 -0
- package/src/validation/resources.ts +24 -16
- package/src/validation/robots.ts +7 -0
- package/src/validation/roles.ts +3 -1
- package/src/validation/webhooks.ts +1 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { BlueprintResource } from '../index.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Base event configuration shared by document and media library function types
|
|
4
|
+
* @category Functions Types
|
|
5
|
+
*/
|
|
3
6
|
export interface BlueprintFunctionBaseResourceEvent {
|
|
4
7
|
/** Event types that trigger the function. Defaults to ['publish'] */
|
|
5
8
|
on?: [BlueprintFunctionResourceEventName, ...BlueprintFunctionResourceEventName[]];
|
|
@@ -10,23 +13,33 @@ export interface BlueprintFunctionBaseResourceEvent {
|
|
|
10
13
|
/** Include draft documents in addition to published documents */
|
|
11
14
|
includeDrafts?: boolean;
|
|
12
15
|
}
|
|
13
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Event configuration for document functions
|
|
18
|
+
* @category Functions Types
|
|
19
|
+
*/
|
|
14
20
|
export interface BlueprintDocumentFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
15
21
|
/** Include all versions of documents, not just the current version */
|
|
16
22
|
includeAllVersions?: boolean;
|
|
17
23
|
/** Optional dataset resource scoping for the function */
|
|
18
24
|
resource?: BlueprintFunctionResourceEventResourceDataset;
|
|
19
25
|
}
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Event configuration for media library asset functions
|
|
28
|
+
* @category Functions Types
|
|
29
|
+
*/
|
|
21
30
|
export interface BlueprintMediaLibraryFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
22
31
|
/** Media library resource scoping (required for media library functions) */
|
|
23
32
|
resource: BlueprintFunctionResourceEventResourceMediaLibrary;
|
|
24
33
|
}
|
|
25
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Union type of all function resource event configurations
|
|
36
|
+
* @category Functions Types
|
|
37
|
+
*/
|
|
26
38
|
export type BlueprintFunctionResourceEvent = BlueprintDocumentFunctionResourceEvent | BlueprintMediaLibraryFunctionResourceEvent;
|
|
27
39
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @example {
|
|
40
|
+
* Explicit resource event for schedule functions to specific minutes, hours, days of month, months, and days of week
|
|
41
|
+
* @example { minute: '0', hour: '9', dayOfMonth: '1', month: '1', dayOfWeek: '1' }
|
|
42
|
+
* @category Functions Types
|
|
30
43
|
*/
|
|
31
44
|
export interface BlueprintScheduleFunctionExplicitResourceEvent {
|
|
32
45
|
minute: string;
|
|
@@ -35,23 +48,56 @@ export interface BlueprintScheduleFunctionExplicitResourceEvent {
|
|
|
35
48
|
month: string;
|
|
36
49
|
dayOfWeek: string;
|
|
37
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Expression resource for schedule functions to specific expressions
|
|
53
|
+
* @example { expression: '0 9 * * *' }
|
|
54
|
+
* @category Functions Types
|
|
55
|
+
*/
|
|
38
56
|
export interface BlueprintScheduleFunctionExpressionResourceEvent {
|
|
39
57
|
expression: string;
|
|
40
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Union type of all schedule function resource event configurations
|
|
61
|
+
* @category Functions Types
|
|
62
|
+
*/
|
|
41
63
|
export type BlueprintScheduleFunctionResourceEvent = BlueprintScheduleFunctionExplicitResourceEvent | BlueprintScheduleFunctionExpressionResourceEvent;
|
|
42
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Dataset resource for scoping document functions to specific datasets
|
|
66
|
+
* @example { type: 'dataset', id: 'my-project.production' }
|
|
67
|
+
* @category Resource Types
|
|
68
|
+
*/
|
|
69
|
+
export interface BlueprintFunctionResourceEventResourceDataset {
|
|
43
70
|
type: 'dataset';
|
|
44
|
-
/**
|
|
71
|
+
/** A dataset ID in the format <projectId>.<datasetName>. <datasetName> can be `*` to signify "all datasets in project with ID <projectId>." */
|
|
45
72
|
id: string;
|
|
46
73
|
}
|
|
47
|
-
/**
|
|
48
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Media library resource for scoping media library functions
|
|
76
|
+
* @category Functions Types
|
|
77
|
+
*/
|
|
78
|
+
export interface BlueprintFunctionResourceEventResourceMediaLibrary {
|
|
49
79
|
type: 'media-library';
|
|
50
80
|
id: string;
|
|
51
81
|
}
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Events that can trigger a function
|
|
84
|
+
* @category Functions Types
|
|
85
|
+
*/
|
|
86
|
+
export type BlueprintFunctionResourceEventName = 'publish' | 'create' | 'delete' | 'update';
|
|
87
|
+
/**
|
|
88
|
+
* Current support Function runtimes
|
|
89
|
+
* @category Functions Types
|
|
90
|
+
*/
|
|
91
|
+
export declare const VALID_RUNTIMES: readonly ["node", "nodejs22.x", "nodejs24.x"];
|
|
92
|
+
/**
|
|
93
|
+
* Supported function runtimes
|
|
94
|
+
* @category Functions Types
|
|
95
|
+
*/
|
|
96
|
+
export type FunctionRuntimes = (typeof VALID_RUNTIMES)[number];
|
|
97
|
+
/**
|
|
98
|
+
* Base function resource with common properties for all function types
|
|
99
|
+
* @category Functions Types
|
|
100
|
+
*/
|
|
55
101
|
export interface BlueprintBaseFunctionResource extends BlueprintResource {
|
|
56
102
|
/** Human-readable display name for the function */
|
|
57
103
|
displayName?: string;
|
|
@@ -65,22 +111,41 @@ export interface BlueprintBaseFunctionResource extends BlueprintResource {
|
|
|
65
111
|
env?: Record<string, string>;
|
|
66
112
|
/** Token provided during function invocation */
|
|
67
113
|
robotToken?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The project ID of the project that contains your function.
|
|
116
|
+
*
|
|
117
|
+
* The `project` attribute must be defined if your blueprint is scoped to an organization. */
|
|
118
|
+
project?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The runtime environment for the function (currently only Node.js is supported)
|
|
121
|
+
* @default 'nodejs24.x'
|
|
122
|
+
*/
|
|
123
|
+
runtime?: FunctionRuntimes;
|
|
68
124
|
}
|
|
69
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* A function resource triggered by document events in Sanity datasets
|
|
127
|
+
* @category Functions Types
|
|
128
|
+
*/
|
|
70
129
|
export interface BlueprintDocumentFunctionResource extends BlueprintBaseFunctionResource {
|
|
71
130
|
type: 'sanity.function.document';
|
|
72
131
|
/** Event configuration specifying when and how the function is triggered */
|
|
73
132
|
event: BlueprintDocumentFunctionResourceEvent;
|
|
74
133
|
}
|
|
75
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* A function resource triggered by media library asset events
|
|
136
|
+
* @category Functions Types
|
|
137
|
+
*/
|
|
76
138
|
export interface BlueprintMediaLibraryAssetFunctionResource extends BlueprintBaseFunctionResource {
|
|
77
139
|
type: 'sanity.function.media-library.asset';
|
|
78
140
|
/** Event configuration specifying when and how the function is triggered */
|
|
79
141
|
event: BlueprintMediaLibraryFunctionResourceEvent;
|
|
80
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* A function resource triggered by schedule events
|
|
145
|
+
* @category Functions Types
|
|
146
|
+
*/
|
|
81
147
|
export interface BlueprintScheduleFunctionResource extends BlueprintBaseFunctionResource {
|
|
82
148
|
type: 'sanity.function.cron';
|
|
83
149
|
event: BlueprintScheduleFunctionResourceEvent;
|
|
84
150
|
timezone?: string;
|
|
85
151
|
}
|
|
86
|
-
export {};
|
package/dist/types/functions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/types/functions.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/types/functions.ts"],"names":[],"mappings":"AAqGA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
|
|
@@ -5,22 +5,33 @@
|
|
|
5
5
|
* - **replace** if a stack is deployed, the resource will be destroyed and created instead of performing an update. If the resource is removed from the blueprint, it will be destroyed. If the stack is destroyed, the resource will be destroyed.
|
|
6
6
|
* - **allow** if a stack is destroyed, the resource will be destroyed along with it. If the resource is removed it will be destroyed
|
|
7
7
|
* - **protect** if a stack is deployed the resource will not be updated. If the resource is removed from the blueprint or the stack is destroyed, deployment will fail.
|
|
8
|
+
* @category Blueprint Internals
|
|
8
9
|
*/
|
|
9
10
|
export type BlueprintResourceDeletionPolicy = 'allow' | 'retain' | 'replace' | 'protect';
|
|
10
11
|
/**
|
|
11
12
|
* An ownership action that will cause the referenced resource to be attached to the current stack.
|
|
13
|
+
* @category Blueprint Internals
|
|
12
14
|
*/
|
|
13
15
|
export interface BlueprintOwnershipAttachAction {
|
|
14
16
|
type: 'attach';
|
|
15
17
|
/** The identifier of the resource to be attached to the current stack */
|
|
16
18
|
id: string;
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* An ownership action that will cause the referenced resource to be detached from the current stack.
|
|
22
|
+
* @category Blueprint Internals
|
|
23
|
+
*/
|
|
24
|
+
export interface BlueprintOwnershipDetachAction {
|
|
25
|
+
type: 'detach';
|
|
26
|
+
}
|
|
18
27
|
/**
|
|
19
28
|
* A union of all possible ownership actions.
|
|
29
|
+
* @category Blueprint Internals
|
|
20
30
|
*/
|
|
21
|
-
export type BlueprintOwnershipAction = BlueprintOwnershipAttachAction;
|
|
31
|
+
export type BlueprintOwnershipAction = BlueprintOwnershipAttachAction | BlueprintOwnershipDetachAction;
|
|
22
32
|
/**
|
|
23
33
|
* An ownership action that will cause the referenced project-contained resource to be attached to the current stack.
|
|
34
|
+
* @category Blueprint Internals
|
|
24
35
|
*/
|
|
25
36
|
export interface BlueprintProjectOwnershipAttachAction extends BlueprintOwnershipAttachAction {
|
|
26
37
|
/** The identifier of the project for resources contained in a project */
|
|
@@ -28,10 +39,12 @@ export interface BlueprintProjectOwnershipAttachAction extends BlueprintOwnershi
|
|
|
28
39
|
}
|
|
29
40
|
/**
|
|
30
41
|
* A union of all possible ownership actions for resources belonging to projects.
|
|
42
|
+
* @category Blueprint Internals
|
|
31
43
|
*/
|
|
32
44
|
export type BlueprintProjectOwnershipAction = BlueprintProjectOwnershipAttachAction;
|
|
33
45
|
/**
|
|
34
46
|
* Defines the lifcycle policy for this resource.
|
|
47
|
+
* @category Blueprint Internals
|
|
35
48
|
*/
|
|
36
49
|
export interface BlueprintResourceLifecycle {
|
|
37
50
|
deletionPolicy?: BlueprintResourceDeletionPolicy;
|
|
@@ -39,12 +52,14 @@ export interface BlueprintResourceLifecycle {
|
|
|
39
52
|
}
|
|
40
53
|
/**
|
|
41
54
|
* Defines the lifcycle policy for this resource.
|
|
55
|
+
* @category Blueprint Internals
|
|
42
56
|
*/
|
|
43
57
|
export interface BlueprintProjectResourceLifecycle extends BlueprintResourceLifecycle {
|
|
44
58
|
ownershipAction?: BlueprintProjectOwnershipAction;
|
|
45
59
|
}
|
|
46
60
|
/**
|
|
47
61
|
* The base type for all resources.
|
|
62
|
+
* @category Blueprint Internals
|
|
48
63
|
*/
|
|
49
64
|
export interface BlueprintResource<Lifecycle extends BlueprintResourceLifecycle = BlueprintResourceLifecycle> {
|
|
50
65
|
type: string;
|
package/dist/types/robots.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type { BlueprintResource } from './resources';
|
|
2
|
-
/**
|
|
1
|
+
import type { BlueprintProjectResourceLifecycle, BlueprintResource } from './resources';
|
|
2
|
+
/**
|
|
3
|
+
* Resource types that robots can be attached to.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
3
6
|
export type RobotResourceType = 'organization' | 'project';
|
|
4
7
|
/**
|
|
5
8
|
* Defines the robot's roles within a given resource.
|
|
9
|
+
* @beta This feature is subject to breaking changes.
|
|
10
|
+
* @category Resource Types
|
|
6
11
|
*/
|
|
7
12
|
export interface RobotMembership {
|
|
8
13
|
resourceType: RobotResourceType;
|
|
@@ -12,8 +17,10 @@ export interface RobotMembership {
|
|
|
12
17
|
/**
|
|
13
18
|
* A robot that provides a token for automated access.
|
|
14
19
|
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
20
|
+
* @beta This feature is subject to breaking changes.
|
|
21
|
+
* @category Resource Types
|
|
15
22
|
*/
|
|
16
|
-
export interface BlueprintRobotResource extends BlueprintResource {
|
|
23
|
+
export interface BlueprintRobotResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
17
24
|
type: 'sanity.access.robot';
|
|
18
25
|
/** A descriptive label for the robot and its use case */
|
|
19
26
|
label: string;
|
|
@@ -24,6 +31,8 @@ export interface BlueprintRobotResource extends BlueprintResource {
|
|
|
24
31
|
/**
|
|
25
32
|
* Configuration for a robot that provides a token for automated access.
|
|
26
33
|
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
34
|
+
* @beta This feature is subject to breaking changes.
|
|
35
|
+
* @category Resource Types
|
|
27
36
|
*/
|
|
28
37
|
export type BlueprintRobotConfig = Omit<BlueprintRobotResource, 'type' | 'label' | 'token'> & {
|
|
29
38
|
label?: string;
|
package/dist/types/roles.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { BlueprintResource } from '../index.js';
|
|
1
|
+
import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* A permission definition for a role.
|
|
4
|
+
* @beta This feature is subject to breaking changes.
|
|
5
|
+
* @category Resource Types
|
|
4
6
|
*/
|
|
5
7
|
export interface RolePermission {
|
|
6
8
|
/** Predefined permission name (e.g., 'sanity-all-documents') */
|
|
@@ -12,8 +14,10 @@ export interface RolePermission {
|
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* Configuration for a custom role.
|
|
17
|
+
* @beta This feature is subject to breaking changes.
|
|
18
|
+
* @category Resource Types
|
|
15
19
|
*/
|
|
16
|
-
export interface BlueprintRoleConfig extends Omit<BlueprintResource
|
|
20
|
+
export interface BlueprintRoleConfig extends Omit<BlueprintResource<BlueprintProjectResourceLifecycle>, 'type'> {
|
|
17
21
|
title: string;
|
|
18
22
|
description?: string;
|
|
19
23
|
appliesToUsers: boolean;
|
|
@@ -22,12 +26,16 @@ export interface BlueprintRoleConfig extends Omit<BlueprintResource, 'type'> {
|
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
28
|
* A custom role resource
|
|
29
|
+
* @beta This feature is subject to breaking changes.
|
|
30
|
+
* @category Resource Types
|
|
25
31
|
*/
|
|
26
|
-
export interface BlueprintRoleResource extends BlueprintRoleConfig, BlueprintResource {
|
|
32
|
+
export interface BlueprintRoleResource extends BlueprintRoleConfig, BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
27
33
|
type: 'sanity.access.role';
|
|
28
34
|
}
|
|
29
35
|
/**
|
|
30
36
|
* A custom role resource that is tied to a specific project
|
|
37
|
+
* @beta This feature is subject to breaking changes.
|
|
38
|
+
* @category Resource Types
|
|
31
39
|
*/
|
|
32
40
|
export interface BlueprintProjectRoleResource extends BlueprintRoleResource {
|
|
33
41
|
resourceType: 'project';
|
package/dist/types/webhooks.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import type { BlueprintResource } from '../index.js';
|
|
2
|
-
/**
|
|
1
|
+
import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Types of events that can trigger a webhook
|
|
4
|
+
* @beta This feature is subject to breaking changes.
|
|
5
|
+
* @category Resource Types
|
|
6
|
+
*/
|
|
3
7
|
export type WebhookTrigger = 'create' | 'update' | 'delete';
|
|
4
|
-
/**
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A webhook resource definition
|
|
10
|
+
* @beta This feature is subject to breaking changes.
|
|
11
|
+
* @category Resource Types
|
|
12
|
+
*/
|
|
13
|
+
export interface BlueprintDocumentWebhookResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
6
14
|
type: 'sanity.project.webhook';
|
|
7
15
|
project?: string;
|
|
8
16
|
displayName?: string;
|
|
@@ -17,8 +25,12 @@ export interface BlueprintDocumentWebhookResource extends BlueprintResource {
|
|
|
17
25
|
includeDrafts?: boolean;
|
|
18
26
|
includeAllVersions?: boolean;
|
|
19
27
|
secret?: string;
|
|
20
|
-
dataset
|
|
28
|
+
dataset: string;
|
|
21
29
|
apiVersion: string;
|
|
22
30
|
}
|
|
23
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Configuration for a webhook
|
|
33
|
+
* @beta This feature is subject to breaking changes.
|
|
34
|
+
* @category Resource Types
|
|
35
|
+
*/
|
|
24
36
|
export type BlueprintDocumentWebhookConfig = Omit<BlueprintDocumentWebhookResource, 'type'>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BlueprintError } from '../types/errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates a schedule expression and returns any errors found.
|
|
4
|
+
*
|
|
5
|
+
* Checks for:
|
|
6
|
+
* - Empty expressions
|
|
7
|
+
* - Invalid time formats (hours, minutes out of range)
|
|
8
|
+
* - Invalid intervals (minutes, hours out of range)
|
|
9
|
+
* - Invalid day of month values
|
|
10
|
+
* - Unrecognizable expressions
|
|
11
|
+
*
|
|
12
|
+
* @param expression Natural language schedule or cron expression
|
|
13
|
+
* @returns Array of validation errors, empty if valid
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateScheduleExpression(expression: string): BlueprintError[];
|
|
17
|
+
/**
|
|
18
|
+
* Parse a natural language schedule expression into a cron expression.
|
|
19
|
+
*
|
|
20
|
+
* The parser is **forgiving** and **freeform** - it extracts recognized parts
|
|
21
|
+
* (days, times, intervals) and ignores unrecognized tokens like "at", "on", "the".
|
|
22
|
+
*
|
|
23
|
+
* Supported patterns:
|
|
24
|
+
* - "every minute", "every 5 minutes", "every hour", "every 2 hours"
|
|
25
|
+
* - "every day at 9am", "daily 14:30", "9am daily"
|
|
26
|
+
* - "at midnight", "noon"
|
|
27
|
+
* - "morning", "evening"
|
|
28
|
+
* - "mondays 9am", "mon wed fri 9:00", "mon-fri 8am"
|
|
29
|
+
* - "9pm fridays and wed", "wednesday friday 9pm"
|
|
30
|
+
* - "weekdays 9am", "weekends 10am"
|
|
31
|
+
* - "first of the month 9am", "15th noon"
|
|
32
|
+
*
|
|
33
|
+
* If the input is already a valid cron expression, it is returned unchanged.
|
|
34
|
+
*
|
|
35
|
+
* This function assumes the expression has already been validated via
|
|
36
|
+
* `validateScheduleExpression`. For invalid input, behavior is undefined.
|
|
37
|
+
*
|
|
38
|
+
* @param expression Natural language schedule or cron expression
|
|
39
|
+
* @returns Cron expression string
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseScheduleExpression(expression: string): string;
|