@evanschleret/formforgeclient 1.0.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/LICENSE +21 -0
- package/README.md +94 -0
- package/dist/module.cjs +112 -0
- package/dist/module.d.cts +20 -0
- package/dist/module.d.mts +20 -0
- package/dist/module.d.ts +20 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +109 -0
- package/dist/runtime/api/categories.d.ts +9 -0
- package/dist/runtime/api/categories.js +83 -0
- package/dist/runtime/api/client.d.ts +45 -0
- package/dist/runtime/api/client.js +148 -0
- package/dist/runtime/api/drafts.d.ts +6 -0
- package/dist/runtime/api/drafts.js +77 -0
- package/dist/runtime/api/http.d.ts +3 -0
- package/dist/runtime/api/http.js +138 -0
- package/dist/runtime/api/index.d.ts +9 -0
- package/dist/runtime/api/index.js +11 -0
- package/dist/runtime/api/management.d.ts +19 -0
- package/dist/runtime/api/management.js +180 -0
- package/dist/runtime/api/request.d.ts +8 -0
- package/dist/runtime/api/request.js +52 -0
- package/dist/runtime/api/responses.d.ts +6 -0
- package/dist/runtime/api/responses.js +61 -0
- package/dist/runtime/api/schema.d.ts +7 -0
- package/dist/runtime/api/schema.js +56 -0
- package/dist/runtime/api/submission.d.ts +11 -0
- package/dist/runtime/api/submission.js +47 -0
- package/dist/runtime/api/upload.d.ts +8 -0
- package/dist/runtime/api/upload.js +37 -0
- package/dist/runtime/composables/index.d.ts +31 -0
- package/dist/runtime/composables/index.js +16 -0
- package/dist/runtime/composables/useFormForgeApi.d.ts +3 -0
- package/dist/runtime/composables/useFormForgeApi.js +4 -0
- package/dist/runtime/composables/useFormForgeBuilder.d.ts +57 -0
- package/dist/runtime/composables/useFormForgeBuilder.js +515 -0
- package/dist/runtime/composables/useFormForgeCategory.d.ts +61 -0
- package/dist/runtime/composables/useFormForgeCategory.js +248 -0
- package/dist/runtime/composables/useFormForgeClient.d.ts +3 -0
- package/dist/runtime/composables/useFormForgeClient.js +200 -0
- package/dist/runtime/composables/useFormForgeDrafts.d.ts +20 -0
- package/dist/runtime/composables/useFormForgeDrafts.js +78 -0
- package/dist/runtime/composables/useFormForgeForm.d.ts +26 -0
- package/dist/runtime/composables/useFormForgeForm.js +114 -0
- package/dist/runtime/composables/useFormForgeGetForm.d.ts +22 -0
- package/dist/runtime/composables/useFormForgeGetForm.js +36 -0
- package/dist/runtime/composables/useFormForgeI18n.d.ts +250 -0
- package/dist/runtime/composables/useFormForgeI18n.js +324 -0
- package/dist/runtime/composables/useFormForgeManagement.d.ts +40 -0
- package/dist/runtime/composables/useFormForgeManagement.js +153 -0
- package/dist/runtime/composables/useFormForgeResolver.d.ts +28 -0
- package/dist/runtime/composables/useFormForgeResolver.js +88 -0
- package/dist/runtime/composables/useFormForgeResponses.d.ts +45 -0
- package/dist/runtime/composables/useFormForgeResponses.js +206 -0
- package/dist/runtime/composables/useFormForgeSchema.d.ts +24 -0
- package/dist/runtime/composables/useFormForgeSchema.js +69 -0
- package/dist/runtime/composables/useFormForgeSubmission.d.ts +12 -0
- package/dist/runtime/composables/useFormForgeSubmission.js +4 -0
- package/dist/runtime/composables/useFormForgeSubmit.d.ts +29 -0
- package/dist/runtime/composables/useFormForgeSubmit.js +291 -0
- package/dist/runtime/composables/useFormForgeUploads.d.ts +21 -0
- package/dist/runtime/composables/useFormForgeUploads.js +37 -0
- package/dist/runtime/composables/useFormForgeWizard.d.ts +20 -0
- package/dist/runtime/composables/useFormForgeWizard.js +83 -0
- package/dist/runtime/index.d.ts +11 -0
- package/dist/runtime/index.js +14 -0
- package/dist/runtime/plugin.d.ts +3 -0
- package/dist/runtime/plugin.js +175 -0
- package/dist/runtime/renderers/default/FormForgeBuilder.d.vue.ts +40 -0
- package/dist/runtime/renderers/default/FormForgeBuilder.vue +1159 -0
- package/dist/runtime/renderers/default/FormForgeBuilder.vue.d.ts +40 -0
- package/dist/runtime/renderers/default/FormForgeCategoryCreateModal.d.vue.ts +16 -0
- package/dist/runtime/renderers/default/FormForgeCategoryCreateModal.vue +129 -0
- package/dist/runtime/renderers/default/FormForgeCategoryCreateModal.vue.d.ts +16 -0
- package/dist/runtime/renderers/default/FormForgeRenderer.d.vue.ts +72 -0
- package/dist/runtime/renderers/default/FormForgeRenderer.vue +1188 -0
- package/dist/runtime/renderers/default/FormForgeRenderer.vue.d.ts +72 -0
- package/dist/runtime/renderers/default/FormForgeResponse.d.vue.ts +18 -0
- package/dist/runtime/renderers/default/FormForgeResponse.vue +744 -0
- package/dist/runtime/renderers/default/FormForgeResponse.vue.d.ts +18 -0
- package/dist/runtime/renderers/default/index.d.ts +5 -0
- package/dist/runtime/renderers/default/index.js +4 -0
- package/dist/runtime/renderers/index.d.ts +2 -0
- package/dist/runtime/renderers/index.js +1 -0
- package/dist/runtime/types/api.d.ts +129 -0
- package/dist/runtime/types/api.js +0 -0
- package/dist/runtime/types/category.d.ts +42 -0
- package/dist/runtime/types/category.js +0 -0
- package/dist/runtime/types/errors.d.ts +16 -0
- package/dist/runtime/types/errors.js +0 -0
- package/dist/runtime/types/index.d.ts +8 -0
- package/dist/runtime/types/index.js +0 -0
- package/dist/runtime/types/json.d.ts +6 -0
- package/dist/runtime/types/json.js +0 -0
- package/dist/runtime/types/management.d.ts +46 -0
- package/dist/runtime/types/management.js +0 -0
- package/dist/runtime/types/nuxt.d.ts +13 -0
- package/dist/runtime/types/nuxt.js +1 -0
- package/dist/runtime/types/schema.d.ts +93 -0
- package/dist/runtime/types/schema.js +0 -0
- package/dist/runtime/utils/category.d.ts +5 -0
- package/dist/runtime/utils/category.js +101 -0
- package/dist/runtime/utils/form-data.d.ts +8 -0
- package/dist/runtime/utils/form-data.js +64 -0
- package/dist/runtime/utils/object.d.ts +8 -0
- package/dist/runtime/utils/object.js +43 -0
- package/dist/runtime/utils/schema.d.ts +3 -0
- package/dist/runtime/utils/schema.js +309 -0
- package/dist/runtime/utils/submission.d.ts +4 -0
- package/dist/runtime/utils/submission.js +45 -0
- package/dist/runtime/validation/errors.d.ts +5 -0
- package/dist/runtime/validation/errors.js +130 -0
- package/dist/runtime/validation/zod.d.ts +6 -0
- package/dist/runtime/validation/zod.js +203 -0
- package/dist/runtime.cjs +16 -0
- package/dist/runtime.d.cts +1 -0
- package/dist/runtime.d.mts +1 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.mjs +1 -0
- package/dist/types.d.mts +3 -0
- package/package.json +60 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FormForgeClientConfig } from '../../types/index.js';
|
|
2
|
+
type FormForgeResponseLayout = 'line' | 'column';
|
|
3
|
+
interface Props {
|
|
4
|
+
responseUuid: string;
|
|
5
|
+
formKey?: string;
|
|
6
|
+
endpoint?: string;
|
|
7
|
+
layout?: FormForgeResponseLayout;
|
|
8
|
+
clientConfig?: FormForgeClientConfig;
|
|
9
|
+
}
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
11
|
+
endpoint: string;
|
|
12
|
+
clientConfig: FormForgeClientConfig;
|
|
13
|
+
layout: FormForgeResponseLayout;
|
|
14
|
+
formKey: string;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=FormForgeResponse.vue.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as FormForgeRenderer } from './FormForgeRenderer.vue.js';
|
|
2
|
+
export { default as FormForgeBuilder } from './FormForgeBuilder.vue.js';
|
|
3
|
+
export { default as FormForgeResponse } from './FormForgeResponse.vue.js';
|
|
4
|
+
export { default as FormForgeCategoryCreateModal } from './FormForgeCategoryCreateModal.vue.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as FormForgeRenderer } from "./FormForgeRenderer.vue";
|
|
2
|
+
export { default as FormForgeBuilder } from "./FormForgeBuilder.vue";
|
|
3
|
+
export { default as FormForgeResponse } from "./FormForgeResponse.vue";
|
|
4
|
+
export { default as FormForgeCategoryCreateModal } from "./FormForgeCategoryCreateModal.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./default/index.js";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { FormForgeJsonObject } from './json.js';
|
|
2
|
+
export type FormForgeUploadMode = 'managed' | 'direct' | 'staged';
|
|
3
|
+
export type FormForgeDatetimeMode = 'offset' | 'utc';
|
|
4
|
+
export interface FormForgeResolvedScope {
|
|
5
|
+
prefix: string;
|
|
6
|
+
params: Record<string, string | number>;
|
|
7
|
+
}
|
|
8
|
+
export interface FormForgeScopedRouteDefinition {
|
|
9
|
+
prefix: string;
|
|
10
|
+
paramsFromRoute: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export type FormForgeScopedRouteMap = Record<string, FormForgeScopedRouteDefinition>;
|
|
13
|
+
export type FormForgeScope = string | FormForgeResolvedScope;
|
|
14
|
+
export type FormForgeScopeParams = Record<string, string | number | undefined>;
|
|
15
|
+
export type FormForgeScopeParamsInput = FormForgeScopeParams | (() => FormForgeScopeParams);
|
|
16
|
+
export interface FormForgeRangeValue {
|
|
17
|
+
start: string | null;
|
|
18
|
+
end: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface FormForgeStagedUploadValue {
|
|
21
|
+
upload_token: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FormForgeDirectUploadValue {
|
|
24
|
+
disk: string;
|
|
25
|
+
path: string;
|
|
26
|
+
original_name?: string;
|
|
27
|
+
}
|
|
28
|
+
export type FormForgeSubmissionScalarValue = string | number | boolean | null;
|
|
29
|
+
export interface FormForgeJsonSubmissionObject {
|
|
30
|
+
[key: string]: FormForgeJsonSubmissionValue;
|
|
31
|
+
}
|
|
32
|
+
export type FormForgeJsonSubmissionValue = FormForgeSubmissionScalarValue | FormForgeRangeValue | FormForgeStagedUploadValue | FormForgeDirectUploadValue | FormForgeJsonSubmissionObject | FormForgeJsonSubmissionValue[];
|
|
33
|
+
export type FormForgeSubmissionValue = FormForgeJsonSubmissionValue | File | File[];
|
|
34
|
+
export interface FormForgeSubmissionPayload {
|
|
35
|
+
[key: string]: FormForgeSubmissionValue;
|
|
36
|
+
}
|
|
37
|
+
export interface FormForgeJsonSubmissionPayload {
|
|
38
|
+
[key: string]: FormForgeJsonSubmissionValue;
|
|
39
|
+
}
|
|
40
|
+
export interface FormForgeSubmitInput {
|
|
41
|
+
payload: FormForgeJsonSubmissionPayload;
|
|
42
|
+
meta?: FormForgeJsonObject;
|
|
43
|
+
test?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface FormForgeSubmissionResponse {
|
|
46
|
+
data: FormForgeJsonObject;
|
|
47
|
+
meta?: FormForgeJsonObject;
|
|
48
|
+
}
|
|
49
|
+
export interface FormForgeResponsesListResponse {
|
|
50
|
+
data: FormForgeJsonObject[];
|
|
51
|
+
meta?: FormForgeJsonObject;
|
|
52
|
+
}
|
|
53
|
+
export interface FormForgeSchemaVersionsResponse {
|
|
54
|
+
data: FormForgeJsonObject;
|
|
55
|
+
meta?: FormForgeJsonObject;
|
|
56
|
+
}
|
|
57
|
+
export interface FormForgeStageUploadInput {
|
|
58
|
+
field?: string;
|
|
59
|
+
field_key?: string;
|
|
60
|
+
file: File;
|
|
61
|
+
}
|
|
62
|
+
export interface FormForgeStagedUploadResponse {
|
|
63
|
+
data: {
|
|
64
|
+
staged: {
|
|
65
|
+
upload_token: string;
|
|
66
|
+
expires_at?: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
meta?: FormForgeJsonObject;
|
|
70
|
+
}
|
|
71
|
+
export interface FormForgeResolveInput {
|
|
72
|
+
payload?: FormForgeJsonSubmissionPayload;
|
|
73
|
+
debug?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface FormForgeDraftSaveInput {
|
|
76
|
+
payload: FormForgeJsonSubmissionPayload;
|
|
77
|
+
meta?: FormForgeJsonObject;
|
|
78
|
+
}
|
|
79
|
+
export interface FormForgeDraftRecord {
|
|
80
|
+
form_key: string;
|
|
81
|
+
form_version?: string;
|
|
82
|
+
owner_type?: string;
|
|
83
|
+
owner_id?: string | number | null;
|
|
84
|
+
payload: FormForgeJsonSubmissionPayload;
|
|
85
|
+
meta?: FormForgeJsonObject;
|
|
86
|
+
expires_at?: string | null;
|
|
87
|
+
created_at?: string;
|
|
88
|
+
updated_at?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface FormForgeDraftResponse {
|
|
91
|
+
data: FormForgeDraftRecord | null;
|
|
92
|
+
meta?: FormForgeJsonObject;
|
|
93
|
+
}
|
|
94
|
+
export interface FormForgeHttpRequest {
|
|
95
|
+
path: string;
|
|
96
|
+
method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
97
|
+
headers?: Record<string, string>;
|
|
98
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
99
|
+
json?: FormForgeJsonObject;
|
|
100
|
+
body?: BodyInit;
|
|
101
|
+
}
|
|
102
|
+
export interface FormForgeHttpResponse<TData> {
|
|
103
|
+
status: number;
|
|
104
|
+
headers: Headers;
|
|
105
|
+
data: TData;
|
|
106
|
+
}
|
|
107
|
+
export type FormForgeHttpAdapter = <TData>(request: FormForgeHttpRequest) => Promise<FormForgeHttpResponse<TData>>;
|
|
108
|
+
export interface FormForgeBeforeRequestContext {
|
|
109
|
+
request: FormForgeHttpRequest;
|
|
110
|
+
headers: Record<string, string>;
|
|
111
|
+
url?: string;
|
|
112
|
+
}
|
|
113
|
+
export type FormForgeBaseURLParams = Record<string, string | number | undefined>;
|
|
114
|
+
export type FormForgeBaseURLParamsInput = FormForgeBaseURLParams | (() => FormForgeBaseURLParams);
|
|
115
|
+
export interface FormForgeClientConfig {
|
|
116
|
+
baseURL?: string;
|
|
117
|
+
baseURLParams?: FormForgeBaseURLParamsInput;
|
|
118
|
+
scopedRoutes?: FormForgeScopedRouteMap;
|
|
119
|
+
defaultScope?: string;
|
|
120
|
+
scopeParams?: FormForgeScopeParamsInput;
|
|
121
|
+
credentials?: RequestCredentials;
|
|
122
|
+
headers?: Record<string, string>;
|
|
123
|
+
fetch?: typeof fetch;
|
|
124
|
+
beforeRequest?: (context: FormForgeBeforeRequestContext) => Promise<void> | void;
|
|
125
|
+
uploadMode?: FormForgeUploadMode;
|
|
126
|
+
datetimeMode?: FormForgeDatetimeMode;
|
|
127
|
+
locale?: string;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=api.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { FormForgeJsonObject } from './json.js';
|
|
2
|
+
export interface FormForgeCategory {
|
|
3
|
+
id: number;
|
|
4
|
+
key: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string | null;
|
|
7
|
+
is_active: boolean;
|
|
8
|
+
meta: FormForgeJsonObject;
|
|
9
|
+
created_at: string | null;
|
|
10
|
+
updated_at: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface FormForgeCategoryCreateInput {
|
|
13
|
+
key?: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description?: string | null;
|
|
16
|
+
is_active?: boolean;
|
|
17
|
+
meta?: FormForgeJsonObject;
|
|
18
|
+
}
|
|
19
|
+
export interface FormForgeCategoryUpdateInput {
|
|
20
|
+
name?: string;
|
|
21
|
+
description?: string | null;
|
|
22
|
+
is_active?: boolean;
|
|
23
|
+
meta?: FormForgeJsonObject;
|
|
24
|
+
}
|
|
25
|
+
export interface FormForgeCategoryListQuery {
|
|
26
|
+
per_page?: number;
|
|
27
|
+
search?: string;
|
|
28
|
+
is_active?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type FormForgePaginationLinks = FormForgeJsonObject;
|
|
31
|
+
export type FormForgePaginationMeta = FormForgeJsonObject;
|
|
32
|
+
export interface FormForgeCategoryListResponse {
|
|
33
|
+
data: FormForgeCategory[];
|
|
34
|
+
meta?: FormForgePaginationMeta;
|
|
35
|
+
links?: FormForgePaginationLinks;
|
|
36
|
+
}
|
|
37
|
+
export interface FormForgeCategorySelectOption {
|
|
38
|
+
label: string;
|
|
39
|
+
value: string;
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=category.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FormForgeJsonObject } from './json.js';
|
|
2
|
+
export type FormForgeClientErrorCode = 'unauthorized' | 'forbidden' | 'not_found' | 'conflict' | 'validation' | 'rate_limited' | 'server_error' | 'network_error';
|
|
3
|
+
export type FormForgeBusinessErrorCode = 'CATEGORY_IN_USE';
|
|
4
|
+
export interface FormForgeClientError {
|
|
5
|
+
status: number;
|
|
6
|
+
code: FormForgeClientErrorCode;
|
|
7
|
+
message: string;
|
|
8
|
+
businessCode?: FormForgeBusinessErrorCode;
|
|
9
|
+
fieldErrors?: Record<string, string[]>;
|
|
10
|
+
raw?: FormForgeJsonObject | null;
|
|
11
|
+
}
|
|
12
|
+
export interface FormForgeValidationErrorPayload {
|
|
13
|
+
message?: string;
|
|
14
|
+
errors?: Record<string, string[]>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { FormForgeClientError, FormForgeClientErrorCode, FormForgeBusinessErrorCode, FormForgeValidationErrorPayload } from './errors.js';
|
|
2
|
+
export type { FormForgeCategory, FormForgeCategoryCreateInput, FormForgeCategoryUpdateInput, FormForgeCategoryListQuery, FormForgeCategoryListResponse, FormForgePaginationMeta, FormForgePaginationLinks, FormForgeCategorySelectOption } from './category.js';
|
|
3
|
+
export type { FormForgeFieldType, FormForgeFieldOption, FormForgeFieldOptionObject, FormForgeFieldSchema, FormForgeFileFieldSchema, FormForgePageSchema, FormForgeCondition, FormForgeConditionClause, FormForgeConditionAction, FormForgeConditionMatch, FormForgeConditionOperator, FormForgeConditionTargetType, FormForgeDraftSettings, FormForgeFormSchema, FormForgeOptionValue, FormForgeFieldStorage } from './schema.js';
|
|
4
|
+
export type { FormForgeBeforeRequestContext, FormForgeBaseURLParams, FormForgeBaseURLParamsInput, FormForgeClientConfig, FormForgeDraftRecord, FormForgeDraftResponse, FormForgeDraftSaveInput, FormForgeHttpAdapter, FormForgeHttpRequest, FormForgeHttpResponse, FormForgeResolveInput, FormForgeSchemaVersionsResponse, FormForgeScopedRouteDefinition, FormForgeScopedRouteMap, FormForgeScope, FormForgeScopeParams, FormForgeScopeParamsInput, FormForgeResolvedScope, FormForgeStageUploadInput, FormForgeStagedUploadResponse, FormForgeSubmitInput, FormForgeJsonSubmissionPayload, FormForgeJsonSubmissionObject, FormForgeJsonSubmissionValue, FormForgeSubmissionPayload, FormForgeSubmissionResponse, FormForgeResponsesListResponse, FormForgeSubmissionValue, FormForgeUploadMode, FormForgeDatetimeMode, FormForgeRangeValue, FormForgeStagedUploadValue, FormForgeDirectUploadValue } from './api.js';
|
|
5
|
+
export type { FormForgeClient } from '../api/client.js';
|
|
6
|
+
export type { FormForgeManagementCreateInput, FormForgeManagementPatchInput, FormForgeManagementForm, FormForgeRevisionSummary, FormForgeDiffResponse } from './management.js';
|
|
7
|
+
export type { FormForgeJsonObject, FormForgeJsonPrimitive, FormForgeJsonValue } from './json.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type FormForgeJsonPrimitive = string | number | boolean | null;
|
|
2
|
+
export interface FormForgeJsonObject {
|
|
3
|
+
[key: string]: FormForgeJsonValue;
|
|
4
|
+
}
|
|
5
|
+
export type FormForgeJsonValue = FormForgeJsonPrimitive | FormForgeJsonObject | FormForgeJsonValue[];
|
|
6
|
+
//# sourceMappingURL=json.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FormForgeCondition, FormForgeDraftSettings, FormForgeFieldSchema, FormForgePageSchema } from './schema.js';
|
|
2
|
+
import type { FormForgeJsonObject } from './json.js';
|
|
3
|
+
import type { FormForgeCategory } from './category.js';
|
|
4
|
+
export interface FormForgeManagementCreateInput {
|
|
5
|
+
title: string;
|
|
6
|
+
fields?: FormForgeFieldSchema[];
|
|
7
|
+
pages?: FormForgePageSchema[];
|
|
8
|
+
conditions?: FormForgeCondition[];
|
|
9
|
+
drafts?: FormForgeDraftSettings;
|
|
10
|
+
category?: string | null;
|
|
11
|
+
meta?: FormForgeJsonObject;
|
|
12
|
+
api?: FormForgeJsonObject;
|
|
13
|
+
}
|
|
14
|
+
export interface FormForgeManagementPatchInput {
|
|
15
|
+
title?: string;
|
|
16
|
+
fields?: FormForgeFieldSchema[];
|
|
17
|
+
pages?: FormForgePageSchema[];
|
|
18
|
+
conditions?: FormForgeCondition[];
|
|
19
|
+
drafts?: FormForgeDraftSettings;
|
|
20
|
+
category?: string | null;
|
|
21
|
+
meta?: FormForgeJsonObject;
|
|
22
|
+
api?: FormForgeJsonObject;
|
|
23
|
+
}
|
|
24
|
+
export type FormForgeManagementForm = FormForgeJsonObject & {
|
|
25
|
+
id?: string | number;
|
|
26
|
+
uuid?: string;
|
|
27
|
+
key?: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
category?: string | null;
|
|
30
|
+
is_published?: boolean;
|
|
31
|
+
deleted_at?: string | null;
|
|
32
|
+
category_item?: FormForgeCategory | null;
|
|
33
|
+
};
|
|
34
|
+
export interface FormForgeRevisionSummary {
|
|
35
|
+
revision_id: string;
|
|
36
|
+
version_number: number;
|
|
37
|
+
is_published: boolean;
|
|
38
|
+
created_at?: string;
|
|
39
|
+
deleted_at?: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface FormForgeDiffResponse {
|
|
42
|
+
from_version: number;
|
|
43
|
+
to_version: number;
|
|
44
|
+
changes: FormForgeJsonObject[];
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=management.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FormForgeClient } from '../api/client.js';
|
|
2
|
+
declare module '#app' {
|
|
3
|
+
interface NuxtApp {
|
|
4
|
+
$formforge: FormForgeClient;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare module 'vue' {
|
|
8
|
+
interface ComponentCustomProperties {
|
|
9
|
+
$formforge: FormForgeClient;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=nuxt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { FormForgeJsonObject, FormForgeJsonValue } from './json.js';
|
|
2
|
+
import type { FormForgeCategory } from './category.js';
|
|
3
|
+
export type FormForgeFieldType = 'text' | 'textarea' | 'email' | 'number' | 'select' | 'select_menu' | 'radio' | 'checkbox' | 'checkbox_group' | 'switch' | 'date' | 'time' | 'datetime' | 'date_range' | 'datetime_range' | 'file';
|
|
4
|
+
export type FormForgeOptionValue = string | number | boolean | null;
|
|
5
|
+
export interface FormForgeFieldOptionObject {
|
|
6
|
+
label?: string;
|
|
7
|
+
value: FormForgeOptionValue;
|
|
8
|
+
description?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
[key: string]: FormForgeJsonValue | undefined;
|
|
11
|
+
}
|
|
12
|
+
export type FormForgeFieldOption = FormForgeOptionValue | FormForgeFieldOptionObject;
|
|
13
|
+
export interface FormForgeFieldStorage {
|
|
14
|
+
disk: string;
|
|
15
|
+
directory: string;
|
|
16
|
+
visibility: 'public' | 'private' | string;
|
|
17
|
+
}
|
|
18
|
+
export interface FormForgeFieldSchemaBase<TType extends FormForgeFieldType> {
|
|
19
|
+
field_key: string;
|
|
20
|
+
type: TType;
|
|
21
|
+
name: string;
|
|
22
|
+
page_key: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
nullable: boolean;
|
|
26
|
+
default: FormForgeJsonValue;
|
|
27
|
+
rules: string[];
|
|
28
|
+
meta: FormForgeJsonObject;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
help_text?: string;
|
|
31
|
+
min?: number | string | null;
|
|
32
|
+
max?: number | string | null;
|
|
33
|
+
step?: number | string | null;
|
|
34
|
+
multiple?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
readonly?: boolean;
|
|
37
|
+
options?: FormForgeFieldOption[];
|
|
38
|
+
}
|
|
39
|
+
export type FormForgeTextLikeFieldSchema = FormForgeFieldSchemaBase<'text' | 'textarea' | 'email'>;
|
|
40
|
+
export type FormForgeNumberFieldSchema = FormForgeFieldSchemaBase<'number'>;
|
|
41
|
+
export type FormForgeSelectLikeFieldSchema = FormForgeFieldSchemaBase<'select' | 'select_menu' | 'radio' | 'checkbox_group'>;
|
|
42
|
+
export type FormForgeBooleanFieldSchema = FormForgeFieldSchemaBase<'checkbox' | 'switch'>;
|
|
43
|
+
export type FormForgeDateLikeFieldSchema = FormForgeFieldSchemaBase<'date' | 'time' | 'datetime' | 'date_range' | 'datetime_range'>;
|
|
44
|
+
export interface FormForgeFileFieldSchema extends FormForgeFieldSchemaBase<'file'> {
|
|
45
|
+
accept?: string[];
|
|
46
|
+
max_size?: number | null;
|
|
47
|
+
max_files?: number | null;
|
|
48
|
+
storage?: FormForgeFieldStorage | null;
|
|
49
|
+
}
|
|
50
|
+
export type FormForgeFieldSchema = FormForgeTextLikeFieldSchema | FormForgeNumberFieldSchema | FormForgeSelectLikeFieldSchema | FormForgeBooleanFieldSchema | FormForgeDateLikeFieldSchema | FormForgeFileFieldSchema;
|
|
51
|
+
export interface FormForgePageSchema {
|
|
52
|
+
page_key: string;
|
|
53
|
+
title: string;
|
|
54
|
+
description?: string | null;
|
|
55
|
+
meta: FormForgeJsonObject;
|
|
56
|
+
fields: FormForgeFieldSchema[];
|
|
57
|
+
}
|
|
58
|
+
export type FormForgeConditionTargetType = 'page' | 'field';
|
|
59
|
+
export type FormForgeConditionAction = 'show' | 'hide' | 'skip' | 'require' | 'disable';
|
|
60
|
+
export type FormForgeConditionMatch = 'all' | 'any';
|
|
61
|
+
export type FormForgeConditionOperator = 'eq' | 'neq' | 'in' | 'not_in' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'not_contains' | 'is_empty' | 'not_empty';
|
|
62
|
+
export interface FormForgeConditionClause {
|
|
63
|
+
field_key: string;
|
|
64
|
+
operator: FormForgeConditionOperator;
|
|
65
|
+
value: FormForgeJsonValue;
|
|
66
|
+
}
|
|
67
|
+
export interface FormForgeCondition {
|
|
68
|
+
condition_key: string;
|
|
69
|
+
target_type: FormForgeConditionTargetType;
|
|
70
|
+
target_key: string;
|
|
71
|
+
action: FormForgeConditionAction;
|
|
72
|
+
match: FormForgeConditionMatch;
|
|
73
|
+
when: FormForgeConditionClause[];
|
|
74
|
+
}
|
|
75
|
+
export interface FormForgeDraftSettings {
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
[key: string]: FormForgeJsonValue | undefined;
|
|
78
|
+
}
|
|
79
|
+
export interface FormForgeFormSchema {
|
|
80
|
+
key: string;
|
|
81
|
+
version: string;
|
|
82
|
+
title: string;
|
|
83
|
+
category?: string | null;
|
|
84
|
+
category_item?: FormForgeCategory | null;
|
|
85
|
+
is_published: boolean;
|
|
86
|
+
fields: FormForgeFieldSchema[];
|
|
87
|
+
pages: FormForgePageSchema[];
|
|
88
|
+
conditions: FormForgeCondition[];
|
|
89
|
+
drafts: FormForgeDraftSettings;
|
|
90
|
+
api: FormForgeJsonObject;
|
|
91
|
+
meta?: FormForgeJsonObject;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FormForgeCategory, FormForgeCategoryListResponse, FormForgeCategorySelectOption, FormForgeJsonObject } from '../types/index.js';
|
|
2
|
+
export declare function normalizeFormForgeCategory(value: unknown): FormForgeCategory | null;
|
|
3
|
+
export declare function normalizeFormForgeCategoryListResponse(payload: FormForgeJsonObject): FormForgeCategoryListResponse;
|
|
4
|
+
export declare function normalizeFormForgeCategoryOptions(categories: FormForgeCategory[], includeInactive?: boolean): FormForgeCategorySelectOption[];
|
|
5
|
+
//# sourceMappingURL=category.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { isFormForgeJsonObject } from "./object.js";
|
|
2
|
+
function toStringOrNull(value) {
|
|
3
|
+
if (typeof value === "string") {
|
|
4
|
+
return value;
|
|
5
|
+
}
|
|
6
|
+
if (value === null) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
function toBoolean(value, fallback) {
|
|
12
|
+
if (typeof value === "boolean") {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
return fallback;
|
|
16
|
+
}
|
|
17
|
+
function toNumber(value, fallback) {
|
|
18
|
+
if (typeof value === "number") {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
return fallback;
|
|
22
|
+
}
|
|
23
|
+
function asJsonObjectArray(value) {
|
|
24
|
+
if (!Array.isArray(value)) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const items = [];
|
|
28
|
+
for (const item of value) {
|
|
29
|
+
if (isFormForgeJsonObject(item)) {
|
|
30
|
+
items.push(item);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return items;
|
|
34
|
+
}
|
|
35
|
+
function normalizePaginationMeta(value) {
|
|
36
|
+
if (!isFormForgeJsonObject(value)) {
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
function normalizePaginationLinks(value) {
|
|
42
|
+
if (!isFormForgeJsonObject(value)) {
|
|
43
|
+
return void 0;
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function pickPaginationPayload(payload) {
|
|
48
|
+
const envelope = payload.data;
|
|
49
|
+
if (isFormForgeJsonObject(envelope) && Array.isArray(envelope.data)) {
|
|
50
|
+
return envelope;
|
|
51
|
+
}
|
|
52
|
+
return payload;
|
|
53
|
+
}
|
|
54
|
+
export function normalizeFormForgeCategory(value) {
|
|
55
|
+
if (!isFormForgeJsonObject(value)) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const category = value;
|
|
59
|
+
const meta = isFormForgeJsonObject(category.meta) ? category.meta : {};
|
|
60
|
+
return {
|
|
61
|
+
id: toNumber(category.id, 0),
|
|
62
|
+
key: typeof category.key === "string" ? category.key : "",
|
|
63
|
+
name: typeof category.name === "string" ? category.name : "",
|
|
64
|
+
description: toStringOrNull(category.description),
|
|
65
|
+
is_active: toBoolean(category.is_active, false),
|
|
66
|
+
meta,
|
|
67
|
+
created_at: toStringOrNull(category.created_at),
|
|
68
|
+
updated_at: toStringOrNull(category.updated_at)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export function normalizeFormForgeCategoryListResponse(payload) {
|
|
72
|
+
const paginationPayload = pickPaginationPayload(payload);
|
|
73
|
+
const rawItems = asJsonObjectArray(paginationPayload.data);
|
|
74
|
+
const categories = [];
|
|
75
|
+
for (const rawItem of rawItems) {
|
|
76
|
+
const item = normalizeFormForgeCategory(rawItem);
|
|
77
|
+
if (item !== null) {
|
|
78
|
+
categories.push(item);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
data: categories,
|
|
83
|
+
meta: normalizePaginationMeta(paginationPayload.meta ?? payload.meta),
|
|
84
|
+
links: normalizePaginationLinks(paginationPayload.links ?? payload.links)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function normalizeFormForgeCategoryOptions(categories, includeInactive = true) {
|
|
88
|
+
const sortable = [...categories].sort((left, right) => left.name.localeCompare(right.name));
|
|
89
|
+
const options = [];
|
|
90
|
+
for (const category of sortable) {
|
|
91
|
+
if (!includeInactive && category.is_active === false) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
options.push({
|
|
95
|
+
label: category.name,
|
|
96
|
+
value: category.key,
|
|
97
|
+
disabled: category.is_active === false
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return options;
|
|
101
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FormForgeJsonObject, FormForgeJsonSubmissionPayload, FormForgeSubmissionValue } from '../types/index.js';
|
|
2
|
+
export type FormForgeManagedValue = FormForgeSubmissionValue | File | File[];
|
|
3
|
+
export interface FormForgeManagedPayload {
|
|
4
|
+
[key: string]: FormForgeManagedValue;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildManagedFormData(payload: FormForgeManagedPayload, meta?: FormForgeJsonObject): FormData;
|
|
7
|
+
export declare function buildJsonSubmitBody(payload: FormForgeJsonSubmissionPayload, meta?: FormForgeJsonObject): FormForgeJsonObject;
|
|
8
|
+
//# sourceMappingURL=form-data.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
function isFileValue(value) {
|
|
2
|
+
if (typeof File === "undefined") {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
return value instanceof File;
|
|
6
|
+
}
|
|
7
|
+
function appendJsonValue(formData, key, value) {
|
|
8
|
+
if (value === void 0) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (value === null) {
|
|
12
|
+
formData.append(key, "");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
16
|
+
formData.append(key, String(value));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(value)) {
|
|
20
|
+
value.forEach((item, index) => {
|
|
21
|
+
appendJsonValue(formData, `${key}[${index}]`, item);
|
|
22
|
+
});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
for (const [childKey, childValue] of Object.entries(value)) {
|
|
26
|
+
appendJsonValue(formData, `${key}[${childKey}]`, childValue);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function buildManagedFormData(payload, meta) {
|
|
30
|
+
const formData = new FormData();
|
|
31
|
+
for (const [fieldName, fieldValue] of Object.entries(payload)) {
|
|
32
|
+
if (fieldValue === void 0) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (isFileValue(fieldValue)) {
|
|
36
|
+
formData.append(fieldName, fieldValue);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(fieldValue) && fieldValue.every((item) => isFileValue(item))) {
|
|
40
|
+
for (const file of fieldValue) {
|
|
41
|
+
if (isFileValue(file)) {
|
|
42
|
+
formData.append(fieldName, file);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
appendJsonValue(formData, `payload[${fieldName}]`, fieldValue);
|
|
48
|
+
}
|
|
49
|
+
if (meta !== void 0) {
|
|
50
|
+
for (const [metaKey, metaValue] of Object.entries(meta)) {
|
|
51
|
+
appendJsonValue(formData, `meta[${metaKey}]`, metaValue);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return formData;
|
|
55
|
+
}
|
|
56
|
+
export function buildJsonSubmitBody(payload, meta) {
|
|
57
|
+
const body = {
|
|
58
|
+
payload
|
|
59
|
+
};
|
|
60
|
+
if (meta !== void 0) {
|
|
61
|
+
body.meta = meta;
|
|
62
|
+
}
|
|
63
|
+
return body;
|
|
64
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FormForgeJsonObject, FormForgeJsonValue } from '../types/index.js';
|
|
2
|
+
export declare function isFormForgeJsonObject(value: FormForgeJsonValue | null | undefined): value is FormForgeJsonObject;
|
|
3
|
+
export declare function getFormForgeString(value: FormForgeJsonValue | undefined): string | undefined;
|
|
4
|
+
export declare function getFormForgeNumber(value: FormForgeJsonValue | undefined): number | undefined;
|
|
5
|
+
export declare function getFormForgeBoolean(value: FormForgeJsonValue | undefined): boolean | undefined;
|
|
6
|
+
export declare function getFormForgeStringArray(value: FormForgeJsonValue | undefined): string[] | undefined;
|
|
7
|
+
export declare function pickFormForgeDataEnvelope(payload: FormForgeJsonObject): FormForgeJsonObject;
|
|
8
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function isFormForgeJsonObject(value) {
|
|
2
|
+
if (value === null) {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
return !Array.isArray(value) && typeof value === "object";
|
|
6
|
+
}
|
|
7
|
+
export function getFormForgeString(value) {
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
export function getFormForgeNumber(value) {
|
|
14
|
+
if (typeof value === "number") {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
export function getFormForgeBoolean(value) {
|
|
20
|
+
if (typeof value === "boolean") {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
export function getFormForgeStringArray(value) {
|
|
26
|
+
if (!Array.isArray(value)) {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
const items = [];
|
|
30
|
+
for (const item of value) {
|
|
31
|
+
if (typeof item === "string") {
|
|
32
|
+
items.push(item);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return items;
|
|
36
|
+
}
|
|
37
|
+
export function pickFormForgeDataEnvelope(payload) {
|
|
38
|
+
const value = payload.data;
|
|
39
|
+
if (isFormForgeJsonObject(value)) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
return payload;
|
|
43
|
+
}
|