openxiangda 1.0.141 → 1.0.142
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 +52 -2
- package/lib/cli.js +89 -0
- package/lib/design-gates.js +29 -0
- package/openxiangda-skills/SKILL.md +3 -1
- package/package.json +1 -1
- package/packages/sdk/dist/{ProcessPreview-CsOTCTRT.d.mts → ProcessPreview-CUQFUDvw.d.mts} +5 -2
- package/packages/sdk/dist/{ProcessPreview-CsOTCTRT.d.ts → ProcessPreview-CUQFUDvw.d.ts} +5 -2
- package/packages/sdk/dist/components/index.cjs +59 -19
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.d.mts +4 -4
- package/packages/sdk/dist/components/index.d.ts +4 -4
- package/packages/sdk/dist/components/index.mjs +59 -19
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/{dataManagementApi-Cd1axl3v.d.ts → dataManagementApi-CwBEmnXg.d.ts} +1 -1
- package/packages/sdk/dist/{dataManagementApi-C1OKWpP7.d.mts → dataManagementApi-DQKInwWS.d.mts} +1 -1
- package/packages/sdk/dist/runtime/index.cjs +75 -20
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +3 -3
- package/packages/sdk/dist/runtime/index.d.ts +3 -3
- package/packages/sdk/dist/runtime/index.mjs +75 -20
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +16 -1
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +17 -2
- package/packages/sdk/dist/runtime/react.d.ts +17 -2
- package/packages/sdk/dist/runtime/react.mjs +16 -1
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/templates/openxiangda-react-spa/src/pages/defaults/FormRoutePage.tsx +9 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as FormEngineConfig, b as FormSchema, e as FieldBehavior, O as OptionItem, a as FormRuntimeApi, f as FormRuntimeConfig, g as FormAppearanceConfig, V as ValidationPreset, h as ValidationRule, i as FormEffect, c as FormRuntimeApiConfig, j as OptionSourceConfig, P as ProcessStatus, S as StatusMeta, T as TaskStatus, A as ApprovalPermission, k as FormDataDeleteParams, C as ChangeRecordQueryParams, l as ChangeRecordListResponse, m as FormDataQueryParams, n as FormInstanceData, I as InitiatorSelectCandidate, o as InitiatorSelectRequirement, p as ProcessBasicInfo, q as ProcessDefinition, r as ProcessTask, s as ReturnableNodeResult, t as ReturnableNode, u as ViewPermissionQueryParams, v as ViewPermissionSummary, w as ApproveParams, x as PreviewParams, y as ProcessRoute, z as ResubmitParams, B as ReturnParams, D as SaveTaskParams, E as TransferParams, W as WithdrawParams, G as TextFieldProps, N as NumberFieldProps, H as TextAreaFieldProps, J as SelectFieldProps, M as MultiSelectFieldProps, K as RadioFieldProps, L as CheckboxFieldProps, Q as DateFieldProps, U as CascadeDateFieldProps, X as AttachmentFieldProps, Y as ImageFieldProps, Z as SubFormFieldProps, _ as UserSelectFieldProps, $ as DepartmentSelectFieldProps, a0 as CascadeSelectFieldProps, a1 as AddressFieldProps, a2 as AssociationFormFieldProps, a3 as EditorFieldProps, a4 as EditorChoiceOption, a5 as SerialNumberFieldProps, a6 as LocationFieldProps, a7 as DigitalSignatureFieldProps, a8 as JSONFieldProps, a9 as ProcessAction, aa as InitiatorSelectedApprovers, ab as ReturnPolicy, ac as ChangeRecord, ad as StandardFormPageMode, ae as LowcodePageSchema } from '../ProcessPreview-
|
|
2
|
-
export { af as AddressValue, ag as ApprovalActionType, ah as ApprovalTimeline, ai as ApprovalTimelineProps, aj as AssociationFormConfig, ak as AssociationValue, al as AttachmentImageVariants, am as AttachmentItem, an as BaseFieldProps, ao as BaseLayoutNode, ap as DataFilter, aq as DataLinkageCondition, ar as DataLinkageConfig, as as DateRangeRestriction, at as DateRestrictionConfig, au as DateShortcutConfig, av as DateShortcutType, aw as DefaultValueLinkageConfig, ax as DepartmentTreeNode, ay as DigitalSignatureValue, az as EditorToolbarAction, F as FieldDefinition, aA as FieldLayoutNode, aB as FieldValueSyncConfig, aC as FormEffectAction, aD as FormEffectCondition, aE as FormEffectConditionOperator, aF as FormEngineMode, aG as FormLayoutNode, aH as FormSection, aI as FormSectionProps, aJ as FormSubmitBehavior, aK as FormTemplateConfig, aL as GridLayoutCell, aM as GridLayoutNode, aN as ImageCompressionConfig, aO as ImageCompressionVariantConfig, aP as ImageVariant, aQ as InitiatorSelectScope, aR as LayoutVisibleWhen, aS as LinkedFormOptionConfig, aT as LocationValue, aU as LowcodePageMeta, aV as LowcodePageNode, aW as LowcodePageNodeType, aX as OptionSourceType, aY as PeopleShortcutConfig, aZ as PeopleShortcutType, a_ as ProcessNodeType, a$ as ProcessPreview, b0 as ProcessPreviewProps, b1 as
|
|
1
|
+
import { d as FormEngineConfig, b as FormSchema, e as FieldBehavior, O as OptionItem, a as FormRuntimeApi, f as FormRuntimeConfig, g as FormAppearanceConfig, V as ValidationPreset, h as ValidationRule, i as FormEffect, c as FormRuntimeApiConfig, j as OptionSourceConfig, P as ProcessStatus, S as StatusMeta, T as TaskStatus, A as ApprovalPermission, k as FormDataDeleteParams, C as ChangeRecordQueryParams, l as ChangeRecordListResponse, m as FormDataQueryParams, n as FormInstanceData, I as InitiatorSelectCandidate, o as InitiatorSelectRequirement, p as ProcessBasicInfo, q as ProcessDefinition, r as ProcessTask, s as ReturnableNodeResult, t as ReturnableNode, u as ViewPermissionQueryParams, v as ViewPermissionSummary, w as ApproveParams, x as PreviewParams, y as ProcessRoute, z as ResubmitParams, B as ReturnParams, D as SaveTaskParams, E as TransferParams, W as WithdrawParams, G as TextFieldProps, N as NumberFieldProps, H as TextAreaFieldProps, J as SelectFieldProps, M as MultiSelectFieldProps, K as RadioFieldProps, L as CheckboxFieldProps, Q as DateFieldProps, U as CascadeDateFieldProps, X as AttachmentFieldProps, Y as ImageFieldProps, Z as SubFormFieldProps, _ as UserSelectFieldProps, $ as DepartmentSelectFieldProps, a0 as CascadeSelectFieldProps, a1 as AddressFieldProps, a2 as AssociationFormFieldProps, a3 as EditorFieldProps, a4 as EditorChoiceOption, a5 as SerialNumberFieldProps, a6 as LocationFieldProps, a7 as DigitalSignatureFieldProps, a8 as JSONFieldProps, a9 as ProcessAction, aa as InitiatorSelectedApprovers, ab as ReturnPolicy, ac as ChangeRecord, ad as StandardFormPageMode, ae as LowcodePageSchema } from '../ProcessPreview-CUQFUDvw.mjs';
|
|
2
|
+
export { af as AddressValue, ag as ApprovalActionType, ah as ApprovalTimeline, ai as ApprovalTimelineProps, aj as AssociationFormConfig, ak as AssociationValue, al as AttachmentImageVariants, am as AttachmentItem, an as BaseFieldProps, ao as BaseLayoutNode, ap as DataFilter, aq as DataLinkageCondition, ar as DataLinkageConfig, as as DateRangeRestriction, at as DateRestrictionConfig, au as DateShortcutConfig, av as DateShortcutType, aw as DefaultValueLinkageConfig, ax as DepartmentTreeNode, ay as DigitalSignatureValue, az as EditorToolbarAction, F as FieldDefinition, aA as FieldLayoutNode, aB as FieldValueSyncConfig, aC as FormEffectAction, aD as FormEffectCondition, aE as FormEffectConditionOperator, aF as FormEngineMode, aG as FormLayoutNode, aH as FormSection, aI as FormSectionProps, aJ as FormSubmitBehavior, aK as FormTemplateConfig, aL as GridLayoutCell, aM as GridLayoutNode, aN as ImageCompressionConfig, aO as ImageCompressionVariantConfig, aP as ImageVariant, aQ as InitiatorSelectScope, aR as LayoutVisibleWhen, aS as LinkedFormOptionConfig, aT as LocationValue, aU as LowcodePageMeta, aV as LowcodePageNode, aW as LowcodePageNodeType, aX as OptionSourceType, aY as PeopleShortcutConfig, aZ as PeopleShortcutType, a_ as ProcessNodeType, a$ as ProcessPreview, b0 as ProcessPreviewProps, b1 as RuntimeAuthHeadersProvider, b2 as RuntimeDataQueryParams, b3 as RuntimeDataQueryResult, b4 as RuntimeRequestConfig, R as RuntimeResponse, b5 as RuntimeUploadOptions, b6 as RuntimeUploadProvider, b7 as SectionLayoutNode, b8 as SignaturePoint, b9 as StepLayoutItem, ba as StepsLayoutNode, bb as SubFormColumn, bc as TabLayoutItem, bd as TabsLayoutNode, be as TextShortcutConfig, bf as TextShortcutType, bg as UserDisplayFormat, bh as UserItem } from '../ProcessPreview-CUQFUDvw.mjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default from 'react';
|
|
5
|
-
import { D as DataManagementConfigScope, a as DataManagementConfig, F as FormActionPermission } from '../dataManagementApi-
|
|
6
|
-
export { b as DataManagementDensity, c as DataManagementField, d as DataManagementFilterGroup, f as DataManagementFilterRule, g as DataManagementListResult, h as DataManagementQuery, i as DataManagementSort, j as advancedSearchDataManagement, k as batchApproveDataManagementRows, l as buildFilterPayload, m as deleteDataManagementRows, n as downloadDataManagementImportTemplate, o as exportDataManagementRows, p as getDataManagementConfig, q as getDataManagementSchema, r as getDataManagementTransferRecords, s as getSystemFieldsForFormType, t as importDataManagementRows, u as importPreviewDataManagementRows, v as normalizeColumnConfig, w as normalizeDataManagementFields, x as normalizeDataManagementList, y as saveDataManagementConfig } from '../dataManagementApi-
|
|
5
|
+
import { D as DataManagementConfigScope, a as DataManagementConfig, F as FormActionPermission } from '../dataManagementApi-DQKInwWS.mjs';
|
|
6
|
+
export { b as DataManagementDensity, c as DataManagementField, d as DataManagementFilterGroup, f as DataManagementFilterRule, g as DataManagementListResult, h as DataManagementQuery, i as DataManagementSort, j as advancedSearchDataManagement, k as batchApproveDataManagementRows, l as buildFilterPayload, m as deleteDataManagementRows, n as downloadDataManagementImportTemplate, o as exportDataManagementRows, p as getDataManagementConfig, q as getDataManagementSchema, r as getDataManagementTransferRecords, s as getSystemFieldsForFormType, t as importDataManagementRows, u as importPreviewDataManagementRows, v as normalizeColumnConfig, w as normalizeDataManagementFields, x as normalizeDataManagementList, y as saveDataManagementConfig } from '../dataManagementApi-DQKInwWS.mjs';
|
|
7
7
|
|
|
8
8
|
interface FormContextValue {
|
|
9
9
|
mode: FormEngineConfig['mode'];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as FormEngineConfig, b as FormSchema, e as FieldBehavior, O as OptionItem, a as FormRuntimeApi, f as FormRuntimeConfig, g as FormAppearanceConfig, V as ValidationPreset, h as ValidationRule, i as FormEffect, c as FormRuntimeApiConfig, j as OptionSourceConfig, P as ProcessStatus, S as StatusMeta, T as TaskStatus, A as ApprovalPermission, k as FormDataDeleteParams, C as ChangeRecordQueryParams, l as ChangeRecordListResponse, m as FormDataQueryParams, n as FormInstanceData, I as InitiatorSelectCandidate, o as InitiatorSelectRequirement, p as ProcessBasicInfo, q as ProcessDefinition, r as ProcessTask, s as ReturnableNodeResult, t as ReturnableNode, u as ViewPermissionQueryParams, v as ViewPermissionSummary, w as ApproveParams, x as PreviewParams, y as ProcessRoute, z as ResubmitParams, B as ReturnParams, D as SaveTaskParams, E as TransferParams, W as WithdrawParams, G as TextFieldProps, N as NumberFieldProps, H as TextAreaFieldProps, J as SelectFieldProps, M as MultiSelectFieldProps, K as RadioFieldProps, L as CheckboxFieldProps, Q as DateFieldProps, U as CascadeDateFieldProps, X as AttachmentFieldProps, Y as ImageFieldProps, Z as SubFormFieldProps, _ as UserSelectFieldProps, $ as DepartmentSelectFieldProps, a0 as CascadeSelectFieldProps, a1 as AddressFieldProps, a2 as AssociationFormFieldProps, a3 as EditorFieldProps, a4 as EditorChoiceOption, a5 as SerialNumberFieldProps, a6 as LocationFieldProps, a7 as DigitalSignatureFieldProps, a8 as JSONFieldProps, a9 as ProcessAction, aa as InitiatorSelectedApprovers, ab as ReturnPolicy, ac as ChangeRecord, ad as StandardFormPageMode, ae as LowcodePageSchema } from '../ProcessPreview-
|
|
2
|
-
export { af as AddressValue, ag as ApprovalActionType, ah as ApprovalTimeline, ai as ApprovalTimelineProps, aj as AssociationFormConfig, ak as AssociationValue, al as AttachmentImageVariants, am as AttachmentItem, an as BaseFieldProps, ao as BaseLayoutNode, ap as DataFilter, aq as DataLinkageCondition, ar as DataLinkageConfig, as as DateRangeRestriction, at as DateRestrictionConfig, au as DateShortcutConfig, av as DateShortcutType, aw as DefaultValueLinkageConfig, ax as DepartmentTreeNode, ay as DigitalSignatureValue, az as EditorToolbarAction, F as FieldDefinition, aA as FieldLayoutNode, aB as FieldValueSyncConfig, aC as FormEffectAction, aD as FormEffectCondition, aE as FormEffectConditionOperator, aF as FormEngineMode, aG as FormLayoutNode, aH as FormSection, aI as FormSectionProps, aJ as FormSubmitBehavior, aK as FormTemplateConfig, aL as GridLayoutCell, aM as GridLayoutNode, aN as ImageCompressionConfig, aO as ImageCompressionVariantConfig, aP as ImageVariant, aQ as InitiatorSelectScope, aR as LayoutVisibleWhen, aS as LinkedFormOptionConfig, aT as LocationValue, aU as LowcodePageMeta, aV as LowcodePageNode, aW as LowcodePageNodeType, aX as OptionSourceType, aY as PeopleShortcutConfig, aZ as PeopleShortcutType, a_ as ProcessNodeType, a$ as ProcessPreview, b0 as ProcessPreviewProps, b1 as
|
|
1
|
+
import { d as FormEngineConfig, b as FormSchema, e as FieldBehavior, O as OptionItem, a as FormRuntimeApi, f as FormRuntimeConfig, g as FormAppearanceConfig, V as ValidationPreset, h as ValidationRule, i as FormEffect, c as FormRuntimeApiConfig, j as OptionSourceConfig, P as ProcessStatus, S as StatusMeta, T as TaskStatus, A as ApprovalPermission, k as FormDataDeleteParams, C as ChangeRecordQueryParams, l as ChangeRecordListResponse, m as FormDataQueryParams, n as FormInstanceData, I as InitiatorSelectCandidate, o as InitiatorSelectRequirement, p as ProcessBasicInfo, q as ProcessDefinition, r as ProcessTask, s as ReturnableNodeResult, t as ReturnableNode, u as ViewPermissionQueryParams, v as ViewPermissionSummary, w as ApproveParams, x as PreviewParams, y as ProcessRoute, z as ResubmitParams, B as ReturnParams, D as SaveTaskParams, E as TransferParams, W as WithdrawParams, G as TextFieldProps, N as NumberFieldProps, H as TextAreaFieldProps, J as SelectFieldProps, M as MultiSelectFieldProps, K as RadioFieldProps, L as CheckboxFieldProps, Q as DateFieldProps, U as CascadeDateFieldProps, X as AttachmentFieldProps, Y as ImageFieldProps, Z as SubFormFieldProps, _ as UserSelectFieldProps, $ as DepartmentSelectFieldProps, a0 as CascadeSelectFieldProps, a1 as AddressFieldProps, a2 as AssociationFormFieldProps, a3 as EditorFieldProps, a4 as EditorChoiceOption, a5 as SerialNumberFieldProps, a6 as LocationFieldProps, a7 as DigitalSignatureFieldProps, a8 as JSONFieldProps, a9 as ProcessAction, aa as InitiatorSelectedApprovers, ab as ReturnPolicy, ac as ChangeRecord, ad as StandardFormPageMode, ae as LowcodePageSchema } from '../ProcessPreview-CUQFUDvw.js';
|
|
2
|
+
export { af as AddressValue, ag as ApprovalActionType, ah as ApprovalTimeline, ai as ApprovalTimelineProps, aj as AssociationFormConfig, ak as AssociationValue, al as AttachmentImageVariants, am as AttachmentItem, an as BaseFieldProps, ao as BaseLayoutNode, ap as DataFilter, aq as DataLinkageCondition, ar as DataLinkageConfig, as as DateRangeRestriction, at as DateRestrictionConfig, au as DateShortcutConfig, av as DateShortcutType, aw as DefaultValueLinkageConfig, ax as DepartmentTreeNode, ay as DigitalSignatureValue, az as EditorToolbarAction, F as FieldDefinition, aA as FieldLayoutNode, aB as FieldValueSyncConfig, aC as FormEffectAction, aD as FormEffectCondition, aE as FormEffectConditionOperator, aF as FormEngineMode, aG as FormLayoutNode, aH as FormSection, aI as FormSectionProps, aJ as FormSubmitBehavior, aK as FormTemplateConfig, aL as GridLayoutCell, aM as GridLayoutNode, aN as ImageCompressionConfig, aO as ImageCompressionVariantConfig, aP as ImageVariant, aQ as InitiatorSelectScope, aR as LayoutVisibleWhen, aS as LinkedFormOptionConfig, aT as LocationValue, aU as LowcodePageMeta, aV as LowcodePageNode, aW as LowcodePageNodeType, aX as OptionSourceType, aY as PeopleShortcutConfig, aZ as PeopleShortcutType, a_ as ProcessNodeType, a$ as ProcessPreview, b0 as ProcessPreviewProps, b1 as RuntimeAuthHeadersProvider, b2 as RuntimeDataQueryParams, b3 as RuntimeDataQueryResult, b4 as RuntimeRequestConfig, R as RuntimeResponse, b5 as RuntimeUploadOptions, b6 as RuntimeUploadProvider, b7 as SectionLayoutNode, b8 as SignaturePoint, b9 as StepLayoutItem, ba as StepsLayoutNode, bb as SubFormColumn, bc as TabLayoutItem, bd as TabsLayoutNode, be as TextShortcutConfig, bf as TextShortcutType, bg as UserDisplayFormat, bh as UserItem } from '../ProcessPreview-CUQFUDvw.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default from 'react';
|
|
5
|
-
import { D as DataManagementConfigScope, a as DataManagementConfig, F as FormActionPermission } from '../dataManagementApi-
|
|
6
|
-
export { b as DataManagementDensity, c as DataManagementField, d as DataManagementFilterGroup, f as DataManagementFilterRule, g as DataManagementListResult, h as DataManagementQuery, i as DataManagementSort, j as advancedSearchDataManagement, k as batchApproveDataManagementRows, l as buildFilterPayload, m as deleteDataManagementRows, n as downloadDataManagementImportTemplate, o as exportDataManagementRows, p as getDataManagementConfig, q as getDataManagementSchema, r as getDataManagementTransferRecords, s as getSystemFieldsForFormType, t as importDataManagementRows, u as importPreviewDataManagementRows, v as normalizeColumnConfig, w as normalizeDataManagementFields, x as normalizeDataManagementList, y as saveDataManagementConfig } from '../dataManagementApi-
|
|
5
|
+
import { D as DataManagementConfigScope, a as DataManagementConfig, F as FormActionPermission } from '../dataManagementApi-CwBEmnXg.js';
|
|
6
|
+
export { b as DataManagementDensity, c as DataManagementField, d as DataManagementFilterGroup, f as DataManagementFilterRule, g as DataManagementListResult, h as DataManagementQuery, i as DataManagementSort, j as advancedSearchDataManagement, k as batchApproveDataManagementRows, l as buildFilterPayload, m as deleteDataManagementRows, n as downloadDataManagementImportTemplate, o as exportDataManagementRows, p as getDataManagementConfig, q as getDataManagementSchema, r as getDataManagementTransferRecords, s as getSystemFieldsForFormType, t as importDataManagementRows, u as importPreviewDataManagementRows, v as normalizeColumnConfig, w as normalizeDataManagementFields, x as normalizeDataManagementList, y as saveDataManagementConfig } from '../dataManagementApi-CwBEmnXg.js';
|
|
7
7
|
|
|
8
8
|
interface FormContextValue {
|
|
9
9
|
mode: FormEngineConfig['mode'];
|
|
@@ -10002,7 +10002,31 @@ var parseResponse = async (response) => {
|
|
|
10002
10002
|
message: response.statusText
|
|
10003
10003
|
};
|
|
10004
10004
|
};
|
|
10005
|
-
var
|
|
10005
|
+
var applyAuthHeaders = (headers, getAuthHeaders) => {
|
|
10006
|
+
const authHeaders = getAuthHeaders?.();
|
|
10007
|
+
if (authHeaders) {
|
|
10008
|
+
new Headers(authHeaders).forEach((value, key) => {
|
|
10009
|
+
if (!headers.has(key)) headers.set(key, value);
|
|
10010
|
+
});
|
|
10011
|
+
}
|
|
10012
|
+
const token = typeof window !== "undefined" ? window.localStorage?.getItem("token") : void 0;
|
|
10013
|
+
if (token && !headers.has("authorization")) {
|
|
10014
|
+
headers.set("authorization", token);
|
|
10015
|
+
}
|
|
10016
|
+
};
|
|
10017
|
+
var applyXhrAuthHeaders = (xhr, getAuthHeaders) => {
|
|
10018
|
+
let hasAuthorization = false;
|
|
10019
|
+
const authHeaders = getAuthHeaders?.();
|
|
10020
|
+
if (authHeaders) {
|
|
10021
|
+
new Headers(authHeaders).forEach((value, key) => {
|
|
10022
|
+
if (key.toLowerCase() === "authorization") hasAuthorization = true;
|
|
10023
|
+
xhr.setRequestHeader(key, value);
|
|
10024
|
+
});
|
|
10025
|
+
}
|
|
10026
|
+
const token = typeof window !== "undefined" ? window.localStorage?.getItem("token") : void 0;
|
|
10027
|
+
if (token && !hasAuthorization) xhr.setRequestHeader("authorization", token);
|
|
10028
|
+
};
|
|
10029
|
+
var createDefaultRequest = (baseUrl, fetchImpl = fetch, getAuthHeaders) => async (config) => {
|
|
10006
10030
|
const method = config.method ?? "get";
|
|
10007
10031
|
const url = appendQuery(joinUrl(baseUrl, config.url), config.params);
|
|
10008
10032
|
const headers = new Headers(config.headers);
|
|
@@ -10015,11 +10039,8 @@ var createDefaultRequest = (baseUrl) => async (config) => {
|
|
|
10015
10039
|
body = JSON.stringify(config.data);
|
|
10016
10040
|
}
|
|
10017
10041
|
}
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
headers.set("authorization", token);
|
|
10021
|
-
}
|
|
10022
|
-
const response = await fetch(url, {
|
|
10042
|
+
applyAuthHeaders(headers, getAuthHeaders);
|
|
10043
|
+
const response = await fetchImpl(url, {
|
|
10023
10044
|
method,
|
|
10024
10045
|
headers,
|
|
10025
10046
|
body,
|
|
@@ -10087,7 +10108,7 @@ var normalizeUploadData = (data, file, bucketName, baseUrl = "") => {
|
|
|
10087
10108
|
variants
|
|
10088
10109
|
};
|
|
10089
10110
|
};
|
|
10090
|
-
var uploadWithXhr = (baseUrl, file, bucketName, onProgress, options = {}) => new Promise((resolve, reject) => {
|
|
10111
|
+
var uploadWithXhr = (baseUrl, file, bucketName, onProgress, options = {}, getAuthHeaders) => new Promise((resolve, reject) => {
|
|
10091
10112
|
if (globalThis.process?.env?.VITEST) {
|
|
10092
10113
|
onProgress?.(100);
|
|
10093
10114
|
resolve({
|
|
@@ -10117,8 +10138,7 @@ var uploadWithXhr = (baseUrl, file, bucketName, onProgress, options = {}) => new
|
|
|
10117
10138
|
)
|
|
10118
10139
|
);
|
|
10119
10140
|
xhr.withCredentials = true;
|
|
10120
|
-
|
|
10121
|
-
if (token) xhr.setRequestHeader("authorization", token);
|
|
10141
|
+
applyXhrAuthHeaders(xhr, getAuthHeaders);
|
|
10122
10142
|
xhr.upload.onprogress = (event) => {
|
|
10123
10143
|
if (event.lengthComputable) {
|
|
10124
10144
|
onProgress?.(Math.round(event.loaded / event.total * 100));
|
|
@@ -10222,7 +10242,8 @@ async function uploadChunkedFile(request, file, bucketName, baseUrl, onProgress,
|
|
|
10222
10242
|
fileSize: file.size,
|
|
10223
10243
|
chunkSize: DEFAULT_CHUNK_SIZE,
|
|
10224
10244
|
bucketName,
|
|
10225
|
-
visibility: options.visibility
|
|
10245
|
+
visibility: options.visibility,
|
|
10246
|
+
contentType: file.type || void 0
|
|
10226
10247
|
}
|
|
10227
10248
|
});
|
|
10228
10249
|
const uploadInfo = initiate.data || initiate.result;
|
|
@@ -10281,7 +10302,7 @@ var createSegmentProgress = (onProgress, start, end) => (percent) => {
|
|
|
10281
10302
|
onProgress?.(Math.round(next));
|
|
10282
10303
|
};
|
|
10283
10304
|
var getAttachmentUrl = (item) => item.publicUrl || item.previewUrl || item.downloadUrl || item.url || "";
|
|
10284
|
-
async function uploadSingleRuntimeFile(request, baseUrl, file, bucketName, onProgress, options) {
|
|
10305
|
+
async function uploadSingleRuntimeFile(request, baseUrl, file, bucketName, onProgress, options, getAuthHeaders) {
|
|
10285
10306
|
const singleOptions = stripImageCompressionOptions(options);
|
|
10286
10307
|
if (singleOptions.uploadProvider === "builtin-oss") {
|
|
10287
10308
|
return uploadBuiltinOssFile(request, file, bucketName, onProgress, singleOptions);
|
|
@@ -10292,7 +10313,7 @@ async function uploadSingleRuntimeFile(request, baseUrl, file, bucketName, onPro
|
|
|
10292
10313
|
if (file.size > CHUNK_UPLOAD_THRESHOLD) {
|
|
10293
10314
|
return uploadChunkedFile(request, file, bucketName, baseUrl, onProgress);
|
|
10294
10315
|
}
|
|
10295
|
-
return uploadWithXhr(baseUrl, file, bucketName, onProgress);
|
|
10316
|
+
return uploadWithXhr(baseUrl, file, bucketName, onProgress, {}, getAuthHeaders);
|
|
10296
10317
|
}
|
|
10297
10318
|
function toImageVariantMetadata(uploaded, variant) {
|
|
10298
10319
|
return {
|
|
@@ -10306,7 +10327,7 @@ function toImageVariantMetadata(uploaded, variant) {
|
|
|
10306
10327
|
quality: variant.quality
|
|
10307
10328
|
};
|
|
10308
10329
|
}
|
|
10309
|
-
async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, onProgress, options) {
|
|
10330
|
+
async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, onProgress, options, getAuthHeaders) {
|
|
10310
10331
|
let variants = [];
|
|
10311
10332
|
try {
|
|
10312
10333
|
variants = await createCompressedImageVariants(file, options.imageCompression);
|
|
@@ -10314,7 +10335,15 @@ async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, o
|
|
|
10314
10335
|
variants = [];
|
|
10315
10336
|
}
|
|
10316
10337
|
if (variants.length === 0) {
|
|
10317
|
-
return uploadSingleRuntimeFile(
|
|
10338
|
+
return uploadSingleRuntimeFile(
|
|
10339
|
+
request,
|
|
10340
|
+
baseUrl,
|
|
10341
|
+
file,
|
|
10342
|
+
bucketName,
|
|
10343
|
+
onProgress,
|
|
10344
|
+
options,
|
|
10345
|
+
getAuthHeaders
|
|
10346
|
+
);
|
|
10318
10347
|
}
|
|
10319
10348
|
const originalProgressEnd = 70;
|
|
10320
10349
|
const uploaded = await uploadSingleRuntimeFile(
|
|
@@ -10323,7 +10352,8 @@ async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, o
|
|
|
10323
10352
|
file,
|
|
10324
10353
|
bucketName,
|
|
10325
10354
|
createSegmentProgress(onProgress, 0, originalProgressEnd),
|
|
10326
|
-
options
|
|
10355
|
+
options,
|
|
10356
|
+
getAuthHeaders
|
|
10327
10357
|
);
|
|
10328
10358
|
const imageVariants = { ...uploaded.variants || {} };
|
|
10329
10359
|
const variantProgressStep = (100 - originalProgressEnd) / variants.length;
|
|
@@ -10338,7 +10368,8 @@ async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, o
|
|
|
10338
10368
|
variant.file,
|
|
10339
10369
|
bucketName,
|
|
10340
10370
|
createSegmentProgress(onProgress, start, end),
|
|
10341
|
-
options
|
|
10371
|
+
options,
|
|
10372
|
+
getAuthHeaders
|
|
10342
10373
|
);
|
|
10343
10374
|
imageVariants[variant.kind] = toImageVariantMetadata(variantUpload, variant);
|
|
10344
10375
|
} catch {
|
|
@@ -10355,11 +10386,20 @@ async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, o
|
|
|
10355
10386
|
}
|
|
10356
10387
|
function createFormRuntimeApi(config) {
|
|
10357
10388
|
const { baseUrl = getDefaultBaseUrl(), ...overrides } = config ?? {};
|
|
10358
|
-
const
|
|
10389
|
+
const { fetchImpl, getAuthHeaders } = overrides;
|
|
10390
|
+
const request = overrides.request ?? createDefaultRequest(baseUrl, fetchImpl, getAuthHeaders);
|
|
10359
10391
|
const defaults = {
|
|
10360
10392
|
request,
|
|
10361
10393
|
uploadFile: async (file, bucketName = "files", onProgress, options = {}) => {
|
|
10362
|
-
return uploadFileWithImageVariants(
|
|
10394
|
+
return uploadFileWithImageVariants(
|
|
10395
|
+
request,
|
|
10396
|
+
baseUrl,
|
|
10397
|
+
file,
|
|
10398
|
+
bucketName,
|
|
10399
|
+
onProgress,
|
|
10400
|
+
options,
|
|
10401
|
+
getAuthHeaders
|
|
10402
|
+
);
|
|
10363
10403
|
},
|
|
10364
10404
|
uploadPublicFile: async (file, bucketName = DEFAULT_PUBLIC_FILE_BUCKET, onProgress) => {
|
|
10365
10405
|
if (file.size > CHUNK_UPLOAD_THRESHOLD) {
|
|
@@ -10369,7 +10409,7 @@ function createFormRuntimeApi(config) {
|
|
|
10369
10409
|
}
|
|
10370
10410
|
return uploadWithXhr(baseUrl, file, bucketName, onProgress, {
|
|
10371
10411
|
visibility: "public"
|
|
10372
|
-
});
|
|
10412
|
+
}, getAuthHeaders);
|
|
10373
10413
|
},
|
|
10374
10414
|
deleteFile: async (objectName, bucketName = "files", options = {}) => {
|
|
10375
10415
|
if (options.uploadProvider === "builtin-oss" || options.storageScope === "platform") {
|