@localness/contract 0.4.0 → 0.4.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/dist/index.d.mts +37 -0
- package/dist/index.mjs +35 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -66,6 +66,7 @@ export declare const deliveryMetaSchema: z.ZodObject<{
|
|
|
66
66
|
name: z.ZodString;
|
|
67
67
|
}, z.core.$strip>;
|
|
68
68
|
locales: z.ZodArray<z.ZodString>;
|
|
69
|
+
sourceLocale: z.ZodOptional<z.ZodString>;
|
|
69
70
|
localeFallback: z.ZodString;
|
|
70
71
|
release: z.ZodNullable<z.ZodNumber>;
|
|
71
72
|
releases: z.ZodArray<z.ZodObject<{
|
|
@@ -125,6 +126,42 @@ export declare const deliveryKeysSchema: z.ZodObject<{
|
|
|
125
126
|
generatedAt: z.ZodString;
|
|
126
127
|
}, z.core.$strip>;
|
|
127
128
|
export type DeliveryKeys = z.infer<typeof deliveryKeysSchema>;
|
|
129
|
+
export declare const deliveryLocaleStateNameSchema: z.ZodEnum<{
|
|
130
|
+
outdated: "outdated";
|
|
131
|
+
draft: "draft";
|
|
132
|
+
published: "published";
|
|
133
|
+
unpublished: "unpublished";
|
|
134
|
+
}>;
|
|
135
|
+
export type DeliveryLocaleStateName = z.infer<typeof deliveryLocaleStateNameSchema>;
|
|
136
|
+
/**
|
|
137
|
+
* `GET /api/v1/keys/states` — per-key, per-locale state, drafts included.
|
|
138
|
+
* Unlike every other delivery shape this carries draft text: a read token sees
|
|
139
|
+
* what the editor sees.
|
|
140
|
+
*/
|
|
141
|
+
export declare const deliveryKeyStatesSchema: z.ZodObject<{
|
|
142
|
+
sourceLocale: z.ZodString;
|
|
143
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
144
|
+
id: z.ZodNumber;
|
|
145
|
+
key: z.ZodString;
|
|
146
|
+
releaseIds: z.ZodArray<z.ZodNumber>;
|
|
147
|
+
draft: z.ZodBoolean;
|
|
148
|
+
locales: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
149
|
+
draftText: z.ZodNullable<z.ZodString>;
|
|
150
|
+
publishedText: z.ZodNullable<z.ZodString>;
|
|
151
|
+
state: z.ZodEnum<{
|
|
152
|
+
outdated: "outdated";
|
|
153
|
+
draft: "draft";
|
|
154
|
+
published: "published";
|
|
155
|
+
unpublished: "unpublished";
|
|
156
|
+
}>;
|
|
157
|
+
}, z.core.$strip>>;
|
|
158
|
+
}, z.core.$strip>>;
|
|
159
|
+
total: z.ZodNumber;
|
|
160
|
+
offset: z.ZodNumber;
|
|
161
|
+
limit: z.ZodNumber;
|
|
162
|
+
generatedAt: z.ZodString;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
export type DeliveryKeyStates = z.infer<typeof deliveryKeyStatesSchema>;
|
|
128
165
|
/**
|
|
129
166
|
* Response shapes of the write half of the public `/api/v1` API, plus the
|
|
130
167
|
* capture reads a design tool needs. Same versioning rule as `delivery.ts`:
|
package/dist/index.mjs
CHANGED
|
@@ -65,6 +65,8 @@ const deliveryMetaSchema = z.object({
|
|
|
65
65
|
name: z.string()
|
|
66
66
|
}),
|
|
67
67
|
locales: z.array(z.string()),
|
|
68
|
+
/** The project's source locale. Optional: servers before it omit it. */
|
|
69
|
+
sourceLocale: z.string().optional(),
|
|
68
70
|
localeFallback: z.string(),
|
|
69
71
|
/** The release the response is scoped to, or null for all keys. */
|
|
70
72
|
release: z.number().nullable(),
|
|
@@ -126,6 +128,38 @@ const deliveryKeysSchema = z.object({
|
|
|
126
128
|
/** ISO 8601. */
|
|
127
129
|
generatedAt: z.string()
|
|
128
130
|
});
|
|
131
|
+
const deliveryLocaleStateNameSchema = z.enum([
|
|
132
|
+
"draft",
|
|
133
|
+
"published",
|
|
134
|
+
"outdated",
|
|
135
|
+
"unpublished"
|
|
136
|
+
]);
|
|
137
|
+
/**
|
|
138
|
+
* `GET /api/v1/keys/states` — per-key, per-locale state, drafts included.
|
|
139
|
+
* Unlike every other delivery shape this carries draft text: a read token sees
|
|
140
|
+
* what the editor sees.
|
|
141
|
+
*/
|
|
142
|
+
const deliveryKeyStatesSchema = z.object({
|
|
143
|
+
sourceLocale: z.string(),
|
|
144
|
+
keys: z.array(z.object({
|
|
145
|
+
id: z.number(),
|
|
146
|
+
key: z.string(),
|
|
147
|
+
releaseIds: z.array(z.number()),
|
|
148
|
+
/** True while the key still has unpublished edits or was never published. */
|
|
149
|
+
draft: z.boolean(),
|
|
150
|
+
locales: z.record(z.string(), z.object({
|
|
151
|
+
draftText: z.string().nullable(),
|
|
152
|
+
publishedText: z.string().nullable(),
|
|
153
|
+
state: deliveryLocaleStateNameSchema
|
|
154
|
+
}))
|
|
155
|
+
})),
|
|
156
|
+
/** Keys in scope, before paging. */
|
|
157
|
+
total: z.number(),
|
|
158
|
+
offset: z.number(),
|
|
159
|
+
limit: z.number(),
|
|
160
|
+
/** ISO 8601. */
|
|
161
|
+
generatedAt: z.string()
|
|
162
|
+
});
|
|
129
163
|
// ../../shared/contract/import.ts
|
|
130
164
|
/**
|
|
131
165
|
* Response shapes of the write half of the public `/api/v1` API, plus the
|
|
@@ -220,4 +254,4 @@ const capturePageSchema = z.object({
|
|
|
220
254
|
releaseIds: z.array(z.number()),
|
|
221
255
|
tags: z.array(captureTagSchema)
|
|
222
256
|
});
|
|
223
|
-
export { captureKeyHitSchema, captureKeySearchSchema, captureMatchSchema, capturePageSchema, captureTagSchema, createPageResultSchema, deleteTagsResultSchema, deliveryBundleSchema, deliveryKeysSchema, deliveryLocaleSchema, deliveryMetaSchema, deliveryOutdatedSchema, deliveryProjectRefSchema, deliveryProjectsSchema, i18nKeyNamespaceCountsSchema, idSchema, importPageResultSchema, importPageTagsSchema, importedTagSchema, keyNamespaceSchema, projectReleaseSchema, releaseMembershipResultSchema, uploadResultSchema };
|
|
257
|
+
export { captureKeyHitSchema, captureKeySearchSchema, captureMatchSchema, capturePageSchema, captureTagSchema, createPageResultSchema, deleteTagsResultSchema, deliveryBundleSchema, deliveryKeyStatesSchema, deliveryKeysSchema, deliveryLocaleSchema, deliveryLocaleStateNameSchema, deliveryMetaSchema, deliveryOutdatedSchema, deliveryProjectRefSchema, deliveryProjectsSchema, i18nKeyNamespaceCountsSchema, idSchema, importPageResultSchema, importPageTagsSchema, importedTagSchema, keyNamespaceSchema, projectReleaseSchema, releaseMembershipResultSchema, uploadResultSchema };
|
package/package.json
CHANGED