@eskais/app-sdk 0.1.0 → 0.2.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 +17 -11
- package/dist/action/action.d.ts +69 -10
- package/dist/action/action.js +147 -29
- package/dist/action/bulk.d.ts +24 -0
- package/dist/action/bulk.js +24 -0
- package/dist/core/constants.d.ts +57 -0
- package/dist/core/constants.js +31 -0
- package/dist/core/contracts.d.ts +7 -0
- package/dist/core/data-labels.d.ts +14 -0
- package/dist/core/data-labels.js +40 -0
- package/dist/core/errors.d.ts +11 -5
- package/dist/core/errors.js +52 -9
- package/dist/dialogs/dialogs.d.ts +75 -0
- package/dist/dialogs/dialogs.js +66 -0
- package/dist/errors/adapters.d.ts +21 -0
- package/dist/errors/adapters.js +81 -0
- package/dist/errors/define-errors.d.ts +88 -0
- package/dist/errors/define-errors.js +168 -0
- package/dist/errors/idempotency.d.ts +2 -0
- package/dist/errors/idempotency.js +13 -0
- package/dist/i18n/adapters.d.ts +53 -0
- package/dist/i18n/adapters.js +56 -0
- package/dist/i18n/format.d.ts +10 -0
- package/dist/i18n/format.js +273 -0
- package/dist/i18n/labels.d.ts +10 -0
- package/dist/i18n/labels.js +227 -0
- package/dist/i18n/locale.d.ts +73 -0
- package/dist/i18n/locale.js +74 -0
- package/dist/i18n/messages.d.ts +93 -0
- package/dist/i18n/messages.js +16 -0
- package/dist/import/import.d.ts +4 -2
- package/dist/import/import.js +7 -4
- package/dist/index.d.ts +18 -3
- package/dist/index.js +17 -2
- package/dist/navigation/nav.d.ts +14 -5
- package/dist/navigation/nav.js +37 -14
- package/dist/next/server/index.d.ts +2 -1
- package/dist/next/server/index.js +2 -1
- package/dist/next/server/page.d.ts +8 -2
- package/dist/next/server/page.js +14 -7
- package/dist/next/server/session.d.ts +13 -0
- package/dist/next/server/session.js +13 -0
- package/dist/permissions/permissions.d.ts +134 -0
- package/dist/permissions/permissions.js +121 -0
- package/dist/react/data-layer.d.ts +42 -5
- package/dist/react/data-layer.js +49 -4
- package/dist/react/hooks/use-action-dialog.d.ts +25 -0
- package/dist/react/hooks/use-action-dialog.js +31 -0
- package/dist/react/hooks/use-action.d.ts +30 -5
- package/dist/react/hooks/use-action.js +85 -27
- package/dist/react/hooks/use-bulk-action.d.ts +20 -0
- package/dist/react/hooks/use-bulk-action.js +24 -0
- package/dist/react/hooks/use-dialogs.d.ts +14 -0
- package/dist/react/hooks/use-dialogs.js +20 -0
- package/dist/react/hooks/use-nav.js +3 -2
- package/dist/react/hooks/use-new-rows.d.ts +22 -0
- package/dist/react/hooks/use-new-rows.js +24 -0
- package/dist/react/hooks/use-permissions.d.ts +13 -0
- package/dist/react/hooks/use-permissions.js +19 -0
- package/dist/react/hooks/use-reauthenticate.d.ts +6 -0
- package/dist/react/hooks/use-reauthenticate.js +11 -0
- package/dist/react/hooks/use-resource.d.ts +28 -5
- package/dist/react/hooks/use-resource.js +63 -26
- package/dist/react/index.d.ts +11 -4
- package/dist/react/index.js +11 -4
- package/dist/react/keys.d.ts +9 -0
- package/dist/react/keys.js +4 -0
- package/dist/react/new-rows.d.ts +22 -0
- package/dist/react/new-rows.js +72 -0
- package/dist/refresh/new-rows.d.ts +13 -0
- package/dist/refresh/new-rows.js +18 -0
- package/dist/resource/resource-relations.d.ts +6 -3
- package/dist/resource/resource-relations.js +26 -13
- package/dist/resource/resource-schema.d.ts +1 -1
- package/dist/resource/resource-schema.js +1 -1
- package/dist/resource/resource-texts.d.ts +18 -0
- package/dist/resource/resource-texts.js +13 -0
- package/dist/resource/resource-types.d.ts +169 -30
- package/dist/resource/resource-words.d.ts +25 -0
- package/dist/resource/resource-words.js +221 -0
- package/dist/resource/resource.d.ts +6 -2
- package/dist/resource/resource.js +99 -173
- package/dist/services/read-only-service.d.ts +18 -0
- package/dist/services/read-only-service.js +25 -0
- package/dist/services/rest-service.d.ts +4 -1
- package/dist/services/rest-service.js +2 -0
- package/dist/view/view-types.d.ts +4 -2
- package/locales/en.json +193 -0
- package/locales/es.json +193 -0
- package/package.json +5 -2
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { ErrorReason } from "../core/constants.js";
|
|
2
|
+
import { Gender } from "./messages.js";
|
|
3
|
+
import { lookup } from "./locale.js";
|
|
4
|
+
const Flag = { yes: "yes", no: "no" };
|
|
5
|
+
const RangeShape = { partial: "partial", estimate: "estimate", exact: "exact" };
|
|
6
|
+
const NoGender = "other";
|
|
7
|
+
const flag = (value) => (value ? Flag.yes : Flag.no);
|
|
8
|
+
function controlsOf(t) {
|
|
9
|
+
const c = (key, values) => t(`controls.${key}`, values);
|
|
10
|
+
return {
|
|
11
|
+
refreshing: c("refreshing"),
|
|
12
|
+
filters: {
|
|
13
|
+
chip: (field, summary) => c("filters.chip", { field, summary, empty: flag(summary === "") }),
|
|
14
|
+
selected: (count) => c("filters.selected", { count }),
|
|
15
|
+
any: c("filters.any"),
|
|
16
|
+
from: c("filters.from"),
|
|
17
|
+
to: c("filters.to"),
|
|
18
|
+
min: c("filters.min"),
|
|
19
|
+
max: c("filters.max"),
|
|
20
|
+
value: c("filters.value"),
|
|
21
|
+
comparison: c("filters.comparison"),
|
|
22
|
+
operators: {
|
|
23
|
+
eq: c("filters.operators.eq"),
|
|
24
|
+
neq: c("filters.operators.neq"),
|
|
25
|
+
lt: c("filters.operators.lt"),
|
|
26
|
+
lte: c("filters.operators.lte"),
|
|
27
|
+
gt: c("filters.operators.gt"),
|
|
28
|
+
gte: c("filters.operators.gte"),
|
|
29
|
+
between: c("filters.operators.between"),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
combobox: {
|
|
33
|
+
trigger: c("combobox.trigger"),
|
|
34
|
+
clear: c("combobox.clear"),
|
|
35
|
+
remove: (label) => c("combobox.remove", { label }),
|
|
36
|
+
error: c("combobox.error"),
|
|
37
|
+
empty: (query) => c("combobox.empty", { query, empty: flag(query === "") }),
|
|
38
|
+
count: (count, hasMore) => c("combobox.count", { count, more: flag(hasMore) }),
|
|
39
|
+
},
|
|
40
|
+
files: {
|
|
41
|
+
list: c("files.list"),
|
|
42
|
+
remove: (name) => c("files.remove", { name }),
|
|
43
|
+
rejected: (name) => c("files.rejected", { name }),
|
|
44
|
+
},
|
|
45
|
+
date: {
|
|
46
|
+
clear: c("date.clear"),
|
|
47
|
+
previousMonth: c("date.previousMonth"),
|
|
48
|
+
nextMonth: c("date.nextMonth"),
|
|
49
|
+
start: c("date.start"),
|
|
50
|
+
end: c("date.end"),
|
|
51
|
+
},
|
|
52
|
+
time: c("time"),
|
|
53
|
+
colorValue: c("colorValue"),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function errorsOf(t) {
|
|
57
|
+
const e = (reason) => t(`errors.${reason}`);
|
|
58
|
+
return {
|
|
59
|
+
[ErrorReason.network]: e(ErrorReason.network),
|
|
60
|
+
[ErrorReason.timeout]: e(ErrorReason.timeout),
|
|
61
|
+
[ErrorReason.unauthorized]: e(ErrorReason.unauthorized),
|
|
62
|
+
[ErrorReason.sessionExpired]: e(ErrorReason.sessionExpired),
|
|
63
|
+
[ErrorReason.forbidden]: e(ErrorReason.forbidden),
|
|
64
|
+
[ErrorReason.notFound]: e(ErrorReason.notFound),
|
|
65
|
+
[ErrorReason.conflict]: e(ErrorReason.conflict),
|
|
66
|
+
[ErrorReason.validation]: e(ErrorReason.validation),
|
|
67
|
+
[ErrorReason.rateLimited]: e(ErrorReason.rateLimited),
|
|
68
|
+
[ErrorReason.server]: e(ErrorReason.server),
|
|
69
|
+
[ErrorReason.unknown]: e(ErrorReason.unknown),
|
|
70
|
+
[ErrorReason.aborted]: e(ErrorReason.aborted),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function build(locale, gender) {
|
|
74
|
+
const { t, code } = locale;
|
|
75
|
+
const lower = (text) => text.toLocaleLowerCase(code);
|
|
76
|
+
const one = (text) => ({ one: lower(text), One: text, gender });
|
|
77
|
+
const other = (text) => ({ other: lower(text), Other: text, gender });
|
|
78
|
+
return {
|
|
79
|
+
create: (name) => t("create", one(name)),
|
|
80
|
+
edit: t("edit"),
|
|
81
|
+
editRecord: (title) => t("editRecord", { title, gender }),
|
|
82
|
+
remove: t("remove"),
|
|
83
|
+
restore: t("restore"),
|
|
84
|
+
save: t("save"),
|
|
85
|
+
cancel: t("cancel"),
|
|
86
|
+
undo: t("undo"),
|
|
87
|
+
open: t("open"),
|
|
88
|
+
back: t("back"),
|
|
89
|
+
retry: t("retry"),
|
|
90
|
+
records: (name) => t("records", other(name)),
|
|
91
|
+
listTool: (name) => t("listTool", other(name)),
|
|
92
|
+
removeRecords: (name) => t("removeRecords", other(name)),
|
|
93
|
+
rowActions: (title) => t("rowActions", { title, gender }),
|
|
94
|
+
quickCreate: (name) => t("quickCreate", one(name)),
|
|
95
|
+
createOption: (text) => t("createOption", { text, gender }),
|
|
96
|
+
creatingOption: (text) => t("creatingOption", { text, gender }),
|
|
97
|
+
empty: (name) => t("empty", other(name)),
|
|
98
|
+
errorTitle: (name) => t("errorTitle", other(name)),
|
|
99
|
+
notFound: (name) => t("notFound", one(name)),
|
|
100
|
+
forbidden: (name) => t("forbidden", one(name)),
|
|
101
|
+
notAllowed: t("notAllowed"),
|
|
102
|
+
forbiddenPage: t("forbiddenPage"),
|
|
103
|
+
newRows: (count) => t("newRows", { count }),
|
|
104
|
+
confirm: t("confirm"),
|
|
105
|
+
ok: t("ok"),
|
|
106
|
+
range: ({ from, to, total, estimate }) => t("range", {
|
|
107
|
+
from,
|
|
108
|
+
to,
|
|
109
|
+
total,
|
|
110
|
+
shape: total === undefined ? RangeShape.partial : estimate === true ? RangeShape.estimate : RangeShape.exact,
|
|
111
|
+
}),
|
|
112
|
+
loading: t("loading"),
|
|
113
|
+
search: (name) => t("search", other(name)),
|
|
114
|
+
filters: (name) => t("filters", other(name)),
|
|
115
|
+
pageSize: t("pageSize"),
|
|
116
|
+
addFilter: t("addFilter"),
|
|
117
|
+
resetFilters: t("resetFilters"),
|
|
118
|
+
removeFilter: (field) => t("removeFilter", { field }),
|
|
119
|
+
previousPage: t("previousPage"),
|
|
120
|
+
nextPage: t("nextPage"),
|
|
121
|
+
page: (page) => t("page", { page }),
|
|
122
|
+
pagination: (name) => t("pagination", other(name)),
|
|
123
|
+
loadMore: t("loadMore"),
|
|
124
|
+
showDeleted: t("showDeleted"),
|
|
125
|
+
columns: t("columns"),
|
|
126
|
+
views: (name) => t("views", other(name)),
|
|
127
|
+
allRows: t("allRows"),
|
|
128
|
+
saveView: t("saveView"),
|
|
129
|
+
viewName: t("viewName"),
|
|
130
|
+
removeView: (label) => t("removeView", { label }),
|
|
131
|
+
removeViews: (name) => t("removeViews", other(name)),
|
|
132
|
+
confirmRemoveView: (label) => t("confirmRemoveView", { label }),
|
|
133
|
+
viewOptions: (label) => t("viewOptions", { label }),
|
|
134
|
+
viewModified: t("viewModified"),
|
|
135
|
+
saveViewChanges: t("saveViewChanges"),
|
|
136
|
+
renameView: t("renameView"),
|
|
137
|
+
defaultView: t("defaultView"),
|
|
138
|
+
setDefaultView: t("setDefaultView"),
|
|
139
|
+
unsetDefaultView: t("unsetDefaultView"),
|
|
140
|
+
onlyThisBrowser: t("onlyThisBrowser"),
|
|
141
|
+
selected: (count) => t("selected", { count, gender }),
|
|
142
|
+
selectAllMatching: (count, name) => t("selectAllMatching", { count, ...other(name) }),
|
|
143
|
+
allMatchingSelected: (count, name) => t("allMatchingSelected", { count, ...other(name) }),
|
|
144
|
+
clearSelection: t("clearSelection"),
|
|
145
|
+
exportCsv: t("exportCsv"),
|
|
146
|
+
importCsv: t("importCsv"),
|
|
147
|
+
importTitle: (name) => t("importTitle", other(name)),
|
|
148
|
+
importTool: (name) => t("importTool", other(name)),
|
|
149
|
+
importNoRows: t("importNoRows"),
|
|
150
|
+
columnField: (column) => t("columnField", { column }),
|
|
151
|
+
skipColumn: t("skipColumn"),
|
|
152
|
+
next: t("next"),
|
|
153
|
+
close: t("close"),
|
|
154
|
+
importReady: (valid, invalid) => t("importReady", { valid, invalid }),
|
|
155
|
+
importRows: (count) => t("importRows", { count }),
|
|
156
|
+
downloadErrors: t("downloadErrors"),
|
|
157
|
+
importing: (done, total) => t("importing", { done, total }),
|
|
158
|
+
stop: t("stop"),
|
|
159
|
+
importSummary: ({ created, updated, failed, cancelled }) => t("importSummary", { created, updated, failed, cancelled: flag(cancelled) }),
|
|
160
|
+
line: t("line"),
|
|
161
|
+
errorColumn: t("errorColumn"),
|
|
162
|
+
exportTooLarge: (count, limit) => t("exportTooLarge", { count, limit }),
|
|
163
|
+
confirmRemove: (target) => t("confirmRemove", { target, gender }),
|
|
164
|
+
confirmRemoveDescription: t("confirmRemoveDescription"),
|
|
165
|
+
removeAgentConfirm: (target) => t("removeAgentConfirm", { target, gender }),
|
|
166
|
+
removed: (count, name) => t("removed", { count, ...other(name) }),
|
|
167
|
+
created: (title) => t("created", { title, gender }),
|
|
168
|
+
saved: (title) => t("saved", { title, gender }),
|
|
169
|
+
restored: (count) => t("restored", { count, gender }),
|
|
170
|
+
failed: t("failed"),
|
|
171
|
+
unsavedChanges: t("unsavedChanges"),
|
|
172
|
+
discard: t("discard"),
|
|
173
|
+
keepEditing: t("keepEditing"),
|
|
174
|
+
draftFound: (date) => t("draftFound", { date }),
|
|
175
|
+
draft: (title) => t("draft", { title: lower(title), Title: title, gender }),
|
|
176
|
+
restoreDraft: t("restoreDraft"),
|
|
177
|
+
discardDraft: t("discardDraft"),
|
|
178
|
+
favorites: t("favorites"),
|
|
179
|
+
recents: t("recents"),
|
|
180
|
+
pin: (label) => t("pin", { label }),
|
|
181
|
+
unpin: (label) => t("unpin", { label }),
|
|
182
|
+
goTo: t("goTo"),
|
|
183
|
+
pages: t("pages"),
|
|
184
|
+
actions: t("actions"),
|
|
185
|
+
breadcrumb: t("breadcrumb"),
|
|
186
|
+
audit: {
|
|
187
|
+
createdAt: t("audit.createdAt"),
|
|
188
|
+
createdBy: t("audit.createdBy"),
|
|
189
|
+
updatedAt: t("audit.updatedAt"),
|
|
190
|
+
updatedBy: t("audit.updatedBy"),
|
|
191
|
+
},
|
|
192
|
+
yes: t("yes"),
|
|
193
|
+
no: t("no"),
|
|
194
|
+
notSet: t("notSet"),
|
|
195
|
+
dropFile: t("dropFile"),
|
|
196
|
+
browseFiles: t("browseFiles"),
|
|
197
|
+
controls: controlsOf(t),
|
|
198
|
+
issues: ({ code: issue, params, label }) => lookup(locale, `issues.${issue}`, { ...params, ...(label === undefined ? {} : { label }) }),
|
|
199
|
+
missingRecord: (id) => t("missingRecord", { id }),
|
|
200
|
+
addRow: t("addRow"),
|
|
201
|
+
removeRow: (row) => t("removeRow", { row }),
|
|
202
|
+
invalidDuration: t("invalidDuration"),
|
|
203
|
+
errors: errorsOf(t),
|
|
204
|
+
bulkResult: (succeeded, failed) => t("bulkResult", { succeeded, failed }),
|
|
205
|
+
retryFailed: (count) => t("retryFailed", { count }),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const built = new WeakMap();
|
|
209
|
+
/**
|
|
210
|
+
* The `DataLabels` the blocks read, from a locale's messages. Messages about a resource get its `gender` too
|
|
211
|
+
* (`Gender.feminine`, `"f"`), for a `select`; `{one}` and `{other}` are its name in lower case, `{One}` and `{Other}`
|
|
212
|
+
* as written.
|
|
213
|
+
*/
|
|
214
|
+
export function dataLabelsOf(locale, gender = NoGender) {
|
|
215
|
+
let byGender = built.get(locale);
|
|
216
|
+
if (!byGender) {
|
|
217
|
+
byGender = new Map();
|
|
218
|
+
built.set(locale, byGender);
|
|
219
|
+
}
|
|
220
|
+
const known = byGender.get(gender);
|
|
221
|
+
if (known)
|
|
222
|
+
return known;
|
|
223
|
+
const labels = build(locale, gender);
|
|
224
|
+
byGender.set(gender, labels);
|
|
225
|
+
return labels;
|
|
226
|
+
}
|
|
227
|
+
export { Gender };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type MessageValues } from "./format.js";
|
|
2
|
+
import type { Messages, MessagesInput, StrictMessages } from "./messages.js";
|
|
3
|
+
import type { AnyResource } from "../resource/resource-types.js";
|
|
4
|
+
export type { MessageValues };
|
|
5
|
+
/** Formats the message under `key` with `values`; the key itself when no catalog has it. */
|
|
6
|
+
export type Translate = (key: string, values?: MessageValues) => string;
|
|
7
|
+
/**
|
|
8
|
+
* The language the App SDK speaks: a BCP 47 `code` for `Intl`, and the messages its blocks and the app's resources
|
|
9
|
+
* read. `defineLocale` makes one from JSON catalogs; `fromNextIntl`, `fromI18next` and `fromIntl` from the app's own
|
|
10
|
+
* library.
|
|
11
|
+
*/
|
|
12
|
+
export type Locale = {
|
|
13
|
+
readonly code: string;
|
|
14
|
+
readonly t: Translate;
|
|
15
|
+
readonly has: (key: string) => boolean;
|
|
16
|
+
};
|
|
17
|
+
declare const messageRef: unique symbol;
|
|
18
|
+
/** A message of the app's catalog, by key: `msg("orders.cancel")`, resolved with the `DataLayer`'s locale. */
|
|
19
|
+
export type MessageRef = {
|
|
20
|
+
readonly [messageRef]: true;
|
|
21
|
+
readonly key: string;
|
|
22
|
+
readonly values?: MessageValues;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Any user-visible string of a `define…`: the text itself, a message by key (`msg("orders.cancel")`) or a function
|
|
26
|
+
* of the locale's `t`, called at render with the `DataLayer`'s locale.
|
|
27
|
+
*/
|
|
28
|
+
export type Text = string | MessageRef | ((t: Translate, locale: Locale | undefined) => string);
|
|
29
|
+
export declare function msg(key: string, values?: MessageValues): MessageRef;
|
|
30
|
+
export declare function isMessageRef(value: unknown): value is MessageRef;
|
|
31
|
+
/** A `Text` as a string in `locale`; without one, a message by key shows its key. */
|
|
32
|
+
export declare function resolveText(text: Text, locale: Locale | undefined): string;
|
|
33
|
+
export declare function resolveText(text: Text | undefined, locale: Locale | undefined): string | undefined;
|
|
34
|
+
/** A refusal whose reason a person reads, so it may be a message: `{ allowed: false, reason: msg("orders.paid") }`. */
|
|
35
|
+
export type TextRefusal = {
|
|
36
|
+
allowed: false;
|
|
37
|
+
reason: Text;
|
|
38
|
+
};
|
|
39
|
+
/** A `can`'s answer with its reason in `locale`. */
|
|
40
|
+
export declare function refusalIn(answer: boolean | TextRefusal | undefined, locale: Locale | undefined): boolean | {
|
|
41
|
+
allowed: false;
|
|
42
|
+
reason: string;
|
|
43
|
+
} | undefined;
|
|
44
|
+
/** The message under `key` when `locale` has it, else `undefined`: how a convention key stays optional. */
|
|
45
|
+
export declare function lookup(locale: Locale | undefined, key: string, values?: MessageValues): string | undefined;
|
|
46
|
+
/** A catalog as JSON holds it: messages nested by key, `{ "controls": { "date": { "clear": "…" } } }`. */
|
|
47
|
+
export type Catalog = {
|
|
48
|
+
readonly [key: string]: string | Catalog;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A nested catalog as flat keys, for a library whose keys are flat (FormatJS):
|
|
52
|
+
* `{ ...flattenCatalog(es, "eskais"), ...mine }`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function flattenCatalog(catalog: Catalog, prefix?: string): Record<string, string>;
|
|
55
|
+
export type LocaleOptions = {
|
|
56
|
+
/** Where a key `messages` leaves out comes from: a shipped catalog (`@eskais/app-sdk/locales/es.json`) or a locale. */
|
|
57
|
+
base?: Locale | Catalog;
|
|
58
|
+
messages?: MessagesInput;
|
|
59
|
+
};
|
|
60
|
+
declare function defineLocaleLoose(code: string, options?: LocaleOptions): Locale;
|
|
61
|
+
declare function defineLocaleStrict<const Resources extends readonly AnyResource[]>(code: string, options: {
|
|
62
|
+
resources: Resources;
|
|
63
|
+
messages: StrictMessages<Resources>;
|
|
64
|
+
base?: Locale | Catalog;
|
|
65
|
+
}): Locale;
|
|
66
|
+
/**
|
|
67
|
+
* A locale from ICU catalogs; `messages` override `base` key by key and are checked here. `defineLocale.strict`
|
|
68
|
+
* requires every key by type: each message, and each name, field and enum value of its `resources`.
|
|
69
|
+
*/
|
|
70
|
+
export declare const defineLocale: typeof defineLocaleLoose & {
|
|
71
|
+
strict: typeof defineLocaleStrict;
|
|
72
|
+
};
|
|
73
|
+
export type { Messages, MessagesInput, StrictMessages };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { isFunction, isRecord, isString } from "../core/guards.js";
|
|
2
|
+
import { checkMessage, formatMessage } from "./format.js";
|
|
3
|
+
const messageRef = Symbol.for("@eskais/app-sdk/message");
|
|
4
|
+
export function msg(key, values) {
|
|
5
|
+
return Object.freeze({ [messageRef]: true, key, ...(values === undefined ? {} : { values }) });
|
|
6
|
+
}
|
|
7
|
+
export function isMessageRef(value) {
|
|
8
|
+
return isRecord(value) && messageRef in value;
|
|
9
|
+
}
|
|
10
|
+
const keyOnly = (key) => key;
|
|
11
|
+
export function resolveText(text, locale) {
|
|
12
|
+
if (text === undefined || isString(text))
|
|
13
|
+
return text;
|
|
14
|
+
if (isFunction(text))
|
|
15
|
+
return text(locale?.t ?? keyOnly, locale);
|
|
16
|
+
return locale ? locale.t(text.key, text.values) : text.key;
|
|
17
|
+
}
|
|
18
|
+
/** A `can`'s answer with its reason in `locale`. */
|
|
19
|
+
export function refusalIn(answer, locale) {
|
|
20
|
+
if (answer === undefined || answer === true || answer === false)
|
|
21
|
+
return answer;
|
|
22
|
+
return { allowed: false, reason: resolveText(answer.reason, locale) };
|
|
23
|
+
}
|
|
24
|
+
/** The message under `key` when `locale` has it, else `undefined`: how a convention key stays optional. */
|
|
25
|
+
export function lookup(locale, key, values) {
|
|
26
|
+
return locale?.has(key) === true ? locale.t(key, values) : undefined;
|
|
27
|
+
}
|
|
28
|
+
function flatten(catalog, prefix, into) {
|
|
29
|
+
if (!isRecord(catalog))
|
|
30
|
+
return into;
|
|
31
|
+
for (const [key, value] of Object.entries(catalog)) {
|
|
32
|
+
const path = prefix === "" ? key : `${prefix}.${key}`;
|
|
33
|
+
if (isString(value))
|
|
34
|
+
into.set(path, value);
|
|
35
|
+
else
|
|
36
|
+
flatten(value, path, into);
|
|
37
|
+
}
|
|
38
|
+
return into;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A nested catalog as flat keys, for a library whose keys are flat (FormatJS):
|
|
42
|
+
* `{ ...flattenCatalog(es, "eskais"), ...mine }`.
|
|
43
|
+
*/
|
|
44
|
+
export function flattenCatalog(catalog, prefix = "") {
|
|
45
|
+
return Object.fromEntries(flatten(catalog, prefix, new Map()));
|
|
46
|
+
}
|
|
47
|
+
function isLocale(value) {
|
|
48
|
+
return isRecord(value) && isString(value.code) && isFunction(value.t) && isFunction(value.has);
|
|
49
|
+
}
|
|
50
|
+
function createLocale(code, messages, from) {
|
|
51
|
+
const own = flatten(messages, "", new Map());
|
|
52
|
+
for (const message of own.values())
|
|
53
|
+
checkMessage(message);
|
|
54
|
+
const base = from === undefined ? undefined : isLocale(from) ? from : createLocale(code, from, undefined);
|
|
55
|
+
const has = (key) => own.has(key) || base?.has(key) === true;
|
|
56
|
+
const t = (key, values) => {
|
|
57
|
+
const message = own.get(key);
|
|
58
|
+
if (message !== undefined)
|
|
59
|
+
return formatMessage(message, values, code);
|
|
60
|
+
return base ? base.t(key, values) : key;
|
|
61
|
+
};
|
|
62
|
+
return Object.freeze({ code, t, has });
|
|
63
|
+
}
|
|
64
|
+
function defineLocaleLoose(code, options = {}) {
|
|
65
|
+
return createLocale(code, options.messages, options.base);
|
|
66
|
+
}
|
|
67
|
+
function defineLocaleStrict(code, options) {
|
|
68
|
+
return createLocale(code, options.messages, options.base);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A locale from ICU catalogs; `messages` override `base` key by key and are checked here. `defineLocale.strict`
|
|
72
|
+
* requires every key by type: each message, and each name, field and enum value of its `resources`.
|
|
73
|
+
*/
|
|
74
|
+
export const defineLocale = Object.assign(defineLocaleLoose, { strict: defineLocaleStrict });
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { DataLabels } from "../core/data-labels.js";
|
|
2
|
+
import type { Resource } from "../resource/resource-types.js";
|
|
3
|
+
/** A resource's grammatical gender, for a `select` in a message: `{gender, select, f {Nueva} other {Nuevo}}`. */
|
|
4
|
+
export declare const Gender: {
|
|
5
|
+
readonly feminine: "f";
|
|
6
|
+
readonly masculine: "m";
|
|
7
|
+
readonly neuter: "n";
|
|
8
|
+
};
|
|
9
|
+
export type Gender = (typeof Gender)[keyof typeof Gender];
|
|
10
|
+
/** The schema issues a catalog's `issues` words: `"minLength": "Use at least {min} characters."`. */
|
|
11
|
+
export declare const IssueCode: {
|
|
12
|
+
readonly required: "required";
|
|
13
|
+
readonly minLength: "minLength";
|
|
14
|
+
readonly maxLength: "maxLength";
|
|
15
|
+
readonly minItems: "minItems";
|
|
16
|
+
readonly maxItems: "maxItems";
|
|
17
|
+
readonly min: "min";
|
|
18
|
+
readonly max: "max";
|
|
19
|
+
readonly email: "email";
|
|
20
|
+
readonly url: "url";
|
|
21
|
+
readonly pattern: "pattern";
|
|
22
|
+
readonly invalid: "invalid";
|
|
23
|
+
};
|
|
24
|
+
export type IssueCode = (typeof IssueCode)[keyof typeof IssueCode];
|
|
25
|
+
type Words<Labels> = {
|
|
26
|
+
readonly [Key in keyof Labels]: Labels[Key] extends string ? string : Labels[Key] extends (...args: never[]) => unknown ? string : Words<Labels[Key]>;
|
|
27
|
+
};
|
|
28
|
+
/** Every generic message, as `@eskais/app-sdk/locales/en.json` holds them: one ICU message per `DataLabels` text. */
|
|
29
|
+
export type Messages = Words<Omit<DataLabels, "issues">> & {
|
|
30
|
+
readonly issues: Readonly<Record<IssueCode, string>>;
|
|
31
|
+
};
|
|
32
|
+
type DeepPartial<Value> = {
|
|
33
|
+
readonly [Key in keyof Value]?: Value[Key] extends string ? string : DeepPartial<Value[Key]>;
|
|
34
|
+
};
|
|
35
|
+
/** What a catalog says about one resource, under `resources.<key>`. */
|
|
36
|
+
export type ResourceMessages = {
|
|
37
|
+
readonly one?: string;
|
|
38
|
+
readonly other?: string;
|
|
39
|
+
readonly gender?: string;
|
|
40
|
+
/** The New button's text, when "New {one}" doesn't fit. */
|
|
41
|
+
readonly create?: string;
|
|
42
|
+
/** Field and column labels, by key: `"fields": { "placedAt": "Fecha" }`. */
|
|
43
|
+
readonly fields?: Readonly<Record<string, unknown>>;
|
|
44
|
+
/** Field descriptions, by key. */
|
|
45
|
+
readonly descriptions?: Readonly<Record<string, string>>;
|
|
46
|
+
/** Each enum value's text, by field: `"values": { "status": { "pending": "Pendiente" } }`. */
|
|
47
|
+
readonly values?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
48
|
+
/** Field group legends, by group id. */
|
|
49
|
+
readonly groups?: Readonly<Record<string, string>>;
|
|
50
|
+
/** The resource's actions, by the id after `<key>.`: `"actions": { "cancel": "Cancelar" }`. */
|
|
51
|
+
readonly actions?: Readonly<Record<string, string>>;
|
|
52
|
+
/** The record page's own tabs and sections, by id. */
|
|
53
|
+
readonly tabs?: Readonly<Record<string, string>>;
|
|
54
|
+
readonly sections?: Readonly<Record<string, string>>;
|
|
55
|
+
};
|
|
56
|
+
/** A catalog to merge over a base: any generic message, the app's resources and the app's own keys for `msg()`. */
|
|
57
|
+
export type MessagesInput = DeepPartial<Messages> & {
|
|
58
|
+
readonly resources?: Readonly<Record<string, ResourceMessages>>;
|
|
59
|
+
readonly [key: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
type Primitive = string | number | boolean | bigint | null | undefined | Date;
|
|
62
|
+
type Literals<Value> = string extends Value ? never : Value extends string ? Value : never;
|
|
63
|
+
type Labelled<Row> = {
|
|
64
|
+
[Key in Exclude<keyof Row & string, "id">]-?: NonNullable<Row[Key]> extends Primitive | readonly Primitive[] ? Key : never;
|
|
65
|
+
}[Exclude<keyof Row & string, "id">];
|
|
66
|
+
type Enums<Row> = {
|
|
67
|
+
[Key in keyof Row & string]-?: [Literals<NonNullable<Row[Key]>>] extends [never] ? never : Key;
|
|
68
|
+
}[keyof Row & string];
|
|
69
|
+
type StrictResource<Row> = Omit<ResourceMessages, "one" | "other" | "fields" | "values"> & {
|
|
70
|
+
readonly one: string;
|
|
71
|
+
readonly other: string;
|
|
72
|
+
readonly fields: {
|
|
73
|
+
readonly [Key in Labelled<Row>]: string;
|
|
74
|
+
} & Readonly<Record<string, unknown>>;
|
|
75
|
+
} & ([Enums<Row>] extends [never] ? {
|
|
76
|
+
readonly values?: ResourceMessages["values"];
|
|
77
|
+
} : {
|
|
78
|
+
readonly values: {
|
|
79
|
+
readonly [Key in Enums<Row>]: Readonly<Record<Literals<NonNullable<Row[Key]>>, string>>;
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
type UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends (value: infer Intersection) => void ? Intersection : never;
|
|
83
|
+
type ResourcesCatalog<Resources extends readonly unknown[]> = UnionToIntersection<{
|
|
84
|
+
[Index in keyof Resources]: Resources[Index] extends Resource<infer Row, infer _Id, infer _Filter, infer Key> ? {
|
|
85
|
+
readonly [Name in Key]: StrictResource<Row>;
|
|
86
|
+
} : never;
|
|
87
|
+
}[number]>;
|
|
88
|
+
/** `defineLocale.strict`'s catalog: every message, and every name, field and enum value of `Resources`. */
|
|
89
|
+
export type StrictMessages<Resources extends readonly unknown[]> = Messages & {
|
|
90
|
+
readonly resources: ResourcesCatalog<Resources>;
|
|
91
|
+
readonly [key: string]: unknown;
|
|
92
|
+
};
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** A resource's grammatical gender, for a `select` in a message: `{gender, select, f {Nueva} other {Nuevo}}`. */
|
|
2
|
+
export const Gender = { feminine: "f", masculine: "m", neuter: "n" };
|
|
3
|
+
/** The schema issues a catalog's `issues` words: `"minLength": "Use at least {min} characters."`. */
|
|
4
|
+
export const IssueCode = {
|
|
5
|
+
required: "required",
|
|
6
|
+
minLength: "minLength",
|
|
7
|
+
maxLength: "maxLength",
|
|
8
|
+
minItems: "minItems",
|
|
9
|
+
maxItems: "maxItems",
|
|
10
|
+
min: "min",
|
|
11
|
+
max: "max",
|
|
12
|
+
email: "email",
|
|
13
|
+
url: "url",
|
|
14
|
+
pattern: "pattern",
|
|
15
|
+
invalid: "invalid",
|
|
16
|
+
};
|
package/dist/import/import.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileFormat, ImportMode } from "../core/constants.js";
|
|
2
2
|
import type { CallContext } from "../core/contracts.js";
|
|
3
|
+
import type { Locale } from "../i18n/locale.js";
|
|
3
4
|
import { type ServiceError } from "../core/errors.js";
|
|
4
5
|
import { type Allowed } from "../core/refusal.js";
|
|
5
6
|
import type { ResolvedField, Resource } from "../resource/resource.js";
|
|
@@ -80,10 +81,11 @@ export type Import<T, Id = unknown, F = unknown> = {
|
|
|
80
81
|
readonly mode: ImportMode;
|
|
81
82
|
/** Whether a file of this format can be read. */
|
|
82
83
|
checkFormat(format: FileFormat): Allowed;
|
|
83
|
-
fields
|
|
84
|
+
/** The fields rows go to, labelled in `locale`. */
|
|
85
|
+
fields(locale?: Locale): ResolvedField<T>[];
|
|
84
86
|
read(text: string): CsvTable;
|
|
85
87
|
/** Pairs columns with fields by key, label and `match`, ignoring case, accents and punctuation. */
|
|
86
|
-
match(header: readonly string[]): ImportMapping;
|
|
88
|
+
match(header: readonly string[], locale?: Locale): ImportMapping;
|
|
87
89
|
/** The rows as records of the fields they go to, each text turned into the field's type. */
|
|
88
90
|
recordsOf(table: CsvTable, mapping: ImportMapping): Record<string, unknown>[];
|
|
89
91
|
/** Checks records against the resource's create schema; `firstLine` numbers them (2 under a header). */
|
package/dist/import/import.js
CHANGED
|
@@ -67,8 +67,11 @@ export function defineImport(resource, options = {}) {
|
|
|
67
67
|
const formats = options.formats ?? [FileFormat.csv];
|
|
68
68
|
const mode = options.mode ?? ImportMode.create;
|
|
69
69
|
const chunk = Math.max(1, options.chunk ?? 100);
|
|
70
|
-
const fields = () => {
|
|
71
|
-
const all = resource
|
|
70
|
+
const fields = (locale) => {
|
|
71
|
+
const all = resource
|
|
72
|
+
.in(locale)
|
|
73
|
+
.fields(FormStage.create)
|
|
74
|
+
.filter((field) => !field.readOnly(undefined));
|
|
72
75
|
return options.fields ? all.filter((field) => options.fields?.includes(field.key) === true) : all;
|
|
73
76
|
};
|
|
74
77
|
async function saveRow(row, context) {
|
|
@@ -106,9 +109,9 @@ export function defineImport(resource, options = {}) {
|
|
|
106
109
|
},
|
|
107
110
|
fields,
|
|
108
111
|
read: (text) => parseCsv(text),
|
|
109
|
-
match(header) {
|
|
112
|
+
match(header, locale) {
|
|
110
113
|
const aliases = new Map(Object.entries(options.match ?? {}).map(([name, key]) => [plain(name), key]));
|
|
111
|
-
const known = fields();
|
|
114
|
+
const known = fields(locale);
|
|
112
115
|
const taken = new Set();
|
|
113
116
|
return Object.fromEntries(header.map((name) => {
|
|
114
117
|
const wanted = plain(name);
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export { isPagePosition } from "./core/contracts.js";
|
|
|
4
4
|
export { fieldErrorsOf, httpServiceError, isServiceError, kindOfStatus, problemDetailError, ServiceFailure, serviceError, toServiceError, type ServiceError, type ServiceFieldError, } from "./core/errors.js";
|
|
5
5
|
export { AppActionRefusedError, firstRefusal, isRefusal, refuse, refusedError, toAllowed, unavailableError, clause, failedError, type Allowed, type Refusal, } from "./core/refusal.js";
|
|
6
6
|
export { createSession, fromCasl, type CaslAbilityLike, type CaslSessionOptions, type PermissionSubject, type Session, type SessionOptions, } from "./session/session.js";
|
|
7
|
+
export { allows, definePermissions, GrantScope, hasRole, permitted, sessionPayload, type GrantedPermissions, type Grants, type OperationOf, type OperationRules, type Operations, type PermissionAnswer, type PermissionContext, type PermissionRule, type PermissionRules, type Permissions, type PermissionSession, type PermissionSessionOptions, type PermissionsOptions, type PermissionTarget, type PermissionUses, type Register, type RegisteredOperation, type SessionPayload, } from "./permissions/permissions.js";
|
|
8
|
+
export { holdNewRows, type HeldPage } from "./refresh/new-rows.js";
|
|
9
|
+
export { createDialogQueue, DialogKind, type AlertRequest, type ConfirmRequest, type DialogAnswer, type DialogEntry, type DialogQueue, type Dialogs, type DialogsSnapshot, type DialogTexts, type PromptRequest, } from "./dialogs/dialogs.js";
|
|
7
10
|
export { betterAuthPermissions, betterAuthServerSession, betterAuthSession, betterAuthStoreSession, type BetterAuthPermissions, type BetterAuthRoleLike, type BetterAuthServerLike, type BetterAuthSessionData, type BetterAuthSessionOptions, type BetterAuthStoreLike, type BetterAuthUser, } from "./session/better-auth.js";
|
|
8
11
|
export { hashRouter, historyRouter, joinPath, memoryRouter, splitPath, tanstackRouter, type HashRouterOptions, type HistoryRouterOptions, type MemoryRouter, type NavigateOptions, type RouterAdapter, type RouterLocation, type TanstackRouterLike, } from "./navigation/router.js";
|
|
9
12
|
export { localPreferences, localViews, memoryPreferences, remotePreferences, type PreferencesStore, type SavedView, type ViewStore, } from "./view/preferences.js";
|
|
@@ -13,10 +16,11 @@ export { applyQuery, matchesFilter, matchesSearch, sortRows, valueAt } from "./s
|
|
|
13
16
|
export { memoryService, type MemoryService, type MemoryServiceOptions } from "./services/memory-service.js";
|
|
14
17
|
export { HttpMethod, restService, type RestServiceOptions } from "./services/rest-service.js";
|
|
15
18
|
export { fromPageSource, type PageSourceCrud } from "./services/from-page-source.js";
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
19
|
+
export { readOnlyService, type ReadService } from "./services/read-only-service.js";
|
|
20
|
+
export { defineResource, dependentsOf, refreshPolicy, searchKey, type RefreshPolicy, type ResolvedRefresh, type AnyResource, type ColumnDef, type DetailOptions, type DetailSectionDef, type DetailTabDef, type ResolvedDetail, type ResourceScreens, type RoutedScreen, type ScreenComponent, type OptionDef, type FieldDef, type FieldGroup, type FilterDef, type Option, type Path, type ResolvedColumn, type ResolvedField, type ResolvedFilter, type Resource, type ResourceAudit, type ResourceLabel, type ResourceMatch, type ResourceOptions, type ResourceRoutes, type ResourceShortcuts, type DefineResourceOptions, type ResolvedRelation, type ToneName, } from "./resource/resource.js";
|
|
21
|
+
export { actionsOf, defineAction, isAction, messageOf, type Action, type ActionConfirm, type ActionConfirmDef, type ActionMessage, type ActionOptions, type ActionRunOptions, type ActionTarget, type AnyAction, } from "./action/action.js";
|
|
18
22
|
export { defineView, type Selection, type View, type ViewOptions, type ViewPreset, type ViewScope, type ViewSnapshot, type ViewState, } from "./view/view.js";
|
|
19
|
-
export { count, defineNav, isNavCount, navItem, type Nav, type NavBadge, type NavCount, type NavGroup, type NavItem, type NavOptions, type NavRouteBuilder, type NavSnapshot, type TrailEntry, } from "./navigation/nav.js";
|
|
23
|
+
export { count, defineNav, isNavCount, navItem, screenUse, type Nav, type NavBadge, type NavCount, type NavGroup, type NavItem, type NavOptions, type NavRouteBuilder, type NavSnapshot, type TrailEntry, } from "./navigation/nav.js";
|
|
20
24
|
export { defineDraft, isStoredDraft, type Draft, type DraftOptions, type DraftSnapshot, type StoredDraft, } from "./draft/draft.js";
|
|
21
25
|
export { fieldsSchema, formSchemaOf, issueText } from "./resource/form-schema.js";
|
|
22
26
|
export { schemaFields } from "./resource/resource-schema.js";
|
|
@@ -29,3 +33,14 @@ export { parseCsv, type CsvTable } from "./import/csv-parse.js";
|
|
|
29
33
|
export { defineImport, invalidRowsText, type Import, type ImportCheckOptions, type ImportChunkResult, type ImportIssue, type ImportMapping, type ImportOptions, type ImportPreview, type ImportRow, type ImportRunOptions, type ImportSummary, } from "./import/import.js";
|
|
30
34
|
export { belongsTo, childChanges, chunkIds, embeds, hasMany, includeOf, keyRelation, manyToMany, registerResource, resolveRelations, type BelongsTo, type ChildChanges, type Embeds, type HasMany, type ManyToMany, type Relation, type RelationContext, type RelationRows, type Relations, } from "./resource/relations.js";
|
|
31
35
|
export { isListSchema } from "./resource/schema.js";
|
|
36
|
+
export { defineLocale, flattenCatalog, isMessageRef, lookup, msg, refusalIn, resolveText, type Catalog, type Locale, type LocaleOptions, type MessageRef, type MessageValues, type Text, type TextRefusal, type Translate, } from "./i18n/locale.js";
|
|
37
|
+
export { Gender, IssueCode, type Messages, type MessagesInput, type ResourceMessages, type StrictMessages, } from "./i18n/messages.js";
|
|
38
|
+
export { checkMessage, formatMessage } from "./i18n/format.js";
|
|
39
|
+
export { dataLabelsOf } from "./i18n/labels.js";
|
|
40
|
+
export { fromI18next, fromIntl, fromNextIntl, type AdapterOptions, type I18nextLike, type IntlShapeLike, type NextIntlTranslator, type NextIntlValue, } from "./i18n/adapters.js";
|
|
41
|
+
export { isErrorReason, reasonOf } from "./core/errors.js";
|
|
42
|
+
export { defineErrors, type AppError, type CallOptions, type CodePolicy, type Errors, type ErrorsOptions, type FeedbackOptions, type Reauthenticate, type ReasonPolicy, type RetryOptions, } from "./errors/define-errors.js";
|
|
43
|
+
export { appError, firebaseErrors, responseErrors, type ErrorAdapter } from "./errors/adapters.js";
|
|
44
|
+
export { idempotencyKey } from "./errors/idempotency.js";
|
|
45
|
+
export { defineBulkAction, type BulkActionOptions } from "./action/action.js";
|
|
46
|
+
export { failedTarget, isBulkResult, type BulkFailure, type BulkResult } from "./action/bulk.js";
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,9 @@ export { isPagePosition } from "./core/contracts.js";
|
|
|
3
3
|
export { fieldErrorsOf, httpServiceError, isServiceError, kindOfStatus, problemDetailError, ServiceFailure, serviceError, toServiceError, } from "./core/errors.js";
|
|
4
4
|
export { AppActionRefusedError, firstRefusal, isRefusal, refuse, refusedError, toAllowed, unavailableError, clause, failedError, } from "./core/refusal.js";
|
|
5
5
|
export { createSession, fromCasl, } from "./session/session.js";
|
|
6
|
+
export { allows, definePermissions, GrantScope, hasRole, permitted, sessionPayload, } from "./permissions/permissions.js";
|
|
7
|
+
export { holdNewRows } from "./refresh/new-rows.js";
|
|
8
|
+
export { createDialogQueue, DialogKind, } from "./dialogs/dialogs.js";
|
|
6
9
|
export { betterAuthPermissions, betterAuthServerSession, betterAuthSession, betterAuthStoreSession, } from "./session/better-auth.js";
|
|
7
10
|
export { hashRouter, historyRouter, joinPath, memoryRouter, splitPath, tanstackRouter, } from "./navigation/router.js";
|
|
8
11
|
export { localPreferences, localViews, memoryPreferences, remotePreferences, } from "./view/preferences.js";
|
|
@@ -12,10 +15,11 @@ export { applyQuery, matchesFilter, matchesSearch, sortRows, valueAt } from "./s
|
|
|
12
15
|
export { memoryService } from "./services/memory-service.js";
|
|
13
16
|
export { HttpMethod, restService } from "./services/rest-service.js";
|
|
14
17
|
export { fromPageSource } from "./services/from-page-source.js";
|
|
15
|
-
export {
|
|
18
|
+
export { readOnlyService } from "./services/read-only-service.js";
|
|
19
|
+
export { defineResource, dependentsOf, refreshPolicy, searchKey, } from "./resource/resource.js";
|
|
16
20
|
export { actionsOf, defineAction, isAction, messageOf, } from "./action/action.js";
|
|
17
21
|
export { defineView, } from "./view/view.js";
|
|
18
|
-
export { count, defineNav, isNavCount, navItem, } from "./navigation/nav.js";
|
|
22
|
+
export { count, defineNav, isNavCount, navItem, screenUse, } from "./navigation/nav.js";
|
|
19
23
|
export { defineDraft, isStoredDraft, } from "./draft/draft.js";
|
|
20
24
|
export { fieldsSchema, formSchemaOf, issueText } from "./resource/form-schema.js";
|
|
21
25
|
export { schemaFields } from "./resource/resource-schema.js";
|
|
@@ -28,3 +32,14 @@ export { parseCsv } from "./import/csv-parse.js";
|
|
|
28
32
|
export { defineImport, invalidRowsText, } from "./import/import.js";
|
|
29
33
|
export { belongsTo, childChanges, chunkIds, embeds, hasMany, includeOf, keyRelation, manyToMany, registerResource, resolveRelations, } from "./resource/relations.js";
|
|
30
34
|
export { isListSchema } from "./resource/schema.js";
|
|
35
|
+
export { defineLocale, flattenCatalog, isMessageRef, lookup, msg, refusalIn, resolveText, } from "./i18n/locale.js";
|
|
36
|
+
export { Gender, IssueCode, } from "./i18n/messages.js";
|
|
37
|
+
export { checkMessage, formatMessage } from "./i18n/format.js";
|
|
38
|
+
export { dataLabelsOf } from "./i18n/labels.js";
|
|
39
|
+
export { fromI18next, fromIntl, fromNextIntl, } from "./i18n/adapters.js";
|
|
40
|
+
export { isErrorReason, reasonOf } from "./core/errors.js";
|
|
41
|
+
export { defineErrors, } from "./errors/define-errors.js";
|
|
42
|
+
export { appError, firebaseErrors, responseErrors } from "./errors/adapters.js";
|
|
43
|
+
export { idempotencyKey } from "./errors/idempotency.js";
|
|
44
|
+
export { defineBulkAction } from "./action/action.js";
|
|
45
|
+
export { failedTarget, isBulkResult } from "./action/bulk.js";
|