@haatlabs-core/announcements-contracts 0.0.0-stage → 0.27.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.
- package/LICENSE +201 -0
- package/README.md +2 -2
- package/dist/cjs/index.d.ts +212 -0
- package/dist/cjs/index.js +172 -0
- package/dist/cjs/package.json +3 -0
- package/dist/index.d.ts +212 -0
- package/dist/index.js +116 -0
- package/dist/index.js.map +1 -0
- package/maintenance.schema.json +34 -0
- package/package.json +61 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Haatlabs
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @haatlabs-core/announcements-contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The formats `@haatlabs-core/announcements` and every surface share: announcements, maintenance windows, the status an app reads, and the 503 body both maintenance layers answer with (`maintenance.schema.json` is its JSON Schema, which the edge checks against). Browser-safe: zod is its only (peer) dependency.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* What every surface and the edge agree on: announcements (the alert bar, optionally
|
|
4
|
+
* notified), app-layer maintenance windows, the status an app reads, and the 503 body both
|
|
5
|
+
* maintenance layers answer with. Browser-safe: zod only.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SEVERITIES: readonly ["INFO", "WARN", "CRITICAL"];
|
|
8
|
+
export type Severity = (typeof SEVERITIES)[number];
|
|
9
|
+
/** How an organization uses the app: a connected Shopify store, the web dashboard, or both. */
|
|
10
|
+
export declare const PLATFORMS: readonly ["SHOPIFY", "DASHBOARD"];
|
|
11
|
+
export type Platform = (typeof PLATFORMS)[number];
|
|
12
|
+
/** Where a notified announcement goes. INBOX is always on when an announcement is notified. */
|
|
13
|
+
export declare const CHANNELS: readonly ["INBOX", "PUSH", "EMAIL"];
|
|
14
|
+
export type Channel = (typeof CHANNELS)[number];
|
|
15
|
+
export declare const TITLE_MAX = 120;
|
|
16
|
+
export declare const BODY_MAX = 1000;
|
|
17
|
+
export declare const MESSAGE_MAX = 500;
|
|
18
|
+
export declare const HEADS_UP_DEFAULT_MINUTES = 1440;
|
|
19
|
+
/** A week: the longest warning ahead of maintenance. */
|
|
20
|
+
export declare const HEADS_UP_MAX_MINUTES = 10080;
|
|
21
|
+
export declare const LINK_LABEL_MAX = 60;
|
|
22
|
+
export declare const LINK_MAX = 2048;
|
|
23
|
+
export declare const PLAN_CODE_MAX = 64;
|
|
24
|
+
export declare const PLANS_MAX = 50;
|
|
25
|
+
export declare const COUNTRIES_MAX = 250;
|
|
26
|
+
/** Who an announcement is for: an AND of three lists, each empty meaning everyone. */
|
|
27
|
+
export declare const SegmentsSchema: z.ZodObject<{
|
|
28
|
+
plans: z.ZodArray<z.ZodString>;
|
|
29
|
+
platforms: z.ZodArray<z.ZodEnum<{
|
|
30
|
+
SHOPIFY: "SHOPIFY";
|
|
31
|
+
DASHBOARD: "DASHBOARD";
|
|
32
|
+
}>>;
|
|
33
|
+
countries: z.ZodArray<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type Segments = z.infer<typeof SegmentsSchema>;
|
|
36
|
+
/** One alert as a viewer receives it. Who it is for stays on the server. */
|
|
37
|
+
export declare const AlertSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
title: z.ZodString;
|
|
40
|
+
body: z.ZodString;
|
|
41
|
+
severity: z.ZodEnum<{
|
|
42
|
+
INFO: "INFO";
|
|
43
|
+
WARN: "WARN";
|
|
44
|
+
CRITICAL: "CRITICAL";
|
|
45
|
+
}>;
|
|
46
|
+
linkUrl: z.ZodNullable<z.ZodString>;
|
|
47
|
+
linkLabel: z.ZodNullable<z.ZodString>;
|
|
48
|
+
dismissible: z.ZodBoolean;
|
|
49
|
+
startsAt: z.ZodString;
|
|
50
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
51
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
52
|
+
startsAt: z.ZodString;
|
|
53
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type Alert = z.infer<typeof AlertSchema>;
|
|
57
|
+
/** What a 503 says while the platform is down: the edge's switch (`infra`) or the app's (`app`). */
|
|
58
|
+
export declare const MaintenanceInfoSchema: z.ZodObject<{
|
|
59
|
+
layer: z.ZodEnum<{
|
|
60
|
+
infra: "infra";
|
|
61
|
+
app: "app";
|
|
62
|
+
}>;
|
|
63
|
+
message: z.ZodString;
|
|
64
|
+
until: z.ZodNullable<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type MaintenanceInfo = z.infer<typeof MaintenanceInfoSchema>;
|
|
67
|
+
export declare const MaintenanceBodySchema: z.ZodObject<{
|
|
68
|
+
maintenance: z.ZodObject<{
|
|
69
|
+
layer: z.ZodEnum<{
|
|
70
|
+
infra: "infra";
|
|
71
|
+
app: "app";
|
|
72
|
+
}>;
|
|
73
|
+
message: z.ZodString;
|
|
74
|
+
until: z.ZodNullable<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type MaintenanceBody = z.infer<typeof MaintenanceBodySchema>;
|
|
78
|
+
export declare const StatusSchema: z.ZodObject<{
|
|
79
|
+
maintenance: z.ZodNullable<z.ZodObject<{
|
|
80
|
+
layer: z.ZodEnum<{
|
|
81
|
+
infra: "infra";
|
|
82
|
+
app: "app";
|
|
83
|
+
}>;
|
|
84
|
+
message: z.ZodString;
|
|
85
|
+
until: z.ZodNullable<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
alerts: z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
title: z.ZodString;
|
|
90
|
+
body: z.ZodString;
|
|
91
|
+
severity: z.ZodEnum<{
|
|
92
|
+
INFO: "INFO";
|
|
93
|
+
WARN: "WARN";
|
|
94
|
+
CRITICAL: "CRITICAL";
|
|
95
|
+
}>;
|
|
96
|
+
linkUrl: z.ZodNullable<z.ZodString>;
|
|
97
|
+
linkLabel: z.ZodNullable<z.ZodString>;
|
|
98
|
+
dismissible: z.ZodBoolean;
|
|
99
|
+
startsAt: z.ZodString;
|
|
100
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
101
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
102
|
+
startsAt: z.ZodString;
|
|
103
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type Status = z.infer<typeof StatusSchema>;
|
|
108
|
+
export declare const AnnouncementInputSchema: z.ZodObject<{
|
|
109
|
+
title: z.ZodString;
|
|
110
|
+
body: z.ZodString;
|
|
111
|
+
severity: z.ZodEnum<{
|
|
112
|
+
INFO: "INFO";
|
|
113
|
+
WARN: "WARN";
|
|
114
|
+
CRITICAL: "CRITICAL";
|
|
115
|
+
}>;
|
|
116
|
+
linkUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
+
linkLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
dismissible: z.ZodDefault<z.ZodBoolean>;
|
|
119
|
+
startsAt: z.ZodString;
|
|
120
|
+
endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
121
|
+
segments: z.ZodObject<{
|
|
122
|
+
plans: z.ZodArray<z.ZodString>;
|
|
123
|
+
platforms: z.ZodArray<z.ZodEnum<{
|
|
124
|
+
SHOPIFY: "SHOPIFY";
|
|
125
|
+
DASHBOARD: "DASHBOARD";
|
|
126
|
+
}>>;
|
|
127
|
+
countries: z.ZodArray<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
notify: z.ZodBoolean;
|
|
130
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
131
|
+
INBOX: "INBOX";
|
|
132
|
+
PUSH: "PUSH";
|
|
133
|
+
EMAIL: "EMAIL";
|
|
134
|
+
}>>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
export type AnnouncementInput = z.input<typeof AnnouncementInputSchema>;
|
|
137
|
+
export type ParsedAnnouncementInput = z.output<typeof AnnouncementInputSchema>;
|
|
138
|
+
/** An announcement as staff see it: what viewers see, plus who it is for and its notify state. */
|
|
139
|
+
export declare const AnnouncementViewSchema: z.ZodObject<{
|
|
140
|
+
id: z.ZodString;
|
|
141
|
+
title: z.ZodString;
|
|
142
|
+
body: z.ZodString;
|
|
143
|
+
severity: z.ZodEnum<{
|
|
144
|
+
INFO: "INFO";
|
|
145
|
+
WARN: "WARN";
|
|
146
|
+
CRITICAL: "CRITICAL";
|
|
147
|
+
}>;
|
|
148
|
+
linkUrl: z.ZodNullable<z.ZodString>;
|
|
149
|
+
linkLabel: z.ZodNullable<z.ZodString>;
|
|
150
|
+
dismissible: z.ZodBoolean;
|
|
151
|
+
startsAt: z.ZodString;
|
|
152
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
153
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
154
|
+
startsAt: z.ZodString;
|
|
155
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
segments: z.ZodObject<{
|
|
158
|
+
plans: z.ZodArray<z.ZodString>;
|
|
159
|
+
platforms: z.ZodArray<z.ZodEnum<{
|
|
160
|
+
SHOPIFY: "SHOPIFY";
|
|
161
|
+
DASHBOARD: "DASHBOARD";
|
|
162
|
+
}>>;
|
|
163
|
+
countries: z.ZodArray<z.ZodString>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
notify: z.ZodBoolean;
|
|
166
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
167
|
+
INBOX: "INBOX";
|
|
168
|
+
PUSH: "PUSH";
|
|
169
|
+
EMAIL: "EMAIL";
|
|
170
|
+
}>>;
|
|
171
|
+
notifiedAt: z.ZodNullable<z.ZodString>;
|
|
172
|
+
cancelledAt: z.ZodNullable<z.ZodString>;
|
|
173
|
+
createdBy: z.ZodString;
|
|
174
|
+
updatedAt: z.ZodString;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
export type AnnouncementView = z.infer<typeof AnnouncementViewSchema>;
|
|
177
|
+
export declare const MaintenanceInputSchema: z.ZodObject<{
|
|
178
|
+
message: z.ZodString;
|
|
179
|
+
startsAt: z.ZodString;
|
|
180
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
181
|
+
headsUpMinutes: z.ZodDefault<z.ZodNumber>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export type MaintenanceInput = z.input<typeof MaintenanceInputSchema>;
|
|
184
|
+
export type ParsedMaintenanceInput = z.output<typeof MaintenanceInputSchema>;
|
|
185
|
+
export declare const MaintenanceViewSchema: z.ZodObject<{
|
|
186
|
+
id: z.ZodString;
|
|
187
|
+
message: z.ZodString;
|
|
188
|
+
startsAt: z.ZodString;
|
|
189
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
190
|
+
headsUpMinutes: z.ZodNumber;
|
|
191
|
+
endedAt: z.ZodNullable<z.ZodString>;
|
|
192
|
+
createdBy: z.ZodString;
|
|
193
|
+
endedBy: z.ZodNullable<z.ZodString>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
export type MaintenanceView = z.infer<typeof MaintenanceViewSchema>;
|
|
196
|
+
export declare const PageSchema: <T extends z.ZodType>(item: T) => z.ZodObject<{
|
|
197
|
+
items: z.ZodArray<T>;
|
|
198
|
+
total: z.ZodNumber;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
export interface Page<T> {
|
|
201
|
+
items: T[];
|
|
202
|
+
total: number;
|
|
203
|
+
}
|
|
204
|
+
/** The 503 body as a JSON Schema, for the edge's own check (infra keeps a copy of it). */
|
|
205
|
+
export declare const maintenanceJsonSchema: () => object;
|
|
206
|
+
export declare const isMaintenanceBody: (value: unknown) => value is MaintenanceBody;
|
|
207
|
+
/**
|
|
208
|
+
* The link to render, or null: https only, checked again where it is shown, so a link that
|
|
209
|
+
* reached the data some other way (a script, a future route) is never an anchor. Anything
|
|
210
|
+
* else is shown as no link at all.
|
|
211
|
+
*/
|
|
212
|
+
export declare const httpsLink: (url: string | null | undefined) => string | null;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var index_exports = {};
|
|
19
|
+
__export(index_exports, {
|
|
20
|
+
AlertSchema: () => AlertSchema,
|
|
21
|
+
AnnouncementInputSchema: () => AnnouncementInputSchema,
|
|
22
|
+
AnnouncementViewSchema: () => AnnouncementViewSchema,
|
|
23
|
+
BODY_MAX: () => BODY_MAX,
|
|
24
|
+
CHANNELS: () => CHANNELS,
|
|
25
|
+
COUNTRIES_MAX: () => COUNTRIES_MAX,
|
|
26
|
+
HEADS_UP_DEFAULT_MINUTES: () => HEADS_UP_DEFAULT_MINUTES,
|
|
27
|
+
HEADS_UP_MAX_MINUTES: () => HEADS_UP_MAX_MINUTES,
|
|
28
|
+
LINK_LABEL_MAX: () => LINK_LABEL_MAX,
|
|
29
|
+
LINK_MAX: () => LINK_MAX,
|
|
30
|
+
MESSAGE_MAX: () => MESSAGE_MAX,
|
|
31
|
+
MaintenanceBodySchema: () => MaintenanceBodySchema,
|
|
32
|
+
MaintenanceInfoSchema: () => MaintenanceInfoSchema,
|
|
33
|
+
MaintenanceInputSchema: () => MaintenanceInputSchema,
|
|
34
|
+
MaintenanceViewSchema: () => MaintenanceViewSchema,
|
|
35
|
+
PLANS_MAX: () => PLANS_MAX,
|
|
36
|
+
PLAN_CODE_MAX: () => PLAN_CODE_MAX,
|
|
37
|
+
PLATFORMS: () => PLATFORMS,
|
|
38
|
+
PageSchema: () => PageSchema,
|
|
39
|
+
SEVERITIES: () => SEVERITIES,
|
|
40
|
+
SegmentsSchema: () => SegmentsSchema,
|
|
41
|
+
StatusSchema: () => StatusSchema,
|
|
42
|
+
TITLE_MAX: () => TITLE_MAX,
|
|
43
|
+
httpsLink: () => httpsLink,
|
|
44
|
+
isMaintenanceBody: () => isMaintenanceBody,
|
|
45
|
+
maintenanceJsonSchema: () => maintenanceJsonSchema
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(index_exports);
|
|
48
|
+
var import_zod = require("zod");
|
|
49
|
+
const SEVERITIES = ["INFO", "WARN", "CRITICAL"];
|
|
50
|
+
const PLATFORMS = ["SHOPIFY", "DASHBOARD"];
|
|
51
|
+
const CHANNELS = ["INBOX", "PUSH", "EMAIL"];
|
|
52
|
+
const TITLE_MAX = 120;
|
|
53
|
+
const BODY_MAX = 1e3;
|
|
54
|
+
const MESSAGE_MAX = 500;
|
|
55
|
+
const HEADS_UP_DEFAULT_MINUTES = 1440;
|
|
56
|
+
const HEADS_UP_MAX_MINUTES = 10080;
|
|
57
|
+
const LINK_LABEL_MAX = 60;
|
|
58
|
+
const LINK_MAX = 2048;
|
|
59
|
+
const PLAN_CODE_MAX = 64;
|
|
60
|
+
const PLANS_MAX = 50;
|
|
61
|
+
const COUNTRIES_MAX = 250;
|
|
62
|
+
const iso = import_zod.z.string().datetime({ offset: true });
|
|
63
|
+
const SegmentsSchema = import_zod.z.object({
|
|
64
|
+
plans: import_zod.z.array(import_zod.z.string()),
|
|
65
|
+
platforms: import_zod.z.array(import_zod.z.enum(PLATFORMS)),
|
|
66
|
+
countries: import_zod.z.array(import_zod.z.string())
|
|
67
|
+
});
|
|
68
|
+
const AlertSchema = import_zod.z.object({
|
|
69
|
+
id: import_zod.z.string(),
|
|
70
|
+
title: import_zod.z.string(),
|
|
71
|
+
body: import_zod.z.string(),
|
|
72
|
+
severity: import_zod.z.enum(SEVERITIES),
|
|
73
|
+
linkUrl: import_zod.z.string().nullable(),
|
|
74
|
+
linkLabel: import_zod.z.string().nullable(),
|
|
75
|
+
dismissible: import_zod.z.boolean(),
|
|
76
|
+
startsAt: iso,
|
|
77
|
+
endsAt: iso.nullable(),
|
|
78
|
+
/** Only on a scheduled-maintenance heads-up: the window it warns about. */
|
|
79
|
+
window: import_zod.z.object({ startsAt: iso, endsAt: iso.nullable() }).nullable()
|
|
80
|
+
});
|
|
81
|
+
const MaintenanceInfoSchema = import_zod.z.object({
|
|
82
|
+
layer: import_zod.z.enum(["infra", "app"]),
|
|
83
|
+
message: import_zod.z.string(),
|
|
84
|
+
/** ISO 8601, or null when nobody said. */
|
|
85
|
+
until: iso.nullable()
|
|
86
|
+
});
|
|
87
|
+
const MaintenanceBodySchema = import_zod.z.object({ maintenance: MaintenanceInfoSchema });
|
|
88
|
+
const StatusSchema = import_zod.z.object({
|
|
89
|
+
maintenance: MaintenanceInfoSchema.nullable(),
|
|
90
|
+
alerts: import_zod.z.array(AlertSchema)
|
|
91
|
+
});
|
|
92
|
+
const AnnouncementInputSchema = import_zod.z.object({
|
|
93
|
+
title: import_zod.z.string(),
|
|
94
|
+
body: import_zod.z.string(),
|
|
95
|
+
severity: import_zod.z.enum(SEVERITIES),
|
|
96
|
+
linkUrl: import_zod.z.string().nullish(),
|
|
97
|
+
linkLabel: import_zod.z.string().nullish(),
|
|
98
|
+
dismissible: import_zod.z.boolean().default(true),
|
|
99
|
+
startsAt: iso,
|
|
100
|
+
endsAt: iso.nullish(),
|
|
101
|
+
segments: SegmentsSchema,
|
|
102
|
+
notify: import_zod.z.boolean(),
|
|
103
|
+
channels: import_zod.z.array(import_zod.z.enum(CHANNELS))
|
|
104
|
+
});
|
|
105
|
+
const AnnouncementViewSchema = AlertSchema.extend({
|
|
106
|
+
segments: SegmentsSchema,
|
|
107
|
+
notify: import_zod.z.boolean(),
|
|
108
|
+
channels: import_zod.z.array(import_zod.z.enum(CHANNELS)),
|
|
109
|
+
notifiedAt: iso.nullable(),
|
|
110
|
+
cancelledAt: iso.nullable(),
|
|
111
|
+
createdBy: import_zod.z.string(),
|
|
112
|
+
updatedAt: iso
|
|
113
|
+
});
|
|
114
|
+
const MaintenanceInputSchema = import_zod.z.object({
|
|
115
|
+
message: import_zod.z.string(),
|
|
116
|
+
/** At or before now means "start now", on the server's clock. */
|
|
117
|
+
startsAt: iso,
|
|
118
|
+
/** Null: until somebody ends it. */
|
|
119
|
+
endsAt: iso.nullable(),
|
|
120
|
+
headsUpMinutes: import_zod.z.number().int().nonnegative().default(HEADS_UP_DEFAULT_MINUTES)
|
|
121
|
+
});
|
|
122
|
+
const MaintenanceViewSchema = import_zod.z.object({
|
|
123
|
+
id: import_zod.z.string(),
|
|
124
|
+
message: import_zod.z.string(),
|
|
125
|
+
startsAt: iso,
|
|
126
|
+
endsAt: iso.nullable(),
|
|
127
|
+
headsUpMinutes: import_zod.z.number().int(),
|
|
128
|
+
endedAt: iso.nullable(),
|
|
129
|
+
createdBy: import_zod.z.string(),
|
|
130
|
+
endedBy: import_zod.z.string().nullable()
|
|
131
|
+
});
|
|
132
|
+
const PageSchema = (item) => import_zod.z.object({ items: import_zod.z.array(item), total: import_zod.z.number().int() });
|
|
133
|
+
const maintenanceJsonSchema = () => import_zod.z.toJSONSchema(MaintenanceBodySchema);
|
|
134
|
+
const isMaintenanceBody = (value) => MaintenanceBodySchema.safeParse(value).success;
|
|
135
|
+
const httpsLink = (url) => {
|
|
136
|
+
if (!url)
|
|
137
|
+
return null;
|
|
138
|
+
try {
|
|
139
|
+
return new URL(url).protocol === "https:" ? url : null;
|
|
140
|
+
} catch {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
145
|
+
0 && (module.exports = {
|
|
146
|
+
AlertSchema,
|
|
147
|
+
AnnouncementInputSchema,
|
|
148
|
+
AnnouncementViewSchema,
|
|
149
|
+
BODY_MAX,
|
|
150
|
+
CHANNELS,
|
|
151
|
+
COUNTRIES_MAX,
|
|
152
|
+
HEADS_UP_DEFAULT_MINUTES,
|
|
153
|
+
HEADS_UP_MAX_MINUTES,
|
|
154
|
+
LINK_LABEL_MAX,
|
|
155
|
+
LINK_MAX,
|
|
156
|
+
MESSAGE_MAX,
|
|
157
|
+
MaintenanceBodySchema,
|
|
158
|
+
MaintenanceInfoSchema,
|
|
159
|
+
MaintenanceInputSchema,
|
|
160
|
+
MaintenanceViewSchema,
|
|
161
|
+
PLANS_MAX,
|
|
162
|
+
PLAN_CODE_MAX,
|
|
163
|
+
PLATFORMS,
|
|
164
|
+
PageSchema,
|
|
165
|
+
SEVERITIES,
|
|
166
|
+
SegmentsSchema,
|
|
167
|
+
StatusSchema,
|
|
168
|
+
TITLE_MAX,
|
|
169
|
+
httpsLink,
|
|
170
|
+
isMaintenanceBody,
|
|
171
|
+
maintenanceJsonSchema
|
|
172
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* What every surface and the edge agree on: announcements (the alert bar, optionally
|
|
4
|
+
* notified), app-layer maintenance windows, the status an app reads, and the 503 body both
|
|
5
|
+
* maintenance layers answer with. Browser-safe: zod only.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SEVERITIES: readonly ["INFO", "WARN", "CRITICAL"];
|
|
8
|
+
export type Severity = (typeof SEVERITIES)[number];
|
|
9
|
+
/** How an organization uses the app: a connected Shopify store, the web dashboard, or both. */
|
|
10
|
+
export declare const PLATFORMS: readonly ["SHOPIFY", "DASHBOARD"];
|
|
11
|
+
export type Platform = (typeof PLATFORMS)[number];
|
|
12
|
+
/** Where a notified announcement goes. INBOX is always on when an announcement is notified. */
|
|
13
|
+
export declare const CHANNELS: readonly ["INBOX", "PUSH", "EMAIL"];
|
|
14
|
+
export type Channel = (typeof CHANNELS)[number];
|
|
15
|
+
export declare const TITLE_MAX = 120;
|
|
16
|
+
export declare const BODY_MAX = 1000;
|
|
17
|
+
export declare const MESSAGE_MAX = 500;
|
|
18
|
+
export declare const HEADS_UP_DEFAULT_MINUTES = 1440;
|
|
19
|
+
/** A week: the longest warning ahead of maintenance. */
|
|
20
|
+
export declare const HEADS_UP_MAX_MINUTES = 10080;
|
|
21
|
+
export declare const LINK_LABEL_MAX = 60;
|
|
22
|
+
export declare const LINK_MAX = 2048;
|
|
23
|
+
export declare const PLAN_CODE_MAX = 64;
|
|
24
|
+
export declare const PLANS_MAX = 50;
|
|
25
|
+
export declare const COUNTRIES_MAX = 250;
|
|
26
|
+
/** Who an announcement is for: an AND of three lists, each empty meaning everyone. */
|
|
27
|
+
export declare const SegmentsSchema: z.ZodObject<{
|
|
28
|
+
plans: z.ZodArray<z.ZodString>;
|
|
29
|
+
platforms: z.ZodArray<z.ZodEnum<{
|
|
30
|
+
SHOPIFY: "SHOPIFY";
|
|
31
|
+
DASHBOARD: "DASHBOARD";
|
|
32
|
+
}>>;
|
|
33
|
+
countries: z.ZodArray<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type Segments = z.infer<typeof SegmentsSchema>;
|
|
36
|
+
/** One alert as a viewer receives it. Who it is for stays on the server. */
|
|
37
|
+
export declare const AlertSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
title: z.ZodString;
|
|
40
|
+
body: z.ZodString;
|
|
41
|
+
severity: z.ZodEnum<{
|
|
42
|
+
INFO: "INFO";
|
|
43
|
+
WARN: "WARN";
|
|
44
|
+
CRITICAL: "CRITICAL";
|
|
45
|
+
}>;
|
|
46
|
+
linkUrl: z.ZodNullable<z.ZodString>;
|
|
47
|
+
linkLabel: z.ZodNullable<z.ZodString>;
|
|
48
|
+
dismissible: z.ZodBoolean;
|
|
49
|
+
startsAt: z.ZodString;
|
|
50
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
51
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
52
|
+
startsAt: z.ZodString;
|
|
53
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type Alert = z.infer<typeof AlertSchema>;
|
|
57
|
+
/** What a 503 says while the platform is down: the edge's switch (`infra`) or the app's (`app`). */
|
|
58
|
+
export declare const MaintenanceInfoSchema: z.ZodObject<{
|
|
59
|
+
layer: z.ZodEnum<{
|
|
60
|
+
infra: "infra";
|
|
61
|
+
app: "app";
|
|
62
|
+
}>;
|
|
63
|
+
message: z.ZodString;
|
|
64
|
+
until: z.ZodNullable<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type MaintenanceInfo = z.infer<typeof MaintenanceInfoSchema>;
|
|
67
|
+
export declare const MaintenanceBodySchema: z.ZodObject<{
|
|
68
|
+
maintenance: z.ZodObject<{
|
|
69
|
+
layer: z.ZodEnum<{
|
|
70
|
+
infra: "infra";
|
|
71
|
+
app: "app";
|
|
72
|
+
}>;
|
|
73
|
+
message: z.ZodString;
|
|
74
|
+
until: z.ZodNullable<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type MaintenanceBody = z.infer<typeof MaintenanceBodySchema>;
|
|
78
|
+
export declare const StatusSchema: z.ZodObject<{
|
|
79
|
+
maintenance: z.ZodNullable<z.ZodObject<{
|
|
80
|
+
layer: z.ZodEnum<{
|
|
81
|
+
infra: "infra";
|
|
82
|
+
app: "app";
|
|
83
|
+
}>;
|
|
84
|
+
message: z.ZodString;
|
|
85
|
+
until: z.ZodNullable<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
alerts: z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
title: z.ZodString;
|
|
90
|
+
body: z.ZodString;
|
|
91
|
+
severity: z.ZodEnum<{
|
|
92
|
+
INFO: "INFO";
|
|
93
|
+
WARN: "WARN";
|
|
94
|
+
CRITICAL: "CRITICAL";
|
|
95
|
+
}>;
|
|
96
|
+
linkUrl: z.ZodNullable<z.ZodString>;
|
|
97
|
+
linkLabel: z.ZodNullable<z.ZodString>;
|
|
98
|
+
dismissible: z.ZodBoolean;
|
|
99
|
+
startsAt: z.ZodString;
|
|
100
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
101
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
102
|
+
startsAt: z.ZodString;
|
|
103
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type Status = z.infer<typeof StatusSchema>;
|
|
108
|
+
export declare const AnnouncementInputSchema: z.ZodObject<{
|
|
109
|
+
title: z.ZodString;
|
|
110
|
+
body: z.ZodString;
|
|
111
|
+
severity: z.ZodEnum<{
|
|
112
|
+
INFO: "INFO";
|
|
113
|
+
WARN: "WARN";
|
|
114
|
+
CRITICAL: "CRITICAL";
|
|
115
|
+
}>;
|
|
116
|
+
linkUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
+
linkLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
dismissible: z.ZodDefault<z.ZodBoolean>;
|
|
119
|
+
startsAt: z.ZodString;
|
|
120
|
+
endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
121
|
+
segments: z.ZodObject<{
|
|
122
|
+
plans: z.ZodArray<z.ZodString>;
|
|
123
|
+
platforms: z.ZodArray<z.ZodEnum<{
|
|
124
|
+
SHOPIFY: "SHOPIFY";
|
|
125
|
+
DASHBOARD: "DASHBOARD";
|
|
126
|
+
}>>;
|
|
127
|
+
countries: z.ZodArray<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
notify: z.ZodBoolean;
|
|
130
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
131
|
+
INBOX: "INBOX";
|
|
132
|
+
PUSH: "PUSH";
|
|
133
|
+
EMAIL: "EMAIL";
|
|
134
|
+
}>>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
export type AnnouncementInput = z.input<typeof AnnouncementInputSchema>;
|
|
137
|
+
export type ParsedAnnouncementInput = z.output<typeof AnnouncementInputSchema>;
|
|
138
|
+
/** An announcement as staff see it: what viewers see, plus who it is for and its notify state. */
|
|
139
|
+
export declare const AnnouncementViewSchema: z.ZodObject<{
|
|
140
|
+
id: z.ZodString;
|
|
141
|
+
title: z.ZodString;
|
|
142
|
+
body: z.ZodString;
|
|
143
|
+
severity: z.ZodEnum<{
|
|
144
|
+
INFO: "INFO";
|
|
145
|
+
WARN: "WARN";
|
|
146
|
+
CRITICAL: "CRITICAL";
|
|
147
|
+
}>;
|
|
148
|
+
linkUrl: z.ZodNullable<z.ZodString>;
|
|
149
|
+
linkLabel: z.ZodNullable<z.ZodString>;
|
|
150
|
+
dismissible: z.ZodBoolean;
|
|
151
|
+
startsAt: z.ZodString;
|
|
152
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
153
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
154
|
+
startsAt: z.ZodString;
|
|
155
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
segments: z.ZodObject<{
|
|
158
|
+
plans: z.ZodArray<z.ZodString>;
|
|
159
|
+
platforms: z.ZodArray<z.ZodEnum<{
|
|
160
|
+
SHOPIFY: "SHOPIFY";
|
|
161
|
+
DASHBOARD: "DASHBOARD";
|
|
162
|
+
}>>;
|
|
163
|
+
countries: z.ZodArray<z.ZodString>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
notify: z.ZodBoolean;
|
|
166
|
+
channels: z.ZodArray<z.ZodEnum<{
|
|
167
|
+
INBOX: "INBOX";
|
|
168
|
+
PUSH: "PUSH";
|
|
169
|
+
EMAIL: "EMAIL";
|
|
170
|
+
}>>;
|
|
171
|
+
notifiedAt: z.ZodNullable<z.ZodString>;
|
|
172
|
+
cancelledAt: z.ZodNullable<z.ZodString>;
|
|
173
|
+
createdBy: z.ZodString;
|
|
174
|
+
updatedAt: z.ZodString;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
export type AnnouncementView = z.infer<typeof AnnouncementViewSchema>;
|
|
177
|
+
export declare const MaintenanceInputSchema: z.ZodObject<{
|
|
178
|
+
message: z.ZodString;
|
|
179
|
+
startsAt: z.ZodString;
|
|
180
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
181
|
+
headsUpMinutes: z.ZodDefault<z.ZodNumber>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export type MaintenanceInput = z.input<typeof MaintenanceInputSchema>;
|
|
184
|
+
export type ParsedMaintenanceInput = z.output<typeof MaintenanceInputSchema>;
|
|
185
|
+
export declare const MaintenanceViewSchema: z.ZodObject<{
|
|
186
|
+
id: z.ZodString;
|
|
187
|
+
message: z.ZodString;
|
|
188
|
+
startsAt: z.ZodString;
|
|
189
|
+
endsAt: z.ZodNullable<z.ZodString>;
|
|
190
|
+
headsUpMinutes: z.ZodNumber;
|
|
191
|
+
endedAt: z.ZodNullable<z.ZodString>;
|
|
192
|
+
createdBy: z.ZodString;
|
|
193
|
+
endedBy: z.ZodNullable<z.ZodString>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
export type MaintenanceView = z.infer<typeof MaintenanceViewSchema>;
|
|
196
|
+
export declare const PageSchema: <T extends z.ZodType>(item: T) => z.ZodObject<{
|
|
197
|
+
items: z.ZodArray<T>;
|
|
198
|
+
total: z.ZodNumber;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
export interface Page<T> {
|
|
201
|
+
items: T[];
|
|
202
|
+
total: number;
|
|
203
|
+
}
|
|
204
|
+
/** The 503 body as a JSON Schema, for the edge's own check (infra keeps a copy of it). */
|
|
205
|
+
export declare const maintenanceJsonSchema: () => object;
|
|
206
|
+
export declare const isMaintenanceBody: (value: unknown) => value is MaintenanceBody;
|
|
207
|
+
/**
|
|
208
|
+
* The link to render, or null: https only, checked again where it is shown, so a link that
|
|
209
|
+
* reached the data some other way (a script, a future route) is never an anchor. Anything
|
|
210
|
+
* else is shown as no link at all.
|
|
211
|
+
*/
|
|
212
|
+
export declare const httpsLink: (url: string | null | undefined) => string | null;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* What every surface and the edge agree on: announcements (the alert bar, optionally
|
|
4
|
+
* notified), app-layer maintenance windows, the status an app reads, and the 503 body both
|
|
5
|
+
* maintenance layers answer with. Browser-safe: zod only.
|
|
6
|
+
*/
|
|
7
|
+
export const SEVERITIES = ['INFO', 'WARN', 'CRITICAL'];
|
|
8
|
+
/** How an organization uses the app: a connected Shopify store, the web dashboard, or both. */
|
|
9
|
+
export const PLATFORMS = ['SHOPIFY', 'DASHBOARD'];
|
|
10
|
+
/** Where a notified announcement goes. INBOX is always on when an announcement is notified. */
|
|
11
|
+
export const CHANNELS = ['INBOX', 'PUSH', 'EMAIL'];
|
|
12
|
+
export const TITLE_MAX = 120;
|
|
13
|
+
export const BODY_MAX = 1000;
|
|
14
|
+
export const MESSAGE_MAX = 500;
|
|
15
|
+
export const HEADS_UP_DEFAULT_MINUTES = 1440;
|
|
16
|
+
/** A week: the longest warning ahead of maintenance. */
|
|
17
|
+
export const HEADS_UP_MAX_MINUTES = 10_080;
|
|
18
|
+
export const LINK_LABEL_MAX = 60;
|
|
19
|
+
export const LINK_MAX = 2048;
|
|
20
|
+
export const PLAN_CODE_MAX = 64;
|
|
21
|
+
export const PLANS_MAX = 50;
|
|
22
|
+
export const COUNTRIES_MAX = 250;
|
|
23
|
+
const iso = z.string().datetime({ offset: true });
|
|
24
|
+
/** Who an announcement is for: an AND of three lists, each empty meaning everyone. */
|
|
25
|
+
export const SegmentsSchema = z.object({
|
|
26
|
+
plans: z.array(z.string()),
|
|
27
|
+
platforms: z.array(z.enum(PLATFORMS)),
|
|
28
|
+
countries: z.array(z.string()),
|
|
29
|
+
});
|
|
30
|
+
/** One alert as a viewer receives it. Who it is for stays on the server. */
|
|
31
|
+
export const AlertSchema = z.object({
|
|
32
|
+
id: z.string(),
|
|
33
|
+
title: z.string(),
|
|
34
|
+
body: z.string(),
|
|
35
|
+
severity: z.enum(SEVERITIES),
|
|
36
|
+
linkUrl: z.string().nullable(),
|
|
37
|
+
linkLabel: z.string().nullable(),
|
|
38
|
+
dismissible: z.boolean(),
|
|
39
|
+
startsAt: iso,
|
|
40
|
+
endsAt: iso.nullable(),
|
|
41
|
+
/** Only on a scheduled-maintenance heads-up: the window it warns about. */
|
|
42
|
+
window: z.object({ startsAt: iso, endsAt: iso.nullable() }).nullable(),
|
|
43
|
+
});
|
|
44
|
+
/** What a 503 says while the platform is down: the edge's switch (`infra`) or the app's (`app`). */
|
|
45
|
+
export const MaintenanceInfoSchema = z.object({
|
|
46
|
+
layer: z.enum(['infra', 'app']),
|
|
47
|
+
message: z.string(),
|
|
48
|
+
/** ISO 8601, or null when nobody said. */
|
|
49
|
+
until: iso.nullable(),
|
|
50
|
+
});
|
|
51
|
+
export const MaintenanceBodySchema = z.object({ maintenance: MaintenanceInfoSchema });
|
|
52
|
+
export const StatusSchema = z.object({
|
|
53
|
+
maintenance: MaintenanceInfoSchema.nullable(),
|
|
54
|
+
alerts: z.array(AlertSchema),
|
|
55
|
+
});
|
|
56
|
+
export const AnnouncementInputSchema = z.object({
|
|
57
|
+
title: z.string(),
|
|
58
|
+
body: z.string(),
|
|
59
|
+
severity: z.enum(SEVERITIES),
|
|
60
|
+
linkUrl: z.string().nullish(),
|
|
61
|
+
linkLabel: z.string().nullish(),
|
|
62
|
+
dismissible: z.boolean().default(true),
|
|
63
|
+
startsAt: iso,
|
|
64
|
+
endsAt: iso.nullish(),
|
|
65
|
+
segments: SegmentsSchema,
|
|
66
|
+
notify: z.boolean(),
|
|
67
|
+
channels: z.array(z.enum(CHANNELS)),
|
|
68
|
+
});
|
|
69
|
+
/** An announcement as staff see it: what viewers see, plus who it is for and its notify state. */
|
|
70
|
+
export const AnnouncementViewSchema = AlertSchema.extend({
|
|
71
|
+
segments: SegmentsSchema,
|
|
72
|
+
notify: z.boolean(),
|
|
73
|
+
channels: z.array(z.enum(CHANNELS)),
|
|
74
|
+
notifiedAt: iso.nullable(),
|
|
75
|
+
cancelledAt: iso.nullable(),
|
|
76
|
+
createdBy: z.string(),
|
|
77
|
+
updatedAt: iso,
|
|
78
|
+
});
|
|
79
|
+
export const MaintenanceInputSchema = z.object({
|
|
80
|
+
message: z.string(),
|
|
81
|
+
/** At or before now means "start now", on the server's clock. */
|
|
82
|
+
startsAt: iso,
|
|
83
|
+
/** Null: until somebody ends it. */
|
|
84
|
+
endsAt: iso.nullable(),
|
|
85
|
+
headsUpMinutes: z.number().int().nonnegative().default(HEADS_UP_DEFAULT_MINUTES),
|
|
86
|
+
});
|
|
87
|
+
export const MaintenanceViewSchema = z.object({
|
|
88
|
+
id: z.string(),
|
|
89
|
+
message: z.string(),
|
|
90
|
+
startsAt: iso,
|
|
91
|
+
endsAt: iso.nullable(),
|
|
92
|
+
headsUpMinutes: z.number().int(),
|
|
93
|
+
endedAt: iso.nullable(),
|
|
94
|
+
createdBy: z.string(),
|
|
95
|
+
endedBy: z.string().nullable(),
|
|
96
|
+
});
|
|
97
|
+
export const PageSchema = (item) => z.object({ items: z.array(item), total: z.number().int() });
|
|
98
|
+
/** The 503 body as a JSON Schema, for the edge's own check (infra keeps a copy of it). */
|
|
99
|
+
export const maintenanceJsonSchema = () => z.toJSONSchema(MaintenanceBodySchema);
|
|
100
|
+
export const isMaintenanceBody = (value) => MaintenanceBodySchema.safeParse(value).success;
|
|
101
|
+
/**
|
|
102
|
+
* The link to render, or null: https only, checked again where it is shown, so a link that
|
|
103
|
+
* reached the data some other way (a script, a future route) is never an anchor. Anything
|
|
104
|
+
* else is shown as no link at all.
|
|
105
|
+
*/
|
|
106
|
+
export const httpsLink = (url) => {
|
|
107
|
+
if (!url)
|
|
108
|
+
return null;
|
|
109
|
+
try {
|
|
110
|
+
return new URL(url).protocol === 'https:' ? url : null;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU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AC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"maintenance": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"layer": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["infra", "app"]
|
|
11
|
+
},
|
|
12
|
+
"message": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"until": {
|
|
16
|
+
"anyOf": [
|
|
17
|
+
{
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "date-time",
|
|
20
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"type": "null"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": ["layer", "message", "until"],
|
|
29
|
+
"additionalProperties": false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["maintenance"],
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haatlabs-core/announcements-contracts",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.27.1",
|
|
4
|
+
"description": "Announcement, maintenance and status schemas shared by an app's API, web pages, extensions and edge.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"haatlabs",
|
|
7
|
+
"announcements",
|
|
8
|
+
"maintenance"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://haatlabs.shop/docs/packages/announcements-contracts/",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=24"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/Haatlabs/haatlabs-platform.git",
|
|
19
|
+
"directory": "packages/announcements-contracts"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public",
|
|
23
|
+
"registry": "https://registry.npmjs.org"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"maintenance.schema.json"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/cjs/index.d.ts",
|
|
37
|
+
"default": "./dist/cjs/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"./maintenance.schema.json": "./maintenance.schema.json"
|
|
41
|
+
},
|
|
42
|
+
"haatlabs": {
|
|
43
|
+
"browser": [
|
|
44
|
+
"."
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"zod": "^4.6.5"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"zod": "^4.6.5",
|
|
52
|
+
"@haatlabs-core/tsconfig": "0.27.1",
|
|
53
|
+
"@haatlabs-core/vitest-config": "0.27.1"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && node ../../scripts/build-cjs.mjs",
|
|
57
|
+
"typecheck": "tsc --noEmit",
|
|
58
|
+
"test": "vitest run --typecheck",
|
|
59
|
+
"check:package": "publint --strict && attw --pack . --profile node16",
|
|
60
|
+
"schema": "node scripts/write-schema.mjs"
|
|
61
|
+
},
|
|
62
|
+
"platformRegistry": "npm"
|
|
63
|
+
}
|