openxiangda-devkit-core 2.48.2 → 2.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application-services.d.ts +1 -0
- package/dist/application-services.d.ts.map +1 -1
- package/dist/application-services.js +32 -6
- package/dist/application-services.js.map +1 -1
- package/dist/compiler/ai-catalog.d.ts.map +1 -1
- package/dist/compiler/ai-catalog.js +2 -10
- package/dist/compiler/ai-catalog.js.map +1 -1
- package/dist/compiler/bundle.d.ts.map +1 -1
- package/dist/compiler/bundle.js +56 -18
- package/dist/compiler/bundle.js.map +1 -1
- package/dist/compiler/config.d.ts +1 -1
- package/dist/compiler/config.d.ts.map +1 -1
- package/dist/compiler/config.js +72 -14
- package/dist/compiler/config.js.map +1 -1
- package/dist/compiler/permission-review.d.ts.map +1 -1
- package/dist/compiler/schema-composition.js +3 -0
- package/dist/compiler/schema-composition.js.map +1 -1
- package/dist/connected-development-vite.d.ts +15 -0
- package/dist/connected-development-vite.d.ts.map +1 -0
- package/dist/connected-development-vite.js +27 -0
- package/dist/connected-development-vite.js.map +1 -0
- package/dist/connected-development.d.ts +5 -0
- package/dist/connected-development.d.ts.map +1 -1
- package/dist/connected-development.js +99 -26
- package/dist/connected-development.js.map +1 -1
- package/dist/control-plane-client.d.ts +8 -0
- package/dist/control-plane-client.d.ts.map +1 -1
- package/dist/control-plane-client.js +36 -0
- package/dist/control-plane-client.js.map +1 -1
- package/dist/development-backend-relay.d.ts +28 -0
- package/dist/development-backend-relay.d.ts.map +1 -0
- package/dist/development-backend-relay.js +184 -0
- package/dist/development-backend-relay.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/workflow.d.ts.map +1 -1
- package/dist/internal/workflow.js +18 -5
- package/dist/internal/workflow.js.map +1 -1
- package/dist/workspace-loader.js +1 -1
- package/dist/workspace-loader.js.map +1 -1
- package/package.json +2 -2
- package/templates/backend/Dockerfile +1 -0
package/dist/compiler/bundle.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { compileNativeEventAction } from 'openxiangda-contracts/native-compiler';
|
|
1
|
+
import { compileNativeEventAction, requiresExtendedDeclarationCapacity, requiresExtendedArtifactCapacity } from 'openxiangda-contracts/native-compiler';
|
|
2
|
+
import { normalizeWorkflowOwnedSubjectCreate } from 'openxiangda-contracts/native-compiler';
|
|
2
3
|
import { compileWorkflowBusinessStepHandlers, validateWorkflowBusinessStepSubscriptions, WORKFLOW_BUSINESS_STEP_EVENTS } from 'openxiangda-contracts/native-compiler';
|
|
3
4
|
import { parseNativeUniqueKeys, parseDecimalReservationLifecycle } from 'openxiangda-contracts/native-compiler';
|
|
4
|
-
import { DATA_AUDIT_METADATA_FIELDS, isDataAuditMetadataField, projectDataResourceView } from 'openxiangda-contracts';
|
|
5
|
-
import { nativeFieldRequiresCreateInputV2 } from 'openxiangda-contracts/native-compiler';
|
|
5
|
+
import { DATA_AUDIT_METADATA_FIELDS, isDataAuditMetadataField, projectDataResourceView, requiresExtendedOwnedSubtableCapacity } from 'openxiangda-contracts';
|
|
6
|
+
import { nativeFieldRequiresCreateInputV2, requiresOwnedSubtableMinimumRows, requiresDateTimeMinutePrecision, requiresUserCandidateLaunchScope, requiresWorkflowRoleUnion } from 'openxiangda-contracts/native-compiler';
|
|
6
7
|
import { createHash } from 'node:crypto';
|
|
7
8
|
import { canonicalJson, applicationEventHandlerPathV2, DATA_EVENT_TYPES_V2, nativePlatformCapabilityCatalog, OPENXIANGDA_COMPILER_CONTRACT_VERSION, SCHEMA_VERSIONS, WORKFLOW_EVENT_TYPES_V2, sha256Digest, } from 'openxiangda-contracts';
|
|
8
9
|
import { AppConfigValidationError, resourceCapabilityCodes, } from './config.js';
|
|
@@ -236,7 +237,7 @@ export function normalizeConfiguration(config) {
|
|
|
236
237
|
: {}),
|
|
237
238
|
failureMode: source.failureMode,
|
|
238
239
|
})), item => item.code),
|
|
239
|
-
dataPolicies: sorted((config.authz?.dataPolicies || []).map(normalizeDataPolicyDeclaration), item => item.code),
|
|
240
|
+
dataPolicies: sorted((config.authz?.dataPolicies || []).map(policy => normalizeDataPolicyDeclaration(policy, config.authz?.authenticatedUserRoleCode || '')), item => item.code),
|
|
240
241
|
authorizationTransitions: sorted((config.authz?.authorizationTransitions || []).map(normalizeAuthorizationTransition), item => item.fromAuthzDigest),
|
|
241
242
|
},
|
|
242
243
|
backend: {
|
|
@@ -259,13 +260,19 @@ export function normalizeConfiguration(config) {
|
|
|
259
260
|
...(operation.platformAccess
|
|
260
261
|
? {
|
|
261
262
|
platformAccess: {
|
|
263
|
+
...(operation.platformAccess.ownedSubject ? { ownedSubject: normalizeWorkflowOwnedSubjectCreate(operation.platformAccess.ownedSubject) } : {}),
|
|
262
264
|
...(operation.platformAccess.dataCommands ? { dataCommands: { mode: operation.platformAccess.dataCommands.mode } } : {}),
|
|
265
|
+
...(operation.platformAccess.workflowStage ? { workflowStage: { ...operation.platformAccess.workflowStage,
|
|
266
|
+
runningNodeIds: uniqueSorted(operation.platformAccess.workflowStage.runningNodeIds),
|
|
267
|
+
allowedStatuses: uniqueSorted(operation.platformAccess.workflowStage.allowedStatuses),
|
|
268
|
+
} } : {}),
|
|
263
269
|
...(operation.platformAccess.recordEdit ? { recordEdit: {
|
|
264
270
|
resourceCode: operation.platformAccess.recordEdit.resourceCode,
|
|
265
271
|
fieldCodes: uniqueSorted(operation.platformAccess.recordEdit.fieldCodes),
|
|
266
272
|
} } : {}),
|
|
267
273
|
...(operation.platformAccess.roleAssertions ? {
|
|
268
|
-
roleAssertions: { roleCodes: uniqueSorted(operation.platformAccess.roleAssertions.roleCodes)
|
|
274
|
+
roleAssertions: { roleCodes: uniqueSorted(operation.platformAccess.roleAssertions.roleCodes),
|
|
275
|
+
...(operation.platformAccess.roleAssertions.actorAuthority ? { actorAuthority: true } : {}) },
|
|
269
276
|
} : {}),
|
|
270
277
|
...(operation.platformAccess.directory
|
|
271
278
|
? {
|
|
@@ -1307,13 +1314,19 @@ function compileOperations(config) {
|
|
|
1307
1314
|
...(operation.platformAccess
|
|
1308
1315
|
? {
|
|
1309
1316
|
platformAccess: {
|
|
1317
|
+
...(operation.platformAccess.ownedSubject ? { ownedSubject: normalizeWorkflowOwnedSubjectCreate(operation.platformAccess.ownedSubject) } : {}),
|
|
1310
1318
|
...(operation.platformAccess.dataCommands ? { dataCommands: { mode: operation.platformAccess.dataCommands.mode } } : {}),
|
|
1319
|
+
...(operation.platformAccess.workflowStage ? { workflowStage: { ...operation.platformAccess.workflowStage,
|
|
1320
|
+
runningNodeIds: uniqueSorted(operation.platformAccess.workflowStage.runningNodeIds),
|
|
1321
|
+
allowedStatuses: uniqueSorted(operation.platformAccess.workflowStage.allowedStatuses),
|
|
1322
|
+
} } : {}),
|
|
1311
1323
|
...(operation.platformAccess.recordEdit ? { recordEdit: {
|
|
1312
1324
|
resourceCode: operation.platformAccess.recordEdit.resourceCode,
|
|
1313
1325
|
fieldCodes: uniqueSorted(operation.platformAccess.recordEdit.fieldCodes),
|
|
1314
1326
|
} } : {}),
|
|
1315
1327
|
...(operation.platformAccess.roleAssertions ? {
|
|
1316
|
-
roleAssertions: { roleCodes: uniqueSorted(operation.platformAccess.roleAssertions.roleCodes)
|
|
1328
|
+
roleAssertions: { roleCodes: uniqueSorted(operation.platformAccess.roleAssertions.roleCodes),
|
|
1329
|
+
...(operation.platformAccess.roleAssertions.actorAuthority ? { actorAuthority: true } : {}) },
|
|
1317
1330
|
} : {}),
|
|
1318
1331
|
...(operation.platformAccess.directory
|
|
1319
1332
|
? {
|
|
@@ -1464,12 +1477,19 @@ function runtimeProtocolCapabilities(config) {
|
|
|
1464
1477
|
const usesDirectory = config.data?.resources.some(resource => resource.schema.fields.some(field => field.type.startsWith('user.') || field.type.startsWith('department.'))) || operations.some(operation => operation.platformAccess?.directory);
|
|
1465
1478
|
return uniqueSorted([
|
|
1466
1479
|
'application-native-2',
|
|
1480
|
+
...(requiresExtendedDeclarationCapacity(config) ? ['application.extended-declaration-capacity'] : []),
|
|
1481
|
+
...(requiresExtendedArtifactCapacity(config) ? ['application.extended-artifact-capacity'] : []),
|
|
1467
1482
|
'authz.batch-explain',
|
|
1468
1483
|
'deployment.durable-runs',
|
|
1469
1484
|
'deployment.platform-executor',
|
|
1470
1485
|
...(config.events?.capturePolicies?.length ? ['events.capture-policy'] : []),
|
|
1471
1486
|
...(config.events?.subscriptions?.some(item => item.execution) ? ['events.native-data-actions'] : []),
|
|
1472
1487
|
...(config.data?.resources.length ? ['data-api-v2'] : []),
|
|
1488
|
+
...(requiresExtendedOwnedSubtableCapacity(config.data?.resources || []) ? ['data.extended-owned-subtable-capacity'] : []),
|
|
1489
|
+
...(requiresWorkflowRoleUnion(config.workflows?.bindings || []) ? ['workflow.role-union'] : []),
|
|
1490
|
+
...(requiresUserCandidateLaunchScope(config.data?.resources || []) ? ['data.user-candidate-launch-scope'] : []),
|
|
1491
|
+
...(requiresDateTimeMinutePrecision(config.data?.resources || []) ? ['data.datetime-minute-precision'] : []),
|
|
1492
|
+
...(requiresOwnedSubtableMinimumRows(config.data?.resources || []) ? ['data.subtable-minimum-rows'] : []),
|
|
1473
1493
|
...(usesDirectory ? ['directory-v2'] : []),
|
|
1474
1494
|
...(operations.some(operation => operation.platformAccess?.directory?.mode === 'selected-user') ? ['directory.selected-user'] : []),
|
|
1475
1495
|
...(operations.some(operation => operation.platformAccess?.directory?.mode === 'current-initiator' && operation.platformAccess.directory.fields.includes('phone')) ||
|
|
@@ -1489,7 +1509,10 @@ function runtimeProtocolCapabilities(config) {
|
|
|
1489
1509
|
? ['business-process.durable-command']
|
|
1490
1510
|
: []),
|
|
1491
1511
|
...(operations.some(operation => operation.platformAccess?.dataCommands) ? ['data.business-commands'] : []),
|
|
1512
|
+
...(operations.some(operation => operation.platformAccess?.workflowStage) ? ['workflow.native-stage-guard'] : []),
|
|
1513
|
+
...(operations.some(operation => operation.platformAccess?.roleAssertions?.actorAuthority) ? ['data.transaction-actor-authority'] : []),
|
|
1492
1514
|
...(operations.some(operation => operation.platformAccess?.recordEdit) ? ['data.record-edit'] : []),
|
|
1515
|
+
...(operations.some(operation => operation.platformAccess?.ownedSubject) ? ['workflow.named-owned-create'] : []),
|
|
1493
1516
|
...(operations.some(operation => operation.platformAccess?.decimalReservation) ||
|
|
1494
1517
|
config.events?.subscriptions.some(subscription => subscription.platformAccess?.decimalReservation)
|
|
1495
1518
|
? ['data.decimal-reservations']
|
|
@@ -1509,6 +1532,8 @@ function runtimeProtocolCapabilities(config) {
|
|
|
1509
1532
|
: []),
|
|
1510
1533
|
...((config.workflows?.definitions || []).some(item => item.definition.commandHandlers !== undefined) || operations.some(operation => operation.platformAccess?.workflow?.businessCommands)
|
|
1511
1534
|
? ['workflow.business-data-command'] : []),
|
|
1535
|
+
...((config.workflows?.definitions || []).some(item => item.definition.commandHandlers?.resubmit) || operations.some(operation => operation.platformAccess?.workflow?.businessCommands?.includes('resubmit'))
|
|
1536
|
+
? ['workflow.correction-business-command'] : []),
|
|
1512
1537
|
...((config.workflows?.definitions || []).some(item => item.definition.launchPreflight !== undefined)
|
|
1513
1538
|
? ['workflow.launch-preflight'] : []),
|
|
1514
1539
|
...((config.workflows?.definitions || []).some(item => item.definition.instanceCommands !== undefined)
|
|
@@ -1519,6 +1544,8 @@ function runtimeProtocolCapabilities(config) {
|
|
|
1519
1544
|
: []),
|
|
1520
1545
|
...((config.workflows?.definitions || []).some(item => Object.values(item.definition.nodes).some(node => node.kind === 'approval' && (node.administration !== undefined || node.operationPolicy !== undefined)))
|
|
1521
1546
|
? ['workflow.node-administration'] : []),
|
|
1547
|
+
...((config.workflows?.definitions || []).some(item => Object.values(item.definition.nodes).some(node => node.kind === 'approval' && Object.values(node.operationPolicy || {}).some(policy => policy?.reasonRequired === false)))
|
|
1548
|
+
? ['workflow.optional-operation-reason'] : []),
|
|
1522
1549
|
...(config.frontend.authentication
|
|
1523
1550
|
? ['authentication.application-login-surface']
|
|
1524
1551
|
: []),
|
|
@@ -1686,14 +1713,16 @@ function normalizeDataPolicyExpression(expression) {
|
|
|
1686
1713
|
}
|
|
1687
1714
|
return normalizeDataPolicyRule(expression);
|
|
1688
1715
|
}
|
|
1689
|
-
function normalizeDataPolicyDeclaration(policy) {
|
|
1716
|
+
function normalizeDataPolicyDeclaration(policy, baselineRoleCode) {
|
|
1690
1717
|
const common = {
|
|
1691
1718
|
code: policy.code,
|
|
1692
1719
|
name: policy.name,
|
|
1693
1720
|
resourceCode: policy.resourceCode,
|
|
1694
|
-
...(policy.
|
|
1695
|
-
|
|
1696
|
-
|
|
1721
|
+
...(policy.publicRead !== undefined ? { publicRead: { fields: uniqueSorted(policy.publicRead.fields) } } : {}),
|
|
1722
|
+
...(policy.publicRead !== undefined ? { unrestrictedRoleCodes: uniqueSorted([...(policy.unrestrictedRoleCodes || []), baselineRoleCode]) } :
|
|
1723
|
+
policy.unrestrictedRoleCodes !== undefined
|
|
1724
|
+
? { unrestrictedRoleCodes: uniqueSorted(policy.unrestrictedRoleCodes) }
|
|
1725
|
+
: {}),
|
|
1697
1726
|
};
|
|
1698
1727
|
if (policy.readExpression !== undefined) {
|
|
1699
1728
|
const readExpression = normalizeDataPolicyExpression(policy.readExpression);
|
|
@@ -1733,9 +1762,9 @@ export function renderGeneratedContracts(config, contract = compileContractBundl
|
|
|
1733
1762
|
item.code,
|
|
1734
1763
|
normalizeResourceSurface(item.surface || defaultResourceSurface(item)),
|
|
1735
1764
|
]));
|
|
1736
|
-
const
|
|
1737
|
-
|
|
1738
|
-
|
|
1765
|
+
const resourceDefinitionEntries = sorted(config.data?.resources || [], item => item.code).map(item => [
|
|
1766
|
+
item.code,
|
|
1767
|
+
`{\n` +
|
|
1739
1768
|
` code: ${JSON.stringify(item.code)},\n` +
|
|
1740
1769
|
` name: ${JSON.stringify(item.name)},\n` +
|
|
1741
1770
|
(item.detailRouteCode
|
|
@@ -1750,9 +1779,8 @@ export function renderGeneratedContracts(config, contract = compileContractBundl
|
|
|
1750
1779
|
(item.recordComments !== undefined ? ` recordComments: ${JSON.stringify(item.recordComments)},\n` : '') +
|
|
1751
1780
|
(item.recordDeletion !== undefined ? ` recordDeletion: ${JSON.stringify(item.recordDeletion)},\n` : '') +
|
|
1752
1781
|
` surface: resourceSurfaces[${JSON.stringify(item.code)}],\n` +
|
|
1753
|
-
' }'
|
|
1754
|
-
|
|
1755
|
-
: ''}}`;
|
|
1782
|
+
' }',
|
|
1783
|
+
]);
|
|
1756
1784
|
const operationEntries = contract.operations.map(operation => [
|
|
1757
1785
|
camel(operation.code),
|
|
1758
1786
|
operation,
|
|
@@ -1795,8 +1823,8 @@ export function renderGeneratedContracts(config, contract = compileContractBundl
|
|
|
1795
1823
|
`export const appName = ${JSON.stringify(config.app.name)} as const;`,
|
|
1796
1824
|
`export const appPerspectives = ${JSON.stringify(contract.perspectives, null, 2)} as const;`,
|
|
1797
1825
|
`export const resourceCodes = ${JSON.stringify(resourceCodes, null, 2)} as const;`,
|
|
1798
|
-
|
|
1799
|
-
|
|
1826
|
+
renderTypedRecord('resourceSurfaces', Object.entries(resourceSurfaces).map(([key, value]) => [key, JSON.stringify(value, null, 2)])),
|
|
1827
|
+
renderTypedRecord('resourceDefinitions', resourceDefinitionEntries),
|
|
1800
1828
|
`export const capabilities = ${JSON.stringify(capabilities, null, 2)} as const;`,
|
|
1801
1829
|
`export const appOperations = ${renderEntries(operationEntries)} as const;`,
|
|
1802
1830
|
`export const appRoutes = ${renderEntries(routeEntries)} as const;`,
|
|
@@ -2135,6 +2163,7 @@ function normalizeDataFieldSource(source) {
|
|
|
2135
2163
|
: {}),
|
|
2136
2164
|
...(source.pageSize !== undefined ? { pageSize: source.pageSize } : {}),
|
|
2137
2165
|
...(source.loadMode ? { loadMode: source.loadMode } : {}),
|
|
2166
|
+
...(source.clearOnBindingChange === undefined ? {} : { clearOnBindingChange: source.clearOnBindingChange }),
|
|
2138
2167
|
};
|
|
2139
2168
|
}
|
|
2140
2169
|
export function sha256Bytes(content) {
|
|
@@ -2175,6 +2204,15 @@ function renderEntries(entries) {
|
|
|
2175
2204
|
.join(',\n');
|
|
2176
2205
|
return `{\n${body}\n}`;
|
|
2177
2206
|
}
|
|
2207
|
+
function renderTypedRecord(name, entries) {
|
|
2208
|
+
if (entries.length === 0)
|
|
2209
|
+
return `export const ${name} = {} as const;`;
|
|
2210
|
+
// Named entries keep declaration emit below TypeScript's aggregate inference limit.
|
|
2211
|
+
const declarations = entries.map(([, value], index) => `const ${name}Item${index} = ${value} as const;`);
|
|
2212
|
+
const types = entries.map(([key], index) => ` readonly ${JSON.stringify(key)}: typeof ${name}Item${index};`);
|
|
2213
|
+
const values = entries.map(([key], index) => ` ${JSON.stringify(key)}: ${name}Item${index}`);
|
|
2214
|
+
return [...declarations, `export const ${name}: {\n${types.join('\n')}\n} = {\n${values.join(',\n')}\n};`].join('\n');
|
|
2215
|
+
}
|
|
2178
2216
|
function safeProperty(value) {
|
|
2179
2217
|
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value)
|
|
2180
2218
|
? value
|