@sealcode/sealgen 0.19.13 → 0.19.15
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/@types/controllers/password-generate-button.stimulus.d.ts +5 -0
- package/@types/forms/controls/controls.d.ts +22 -21
- package/@types/forms/controls/password-with-generator.d.ts +6 -0
- package/@types/forms/fields/field.d.ts +2 -0
- package/lib/controllers/password-generate-button.stimulus.js +24 -0
- package/lib/forms/controls/controls.js +22 -21
- package/lib/forms/controls/password-with-generator.js +21 -0
- package/lib/forms/controls/simple-input.js +1 -0
- package/lib/forms/fields/field.js +5 -0
- package/lib/forms/fields/simple-form-field.js +3 -0
- package/lib/templates/form.js +2 -2
- package/lib/templates/shared/collection-edit-form.js +8 -2
- package/package.json +1 -1
- package/src/controllers/password-generate-button.stimulus.ts +25 -0
- package/src/forms/controls/controls.ts +22 -21
- package/src/forms/controls/password-with-generator.ts +17 -0
- package/src/forms/controls/simple-input.ts +21 -21
- package/src/forms/fields/field.ts +6 -0
- package/src/forms/fields/simple-form-field.ts +3 -0
- package/src/templates/form.ts +2 -2
- package/src/templates/shared/collection-edit-form.ts +8 -2
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from "./autocomplete.js";
|
|
2
|
+
export * from "./big-radio-group.js";
|
|
3
|
+
export * from "./checkbox-group.js";
|
|
4
|
+
export * from "./checkbox.js";
|
|
5
5
|
export { CheckboxedListInput } from "./checkboxed-list-input.js";
|
|
6
|
+
export * from "./collapsible-checkbox-group.js";
|
|
7
|
+
export * from "./collapsible-field-group.js";
|
|
8
|
+
export * from "./derived-frame.js";
|
|
9
|
+
export * from "./derived.js";
|
|
6
10
|
export * from "./dropdown.js";
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
11
|
+
export { EditableCollectionSubset } from "./editable-collection-subset.js";
|
|
12
|
+
export { FieldGroup } from "./field-group.js";
|
|
13
|
+
export * from "./file.js";
|
|
14
|
+
export { FormControl } from "./form-control.js";
|
|
15
|
+
export { FormFieldControl } from "./form-field-control.js";
|
|
9
16
|
export { FormHeader } from "./form-header.js";
|
|
10
17
|
export { FormParagraph } from "./form-paragraph.js";
|
|
11
|
-
export {
|
|
18
|
+
export { Frame } from "./frame.js";
|
|
12
19
|
export { HiddenInput } from "./hidden-input.js";
|
|
13
|
-
export {
|
|
14
|
-
export { FieldGroup } from "./field-group.js";
|
|
15
|
-
export * from "./derived.js";
|
|
16
|
-
export * from "./derived-frame.js";
|
|
17
|
-
export * from "./tickable.js";
|
|
18
|
-
export * from "./checkbox.js";
|
|
19
|
-
export * from "./radio.js";
|
|
20
|
-
export * from "./big-radio-group.js";
|
|
21
|
-
export * from "./checkbox-group.js";
|
|
22
|
-
export * from "./collapsible-field-group.js";
|
|
23
|
-
export * from "./collapsible-checkbox-group.js";
|
|
24
|
-
export * from "./autocomplete.js";
|
|
25
|
-
export * from "./file.js";
|
|
20
|
+
export { HTML } from "./html.js";
|
|
26
21
|
export * from "./image.js";
|
|
27
22
|
export * from "./multiple-files.js";
|
|
28
|
-
export * from "./number.js";
|
|
29
23
|
export * from "./multiple-images.js";
|
|
24
|
+
export * from "./number.js";
|
|
25
|
+
export * from "./password-with-generator.js";
|
|
26
|
+
export * from "./radio.js";
|
|
27
|
+
export { SimpleInput } from "./simple-input.js";
|
|
28
|
+
export * from "./single-reference.js";
|
|
29
|
+
export { Textarea } from "./textarea.js";
|
|
30
|
+
export * from "./tickable.js";
|
|
30
31
|
export * from "./array.js";
|
|
31
32
|
export * from "./table.js";
|
|
@@ -36,8 +36,10 @@ export declare abstract class FormField<Required extends boolean = boolean, Pars
|
|
|
36
36
|
constructor(required: Required);
|
|
37
37
|
predicate: Predicate;
|
|
38
38
|
mapToFilter: (parsed: ParsedValue) => unknown;
|
|
39
|
+
disabled: boolean;
|
|
39
40
|
init(): Promise<void>;
|
|
40
41
|
setName(name: string): this;
|
|
42
|
+
setDisabled(status: boolean): this;
|
|
41
43
|
setLabel(label: string): this;
|
|
42
44
|
_validate(ctx: Context, value: ParsedValue): Promise<FormFieldValidationResponse>;
|
|
43
45
|
abstract getEmptyValue(): ParsedValue;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Controller } from "stimulus";
|
|
2
|
+
function generatePassword() {
|
|
3
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";
|
|
4
|
+
let password = "";
|
|
5
|
+
for (let i = 0; i < 8; i++) {
|
|
6
|
+
password += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
7
|
+
}
|
|
8
|
+
return password;
|
|
9
|
+
}
|
|
10
|
+
class password_generate_button_stimulus_default extends Controller {
|
|
11
|
+
getInput() {
|
|
12
|
+
return this.element.parentElement.querySelector(
|
|
13
|
+
"input"
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
generate() {
|
|
17
|
+
this.getInput().value = generatePassword();
|
|
18
|
+
this.getInput().setAttribute("type", "text");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
password_generate_button_stimulus_default as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=password-generate-button.stimulus.js.map
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export * from "./autocomplete.js";
|
|
2
|
+
export * from "./big-radio-group.js";
|
|
3
|
+
export * from "./checkbox-group.js";
|
|
4
|
+
export * from "./checkbox.js";
|
|
5
5
|
import { CheckboxedListInput } from "./checkboxed-list-input.js";
|
|
6
|
+
export * from "./collapsible-checkbox-group.js";
|
|
7
|
+
export * from "./collapsible-field-group.js";
|
|
8
|
+
export * from "./derived-frame.js";
|
|
9
|
+
export * from "./derived.js";
|
|
6
10
|
export * from "./dropdown.js";
|
|
7
|
-
|
|
8
|
-
import {
|
|
11
|
+
import { EditableCollectionSubset } from "./editable-collection-subset.js";
|
|
12
|
+
import { FieldGroup } from "./field-group.js";
|
|
13
|
+
export * from "./file.js";
|
|
14
|
+
import { FormControl } from "./form-control.js";
|
|
15
|
+
import { FormFieldControl } from "./form-field-control.js";
|
|
9
16
|
import { FormHeader } from "./form-header.js";
|
|
10
17
|
import { FormParagraph } from "./form-paragraph.js";
|
|
11
|
-
import {
|
|
18
|
+
import { Frame } from "./frame.js";
|
|
12
19
|
import { HiddenInput } from "./hidden-input.js";
|
|
13
|
-
import {
|
|
14
|
-
import { FieldGroup } from "./field-group.js";
|
|
15
|
-
export * from "./derived.js";
|
|
16
|
-
export * from "./derived-frame.js";
|
|
17
|
-
export * from "./tickable.js";
|
|
18
|
-
export * from "./checkbox.js";
|
|
19
|
-
export * from "./radio.js";
|
|
20
|
-
export * from "./big-radio-group.js";
|
|
21
|
-
export * from "./checkbox-group.js";
|
|
22
|
-
export * from "./collapsible-field-group.js";
|
|
23
|
-
export * from "./collapsible-checkbox-group.js";
|
|
24
|
-
export * from "./autocomplete.js";
|
|
25
|
-
export * from "./file.js";
|
|
20
|
+
import { HTML } from "./html.js";
|
|
26
21
|
export * from "./image.js";
|
|
27
22
|
export * from "./multiple-files.js";
|
|
28
|
-
export * from "./number.js";
|
|
29
23
|
export * from "./multiple-images.js";
|
|
24
|
+
export * from "./number.js";
|
|
25
|
+
export * from "./password-with-generator.js";
|
|
26
|
+
export * from "./radio.js";
|
|
27
|
+
import { SimpleInput } from "./simple-input.js";
|
|
28
|
+
export * from "./single-reference.js";
|
|
29
|
+
import { Textarea } from "./textarea.js";
|
|
30
|
+
export * from "./tickable.js";
|
|
30
31
|
export * from "./array.js";
|
|
31
32
|
export * from "./table.js";
|
|
32
33
|
export {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SimpleInput } from "./simple-input.js";
|
|
2
|
+
class PasswordWithGenerator extends SimpleInput {
|
|
3
|
+
constructor(field) {
|
|
4
|
+
super(field, { type: "password" });
|
|
5
|
+
}
|
|
6
|
+
async preInput() {
|
|
7
|
+
return (
|
|
8
|
+
/* HTML */
|
|
9
|
+
`<button
|
|
10
|
+
data-controller="password-generate-button"
|
|
11
|
+
data-action="password-generate-button#generate"
|
|
12
|
+
>
|
|
13
|
+
Generate
|
|
14
|
+
</button>`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
PasswordWithGenerator
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=password-with-generator.js.map
|
|
@@ -47,6 +47,7 @@ class SimpleInput extends FormFieldControl {
|
|
|
47
47
|
...!this.options.autocomplete ? [["autocomplete", "off"]] : [],
|
|
48
48
|
...this.options.step ? [["step", this.options.step]] : [],
|
|
49
49
|
["aria-invalid", String(!valid)],
|
|
50
|
+
["disabled", this.field.disabled],
|
|
50
51
|
...this.options.inputmode ? [["inputmode", this.options.inputmode]] : []
|
|
51
52
|
]);
|
|
52
53
|
}
|
|
@@ -11,6 +11,7 @@ class FormField {
|
|
|
11
11
|
this.required = required;
|
|
12
12
|
this.predicate = predicates.unknown;
|
|
13
13
|
this.mapToFilter = (value) => value;
|
|
14
|
+
this.disabled = false;
|
|
14
15
|
}
|
|
15
16
|
async init() {
|
|
16
17
|
}
|
|
@@ -18,6 +19,10 @@ class FormField {
|
|
|
18
19
|
this.name = name;
|
|
19
20
|
return this;
|
|
20
21
|
}
|
|
22
|
+
setDisabled(status) {
|
|
23
|
+
this.disabled = status;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
21
26
|
setLabel(label) {
|
|
22
27
|
this.label = label;
|
|
23
28
|
return this;
|
package/lib/templates/form.js
CHANGED
|
@@ -5,10 +5,10 @@ const defaults = {
|
|
|
5
5
|
import type {FormDataValue} from "@sealcode/sealgen";`,
|
|
6
6
|
get_fields: `()=>(<const>{ password: new Fields.Password(true) })`,
|
|
7
7
|
get_controls: `
|
|
8
|
-
()
|
|
8
|
+
(fields: ReturnType<typeof getFields>)=>[new Controls.SimpleInput(fields.password, {
|
|
9
9
|
label: "Password:",
|
|
10
10
|
type: "password",
|
|
11
|
-
})]
|
|
11
|
+
})]`,
|
|
12
12
|
validate_method: `async validateValues(
|
|
13
13
|
ctx: Context,
|
|
14
14
|
data: Record<string, FormDataValue>
|
|
@@ -24,8 +24,14 @@ async function editItemFormTemplate(edit_action_name, newfilefullpath, collectio
|
|
|
24
24
|
)}"),
|
|
25
25
|
...get${toPascalCase(collection_name)}FormControls(fields)]`,
|
|
26
26
|
can_access: `canAccess = async (ctx: Context) => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const policy = ${toPascalCase(collection_name)}.getPolicy("edit");
|
|
28
|
+
const response = await policy.check(ctx.$context, async () => {
|
|
29
|
+
const id = await this.getID(ctx);
|
|
30
|
+
const {
|
|
31
|
+
items: [item],
|
|
32
|
+
} = await ctx.$app.collections${wrapAttribute(collection_name)}.list(ctx.$context).ids([id]).fetch();
|
|
33
|
+
return item!;
|
|
34
|
+
});
|
|
29
35
|
return { canAccess: response?.allowed || false, message: response?.reason || "" };
|
|
30
36
|
};`,
|
|
31
37
|
onsubmit: `
|
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
import { Controller } from "stimulus";
|
|
3
|
+
|
|
4
|
+
function generatePassword() {
|
|
5
|
+
const chars =
|
|
6
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";
|
|
7
|
+
let password = "";
|
|
8
|
+
for (let i = 0; i < 8; i++) {
|
|
9
|
+
password += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
10
|
+
}
|
|
11
|
+
return password;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default class extends Controller<HTMLButtonElement> {
|
|
15
|
+
getInput(): HTMLInputElement {
|
|
16
|
+
return this.element.parentElement!.querySelector(
|
|
17
|
+
"input"
|
|
18
|
+
) as HTMLInputElement;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
generate() {
|
|
22
|
+
this.getInput().value = generatePassword();
|
|
23
|
+
this.getInput().setAttribute("type", "text");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from "./autocomplete.js";
|
|
2
|
+
export * from "./big-radio-group.js";
|
|
3
|
+
export * from "./checkbox-group.js";
|
|
4
|
+
export * from "./checkbox.js";
|
|
5
5
|
export { CheckboxedListInput } from "./checkboxed-list-input.js";
|
|
6
|
+
export * from "./collapsible-checkbox-group.js";
|
|
7
|
+
export * from "./collapsible-field-group.js";
|
|
8
|
+
export * from "./derived-frame.js";
|
|
9
|
+
export * from "./derived.js";
|
|
6
10
|
export * from "./dropdown.js";
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
11
|
+
export { EditableCollectionSubset } from "./editable-collection-subset.js";
|
|
12
|
+
export { FieldGroup } from "./field-group.js";
|
|
13
|
+
export * from "./file.js";
|
|
14
|
+
export { FormControl } from "./form-control.js";
|
|
15
|
+
export { FormFieldControl } from "./form-field-control.js";
|
|
9
16
|
export { FormHeader } from "./form-header.js";
|
|
10
17
|
export { FormParagraph } from "./form-paragraph.js";
|
|
11
|
-
export {
|
|
18
|
+
export { Frame } from "./frame.js";
|
|
12
19
|
export { HiddenInput } from "./hidden-input.js";
|
|
13
|
-
export {
|
|
14
|
-
export { FieldGroup } from "./field-group.js";
|
|
15
|
-
export * from "./derived.js";
|
|
16
|
-
export * from "./derived-frame.js";
|
|
17
|
-
export * from "./tickable.js";
|
|
18
|
-
export * from "./checkbox.js";
|
|
19
|
-
export * from "./radio.js";
|
|
20
|
-
export * from "./big-radio-group.js";
|
|
21
|
-
export * from "./checkbox-group.js";
|
|
22
|
-
export * from "./collapsible-field-group.js";
|
|
23
|
-
export * from "./collapsible-checkbox-group.js";
|
|
24
|
-
export * from "./autocomplete.js";
|
|
25
|
-
export * from "./file.js";
|
|
20
|
+
export { HTML } from "./html.js";
|
|
26
21
|
export * from "./image.js";
|
|
27
22
|
export * from "./multiple-files.js";
|
|
28
|
-
export * from "./number.js";
|
|
29
23
|
export * from "./multiple-images.js";
|
|
24
|
+
export * from "./number.js";
|
|
25
|
+
export * from "./password-with-generator.js";
|
|
26
|
+
export * from "./radio.js";
|
|
27
|
+
export { SimpleInput } from "./simple-input.js";
|
|
28
|
+
export * from "./single-reference.js";
|
|
29
|
+
export { Textarea } from "./textarea.js";
|
|
30
|
+
export * from "./tickable.js";
|
|
30
31
|
// export * from "./reverse-single-reference";
|
|
31
32
|
export * from "./array.js";
|
|
32
33
|
export * from "./table.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FormField } from "../../index.js";
|
|
2
|
+
import { SimpleInput } from "./simple-input.js";
|
|
3
|
+
|
|
4
|
+
export class PasswordWithGenerator extends SimpleInput {
|
|
5
|
+
constructor(field: FormField) {
|
|
6
|
+
super(field, { type: "password" });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async preInput() {
|
|
10
|
+
return /* HTML */ `<button
|
|
11
|
+
data-controller="password-generate-button"
|
|
12
|
+
data-action="password-generate-button#generate"
|
|
13
|
+
>
|
|
14
|
+
Generate
|
|
15
|
+
</button>`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -48,9 +48,9 @@ export class SimpleInput<
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
getLabel(): string {
|
|
51
|
-
return this.options.label != undefined
|
|
52
|
-
|
|
53
|
-
:
|
|
51
|
+
return this.options.label != undefined ?
|
|
52
|
+
this.options.label
|
|
53
|
+
: this.field.label || this.field.name;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
getID(): string {
|
|
@@ -61,9 +61,9 @@ export class SimpleInput<
|
|
|
61
61
|
if (this.field instanceof SimpleFormField && this.field.placeholder) {
|
|
62
62
|
return this.field.placeholder;
|
|
63
63
|
}
|
|
64
|
-
return this.options.placeholder === ""
|
|
65
|
-
|
|
66
|
-
:
|
|
64
|
+
return this.options.placeholder === "" ?
|
|
65
|
+
""
|
|
66
|
+
: this.options.placeholder || this.getType();
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
async getInputAttributes(
|
|
@@ -88,16 +88,17 @@ export class SimpleInput<
|
|
|
88
88
|
...(!this.options.autocomplete ? [["autocomplete", "off"]] : []),
|
|
89
89
|
...(this.options.step ? [["step", this.options.step]] : []),
|
|
90
90
|
["aria-invalid", String(!valid)],
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
["disabled", this.field.disabled],
|
|
92
|
+
...(this.options.inputmode ?
|
|
93
|
+
[["inputmode", this.options.inputmode]]
|
|
94
|
+
: []),
|
|
94
95
|
]) as Record<string, string>;
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
async postInput(_: Context): Promise<FlatTemplatable> {
|
|
98
|
-
return this.options.suffix
|
|
99
|
-
|
|
100
|
-
:
|
|
99
|
+
return this.options.suffix ?
|
|
100
|
+
/* HTML */ `<span class="suffix">${this.options.suffix}</span>`
|
|
101
|
+
: "";
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
async renderInput(
|
|
@@ -138,15 +139,14 @@ export class SimpleInput<
|
|
|
138
139
|
fctx.data.raw_values
|
|
139
140
|
)}
|
|
140
141
|
${this.postInput(fctx.ctx)}
|
|
141
|
-
${~valid && !this.options.hide_errors && fctx.validate
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
: ""}
|
|
142
|
+
${~valid && !this.options.hide_errors && fctx.validate ?
|
|
143
|
+
`<div class="input__error">${[
|
|
144
|
+
message,
|
|
145
|
+
fctx.data.field_messages?.[this.field.name]?.message,
|
|
146
|
+
]
|
|
147
|
+
.filter((e) => !!e)
|
|
148
|
+
.join(" · ")}</div>`
|
|
149
|
+
: ""}
|
|
150
150
|
`
|
|
151
151
|
);
|
|
152
152
|
}
|
|
@@ -69,6 +69,7 @@ export abstract class FormField<
|
|
|
69
69
|
constructor(public readonly required: Required) {}
|
|
70
70
|
predicate: Predicate = predicates.unknown;
|
|
71
71
|
mapToFilter: (parsed: ParsedValue) => unknown = (value) => value;
|
|
72
|
+
disabled = false;
|
|
72
73
|
|
|
73
74
|
async init(): Promise<void> {}
|
|
74
75
|
|
|
@@ -77,6 +78,11 @@ export abstract class FormField<
|
|
|
77
78
|
return this;
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
setDisabled(status: boolean) {
|
|
82
|
+
this.disabled = status;
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
|
|
80
86
|
setLabel(label: string): this {
|
|
81
87
|
this.label = label;
|
|
82
88
|
return this;
|
package/src/templates/form.ts
CHANGED
|
@@ -6,10 +6,10 @@ const defaults = {
|
|
|
6
6
|
import type {FormDataValue} from "@sealcode/sealgen";`,
|
|
7
7
|
get_fields: `()=>(<const>{ password: new Fields.Password(true) })`,
|
|
8
8
|
get_controls: `
|
|
9
|
-
()
|
|
9
|
+
(fields: ReturnType<typeof getFields>)=>[new Controls.SimpleInput(fields.password, {
|
|
10
10
|
label: "Password:",
|
|
11
11
|
type: "password",
|
|
12
|
-
})]
|
|
12
|
+
})]`,
|
|
13
13
|
validate_method: `async validateValues(
|
|
14
14
|
ctx: Context,
|
|
15
15
|
data: Record<string, FormDataValue>
|
|
@@ -35,8 +35,14 @@ export async function editItemFormTemplate(
|
|
|
35
35
|
...get${toPascalCase(collection_name)}FormControls(fields)]`,
|
|
36
36
|
|
|
37
37
|
can_access: `canAccess = async (ctx: Context) => {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const policy = ${toPascalCase(collection_name)}.getPolicy("edit");
|
|
39
|
+
const response = await policy.check(ctx.$context, async () => {
|
|
40
|
+
const id = await this.getID(ctx);
|
|
41
|
+
const {
|
|
42
|
+
items: [item],
|
|
43
|
+
} = await ctx.$app.collections${wrapAttribute(collection_name)}.list(ctx.$context).ids([id]).fetch();
|
|
44
|
+
return item!;
|
|
45
|
+
});
|
|
40
46
|
return { canAccess: response?.allowed || false, message: response?.reason || "" };
|
|
41
47
|
};`,
|
|
42
48
|
|