@noodleseed/one 0.172.1 → 0.174.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/dist/commands/solutions-draft-source.d.ts +9 -0
- package/dist/commands/solutions-draft-source.d.ts.map +1 -0
- package/dist/commands/solutions-draft-source.js +67 -0
- package/dist/commands/solutions-draft-source.js.map +1 -0
- package/dist/commands/solutions-drafts.d.ts +5 -0
- package/dist/commands/solutions-drafts.d.ts.map +1 -0
- package/dist/commands/solutions-drafts.js +159 -0
- package/dist/commands/solutions-drafts.js.map +1 -0
- package/dist/commands/solutions-ops-args.d.ts +42 -0
- package/dist/commands/solutions-ops-args.d.ts.map +1 -0
- package/dist/commands/solutions-ops-args.js +47 -0
- package/dist/commands/solutions-ops-args.js.map +1 -0
- package/dist/commands/solutions-ops.d.ts.map +1 -1
- package/dist/commands/solutions-ops.js +12 -46
- package/dist/commands/solutions-ops.js.map +1 -1
- package/dist/commands/solutions-page.d.ts +5 -0
- package/dist/commands/solutions-page.d.ts.map +1 -0
- package/dist/commands/solutions-page.js +85 -0
- package/dist/commands/solutions-page.js.map +1 -0
- package/dist/commands/solutions-workspace.d.ts +5 -0
- package/dist/commands/solutions-workspace.d.ts.map +1 -0
- package/dist/commands/solutions-workspace.js +132 -0
- package/dist/commands/solutions-workspace.js.map +1 -0
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solution-drafts.js +141 -0
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solution-page.js +57 -0
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solution-workspace.js +88 -0
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solutions.js +6 -0
- package/node_modules/@noodle-borg/service/dist/application-drafts/contracts.js +11 -0
- package/node_modules/@noodle-borg/service/dist/application-drafts/paths.js +26 -0
- package/node_modules/@noodle-borg/service/dist/business-information/business-page-paths.js +14 -0
- package/node_modules/@noodle-borg/service/dist/business-information/business-page.d.ts +39 -0
- package/node_modules/@noodle-borg/service/dist/business-information/business-page.js +81 -0
- package/node_modules/@noodle-borg/service/dist/business-information/contracts.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/business-information/in-memory-business-pages.js +37 -0
- package/node_modules/@noodle-borg/service/dist/business-information/in-memory-store.js +3 -0
- package/node_modules/@noodle-borg/service/dist/business-information/managed-solution-executable.js +11 -3
- package/node_modules/@noodle-borg/service/dist/business-workspaces/contracts.js +52 -0
- package/node_modules/@noodle-borg/service/dist/business-workspaces/paths.js +17 -0
- package/node_modules/@noodle-borg/service/dist/routes/application-drafts.js +162 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-authoring-dispatch.js +23 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-channels.js +3 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-dispatch.js +16 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-pages.js +158 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-workspaces.js +106 -0
- package/node_modules/@noodle-borg/service/dist/routes/service-probes.js +32 -0
- package/node_modules/@noodle-borg/service/dist/service.js +20 -18
- package/node_modules/@noodle-borg/service/dist/solution-installation-activation.js +3 -3
- package/node_modules/@noodle-borg/wire-contracts/dist/application-channels.d.ts +3 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-channels.js +1 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-drafts.d.ts +322 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-drafts.js +152 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/billing-org-transfer.d.ts +8 -8
- package/node_modules/@noodle-borg/wire-contracts/dist/billing-read.d.ts +5 -5
- package/node_modules/@noodle-borg/wire-contracts/dist/business-page.d.ts +157 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/business-page.js +105 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/business-workspaces.d.ts +210 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/business-workspaces.js +102 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/distribution.d.ts +10 -10
- package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts +3 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/index.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Bounded browser-authoring input; not the compiled deployment artifact allowance. */
|
|
3
|
+
export const APPLICATION_DRAFT_LIMITS = Object.freeze({
|
|
4
|
+
draftsPerApp: 10,
|
|
5
|
+
draftsPerWorkspace: 50,
|
|
6
|
+
sourceBytesPerWorkspace: 32 * 1024 * 1024,
|
|
7
|
+
receiptsPerWorkspace: 10_000,
|
|
8
|
+
retryWindowMs: 24 * 60 * 60 * 1000,
|
|
9
|
+
revisionsPerDraft: 100,
|
|
10
|
+
files: 64,
|
|
11
|
+
pathChars: 240,
|
|
12
|
+
fileBytes: 256 * 1024,
|
|
13
|
+
totalBytes: 1024 * 1024,
|
|
14
|
+
});
|
|
15
|
+
const sourcePath = z
|
|
16
|
+
.string()
|
|
17
|
+
.max(APPLICATION_DRAFT_LIMITS.pathChars)
|
|
18
|
+
.regex(/^(?:[A-Za-z0-9_][A-Za-z0-9_.-]*\/)*[A-Za-z0-9_][A-Za-z0-9_.-]*\.(?:ts|tsx|css)$/);
|
|
19
|
+
const sourceText = z
|
|
20
|
+
.string()
|
|
21
|
+
.max(APPLICATION_DRAFT_LIMITS.fileBytes)
|
|
22
|
+
.refine((value) => new TextEncoder().encode(value).byteLength <= APPLICATION_DRAFT_LIMITS.fileBytes, 'Source file exceeds the UTF-8 byte allowance');
|
|
23
|
+
function sourceSchema(additive) {
|
|
24
|
+
const object = additive ? z.object : z.strictObject;
|
|
25
|
+
return object({
|
|
26
|
+
entrypoint: sourcePath.refine((path) => /\.tsx?$/.test(path), 'Entrypoint must be TypeScript'),
|
|
27
|
+
files: z
|
|
28
|
+
.array(object({ path: sourcePath, content: sourceText }))
|
|
29
|
+
.min(1)
|
|
30
|
+
.max(APPLICATION_DRAFT_LIMITS.files),
|
|
31
|
+
}).superRefine((source, context) => {
|
|
32
|
+
const paths = source.files.map((file) => file.path);
|
|
33
|
+
if (new Set(paths).size !== paths.length) {
|
|
34
|
+
context.addIssue({ code: 'custom', message: 'Source paths must be unique', path: ['files'] });
|
|
35
|
+
}
|
|
36
|
+
if (!paths.includes(source.entrypoint)) {
|
|
37
|
+
context.addIssue({ code: 'custom', message: 'Entrypoint must exist', path: ['entrypoint'] });
|
|
38
|
+
}
|
|
39
|
+
const bytes = source.files.reduce((total, file) => total + new TextEncoder().encode(file.content).byteLength, 0);
|
|
40
|
+
if (bytes > APPLICATION_DRAFT_LIMITS.totalBytes) {
|
|
41
|
+
context.addIssue({
|
|
42
|
+
code: 'custom',
|
|
43
|
+
message: 'Draft source exceeds the byte allowance',
|
|
44
|
+
path: ['files'],
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export const ApplicationDraftSourceSchema = sourceSchema(false);
|
|
50
|
+
export const ApplicationDraftIdSchema = z.string().uuid();
|
|
51
|
+
const revision = z.number().int().positive().max(2147483647);
|
|
52
|
+
const digest = z.string().regex(/^[a-f0-9]{64}$/);
|
|
53
|
+
const environment = z.string().regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/);
|
|
54
|
+
export const ApplicationDraftCreateRequestSchema = z.strictObject({
|
|
55
|
+
environment,
|
|
56
|
+
source: ApplicationDraftSourceSchema,
|
|
57
|
+
baseRelease: z.string().min(1).max(200).optional(),
|
|
58
|
+
});
|
|
59
|
+
export const ApplicationDraftEditRequestSchema = z.strictObject({
|
|
60
|
+
expectedRevision: revision,
|
|
61
|
+
source: ApplicationDraftSourceSchema,
|
|
62
|
+
});
|
|
63
|
+
export const ApplicationDraftUndoRequestSchema = z.strictObject({
|
|
64
|
+
expectedRevision: revision,
|
|
65
|
+
targetRevision: revision,
|
|
66
|
+
});
|
|
67
|
+
export const ApplicationDraftRevisionRequestSchema = z.strictObject({
|
|
68
|
+
expectedRevision: revision,
|
|
69
|
+
});
|
|
70
|
+
function draftSchema(additive) {
|
|
71
|
+
const object = additive ? z.object : z.strictObject;
|
|
72
|
+
return object({
|
|
73
|
+
id: ApplicationDraftIdSchema,
|
|
74
|
+
org: environment,
|
|
75
|
+
app: environment,
|
|
76
|
+
environment,
|
|
77
|
+
revision,
|
|
78
|
+
sourceDigest: digest,
|
|
79
|
+
source: sourceSchema(additive),
|
|
80
|
+
baseRelease: z.string().min(1).max(200).optional(),
|
|
81
|
+
createdAt: z.iso.datetime(),
|
|
82
|
+
createdBySubject: z.string().min(1).max(500),
|
|
83
|
+
updatedAt: z.iso.datetime(),
|
|
84
|
+
updatedBySubject: z.string().min(1).max(500),
|
|
85
|
+
origin: z.enum(['manual', 'guided', 'ai', 'undo', 'import']),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export const ApplicationDraftSchema = draftSchema(false);
|
|
89
|
+
export const ApplicationDraftSummarySchema = ApplicationDraftSchema.omit({ source: true });
|
|
90
|
+
export const ApplicationDraftResponseSchema = z.strictObject({
|
|
91
|
+
ok: z.literal(true),
|
|
92
|
+
data: z.strictObject({ draft: ApplicationDraftSchema }),
|
|
93
|
+
});
|
|
94
|
+
function historyResponse(additive) {
|
|
95
|
+
const object = additive ? z.object : z.strictObject;
|
|
96
|
+
return object({
|
|
97
|
+
ok: z.literal(true),
|
|
98
|
+
data: object({
|
|
99
|
+
revisions: z
|
|
100
|
+
.array(draftSchema(additive).omit({ source: true }))
|
|
101
|
+
.max(APPLICATION_DRAFT_LIMITS.revisionsPerDraft),
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export const ApplicationDraftHistoryResponseSchema = historyResponse(false);
|
|
106
|
+
export const ApplicationDraftHistoryClientResponseSchema = historyResponse(true);
|
|
107
|
+
function diffSchema(additive) {
|
|
108
|
+
const object = additive ? z.object : z.strictObject;
|
|
109
|
+
return object({
|
|
110
|
+
draftId: ApplicationDraftIdSchema,
|
|
111
|
+
fromRevision: revision,
|
|
112
|
+
toRevision: revision,
|
|
113
|
+
fromDigest: digest,
|
|
114
|
+
toDigest: digest,
|
|
115
|
+
fromEntrypoint: sourcePath,
|
|
116
|
+
toEntrypoint: sourcePath,
|
|
117
|
+
changes: z
|
|
118
|
+
.array(object({ path: sourcePath, before: sourceText.nullable(), after: sourceText.nullable() }))
|
|
119
|
+
.max(APPLICATION_DRAFT_LIMITS.files * 2),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
export const ApplicationDraftDiffSchema = diffSchema(false);
|
|
123
|
+
export const ApplicationDraftDiffResponseSchema = z.strictObject({
|
|
124
|
+
ok: z.literal(true),
|
|
125
|
+
data: z.strictObject({ diff: ApplicationDraftDiffSchema }),
|
|
126
|
+
});
|
|
127
|
+
export const ApplicationDraftDiffClientResponseSchema = z.object({
|
|
128
|
+
ok: z.literal(true),
|
|
129
|
+
data: z.object({ diff: diffSchema(true) }),
|
|
130
|
+
});
|
|
131
|
+
export const ApplicationDraftDiffRequestSchema = z.strictObject({ from: revision, to: revision });
|
|
132
|
+
export const ApplicationDraftClientResponseSchema = z.object({
|
|
133
|
+
ok: z.literal(true),
|
|
134
|
+
data: z.object({ draft: draftSchema(true) }),
|
|
135
|
+
});
|
|
136
|
+
export const ApplicationDraftListResponseSchema = z.strictObject({
|
|
137
|
+
ok: z.literal(true),
|
|
138
|
+
data: z.strictObject({
|
|
139
|
+
drafts: z
|
|
140
|
+
.array(ApplicationDraftSchema.omit({ source: true }))
|
|
141
|
+
.max(APPLICATION_DRAFT_LIMITS.draftsPerApp),
|
|
142
|
+
}),
|
|
143
|
+
});
|
|
144
|
+
export const ApplicationDraftListClientResponseSchema = z.object({
|
|
145
|
+
ok: z.literal(true),
|
|
146
|
+
data: z.object({
|
|
147
|
+
drafts: z
|
|
148
|
+
.array(draftSchema(true).omit({ source: true }))
|
|
149
|
+
.max(APPLICATION_DRAFT_LIMITS.draftsPerApp),
|
|
150
|
+
}),
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=application-drafts.js.map
|
|
@@ -94,8 +94,8 @@ export declare function createBillingOrganizationTransferSchemas(loose: boolean)
|
|
|
94
94
|
displayName: z.ZodString;
|
|
95
95
|
state: z.ZodEnum<{
|
|
96
96
|
active: "active";
|
|
97
|
-
inactive: "inactive";
|
|
98
97
|
draft: "draft";
|
|
98
|
+
inactive: "inactive";
|
|
99
99
|
}>;
|
|
100
100
|
plan: z.ZodNullable<z.ZodObject<{
|
|
101
101
|
code: z.ZodString;
|
|
@@ -153,8 +153,8 @@ export declare function createBillingOrganizationTransferSchemas(loose: boolean)
|
|
|
153
153
|
displayName: z.ZodString;
|
|
154
154
|
state: z.ZodEnum<{
|
|
155
155
|
active: "active";
|
|
156
|
-
inactive: "inactive";
|
|
157
156
|
draft: "draft";
|
|
157
|
+
inactive: "inactive";
|
|
158
158
|
}>;
|
|
159
159
|
plan: z.ZodNullable<z.ZodObject<{
|
|
160
160
|
code: z.ZodString;
|
|
@@ -240,8 +240,8 @@ export declare const BillingOrganizationTransferPreviewResponseSchema: z.ZodObje
|
|
|
240
240
|
displayName: z.ZodString;
|
|
241
241
|
state: z.ZodEnum<{
|
|
242
242
|
active: "active";
|
|
243
|
-
inactive: "inactive";
|
|
244
243
|
draft: "draft";
|
|
244
|
+
inactive: "inactive";
|
|
245
245
|
}>;
|
|
246
246
|
plan: z.ZodNullable<z.ZodObject<{
|
|
247
247
|
code: z.ZodString;
|
|
@@ -299,8 +299,8 @@ export declare const BillingOrganizationTransferApplyResponseSchema: z.ZodObject
|
|
|
299
299
|
displayName: z.ZodString;
|
|
300
300
|
state: z.ZodEnum<{
|
|
301
301
|
active: "active";
|
|
302
|
-
inactive: "inactive";
|
|
303
302
|
draft: "draft";
|
|
303
|
+
inactive: "inactive";
|
|
304
304
|
}>;
|
|
305
305
|
plan: z.ZodNullable<z.ZodObject<{
|
|
306
306
|
code: z.ZodString;
|
|
@@ -385,8 +385,8 @@ export declare const BillingOrganizationTransferPreviewClientResponseSchema: z.Z
|
|
|
385
385
|
displayName: z.ZodString;
|
|
386
386
|
state: z.ZodEnum<{
|
|
387
387
|
active: "active";
|
|
388
|
-
inactive: "inactive";
|
|
389
388
|
draft: "draft";
|
|
389
|
+
inactive: "inactive";
|
|
390
390
|
}>;
|
|
391
391
|
plan: z.ZodNullable<z.ZodObject<{
|
|
392
392
|
code: z.ZodString;
|
|
@@ -444,8 +444,8 @@ export declare const BillingOrganizationTransferApplyClientResponseSchema: z.Zod
|
|
|
444
444
|
displayName: z.ZodString;
|
|
445
445
|
state: z.ZodEnum<{
|
|
446
446
|
active: "active";
|
|
447
|
-
inactive: "inactive";
|
|
448
447
|
draft: "draft";
|
|
448
|
+
inactive: "inactive";
|
|
449
449
|
}>;
|
|
450
450
|
plan: z.ZodNullable<z.ZodObject<{
|
|
451
451
|
code: z.ZodString;
|
|
@@ -510,8 +510,8 @@ export declare const BillingOrganizationTransferArtifactSchema: z.ZodDiscriminat
|
|
|
510
510
|
displayName: z.ZodString;
|
|
511
511
|
state: z.ZodEnum<{
|
|
512
512
|
active: "active";
|
|
513
|
-
inactive: "inactive";
|
|
514
513
|
draft: "draft";
|
|
514
|
+
inactive: "inactive";
|
|
515
515
|
}>;
|
|
516
516
|
plan: z.ZodNullable<z.ZodObject<{
|
|
517
517
|
code: z.ZodString;
|
|
@@ -575,8 +575,8 @@ export declare const BillingOrganizationTransferArtifactSchema: z.ZodDiscriminat
|
|
|
575
575
|
displayName: z.ZodString;
|
|
576
576
|
state: z.ZodEnum<{
|
|
577
577
|
active: "active";
|
|
578
|
-
inactive: "inactive";
|
|
579
578
|
draft: "draft";
|
|
579
|
+
inactive: "inactive";
|
|
580
580
|
}>;
|
|
581
581
|
plan: z.ZodNullable<z.ZodObject<{
|
|
582
582
|
code: z.ZodString;
|
|
@@ -122,8 +122,8 @@ export declare const BillingAccountSummarySchema: z.ZodObject<{
|
|
|
122
122
|
displayName: z.ZodString;
|
|
123
123
|
state: z.ZodEnum<{
|
|
124
124
|
active: "active";
|
|
125
|
-
inactive: "inactive";
|
|
126
125
|
draft: "draft";
|
|
126
|
+
inactive: "inactive";
|
|
127
127
|
}>;
|
|
128
128
|
createdAt: z.ZodString;
|
|
129
129
|
role: z.ZodEnum<{
|
|
@@ -240,8 +240,8 @@ export declare const BillingAccountsListResponseSchema: z.ZodObject<{
|
|
|
240
240
|
displayName: z.ZodString;
|
|
241
241
|
state: z.ZodEnum<{
|
|
242
242
|
active: "active";
|
|
243
|
-
inactive: "inactive";
|
|
244
243
|
draft: "draft";
|
|
244
|
+
inactive: "inactive";
|
|
245
245
|
}>;
|
|
246
246
|
createdAt: z.ZodString;
|
|
247
247
|
role: z.ZodEnum<{
|
|
@@ -296,8 +296,8 @@ export declare const BillingAccountResponseSchema: z.ZodObject<{
|
|
|
296
296
|
displayName: z.ZodString;
|
|
297
297
|
state: z.ZodEnum<{
|
|
298
298
|
active: "active";
|
|
299
|
-
inactive: "inactive";
|
|
300
299
|
draft: "draft";
|
|
300
|
+
inactive: "inactive";
|
|
301
301
|
}>;
|
|
302
302
|
createdAt: z.ZodString;
|
|
303
303
|
role: z.ZodEnum<{
|
|
@@ -547,8 +547,8 @@ export declare const BillingAccountsListClientResponseSchema: z.ZodObject<{
|
|
|
547
547
|
displayName: z.ZodString;
|
|
548
548
|
state: z.ZodEnum<{
|
|
549
549
|
active: "active";
|
|
550
|
-
inactive: "inactive";
|
|
551
550
|
draft: "draft";
|
|
551
|
+
inactive: "inactive";
|
|
552
552
|
}>;
|
|
553
553
|
createdAt: z.ZodString;
|
|
554
554
|
role: z.ZodEnum<{
|
|
@@ -603,8 +603,8 @@ export declare const BillingAccountClientResponseSchema: z.ZodObject<{
|
|
|
603
603
|
displayName: z.ZodString;
|
|
604
604
|
state: z.ZodEnum<{
|
|
605
605
|
active: "active";
|
|
606
|
-
inactive: "inactive";
|
|
607
606
|
draft: "draft";
|
|
607
|
+
inactive: "inactive";
|
|
608
608
|
}>;
|
|
609
609
|
createdAt: z.ZodString;
|
|
610
610
|
role: z.ZodEnum<{
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BusinessPageContentSchema: z.ZodObject<{
|
|
3
|
+
introduction: z.ZodString;
|
|
4
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
text: z.ZodString;
|
|
7
|
+
}, z.core.$strict>>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type BusinessPageContent = z.infer<typeof BusinessPageContentSchema>;
|
|
10
|
+
export declare const BusinessPageSaveRequestSchema: z.ZodObject<{
|
|
11
|
+
expectedRevision: z.ZodNumber;
|
|
12
|
+
content: z.ZodObject<{
|
|
13
|
+
introduction: z.ZodString;
|
|
14
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
15
|
+
title: z.ZodString;
|
|
16
|
+
text: z.ZodString;
|
|
17
|
+
}, z.core.$strict>>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
export declare const BusinessPagePublishRequestSchema: z.ZodObject<{
|
|
21
|
+
expectedRevision: z.ZodNumber;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export declare const BusinessPageUnpublishRequestSchema: z.ZodObject<{
|
|
24
|
+
expectedRevision: z.ZodNumber;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
/** A snapshot approved by a business administrator, not current mutable business settings. */
|
|
27
|
+
export declare const BusinessPagePublicationSchema: z.ZodObject<{
|
|
28
|
+
content: z.ZodObject<{
|
|
29
|
+
introduction: z.ZodString;
|
|
30
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
31
|
+
title: z.ZodString;
|
|
32
|
+
text: z.ZodString;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
notice: z.ZodObject<{
|
|
36
|
+
displayName: z.ZodString;
|
|
37
|
+
privacyUrl: z.ZodString;
|
|
38
|
+
supportUrl: z.ZodString;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
noticeRevision: z.ZodNumber;
|
|
41
|
+
sourceRevision: z.ZodNumber;
|
|
42
|
+
deploymentId: z.ZodString;
|
|
43
|
+
publishedAt: z.ZodISODateTime;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type BusinessPagePublication = z.infer<typeof BusinessPagePublicationSchema>;
|
|
46
|
+
export declare const BusinessPageResponseSchema: z.ZodObject<{
|
|
47
|
+
ok: z.ZodLiteral<true>;
|
|
48
|
+
data: z.ZodObject<{
|
|
49
|
+
revision: z.ZodNumber;
|
|
50
|
+
draft: z.ZodNullable<z.ZodObject<{
|
|
51
|
+
introduction: z.ZodString;
|
|
52
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
53
|
+
title: z.ZodString;
|
|
54
|
+
text: z.ZodString;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
published: z.ZodNullable<z.ZodObject<{
|
|
58
|
+
content: z.ZodObject<{
|
|
59
|
+
introduction: z.ZodString;
|
|
60
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
61
|
+
title: z.ZodString;
|
|
62
|
+
text: z.ZodString;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
notice: z.ZodObject<{
|
|
66
|
+
displayName: z.ZodString;
|
|
67
|
+
privacyUrl: z.ZodString;
|
|
68
|
+
supportUrl: z.ZodString;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
noticeRevision: z.ZodNumber;
|
|
71
|
+
sourceRevision: z.ZodNumber;
|
|
72
|
+
deploymentId: z.ZodString;
|
|
73
|
+
publishedAt: z.ZodISODateTime;
|
|
74
|
+
}, z.core.$strict>>;
|
|
75
|
+
canEdit: z.ZodBoolean;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
export declare const BusinessPageClientResponseSchema: z.ZodObject<{
|
|
79
|
+
ok: z.ZodLiteral<true>;
|
|
80
|
+
data: z.ZodObject<{
|
|
81
|
+
revision: z.ZodNumber;
|
|
82
|
+
canEdit: z.ZodBoolean;
|
|
83
|
+
draft: z.ZodNullable<z.ZodObject<{
|
|
84
|
+
introduction: z.ZodString;
|
|
85
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
86
|
+
title: z.ZodString;
|
|
87
|
+
text: z.ZodString;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
published: z.ZodNullable<z.ZodObject<{
|
|
91
|
+
noticeRevision: z.ZodNumber;
|
|
92
|
+
sourceRevision: z.ZodNumber;
|
|
93
|
+
deploymentId: z.ZodString;
|
|
94
|
+
publishedAt: z.ZodISODateTime;
|
|
95
|
+
content: z.ZodObject<{
|
|
96
|
+
introduction: z.ZodString;
|
|
97
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
98
|
+
title: z.ZodString;
|
|
99
|
+
text: z.ZodString;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
notice: z.ZodObject<{
|
|
103
|
+
displayName: z.ZodString;
|
|
104
|
+
privacyUrl: z.ZodString;
|
|
105
|
+
supportUrl: z.ZodString;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
/** Intentionally excludes draft, subjects, scope, configuration, and records. */
|
|
111
|
+
export declare const PublicBusinessPageResponseSchema: z.ZodObject<{
|
|
112
|
+
ok: z.ZodLiteral<true>;
|
|
113
|
+
data: z.ZodObject<{
|
|
114
|
+
publicId: z.ZodString;
|
|
115
|
+
content: z.ZodObject<{
|
|
116
|
+
introduction: z.ZodString;
|
|
117
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
118
|
+
title: z.ZodString;
|
|
119
|
+
text: z.ZodString;
|
|
120
|
+
}, z.core.$strict>>;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
notice: z.ZodObject<{
|
|
123
|
+
displayName: z.ZodString;
|
|
124
|
+
privacyUrl: z.ZodString;
|
|
125
|
+
supportUrl: z.ZodString;
|
|
126
|
+
}, z.core.$strict>;
|
|
127
|
+
assistant: z.ZodNullable<z.ZodObject<{
|
|
128
|
+
embedId: z.ZodString;
|
|
129
|
+
serviceUrl: z.ZodString;
|
|
130
|
+
scriptUrl: z.ZodString;
|
|
131
|
+
}, z.core.$strict>>;
|
|
132
|
+
}, z.core.$strict>;
|
|
133
|
+
}, z.core.$strict>;
|
|
134
|
+
export declare const PublicBusinessPageClientResponseSchema: z.ZodObject<{
|
|
135
|
+
ok: z.ZodLiteral<true>;
|
|
136
|
+
data: z.ZodObject<{
|
|
137
|
+
publicId: z.ZodString;
|
|
138
|
+
content: z.ZodObject<{
|
|
139
|
+
introduction: z.ZodString;
|
|
140
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
141
|
+
title: z.ZodString;
|
|
142
|
+
text: z.ZodString;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
notice: z.ZodObject<{
|
|
146
|
+
displayName: z.ZodString;
|
|
147
|
+
privacyUrl: z.ZodString;
|
|
148
|
+
supportUrl: z.ZodString;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
assistant: z.ZodNullable<z.ZodObject<{
|
|
151
|
+
embedId: z.ZodString;
|
|
152
|
+
serviceUrl: z.ZodString;
|
|
153
|
+
scriptUrl: z.ZodString;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
//# sourceMappingURL=business-page.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BusinessNoticeSchema } from './solution-onboarding.js';
|
|
3
|
+
const revision = z.number().int().min(0).max(2_147_483_647);
|
|
4
|
+
const positiveRevision = revision.positive();
|
|
5
|
+
const text = (maximum) => z
|
|
6
|
+
.string()
|
|
7
|
+
.trim()
|
|
8
|
+
.min(1)
|
|
9
|
+
.max(maximum)
|
|
10
|
+
.refine((value) => !Array.from(value).some((character) => {
|
|
11
|
+
const code = character.charCodeAt(0);
|
|
12
|
+
return (code < 32 && ![9, 10, 13].includes(code)) || code === 127;
|
|
13
|
+
}));
|
|
14
|
+
const section = z.strictObject({ title: text(120), text: text(4000) });
|
|
15
|
+
export const BusinessPageContentSchema = z.strictObject({
|
|
16
|
+
introduction: text(1200),
|
|
17
|
+
sections: z.array(section).max(8),
|
|
18
|
+
});
|
|
19
|
+
const contentClient = BusinessPageContentSchema.extend({
|
|
20
|
+
sections: z.array(section.strip()).max(8),
|
|
21
|
+
}).strip();
|
|
22
|
+
export const BusinessPageSaveRequestSchema = z.strictObject({
|
|
23
|
+
expectedRevision: revision,
|
|
24
|
+
content: BusinessPageContentSchema,
|
|
25
|
+
});
|
|
26
|
+
export const BusinessPagePublishRequestSchema = z.strictObject({
|
|
27
|
+
expectedRevision: positiveRevision,
|
|
28
|
+
});
|
|
29
|
+
export const BusinessPageUnpublishRequestSchema = BusinessPagePublishRequestSchema;
|
|
30
|
+
/** A snapshot approved by a business administrator, not current mutable business settings. */
|
|
31
|
+
export const BusinessPagePublicationSchema = z.strictObject({
|
|
32
|
+
content: BusinessPageContentSchema,
|
|
33
|
+
notice: BusinessNoticeSchema,
|
|
34
|
+
noticeRevision: positiveRevision,
|
|
35
|
+
sourceRevision: positiveRevision,
|
|
36
|
+
deploymentId: z.string().min(1).max(128),
|
|
37
|
+
publishedAt: z.iso.datetime(),
|
|
38
|
+
});
|
|
39
|
+
const publicationClient = BusinessPagePublicationSchema.extend({
|
|
40
|
+
content: contentClient,
|
|
41
|
+
notice: BusinessNoticeSchema.strip(),
|
|
42
|
+
}).strip();
|
|
43
|
+
const pageState = z.strictObject({
|
|
44
|
+
revision,
|
|
45
|
+
draft: BusinessPageContentSchema.nullable(),
|
|
46
|
+
published: BusinessPagePublicationSchema.nullable(),
|
|
47
|
+
canEdit: z.boolean(),
|
|
48
|
+
});
|
|
49
|
+
export const BusinessPageResponseSchema = z.strictObject({ ok: z.literal(true), data: pageState });
|
|
50
|
+
export const BusinessPageClientResponseSchema = z
|
|
51
|
+
.object({
|
|
52
|
+
ok: z.literal(true),
|
|
53
|
+
data: pageState
|
|
54
|
+
.extend({
|
|
55
|
+
draft: contentClient.nullable(),
|
|
56
|
+
published: publicationClient.nullable(),
|
|
57
|
+
})
|
|
58
|
+
.strip(),
|
|
59
|
+
})
|
|
60
|
+
.strip();
|
|
61
|
+
const assistantUrl = z
|
|
62
|
+
.string()
|
|
63
|
+
.max(2048)
|
|
64
|
+
.refine((value) => {
|
|
65
|
+
try {
|
|
66
|
+
const url = new URL(value);
|
|
67
|
+
return (!url.username &&
|
|
68
|
+
!url.password &&
|
|
69
|
+
!url.hash &&
|
|
70
|
+
(url.protocol === 'https:' ||
|
|
71
|
+
(url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const publicAssistant = z.strictObject({
|
|
78
|
+
embedId: z.string().min(1).max(128),
|
|
79
|
+
serviceUrl: assistantUrl,
|
|
80
|
+
scriptUrl: assistantUrl,
|
|
81
|
+
});
|
|
82
|
+
const publicPage = z.strictObject({
|
|
83
|
+
publicId: z.string().regex(/^sol_[a-f0-9]{32}$/),
|
|
84
|
+
content: BusinessPageContentSchema,
|
|
85
|
+
notice: BusinessNoticeSchema,
|
|
86
|
+
assistant: publicAssistant.nullable(),
|
|
87
|
+
});
|
|
88
|
+
/** Intentionally excludes draft, subjects, scope, configuration, and records. */
|
|
89
|
+
export const PublicBusinessPageResponseSchema = z.strictObject({
|
|
90
|
+
ok: z.literal(true),
|
|
91
|
+
data: publicPage,
|
|
92
|
+
});
|
|
93
|
+
export const PublicBusinessPageClientResponseSchema = z
|
|
94
|
+
.object({
|
|
95
|
+
ok: z.literal(true),
|
|
96
|
+
data: publicPage
|
|
97
|
+
.extend({
|
|
98
|
+
content: contentClient,
|
|
99
|
+
notice: BusinessNoticeSchema.strip(),
|
|
100
|
+
assistant: publicAssistant.strip().nullable(),
|
|
101
|
+
})
|
|
102
|
+
.strip(),
|
|
103
|
+
})
|
|
104
|
+
.strip();
|
|
105
|
+
//# sourceMappingURL=business-page.js.map
|