@intlayer/backend-contract 0.0.0-stage → 9.6.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 +330 -2
- package/dist/cjs/ai.cjs +267 -0
- package/dist/cjs/ai.cjs.map +1 -0
- package/dist/cjs/analytics.cjs +175 -0
- package/dist/cjs/analytics.cjs.map +1 -0
- package/dist/cjs/asset.cjs +88 -0
- package/dist/cjs/asset.cjs.map +1 -0
- package/dist/cjs/blogComment.cjs +98 -0
- package/dist/cjs/blogComment.cjs.map +1 -0
- package/dist/cjs/cliSessionToken.cjs +40 -0
- package/dist/cjs/cliSessionToken.cjs.map +1 -0
- package/dist/cjs/common.cjs +42 -0
- package/dist/cjs/common.cjs.map +1 -0
- package/dist/cjs/defineRoute.cjs +26 -0
- package/dist/cjs/defineRoute.cjs.map +1 -0
- package/dist/cjs/demo.cjs +22 -0
- package/dist/cjs/demo.cjs.map +1 -0
- package/dist/cjs/dictionary.cjs +168 -0
- package/dist/cjs/dictionary.cjs.map +1 -0
- package/dist/cjs/environment.cjs +91 -0
- package/dist/cjs/environment.cjs.map +1 -0
- package/dist/cjs/eventListener.cjs +19 -0
- package/dist/cjs/eventListener.cjs.map +1 -0
- package/dist/cjs/gitProviders.cjs +361 -0
- package/dist/cjs/gitProviders.cjs.map +1 -0
- package/dist/cjs/newsletter.cjs +50 -0
- package/dist/cjs/newsletter.cjs.map +1 -0
- package/dist/cjs/oAuth2.cjs +62 -0
- package/dist/cjs/oAuth2.cjs.map +1 -0
- package/dist/cjs/organization.cjs +226 -0
- package/dist/cjs/organization.cjs.map +1 -0
- package/dist/cjs/project.cjs +401 -0
- package/dist/cjs/project.cjs.map +1 -0
- package/dist/cjs/public.cjs +60 -0
- package/dist/cjs/public.cjs.map +1 -0
- package/dist/cjs/responseData.cjs +33 -0
- package/dist/cjs/responseData.cjs.map +1 -0
- package/dist/cjs/reviewer.cjs +401 -0
- package/dist/cjs/reviewer.cjs.map +1 -0
- package/dist/cjs/scan.cjs +235 -0
- package/dist/cjs/scan.cjs.map +1 -0
- package/dist/cjs/search.cjs +40 -0
- package/dist/cjs/search.cjs.map +1 -0
- package/dist/cjs/session.cjs +56 -0
- package/dist/cjs/session.cjs.map +1 -0
- package/dist/cjs/showcaseProject.cjs +185 -0
- package/dist/cjs/showcaseProject.cjs.map +1 -0
- package/dist/cjs/stripe.cjs +388 -0
- package/dist/cjs/stripe.cjs.map +1 -0
- package/dist/cjs/tag.cjs +83 -0
- package/dist/cjs/tag.cjs.map +1 -0
- package/dist/cjs/translation.cjs +54 -0
- package/dist/cjs/translation.cjs.map +1 -0
- package/dist/cjs/user.cjs +153 -0
- package/dist/cjs/user.cjs.map +1 -0
- package/dist/esm/ai.mjs +261 -0
- package/dist/esm/ai.mjs.map +1 -0
- package/dist/esm/analytics.mjs +168 -0
- package/dist/esm/analytics.mjs.map +1 -0
- package/dist/esm/asset.mjs +86 -0
- package/dist/esm/asset.mjs.map +1 -0
- package/dist/esm/blogComment.mjs +94 -0
- package/dist/esm/blogComment.mjs.map +1 -0
- package/dist/esm/cliSessionToken.mjs +39 -0
- package/dist/esm/cliSessionToken.mjs.map +1 -0
- package/dist/esm/common.mjs +35 -0
- package/dist/esm/common.mjs.map +1 -0
- package/dist/esm/defineRoute.mjs +23 -0
- package/dist/esm/defineRoute.mjs.map +1 -0
- package/dist/esm/demo.mjs +21 -0
- package/dist/esm/demo.mjs.map +1 -0
- package/dist/esm/dictionary.mjs +163 -0
- package/dist/esm/dictionary.mjs.map +1 -0
- package/dist/esm/environment.mjs +90 -0
- package/dist/esm/environment.mjs.map +1 -0
- package/dist/esm/eventListener.mjs +18 -0
- package/dist/esm/eventListener.mjs.map +1 -0
- package/dist/esm/gitProviders.mjs +352 -0
- package/dist/esm/gitProviders.mjs.map +1 -0
- package/dist/esm/newsletter.mjs +49 -0
- package/dist/esm/newsletter.mjs.map +1 -0
- package/dist/esm/oAuth2.mjs +60 -0
- package/dist/esm/oAuth2.mjs.map +1 -0
- package/dist/esm/organization.mjs +219 -0
- package/dist/esm/organization.mjs.map +1 -0
- package/dist/esm/project.mjs +387 -0
- package/dist/esm/project.mjs.map +1 -0
- package/dist/esm/public.mjs +58 -0
- package/dist/esm/public.mjs.map +1 -0
- package/dist/esm/responseData.mjs +30 -0
- package/dist/esm/responseData.mjs.map +1 -0
- package/dist/esm/reviewer.mjs +390 -0
- package/dist/esm/reviewer.mjs.map +1 -0
- package/dist/esm/scan.mjs +225 -0
- package/dist/esm/scan.mjs.map +1 -0
- package/dist/esm/search.mjs +38 -0
- package/dist/esm/search.mjs.map +1 -0
- package/dist/esm/session.mjs +53 -0
- package/dist/esm/session.mjs.map +1 -0
- package/dist/esm/showcaseProject.mjs +182 -0
- package/dist/esm/showcaseProject.mjs.map +1 -0
- package/dist/esm/stripe.mjs +379 -0
- package/dist/esm/stripe.mjs.map +1 -0
- package/dist/esm/tag.mjs +81 -0
- package/dist/esm/tag.mjs.map +1 -0
- package/dist/esm/translation.mjs +53 -0
- package/dist/esm/translation.mjs.map +1 -0
- package/dist/esm/user.mjs +149 -0
- package/dist/esm/user.mjs.map +1 -0
- package/dist/types/ai.d.ts +549 -0
- package/dist/types/ai.d.ts.map +1 -0
- package/dist/types/analytics.d.ts +378 -0
- package/dist/types/analytics.d.ts.map +1 -0
- package/dist/types/asset.d.ts +207 -0
- package/dist/types/asset.d.ts.map +1 -0
- package/dist/types/blogComment.d.ts +241 -0
- package/dist/types/blogComment.d.ts.map +1 -0
- package/dist/types/cliSessionToken.d.ts +263 -0
- package/dist/types/cliSessionToken.d.ts.map +1 -0
- package/dist/types/common.d.ts +32 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/defineRoute.d.ts +57 -0
- package/dist/types/defineRoute.d.ts.map +1 -0
- package/dist/types/demo.d.ts +21 -0
- package/dist/types/demo.d.ts.map +1 -0
- package/dist/types/dictionary.d.ts +360 -0
- package/dist/types/dictionary.d.ts.map +1 -0
- package/dist/types/environment.d.ts +284 -0
- package/dist/types/environment.d.ts.map +1 -0
- package/dist/types/eventListener.d.ts +17 -0
- package/dist/types/eventListener.d.ts.map +1 -0
- package/dist/types/gitProviders.d.ts +807 -0
- package/dist/types/gitProviders.d.ts.map +1 -0
- package/dist/types/newsletter.d.ts +165 -0
- package/dist/types/newsletter.d.ts.map +1 -0
- package/dist/types/oAuth2.d.ts +481 -0
- package/dist/types/oAuth2.d.ts.map +1 -0
- package/dist/types/organization.d.ts +1069 -0
- package/dist/types/organization.d.ts.map +1 -0
- package/dist/types/project.d.ts +1735 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/types/public.d.ts +109 -0
- package/dist/types/public.d.ts.map +1 -0
- package/dist/types/responseData.d.ts +68 -0
- package/dist/types/responseData.d.ts.map +1 -0
- package/dist/types/reviewer.d.ts +1239 -0
- package/dist/types/reviewer.d.ts.map +1 -0
- package/dist/types/scan.d.ts +625 -0
- package/dist/types/scan.d.ts.map +1 -0
- package/dist/types/search.d.ts +55 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/session.d.ts +286 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/showcaseProject.d.ts +550 -0
- package/dist/types/showcaseProject.d.ts.map +1 -0
- package/dist/types/stripe.d.ts +1219 -0
- package/dist/types/stripe.d.ts.map +1 -0
- package/dist/types/tag.d.ts +193 -0
- package/dist/types/tag.d.ts.map +1 -0
- package/dist/types/translation.d.ts +162 -0
- package/dist/types/translation.d.ts.map +1 -0
- package/dist/types/user.d.ts +447 -0
- package/dist/types/user.d.ts.map +1 -0
- package/package.json +300 -4
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_defineRoute = require('./defineRoute.cjs');
|
|
3
|
+
const require_responseData = require('./responseData.cjs');
|
|
4
|
+
const require_common = require('./common.cjs');
|
|
5
|
+
let zod_mini = require("zod/mini");
|
|
6
|
+
|
|
7
|
+
//#region src/dictionary.ts
|
|
8
|
+
/** Whether a value looks like a dictionary (object with a string `key`). */
|
|
9
|
+
const isDictionaryLike = (value) => require_common.isJSONObject(value) && typeof value.key === "string";
|
|
10
|
+
/** Dictionary as returned by the API (content documented as any JSON). */
|
|
11
|
+
const dictionarySchema = require_common.typedValueSchema(isDictionaryLike);
|
|
12
|
+
/** Dictionary pushed by the CLI / editor (`@intlayer/types` shape). */
|
|
13
|
+
const localDictionarySchema = require_common.typedValueSchema(isDictionaryLike);
|
|
14
|
+
/** Content node of a dictionary (`@intlayer/types`). */
|
|
15
|
+
const contentNodeSchema = require_common.typedValueSchema();
|
|
16
|
+
/** Result of a push, per dictionary. */
|
|
17
|
+
const pushedDictionarySchema = zod_mini.z.object({
|
|
18
|
+
key: zod_mini.z.string(),
|
|
19
|
+
localId: zod_mini.z.string(),
|
|
20
|
+
id: zod_mini.z.optional(zod_mini.z.string())
|
|
21
|
+
});
|
|
22
|
+
const pushDictionariesResultSchema = zod_mini.z.object({
|
|
23
|
+
newDictionaries: zod_mini.z.array(pushedDictionarySchema),
|
|
24
|
+
updatedDictionaries: zod_mini.z.array(pushedDictionarySchema),
|
|
25
|
+
upToDateDictionaries: zod_mini.z.array(pushedDictionarySchema),
|
|
26
|
+
error: zod_mini.z.array(zod_mini.z.object({
|
|
27
|
+
id: zod_mini.z.optional(zod_mini.z.string()),
|
|
28
|
+
key: zod_mini.z.string(),
|
|
29
|
+
localId: zod_mini.z.optional(zod_mini.z.string()),
|
|
30
|
+
message: zod_mini.z.string()
|
|
31
|
+
}))
|
|
32
|
+
});
|
|
33
|
+
const dictionaryIdParamsSchema = zod_mini.z.object({ dictionaryId: require_common.objectIdSchema });
|
|
34
|
+
/** REST contract of the `/api/dictionary` routes. */
|
|
35
|
+
const dictionaryContract = require_defineRoute.defineRouteGroup({
|
|
36
|
+
prefix: "/api/dictionary",
|
|
37
|
+
tag: "Dictionary",
|
|
38
|
+
routes: {
|
|
39
|
+
getDictionaries: require_defineRoute.defineRoute({
|
|
40
|
+
method: "GET",
|
|
41
|
+
path: "/",
|
|
42
|
+
summary: "List the dictionaries of the selected project",
|
|
43
|
+
schemas: {
|
|
44
|
+
querystring: zod_mini.z.looseObject({
|
|
45
|
+
...require_common.paginationQueryShape,
|
|
46
|
+
ids: zod_mini.z.optional(require_common.repeatableQueryValueSchema),
|
|
47
|
+
projectId: zod_mini.z.optional(zod_mini.z.string()),
|
|
48
|
+
projectIds: zod_mini.z.optional(require_common.repeatableQueryValueSchema),
|
|
49
|
+
organizationId: zod_mini.z.optional(zod_mini.z.string()),
|
|
50
|
+
organizationIds: zod_mini.z.optional(require_common.repeatableQueryValueSchema),
|
|
51
|
+
userId: zod_mini.z.optional(zod_mini.z.string()),
|
|
52
|
+
userIds: zod_mini.z.optional(require_common.repeatableQueryValueSchema),
|
|
53
|
+
creatorId: zod_mini.z.optional(zod_mini.z.string()),
|
|
54
|
+
creatorIds: zod_mini.z.optional(require_common.repeatableQueryValueSchema),
|
|
55
|
+
title: zod_mini.z.optional(zod_mini.z.string()),
|
|
56
|
+
description: zod_mini.z.optional(zod_mini.z.string()),
|
|
57
|
+
key: zod_mini.z.optional(zod_mini.z.string()),
|
|
58
|
+
keys: zod_mini.z.optional(require_common.repeatableQueryValueSchema),
|
|
59
|
+
tags: zod_mini.z.optional(require_common.repeatableQueryValueSchema),
|
|
60
|
+
location: zod_mini.z.optional(zod_mini.z.enum([
|
|
61
|
+
"remote",
|
|
62
|
+
"local",
|
|
63
|
+
"both",
|
|
64
|
+
"none"
|
|
65
|
+
]))
|
|
66
|
+
}),
|
|
67
|
+
response: { 200: require_responseData.paginatedResponseSchema(dictionarySchema) }
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
getDictionariesKeys: require_defineRoute.defineRoute({
|
|
71
|
+
method: "GET",
|
|
72
|
+
path: "/keys",
|
|
73
|
+
summary: "Keys of every dictionary of the selected project",
|
|
74
|
+
schemas: { response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(zod_mini.z.string())) } }
|
|
75
|
+
}),
|
|
76
|
+
getDictionariesUpdateTimestamp: require_defineRoute.defineRoute({
|
|
77
|
+
method: "GET",
|
|
78
|
+
path: "/update",
|
|
79
|
+
summary: "Last update time (epoch ms) of each dictionary, by id",
|
|
80
|
+
schemas: { response: { 200: require_responseData.responseDataSchema(zod_mini.z.record(zod_mini.z.string(), zod_mini.z.object({
|
|
81
|
+
key: zod_mini.z.string(),
|
|
82
|
+
updatedAt: zod_mini.z.number()
|
|
83
|
+
}))) } }
|
|
84
|
+
}),
|
|
85
|
+
getDictionariesByKeys: require_defineRoute.defineRoute({
|
|
86
|
+
method: "GET",
|
|
87
|
+
path: "/by-keys",
|
|
88
|
+
summary: "Get several dictionaries by key",
|
|
89
|
+
schemas: {
|
|
90
|
+
querystring: zod_mini.z.object({
|
|
91
|
+
/** Comma-separated string or repeated parameter. */
|
|
92
|
+
keys: require_common.repeatableQueryValueSchema,
|
|
93
|
+
version: zod_mini.z.optional(zod_mini.z.string())
|
|
94
|
+
}),
|
|
95
|
+
response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(dictionarySchema)) }
|
|
96
|
+
}
|
|
97
|
+
}),
|
|
98
|
+
getDictionary: require_defineRoute.defineRoute({
|
|
99
|
+
method: "GET",
|
|
100
|
+
path: "/:dictionaryKey",
|
|
101
|
+
summary: "Get a dictionary by key",
|
|
102
|
+
schemas: {
|
|
103
|
+
params: zod_mini.z.object({ dictionaryKey: zod_mini.z.string().check(zod_mini.z.minLength(1), zod_mini.z.maxLength(255)) }),
|
|
104
|
+
querystring: zod_mini.z.object({ version: zod_mini.z.optional(zod_mini.z.string()) }),
|
|
105
|
+
response: { 200: require_responseData.responseDataSchema(dictionarySchema) }
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
addDictionary: require_defineRoute.defineRoute({
|
|
109
|
+
method: "POST",
|
|
110
|
+
path: "/",
|
|
111
|
+
summary: "Create a dictionary in the selected project",
|
|
112
|
+
schemas: {
|
|
113
|
+
body: zod_mini.z.object({ dictionary: zod_mini.z.looseObject({
|
|
114
|
+
key: zod_mini.z.string().check(zod_mini.z.minLength(1)),
|
|
115
|
+
projectIds: zod_mini.z.array(zod_mini.z.string()),
|
|
116
|
+
content: zod_mini.z.optional(contentNodeSchema),
|
|
117
|
+
title: zod_mini.z.optional(zod_mini.z.string()),
|
|
118
|
+
description: zod_mini.z.optional(zod_mini.z.string()),
|
|
119
|
+
priority: zod_mini.z.optional(zod_mini.z.number()),
|
|
120
|
+
importMode: zod_mini.z.optional(zod_mini.z.enum([
|
|
121
|
+
"static",
|
|
122
|
+
"dynamic",
|
|
123
|
+
"fetch"
|
|
124
|
+
])),
|
|
125
|
+
tags: zod_mini.z.optional(zod_mini.z.array(zod_mini.z.string())),
|
|
126
|
+
environmentId: zod_mini.z.optional(zod_mini.z.string())
|
|
127
|
+
}) }),
|
|
128
|
+
response: { 200: require_responseData.responseDataSchema(dictionarySchema) }
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
pushDictionaries: require_defineRoute.defineRoute({
|
|
132
|
+
method: "PATCH",
|
|
133
|
+
path: "/",
|
|
134
|
+
summary: "Push local dictionaries (CLI): create or version them",
|
|
135
|
+
schemas: {
|
|
136
|
+
body: zod_mini.z.object({ dictionaries: zod_mini.z.array(localDictionarySchema) }),
|
|
137
|
+
response: { 200: require_responseData.responseDataSchema(pushDictionariesResultSchema) }
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
updateDictionary: require_defineRoute.defineRoute({
|
|
141
|
+
method: "PUT",
|
|
142
|
+
path: "/:dictionaryId",
|
|
143
|
+
summary: "Update a dictionary of the selected project",
|
|
144
|
+
schemas: {
|
|
145
|
+
params: dictionaryIdParamsSchema,
|
|
146
|
+
body: require_common.typedValueSchema(require_common.isJSONObject),
|
|
147
|
+
response: { 200: require_responseData.responseDataSchema(dictionarySchema) }
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
150
|
+
deleteDictionary: require_defineRoute.defineRoute({
|
|
151
|
+
method: "DELETE",
|
|
152
|
+
path: "/:dictionaryId",
|
|
153
|
+
summary: "Delete a dictionary of the selected project",
|
|
154
|
+
schemas: {
|
|
155
|
+
params: dictionaryIdParamsSchema,
|
|
156
|
+
response: { 200: require_responseData.responseDataSchema(dictionarySchema) }
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
exports.contentNodeSchema = contentNodeSchema;
|
|
164
|
+
exports.dictionaryContract = dictionaryContract;
|
|
165
|
+
exports.dictionarySchema = dictionarySchema;
|
|
166
|
+
exports.localDictionarySchema = localDictionarySchema;
|
|
167
|
+
exports.pushDictionariesResultSchema = pushDictionariesResultSchema;
|
|
168
|
+
//# sourceMappingURL=dictionary.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionary.cjs","names":["isJSONObject","typedValueSchema","z","objectIdSchema","defineRouteGroup","defineRoute","paginationQueryShape","repeatableQueryValueSchema","paginatedResponseSchema","responseDataSchema"],"sources":["../../src/dictionary.ts"],"sourcesContent":["import type { ContentNode, Dictionary } from '@intlayer/types/dictionary';\nimport { z } from 'zod/mini';\nimport {\n isJSONObject,\n objectIdSchema,\n paginationQueryShape,\n repeatableQueryValueSchema,\n typedValueSchema,\n} from './common';\nimport {\n defineRoute,\n defineRouteGroup,\n type RouteBodyInput,\n type RouteParams,\n type RouteQuerystring,\n} from './defineRoute';\nimport {\n type PaginatedResponse,\n paginatedResponseSchema,\n type ResponseData,\n responseDataSchema,\n} from './responseData';\n\n/** Outcome of the last commit of a CMS edit to the source `.content` file. */\nexport type DictionarySourceSync = {\n status:\n | 'committed'\n | 'pull-request'\n | 'up-to-date'\n | 'file-not-found'\n | 'unsupported'\n | 'error';\n /** Commit (or pull request) link on the git provider. */\n url?: string;\n commitSha?: string;\n message?: string;\n syncedAt: string;\n};\n\n/** Fields the server adds to a stored dictionary. */\ntype DictionaryServerFields = {\n id: string;\n projectIds: string[];\n creatorId: string;\n /** Content versions, oldest first. */\n versionList: string[];\n /** Environment the dictionary belongs to; null = shared by all. */\n environmentId?: string | null;\n sourceSync?: DictionarySourceSync;\n createdAt: string;\n updatedAt: string;\n};\n\n/**\n * Dictionary as returned by the API: the `@intlayer/types` dictionary (the\n * framework-wide source of truth for content) plus the server fields.\n */\nexport type DictionaryAPI = Omit<Dictionary, keyof DictionaryServerFields> &\n DictionaryServerFields;\n\n/** Whether a value looks like a dictionary (object with a string `key`). */\nconst isDictionaryLike = (value: unknown): boolean =>\n isJSONObject(value) && typeof value.key === 'string';\n\n/** Dictionary as returned by the API (content documented as any JSON). */\nexport const dictionarySchema =\n typedValueSchema<DictionaryAPI>(isDictionaryLike);\n\n/** Dictionary pushed by the CLI / editor (`@intlayer/types` shape). */\nexport const localDictionarySchema =\n typedValueSchema<Dictionary>(isDictionaryLike);\n\n/** Content node of a dictionary (`@intlayer/types`). */\nexport const contentNodeSchema = typedValueSchema<ContentNode>();\n\n/** Result of a push, per dictionary. */\nconst pushedDictionarySchema = z.object({\n key: z.string(),\n localId: z.string(),\n id: z.optional(z.string()),\n});\n\nexport const pushDictionariesResultSchema = z.object({\n newDictionaries: z.array(pushedDictionarySchema),\n updatedDictionaries: z.array(pushedDictionarySchema),\n upToDateDictionaries: z.array(pushedDictionarySchema),\n error: z.array(\n z.object({\n id: z.optional(z.string()),\n key: z.string(),\n localId: z.optional(z.string()),\n message: z.string(),\n })\n ),\n});\n\nconst dictionaryIdParamsSchema = z.object({ dictionaryId: objectIdSchema });\n\n/** REST contract of the `/api/dictionary` routes. */\nexport const dictionaryContract = defineRouteGroup({\n prefix: '/api/dictionary',\n tag: 'Dictionary',\n routes: {\n getDictionaries: defineRoute({\n method: 'GET',\n path: '/',\n summary: 'List the dictionaries of the selected project',\n schemas: {\n querystring: z.looseObject({\n ...paginationQueryShape,\n ids: z.optional(repeatableQueryValueSchema),\n projectId: z.optional(z.string()),\n projectIds: z.optional(repeatableQueryValueSchema),\n organizationId: z.optional(z.string()),\n organizationIds: z.optional(repeatableQueryValueSchema),\n userId: z.optional(z.string()),\n userIds: z.optional(repeatableQueryValueSchema),\n creatorId: z.optional(z.string()),\n creatorIds: z.optional(repeatableQueryValueSchema),\n title: z.optional(z.string()),\n description: z.optional(z.string()),\n key: z.optional(z.string()),\n keys: z.optional(repeatableQueryValueSchema),\n tags: z.optional(repeatableQueryValueSchema),\n location: z.optional(z.enum(['remote', 'local', 'both', 'none'])),\n }),\n response: { 200: paginatedResponseSchema(dictionarySchema) },\n },\n }),\n getDictionariesKeys: defineRoute({\n method: 'GET',\n path: '/keys',\n summary: 'Keys of every dictionary of the selected project',\n schemas: {\n response: { 200: responseDataSchema(z.array(z.string())) },\n },\n }),\n getDictionariesUpdateTimestamp: defineRoute({\n method: 'GET',\n path: '/update',\n summary: 'Last update time (epoch ms) of each dictionary, by id',\n schemas: {\n response: {\n 200: responseDataSchema(\n z.record(\n z.string(),\n z.object({ key: z.string(), updatedAt: z.number() })\n )\n ),\n },\n },\n }),\n getDictionariesByKeys: defineRoute({\n method: 'GET',\n path: '/by-keys',\n summary: 'Get several dictionaries by key',\n schemas: {\n querystring: z.object({\n /** Comma-separated string or repeated parameter. */\n keys: repeatableQueryValueSchema,\n version: z.optional(z.string()),\n }),\n response: { 200: responseDataSchema(z.array(dictionarySchema)) },\n },\n }),\n getDictionary: defineRoute({\n method: 'GET',\n path: '/:dictionaryKey',\n summary: 'Get a dictionary by key',\n schemas: {\n params: z.object({\n dictionaryKey: z.string().check(z.minLength(1), z.maxLength(255)),\n }),\n querystring: z.object({ version: z.optional(z.string()) }),\n response: { 200: responseDataSchema(dictionarySchema) },\n },\n }),\n addDictionary: defineRoute({\n method: 'POST',\n path: '/',\n summary: 'Create a dictionary in the selected project',\n schemas: {\n body: z.object({\n dictionary: z.looseObject({\n key: z.string().check(z.minLength(1)),\n projectIds: z.array(z.string()),\n content: z.optional(contentNodeSchema),\n title: z.optional(z.string()),\n description: z.optional(z.string()),\n priority: z.optional(z.number()),\n importMode: z.optional(z.enum(['static', 'dynamic', 'fetch'])),\n tags: z.optional(z.array(z.string())),\n environmentId: z.optional(z.string()),\n }),\n }),\n response: { 200: responseDataSchema(dictionarySchema) },\n },\n }),\n pushDictionaries: defineRoute({\n method: 'PATCH',\n path: '/',\n summary: 'Push local dictionaries (CLI): create or version them',\n schemas: {\n body: z.object({ dictionaries: z.array(localDictionarySchema) }),\n response: { 200: responseDataSchema(pushDictionariesResultSchema) },\n },\n }),\n updateDictionary: defineRoute({\n method: 'PUT',\n path: '/:dictionaryId',\n summary: 'Update a dictionary of the selected project',\n schemas: {\n params: dictionaryIdParamsSchema,\n body: typedValueSchema<Partial<DictionaryAPI>>(isJSONObject),\n response: { 200: responseDataSchema(dictionarySchema) },\n },\n }),\n deleteDictionary: defineRoute({\n method: 'DELETE',\n path: '/:dictionaryId',\n summary: 'Delete a dictionary of the selected project',\n schemas: {\n params: dictionaryIdParamsSchema,\n response: { 200: responseDataSchema(dictionarySchema) },\n },\n }),\n },\n});\n\n/** Route definitions of the `/api/dictionary` group, by name. */\nexport type DictionaryRoutes = (typeof dictionaryContract)['routes'];\n\nexport type PushDictionariesResultData = z.output<\n typeof pushDictionariesResultSchema\n>;\nexport type GetDictionariesParams = RouteQuerystring<\n DictionaryRoutes['getDictionaries']\n>;\nexport type GetDictionariesResult = PaginatedResponse<DictionaryAPI>;\nexport type GetDictionariesKeysResult = ResponseData<string[]>;\nexport type GetDictionariesUpdateTimestampResult = ResponseData<\n Record<string, { key: string; updatedAt: number }>\n>;\nexport type GetDictionaryParams = RouteParams<\n DictionaryRoutes['getDictionary']\n>;\nexport type GetDictionaryQuery = RouteQuerystring<\n DictionaryRoutes['getDictionary']\n>;\nexport type GetDictionaryResult = ResponseData<DictionaryAPI>;\nexport type GetDictionariesByKeysQuery = RouteQuerystring<\n DictionaryRoutes['getDictionariesByKeys']\n>;\nexport type GetDictionariesByKeysResult = ResponseData<DictionaryAPI[]>;\nexport type AddDictionaryBody = RouteBodyInput<\n DictionaryRoutes['addDictionary']\n>;\nexport type AddDictionaryResult = ResponseData<DictionaryAPI>;\nexport type PushDictionariesBody = RouteBodyInput<\n DictionaryRoutes['pushDictionaries']\n>;\nexport type PushDictionariesResult = ResponseData<PushDictionariesResultData>;\nexport type UpdateDictionaryParam = RouteParams<\n DictionaryRoutes['updateDictionary']\n>;\nexport type UpdateDictionaryBody = RouteBodyInput<\n DictionaryRoutes['updateDictionary']\n>;\nexport type UpdateDictionaryResult = ResponseData<DictionaryAPI>;\nexport type DeleteDictionaryParam = RouteParams<\n DictionaryRoutes['deleteDictionary']\n>;\nexport type DeleteDictionaryResult = ResponseData<DictionaryAPI>;\n"],"mappings":";;;;;;;;AA6DA,MAAM,oBAAoB,UACxBA,4BAAa,KAAK,KAAK,OAAO,MAAM,QAAQ;;AAG9C,MAAa,mBACXC,gCAAgC,gBAAgB;;AAGlD,MAAa,wBACXA,gCAA6B,gBAAgB;;AAG/C,MAAa,oBAAoBA,gCAA8B;;AAG/D,MAAM,yBAAyBC,WAAE,OAAO;CACtC,KAAKA,WAAE,OAAO;CACd,SAASA,WAAE,OAAO;CAClB,IAAIA,WAAE,SAASA,WAAE,OAAO,CAAC;AAC3B,CAAC;AAED,MAAa,+BAA+BA,WAAE,OAAO;CACnD,iBAAiBA,WAAE,MAAM,sBAAsB;CAC/C,qBAAqBA,WAAE,MAAM,sBAAsB;CACnD,sBAAsBA,WAAE,MAAM,sBAAsB;CACpD,OAAOA,WAAE,MACPA,WAAE,OAAO;EACP,IAAIA,WAAE,SAASA,WAAE,OAAO,CAAC;EACzB,KAAKA,WAAE,OAAO;EACd,SAASA,WAAE,SAASA,WAAE,OAAO,CAAC;EAC9B,SAASA,WAAE,OAAO;CACpB,CAAC,CACH;AACF,CAAC;AAED,MAAM,2BAA2BA,WAAE,OAAO,EAAE,cAAcC,8BAAe,CAAC;;AAG1E,MAAa,qBAAqBC,qCAAiB;CACjD,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,iBAAiBC,gCAAY;GAC3B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,aAAaH,WAAE,YAAY;KACzB,GAAGI;KACH,KAAKJ,WAAE,SAASK,yCAA0B;KAC1C,WAAWL,WAAE,SAASA,WAAE,OAAO,CAAC;KAChC,YAAYA,WAAE,SAASK,yCAA0B;KACjD,gBAAgBL,WAAE,SAASA,WAAE,OAAO,CAAC;KACrC,iBAAiBA,WAAE,SAASK,yCAA0B;KACtD,QAAQL,WAAE,SAASA,WAAE,OAAO,CAAC;KAC7B,SAASA,WAAE,SAASK,yCAA0B;KAC9C,WAAWL,WAAE,SAASA,WAAE,OAAO,CAAC;KAChC,YAAYA,WAAE,SAASK,yCAA0B;KACjD,OAAOL,WAAE,SAASA,WAAE,OAAO,CAAC;KAC5B,aAAaA,WAAE,SAASA,WAAE,OAAO,CAAC;KAClC,KAAKA,WAAE,SAASA,WAAE,OAAO,CAAC;KAC1B,MAAMA,WAAE,SAASK,yCAA0B;KAC3C,MAAML,WAAE,SAASK,yCAA0B;KAC3C,UAAUL,WAAE,SAASA,WAAE,KAAK;MAAC;MAAU;MAAS;MAAQ;KAAM,CAAC,CAAC;IAClE,CAAC;IACD,UAAU,EAAE,KAAKM,6CAAwB,gBAAgB,EAAE;GAC7D;EACF,CAAC;EACD,qBAAqBH,gCAAY;GAC/B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EAAE,KAAKI,wCAAmBP,WAAE,MAAMA,WAAE,OAAO,CAAC,CAAC,EAAE,EAC3D;EACF,CAAC;EACD,gCAAgCG,gCAAY;GAC1C,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EACR,KAAKI,wCACHP,WAAE,OACAA,WAAE,OAAO,GACTA,WAAE,OAAO;IAAE,KAAKA,WAAE,OAAO;IAAG,WAAWA,WAAE,OAAO;GAAE,CAAC,CACrD,CACF,EACF,EACF;EACF,CAAC;EACD,uBAAuBG,gCAAY;GACjC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,aAAaH,WAAE,OAAO;;KAEpB,MAAMK;KACN,SAASL,WAAE,SAASA,WAAE,OAAO,CAAC;IAChC,CAAC;IACD,UAAU,EAAE,KAAKO,wCAAmBP,WAAE,MAAM,gBAAgB,CAAC,EAAE;GACjE;EACF,CAAC;EACD,eAAeG,gCAAY;GACzB,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQH,WAAE,OAAO,EACf,eAAeA,WAAE,OAAO,CAAC,CAAC,MAAMA,WAAE,UAAU,CAAC,GAAGA,WAAE,UAAU,GAAG,CAAC,EAClE,CAAC;IACD,aAAaA,WAAE,OAAO,EAAE,SAASA,WAAE,SAASA,WAAE,OAAO,CAAC,EAAE,CAAC;IACzD,UAAU,EAAE,KAAKO,wCAAmB,gBAAgB,EAAE;GACxD;EACF,CAAC;EACD,eAAeJ,gCAAY;GACzB,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAMH,WAAE,OAAO,EACb,YAAYA,WAAE,YAAY;KACxB,KAAKA,WAAE,OAAO,CAAC,CAAC,MAAMA,WAAE,UAAU,CAAC,CAAC;KACpC,YAAYA,WAAE,MAAMA,WAAE,OAAO,CAAC;KAC9B,SAASA,WAAE,SAAS,iBAAiB;KACrC,OAAOA,WAAE,SAASA,WAAE,OAAO,CAAC;KAC5B,aAAaA,WAAE,SAASA,WAAE,OAAO,CAAC;KAClC,UAAUA,WAAE,SAASA,WAAE,OAAO,CAAC;KAC/B,YAAYA,WAAE,SAASA,WAAE,KAAK;MAAC;MAAU;MAAW;KAAO,CAAC,CAAC;KAC7D,MAAMA,WAAE,SAASA,WAAE,MAAMA,WAAE,OAAO,CAAC,CAAC;KACpC,eAAeA,WAAE,SAASA,WAAE,OAAO,CAAC;IACtC,CAAC,EACH,CAAC;IACD,UAAU,EAAE,KAAKO,wCAAmB,gBAAgB,EAAE;GACxD;EACF,CAAC;EACD,kBAAkBJ,gCAAY;GAC5B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAMH,WAAE,OAAO,EAAE,cAAcA,WAAE,MAAM,qBAAqB,EAAE,CAAC;IAC/D,UAAU,EAAE,KAAKO,wCAAmB,4BAA4B,EAAE;GACpE;EACF,CAAC;EACD,kBAAkBJ,gCAAY;GAC5B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ;IACR,MAAMJ,gCAAyCD,2BAAY;IAC3D,UAAU,EAAE,KAAKS,wCAAmB,gBAAgB,EAAE;GACxD;EACF,CAAC;EACD,kBAAkBJ,gCAAY;GAC5B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ;IACR,UAAU,EAAE,KAAKI,wCAAmB,gBAAgB,EAAE;GACxD;EACF,CAAC;CACH;AACF,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_defineRoute = require('./defineRoute.cjs');
|
|
3
|
+
const require_responseData = require('./responseData.cjs');
|
|
4
|
+
const require_common = require('./common.cjs');
|
|
5
|
+
const require_project = require('./project.cjs');
|
|
6
|
+
let zod_mini = require("zod/mini");
|
|
7
|
+
|
|
8
|
+
//#region src/environment.ts
|
|
9
|
+
const environmentIdParamsSchema = zod_mini.z.object({ environmentId: require_common.objectIdSchema });
|
|
10
|
+
/** Every environment of the project, production first when virtual. */
|
|
11
|
+
const environmentsResponseSchema = require_responseData.responseDataSchema(zod_mini.z.array(require_project.environmentSchema));
|
|
12
|
+
/** REST contract of the `/api/project/environment` routes. */
|
|
13
|
+
const environmentContract = require_defineRoute.defineRouteGroup({
|
|
14
|
+
prefix: "/api/project/environment",
|
|
15
|
+
tag: "Environment",
|
|
16
|
+
routes: {
|
|
17
|
+
addEnvironment: require_defineRoute.defineRoute({
|
|
18
|
+
method: "POST",
|
|
19
|
+
path: "/",
|
|
20
|
+
summary: "Create an environment in the selected project",
|
|
21
|
+
schemas: {
|
|
22
|
+
body: zod_mini.z.object({
|
|
23
|
+
name: zod_mini.z.string(),
|
|
24
|
+
configuration: zod_mini.z.optional(require_project.projectConfigurationSchema)
|
|
25
|
+
}),
|
|
26
|
+
response: { 200: environmentsResponseSchema }
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
updateEnvironment: require_defineRoute.defineRoute({
|
|
30
|
+
method: "PUT",
|
|
31
|
+
path: "/:environmentId",
|
|
32
|
+
summary: "Rename or reconfigure an environment",
|
|
33
|
+
schemas: {
|
|
34
|
+
params: environmentIdParamsSchema,
|
|
35
|
+
body: zod_mini.z.object({
|
|
36
|
+
name: zod_mini.z.optional(zod_mini.z.string()),
|
|
37
|
+
configuration: zod_mini.z.optional(require_project.projectConfigurationSchema)
|
|
38
|
+
}),
|
|
39
|
+
response: { 200: environmentsResponseSchema }
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
deleteEnvironment: require_defineRoute.defineRoute({
|
|
43
|
+
method: "DELETE",
|
|
44
|
+
path: "/:environmentId",
|
|
45
|
+
summary: "Delete an environment",
|
|
46
|
+
schemas: {
|
|
47
|
+
params: environmentIdParamsSchema,
|
|
48
|
+
response: { 200: environmentsResponseSchema }
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
resetToProductionEnvironment: require_defineRoute.defineRoute({
|
|
52
|
+
method: "PUT",
|
|
53
|
+
path: "/production/select",
|
|
54
|
+
summary: "Select the production environment for the session",
|
|
55
|
+
schemas: { response: { 200: require_responseData.responseDataSchema(zod_mini.z.nullable(require_project.environmentSchema)) } }
|
|
56
|
+
}),
|
|
57
|
+
selectEnvironment: require_defineRoute.defineRoute({
|
|
58
|
+
method: "PUT",
|
|
59
|
+
path: "/:environmentId/select",
|
|
60
|
+
summary: "Select an environment for the session",
|
|
61
|
+
schemas: {
|
|
62
|
+
params: environmentIdParamsSchema,
|
|
63
|
+
response: { 200: require_responseData.responseDataSchema(require_project.environmentSchema) }
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
migrateEnvironment: require_defineRoute.defineRoute({
|
|
67
|
+
method: "POST",
|
|
68
|
+
path: "/migrate",
|
|
69
|
+
summary: "Copy dictionaries and configuration between environments",
|
|
70
|
+
schemas: {
|
|
71
|
+
body: zod_mini.z.object({
|
|
72
|
+
/** Environment id, or `production` for the default environment. */
|
|
73
|
+
sourceEnvironmentId: zod_mini.z.string(),
|
|
74
|
+
targetEnvironmentId: zod_mini.z.string(),
|
|
75
|
+
strategy: zod_mini.z.enum(["overwrite", "fill-missing"]),
|
|
76
|
+
migrateContent: zod_mini.z.optional(zod_mini.z.boolean()),
|
|
77
|
+
migrateConfiguration: zod_mini.z.optional(zod_mini.z.boolean())
|
|
78
|
+
}),
|
|
79
|
+
response: { 200: require_responseData.responseDataSchema(zod_mini.z.object({
|
|
80
|
+
migratedDictionaries: zod_mini.z.number(),
|
|
81
|
+
skippedDictionaries: zod_mini.z.number(),
|
|
82
|
+
configurationMigrated: zod_mini.z.boolean()
|
|
83
|
+
})) }
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
exports.environmentContract = environmentContract;
|
|
91
|
+
//# sourceMappingURL=environment.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.cjs","names":["z","objectIdSchema","responseDataSchema","environmentSchema","defineRouteGroup","defineRoute","projectConfigurationSchema"],"sources":["../../src/environment.ts"],"sourcesContent":["import { z } from 'zod/mini';\nimport { objectIdSchema } from './common';\nimport {\n defineRoute,\n defineRouteGroup,\n type RouteBodyInput,\n type RouteParams,\n} from './defineRoute';\nimport {\n type EnvironmentAPI,\n environmentSchema,\n projectConfigurationSchema,\n} from './project';\nimport { type ResponseData, responseDataSchema } from './responseData';\n\nconst environmentIdParamsSchema = z.object({ environmentId: objectIdSchema });\n\n/** Every environment of the project, production first when virtual. */\nconst environmentsResponseSchema = responseDataSchema(\n z.array(environmentSchema)\n);\n\n/** REST contract of the `/api/project/environment` routes. */\nexport const environmentContract = defineRouteGroup({\n prefix: '/api/project/environment',\n tag: 'Environment',\n routes: {\n addEnvironment: defineRoute({\n method: 'POST',\n path: '/',\n summary: 'Create an environment in the selected project',\n schemas: {\n body: z.object({\n name: z.string(),\n configuration: z.optional(projectConfigurationSchema),\n }),\n response: { 200: environmentsResponseSchema },\n },\n }),\n updateEnvironment: defineRoute({\n method: 'PUT',\n path: '/:environmentId',\n summary: 'Rename or reconfigure an environment',\n schemas: {\n params: environmentIdParamsSchema,\n body: z.object({\n name: z.optional(z.string()),\n configuration: z.optional(projectConfigurationSchema),\n }),\n response: { 200: environmentsResponseSchema },\n },\n }),\n deleteEnvironment: defineRoute({\n method: 'DELETE',\n path: '/:environmentId',\n summary: 'Delete an environment',\n schemas: {\n params: environmentIdParamsSchema,\n response: { 200: environmentsResponseSchema },\n },\n }),\n resetToProductionEnvironment: defineRoute({\n method: 'PUT',\n path: '/production/select',\n summary: 'Select the production environment for the session',\n schemas: {\n response: { 200: responseDataSchema(z.nullable(environmentSchema)) },\n },\n }),\n selectEnvironment: defineRoute({\n method: 'PUT',\n path: '/:environmentId/select',\n summary: 'Select an environment for the session',\n schemas: {\n params: environmentIdParamsSchema,\n response: { 200: responseDataSchema(environmentSchema) },\n },\n }),\n migrateEnvironment: defineRoute({\n method: 'POST',\n path: '/migrate',\n summary: 'Copy dictionaries and configuration between environments',\n schemas: {\n body: z.object({\n /** Environment id, or `production` for the default environment. */\n sourceEnvironmentId: z.string(),\n targetEnvironmentId: z.string(),\n strategy: z.enum(['overwrite', 'fill-missing']),\n migrateContent: z.optional(z.boolean()),\n migrateConfiguration: z.optional(z.boolean()),\n }),\n response: {\n 200: responseDataSchema(\n z.object({\n migratedDictionaries: z.number(),\n skippedDictionaries: z.number(),\n configurationMigrated: z.boolean(),\n })\n ),\n },\n },\n }),\n },\n});\n\n/** Route definitions of the `/api/project/environment` group, by name. */\nexport type EnvironmentRoutes = (typeof environmentContract)['routes'];\n\nexport type AddEnvironmentBody = RouteBodyInput<\n EnvironmentRoutes['addEnvironment']\n>;\nexport type AddEnvironmentResult = ResponseData<EnvironmentAPI[]>;\nexport type UpdateEnvironmentParams = RouteParams<\n EnvironmentRoutes['updateEnvironment']\n>;\nexport type UpdateEnvironmentBody = RouteBodyInput<\n EnvironmentRoutes['updateEnvironment']\n>;\nexport type UpdateEnvironmentResult = ResponseData<EnvironmentAPI[]>;\nexport type DeleteEnvironmentParams = RouteParams<\n EnvironmentRoutes['deleteEnvironment']\n>;\nexport type DeleteEnvironmentResult = ResponseData<EnvironmentAPI[]>;\nexport type SelectEnvironmentParams = RouteParams<\n EnvironmentRoutes['selectEnvironment']\n>;\nexport type SelectEnvironmentResult = ResponseData<EnvironmentAPI>;\nexport type ResetToProductionEnvironmentResult =\n ResponseData<EnvironmentAPI | null>;\nexport type MigrateEnvironmentBody = RouteBodyInput<\n EnvironmentRoutes['migrateEnvironment']\n>;\nexport type MigrateEnvironmentResult = ResponseData<{\n migratedDictionaries: number;\n skippedDictionaries: number;\n configurationMigrated: boolean;\n}>;\n"],"mappings":";;;;;;;;AAeA,MAAM,4BAA4BA,WAAE,OAAO,EAAE,eAAeC,8BAAe,CAAC;;AAG5E,MAAM,6BAA6BC,wCACjCF,WAAE,MAAMG,iCAAiB,CAC3B;;AAGA,MAAa,sBAAsBC,qCAAiB;CAClD,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,gBAAgBC,gCAAY;GAC1B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAML,WAAE,OAAO;KACb,MAAMA,WAAE,OAAO;KACf,eAAeA,WAAE,SAASM,0CAA0B;IACtD,CAAC;IACD,UAAU,EAAE,KAAK,2BAA2B;GAC9C;EACF,CAAC;EACD,mBAAmBD,gCAAY;GAC7B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ;IACR,MAAML,WAAE,OAAO;KACb,MAAMA,WAAE,SAASA,WAAE,OAAO,CAAC;KAC3B,eAAeA,WAAE,SAASM,0CAA0B;IACtD,CAAC;IACD,UAAU,EAAE,KAAK,2BAA2B;GAC9C;EACF,CAAC;EACD,mBAAmBD,gCAAY;GAC7B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ;IACR,UAAU,EAAE,KAAK,2BAA2B;GAC9C;EACF,CAAC;EACD,8BAA8BA,gCAAY;GACxC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EAAE,KAAKH,wCAAmBF,WAAE,SAASG,iCAAiB,CAAC,EAAE,EACrE;EACF,CAAC;EACD,mBAAmBE,gCAAY;GAC7B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,QAAQ;IACR,UAAU,EAAE,KAAKH,wCAAmBC,iCAAiB,EAAE;GACzD;EACF,CAAC;EACD,oBAAoBE,gCAAY;GAC9B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAML,WAAE,OAAO;;KAEb,qBAAqBA,WAAE,OAAO;KAC9B,qBAAqBA,WAAE,OAAO;KAC9B,UAAUA,WAAE,KAAK,CAAC,aAAa,cAAc,CAAC;KAC9C,gBAAgBA,WAAE,SAASA,WAAE,QAAQ,CAAC;KACtC,sBAAsBA,WAAE,SAASA,WAAE,QAAQ,CAAC;IAC9C,CAAC;IACD,UAAU,EACR,KAAKE,wCACHF,WAAE,OAAO;KACP,sBAAsBA,WAAE,OAAO;KAC/B,qBAAqBA,WAAE,OAAO;KAC9B,uBAAuBA,WAAE,QAAQ;IACnC,CAAC,CACH,EACF;GACF;EACF,CAAC;CACH;AACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_defineRoute = require('./defineRoute.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/eventListener.ts
|
|
5
|
+
/** Live dictionary change stream (server-sent events). */
|
|
6
|
+
const eventListenerContract = require_defineRoute.defineRouteGroup({
|
|
7
|
+
prefix: "/api/event-listener",
|
|
8
|
+
tag: "Event listener",
|
|
9
|
+
routes: { checkDictionaryChangeSSE: require_defineRoute.defineRoute({
|
|
10
|
+
method: "GET",
|
|
11
|
+
path: "/",
|
|
12
|
+
summary: "Stream dictionary changes of the project (server-sent events)",
|
|
13
|
+
schemas: {}
|
|
14
|
+
}) }
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.eventListenerContract = eventListenerContract;
|
|
19
|
+
//# sourceMappingURL=eventListener.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventListener.cjs","names":["defineRouteGroup","defineRoute"],"sources":["../../src/eventListener.ts"],"sourcesContent":["import { defineRoute, defineRouteGroup } from './defineRoute';\nimport type { DictionaryAPI } from './dictionary';\n\n/** Live dictionary change stream (server-sent events). */\nexport const eventListenerContract = defineRouteGroup({\n prefix: '/api/event-listener',\n tag: 'Event listener',\n routes: {\n checkDictionaryChangeSSE: defineRoute({\n method: 'GET',\n path: '/',\n summary: 'Stream dictionary changes of the project (server-sent events)',\n schemas: {},\n }),\n },\n});\n\n/** Route definitions of the event listener group, by name. */\nexport type EventListenerRoutes = (typeof eventListenerContract)['routes'];\n\n/** Message pushed on the dictionary change stream. */\nexport type MessageEventData = {\n object: 'DICTIONARY';\n status: 'ADDED' | 'UPDATED' | 'DELETED' | 'CREATED';\n data: DictionaryAPI;\n};\n"],"mappings":";;;;;AAIA,MAAa,wBAAwBA,qCAAiB;CACpD,QAAQ;CACR,KAAK;CACL,QAAQ,EACN,0BAA0BC,gCAAY;EACpC,QAAQ;EACR,MAAM;EACN,SAAS;EACT,SAAS,CAAC;CACZ,CAAC,EACH;AACF,CAAC"}
|