openxiangda-devkit-core 2.0.0-alpha.100

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.
Files changed (126) hide show
  1. package/README.md +13 -0
  2. package/dist/app-spec.d.ts +210 -0
  3. package/dist/app-spec.d.ts.map +1 -0
  4. package/dist/app-spec.js +1262 -0
  5. package/dist/app-spec.js.map +1 -0
  6. package/dist/application-services.d.ts +600 -0
  7. package/dist/application-services.d.ts.map +1 -0
  8. package/dist/application-services.js +1603 -0
  9. package/dist/application-services.js.map +1 -0
  10. package/dist/backend-image-build.d.ts +23 -0
  11. package/dist/backend-image-build.d.ts.map +1 -0
  12. package/dist/backend-image-build.js +209 -0
  13. package/dist/backend-image-build.js.map +1 -0
  14. package/dist/command-registry.d.ts +177 -0
  15. package/dist/command-registry.d.ts.map +1 -0
  16. package/dist/command-registry.js +27 -0
  17. package/dist/command-registry.js.map +1 -0
  18. package/dist/compiler/ai-catalog.d.ts +4 -0
  19. package/dist/compiler/ai-catalog.d.ts.map +1 -0
  20. package/dist/compiler/ai-catalog.js +353 -0
  21. package/dist/compiler/ai-catalog.js.map +1 -0
  22. package/dist/compiler/authorization-transition.d.ts +7 -0
  23. package/dist/compiler/authorization-transition.d.ts.map +1 -0
  24. package/dist/compiler/authorization-transition.js +27 -0
  25. package/dist/compiler/authorization-transition.js.map +1 -0
  26. package/dist/compiler/bundle.d.ts +34 -0
  27. package/dist/compiler/bundle.d.ts.map +1 -0
  28. package/dist/compiler/bundle.js +1865 -0
  29. package/dist/compiler/bundle.js.map +1 -0
  30. package/dist/compiler/config.d.ts +857 -0
  31. package/dist/compiler/config.d.ts.map +1 -0
  32. package/dist/compiler/config.js +3848 -0
  33. package/dist/compiler/config.js.map +1 -0
  34. package/dist/compiler/data-policy-expression.d.ts +12 -0
  35. package/dist/compiler/data-policy-expression.d.ts.map +1 -0
  36. package/dist/compiler/data-policy-expression.js +43 -0
  37. package/dist/compiler/data-policy-expression.js.map +1 -0
  38. package/dist/compiler/field-codec.d.ts +14 -0
  39. package/dist/compiler/field-codec.d.ts.map +1 -0
  40. package/dist/compiler/field-codec.js +131 -0
  41. package/dist/compiler/field-codec.js.map +1 -0
  42. package/dist/compiler/field-physical-plan.d.ts +10 -0
  43. package/dist/compiler/field-physical-plan.d.ts.map +1 -0
  44. package/dist/compiler/field-physical-plan.js +66 -0
  45. package/dist/compiler/field-physical-plan.js.map +1 -0
  46. package/dist/compiler/field-policy-path.d.ts +10 -0
  47. package/dist/compiler/field-policy-path.d.ts.map +1 -0
  48. package/dist/compiler/field-policy-path.js +283 -0
  49. package/dist/compiler/field-policy-path.js.map +1 -0
  50. package/dist/compiler/field-query-plan.d.ts +13 -0
  51. package/dist/compiler/field-query-plan.d.ts.map +1 -0
  52. package/dist/compiler/field-query-plan.js +122 -0
  53. package/dist/compiler/field-query-plan.js.map +1 -0
  54. package/dist/compiler/field-surface.d.ts +15 -0
  55. package/dist/compiler/field-surface.d.ts.map +1 -0
  56. package/dist/compiler/field-surface.js +51 -0
  57. package/dist/compiler/field-surface.js.map +1 -0
  58. package/dist/compiler/index.d.ts +6 -0
  59. package/dist/compiler/index.d.ts.map +1 -0
  60. package/dist/compiler/index.js +6 -0
  61. package/dist/compiler/index.js.map +1 -0
  62. package/dist/compiler/package-compiler.d.ts +22 -0
  63. package/dist/compiler/package-compiler.d.ts.map +1 -0
  64. package/dist/compiler/package-compiler.js +246 -0
  65. package/dist/compiler/package-compiler.js.map +1 -0
  66. package/dist/compiler/schema-composition.d.ts +21 -0
  67. package/dist/compiler/schema-composition.d.ts.map +1 -0
  68. package/dist/compiler/schema-composition.js +193 -0
  69. package/dist/compiler/schema-composition.js.map +1 -0
  70. package/dist/config.d.ts +2 -0
  71. package/dist/config.d.ts.map +1 -0
  72. package/dist/config.js +2 -0
  73. package/dist/config.js.map +1 -0
  74. package/dist/connected-development.d.ts +62 -0
  75. package/dist/connected-development.d.ts.map +1 -0
  76. package/dist/connected-development.js +393 -0
  77. package/dist/connected-development.js.map +1 -0
  78. package/dist/control-plane-client.d.ts +684 -0
  79. package/dist/control-plane-client.d.ts.map +1 -0
  80. package/dist/control-plane-client.js +860 -0
  81. package/dist/control-plane-client.js.map +1 -0
  82. package/dist/deployment.d.ts +67 -0
  83. package/dist/deployment.d.ts.map +1 -0
  84. package/dist/deployment.js +311 -0
  85. package/dist/deployment.js.map +1 -0
  86. package/dist/index.d.ts +17 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +17 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/internal/workflow.d.ts +83 -0
  91. package/dist/internal/workflow.d.ts.map +1 -0
  92. package/dist/internal/workflow.js +419 -0
  93. package/dist/internal/workflow.js.map +1 -0
  94. package/dist/nest-injection-contract.d.ts +4 -0
  95. package/dist/nest-injection-contract.d.ts.map +1 -0
  96. package/dist/nest-injection-contract.js +116 -0
  97. package/dist/nest-injection-contract.js.map +1 -0
  98. package/dist/package-compiler.d.ts +2 -0
  99. package/dist/package-compiler.d.ts.map +1 -0
  100. package/dist/package-compiler.js +2 -0
  101. package/dist/package-compiler.js.map +1 -0
  102. package/dist/session.d.ts +143 -0
  103. package/dist/session.d.ts.map +1 -0
  104. package/dist/session.js +351 -0
  105. package/dist/session.js.map +1 -0
  106. package/dist/testing.d.ts +77 -0
  107. package/dist/testing.d.ts.map +1 -0
  108. package/dist/testing.js +213 -0
  109. package/dist/testing.js.map +1 -0
  110. package/dist/toolchain-capsule.d.ts +45 -0
  111. package/dist/toolchain-capsule.d.ts.map +1 -0
  112. package/dist/toolchain-capsule.js +165 -0
  113. package/dist/toolchain-capsule.js.map +1 -0
  114. package/dist/version.d.ts +3 -0
  115. package/dist/version.d.ts.map +1 -0
  116. package/dist/version.js +11 -0
  117. package/dist/version.js.map +1 -0
  118. package/dist/workspace-loader.d.ts +17 -0
  119. package/dist/workspace-loader.d.ts.map +1 -0
  120. package/dist/workspace-loader.js +140 -0
  121. package/dist/workspace-loader.js.map +1 -0
  122. package/dist/workspace.d.ts +15 -0
  123. package/dist/workspace.d.ts.map +1 -0
  124. package/dist/workspace.js +69 -0
  125. package/dist/workspace.js.map +1 -0
  126. package/package.json +44 -0
@@ -0,0 +1,857 @@
1
+ import { type AppApiOperationDeclaration, type AppEventSubscriptionPlatformAccessDeclaration, type AppAuthorizationTransitionDeclaration, type AppBackendSecretDeclaration, type AppCapabilityDeclaration, type AppDataPolicyDeclaration, type AppDataPolicyExpressionDeclaration, type AppDataPolicyRuleDeclaration, type AppFrontendRouteDeclaration, type AppFrontendRouteAccess, type AppRouteManifestDevicePolicyV3, type AnonymousPublicAccessContractV2, type ApplicationAuthenticationDeclarationV2, type AppAdminNavigationDeclaration, type AppAdminNavigationGroupDeclaration, type AppAdminNavigationItemDeclaration, type AppWorkflowLaunchDeclaration, type AppWorkflowDetailRouteCodeDeclaration, type AppPerspectiveDeclaration, type AppRoleDeclaration, type AppRoleMembershipSourceDeclaration, type AppRelationshipGrantSourceDeclaration, type AppScopeDimensionDeclaration, type AppScopeSourceDeclaration, type NativeWorkflowEditableParameterDeclaration, type DataFieldDefinition, type DataFieldPolicy, type DataFieldSurfaceWidget, type DataResourceSurface, type DataResource, type Diagnostic, type ApplicationEventSchemaDeclaration, type DateTrigger, type EventSubscription, type TimerSubscription, type WorkflowBinding, type WorkflowDefinition } from 'openxiangda-contracts';
2
+ export type EventSubscriptionDeclaration = Pick<EventSubscription, 'code' | 'eventTypes'> & {
3
+ description?: string;
4
+ filter?: EventSubscription['filter'];
5
+ payload?: Partial<EventSubscription['payload']>;
6
+ platformAccess?: AppEventSubscriptionPlatformAccessDeclaration;
7
+ delivery?: Partial<EventSubscription['delivery']>;
8
+ };
9
+ export type TimerSubscriptionDeclaration = Pick<TimerSubscription, 'code' | 'eventType' | 'cronExpression' | 'timezone' | 'payload'> & {
10
+ misfirePolicy?: TimerSubscription['misfirePolicy'];
11
+ };
12
+ export type DateTriggerDeclaration = Pick<DateTrigger, 'code' | 'resourceCode' | 'field' | 'offset' | 'eventType' | 'payload'>;
13
+ export interface WorkflowDefinitionDeclaration {
14
+ version: number;
15
+ definition: WorkflowDefinition;
16
+ launch?: AppWorkflowLaunchDeclaration;
17
+ detailRouteCode?: AppWorkflowDetailRouteCodeDeclaration;
18
+ }
19
+ export interface WorkflowBindingDeclaration {
20
+ version: number;
21
+ binding: WorkflowBinding;
22
+ }
23
+ export interface WorkflowActivationDeclaration {
24
+ workflowCode: string;
25
+ definitionVersion: number;
26
+ bindingVersion: number;
27
+ acceptedCommandDeactivationPolicy: WorkflowDefinition['acceptedCommandDeactivationPolicy'];
28
+ }
29
+ export interface WorkflowAssigneeProviderDeclaration {
30
+ code: string;
31
+ endpointPath: string;
32
+ timeoutMs?: number;
33
+ status?: 'active' | 'paused';
34
+ }
35
+ export type BackendSecretDeclaration = AppBackendSecretDeclaration;
36
+ export type AuthzRoleDeclaration = AppRoleDeclaration;
37
+ export type AuthzScopeDimensionDeclaration = AppScopeDimensionDeclaration;
38
+ export type AuthzScopeSourceDeclaration = AppScopeSourceDeclaration;
39
+ export type AuthzRoleMembershipSourceDeclaration = AppRoleMembershipSourceDeclaration;
40
+ export type AuthzRelationshipGrantSourceDeclaration = AppRelationshipGrantSourceDeclaration;
41
+ export type AuthzDataPolicyRuleDeclaration = AppDataPolicyRuleDeclaration;
42
+ export type AuthzDataPolicyDeclaration = AppDataPolicyDeclaration;
43
+ export type AppDataFieldAccessDeclaration = {
44
+ read?: string[] | false;
45
+ create?: string[] | false;
46
+ update?: string[] | false;
47
+ mask?: DataFieldPolicy['mask'];
48
+ };
49
+ /**
50
+ * One source field owns storage, validation, presentation and field access.
51
+ * The compiler projects it into the strict platform schema and UI Surface.
52
+ */
53
+ export interface AppDataFieldDeclaration {
54
+ code: string;
55
+ type: DataFieldDefinition['type'];
56
+ label: string;
57
+ required?: boolean;
58
+ indexed?: boolean;
59
+ options?: DataFieldDefinition['options'];
60
+ source?: DataFieldDefinition['source'];
61
+ maxLength?: DataFieldDefinition['maxLength'];
62
+ precision?: DataFieldDefinition['precision'];
63
+ scale?: DataFieldDefinition['scale'];
64
+ min?: DataFieldDefinition['min'];
65
+ max?: DataFieldDefinition['max'];
66
+ rangeBoundary?: NonNullable<DataFieldDefinition['rangeBoundary']>;
67
+ timePrecision?: DataFieldDefinition['timePrecision'];
68
+ file?: DataFieldDefinition['file'];
69
+ serial?: DataFieldDefinition['serial'];
70
+ subtable?: DataFieldDefinition['subtable'];
71
+ widget?: DataFieldSurfaceWidget;
72
+ section?: string;
73
+ system?: boolean;
74
+ list?: boolean;
75
+ filter?: boolean;
76
+ searchable?: boolean;
77
+ sortable?: boolean;
78
+ access?: AppDataFieldAccessDeclaration;
79
+ }
80
+ export interface AppDataResourceDeclaration {
81
+ code: string;
82
+ name: string;
83
+ mutationOwner?: 'native' | 'action' | 'readonly' | 'workflow';
84
+ generated?: {
85
+ list?: boolean;
86
+ detail?: boolean;
87
+ create?: boolean;
88
+ update?: boolean;
89
+ delete?: boolean;
90
+ };
91
+ fields: AppDataFieldDeclaration[];
92
+ invariants?: DataResource['invariants'];
93
+ list?: {
94
+ defaultPageSize?: number;
95
+ defaultSort?: {
96
+ field: string;
97
+ order?: 'asc' | 'desc';
98
+ };
99
+ };
100
+ form?: {
101
+ layout?: 'flat' | 'sections';
102
+ };
103
+ detail?: {
104
+ layout?: 'flat' | 'sections';
105
+ };
106
+ mobile?: DataResourceSurface['mobile'];
107
+ dataPolicyCode?: string | null;
108
+ }
109
+ export interface OpenXiangdaAppDeclaration {
110
+ schemaVersion: 3;
111
+ app: OpenXiangdaAppConfig['app'];
112
+ frontend: OpenXiangdaAppConfig['frontend'];
113
+ backend: OpenXiangdaAppConfig['backend'];
114
+ platform: OpenXiangdaAppConfig['platform'];
115
+ perspectives?: AppPerspectiveDeclaration[];
116
+ data?: {
117
+ resources: AppDataResourceDeclaration[];
118
+ };
119
+ authz?: NonNullable<OpenXiangdaAppConfig['authz']>;
120
+ events?: NonNullable<OpenXiangdaAppConfig['events']>;
121
+ workflows?: NonNullable<OpenXiangdaAppConfig['workflows']>;
122
+ }
123
+ export interface OpenXiangdaAppConfig {
124
+ schemaVersion: 3;
125
+ app: {
126
+ code: string;
127
+ name: string;
128
+ };
129
+ frontend: {
130
+ root: string;
131
+ routes?: AppFrontendRouteDeclaration[];
132
+ devicePolicy?: AppRouteManifestDevicePolicyV3;
133
+ user?: {
134
+ applicationTodoCenter?: boolean;
135
+ };
136
+ admin?: {
137
+ access?: AppFrontendRouteAccess;
138
+ navigation: AppAdminNavigationDeclaration;
139
+ };
140
+ authentication?: ApplicationAuthenticationDeclarationV2;
141
+ publicAccess?: AnonymousPublicAccessContractV2;
142
+ };
143
+ backend: {
144
+ root: string;
145
+ runtime: 'node';
146
+ framework: 'nestjs';
147
+ /** Omit for pure CRUD applications; set true for an intentional backend. */
148
+ enabled?: boolean;
149
+ isolation?: 'shared' | 'dedicated';
150
+ resourceProfile?: 'light' | 'standard';
151
+ secrets?: BackendSecretDeclaration[];
152
+ operations?: AppApiOperationDeclaration[];
153
+ };
154
+ platform: {
155
+ root: string;
156
+ };
157
+ perspectives?: AppPerspectiveDeclaration[];
158
+ data?: {
159
+ resources: DataResource[];
160
+ };
161
+ authz?: {
162
+ /** Package role granted by the platform to every authenticated user on first access. */
163
+ authenticatedUserRoleCode?: string;
164
+ capabilities: AppCapabilityDeclaration[];
165
+ roles: AuthzRoleDeclaration[];
166
+ scopeDimensions?: AuthzScopeDimensionDeclaration[];
167
+ scopeSources?: AuthzScopeSourceDeclaration[];
168
+ roleMembershipSources?: AuthzRoleMembershipSourceDeclaration[];
169
+ relationshipGrantSources?: AuthzRelationshipGrantSourceDeclaration[];
170
+ dataPolicies?: AuthzDataPolicyDeclaration[];
171
+ authorizationTransitions?: AppAuthorizationTransitionDeclaration[];
172
+ };
173
+ events?: {
174
+ schemas?: ApplicationEventSchemaDeclaration[];
175
+ subscriptions: EventSubscriptionDeclaration[];
176
+ timers?: TimerSubscriptionDeclaration[];
177
+ dateTriggers?: DateTriggerDeclaration[];
178
+ };
179
+ workflows?: {
180
+ definitions: WorkflowDefinitionDeclaration[];
181
+ bindings: WorkflowBindingDeclaration[];
182
+ /** Complete desired activation set; removing an item deactivates it on deploy. */
183
+ activations: WorkflowActivationDeclaration[];
184
+ providers?: WorkflowAssigneeProviderDeclaration[];
185
+ editableParameters?: NativeWorkflowEditableParameterDeclaration[];
186
+ };
187
+ }
188
+ type AdminNavigationItemOptions = Omit<AppAdminNavigationItemDeclaration, 'page'>;
189
+ type AdminNavigationGroupOptions = Pick<AppAdminNavigationGroupDeclaration, 'icon' | 'order'>;
190
+ /** Explicitly owns the complete admin menu; the compiler never appends pages. */
191
+ export declare function defineAdminNavigation<const Groups extends AppAdminNavigationDeclaration>(groups: Groups): Groups;
192
+ export declare function adminNavigationGroup(code: string, label: string, items: readonly AppAdminNavigationItemDeclaration[], options?: AdminNavigationGroupOptions): AppAdminNavigationGroupDeclaration;
193
+ export declare function adminResourcePage(resourceCode: string, options?: AdminNavigationItemOptions): AppAdminNavigationItemDeclaration;
194
+ export declare function adminOperationPage(routeCode: string, options?: AdminNavigationItemOptions): AppAdminNavigationItemDeclaration;
195
+ /**
196
+ * Produces a deterministic one-time authoring suggestion for tooling. The
197
+ * compiler never calls this function and never mutates a saved declaration.
198
+ */
199
+ export declare function suggestAdminNavigation(config: OpenXiangdaAppConfig): AppAdminNavigationDeclaration;
200
+ export interface AdminNavigationSuggestionSource {
201
+ module: 'openxiangda/config';
202
+ imports: readonly string[];
203
+ proposal: AppAdminNavigationDeclaration;
204
+ expression: string;
205
+ groupCount: number;
206
+ itemCount: number;
207
+ }
208
+ /**
209
+ * Renders the deterministic proposal as a typed expression that an AI author
210
+ * can copy once into frontend.admin.navigation and then edit normally.
211
+ */
212
+ export declare function renderAdminNavigationSuggestion(config: OpenXiangdaAppConfig): AdminNavigationSuggestionSource;
213
+ export declare const openXiangdaAppConfigSchema: {
214
+ readonly $id: "openxiangda.app-config/v3";
215
+ readonly type: "object";
216
+ readonly additionalProperties: false;
217
+ readonly required: readonly ["schemaVersion", "app", "frontend", "backend", "platform"];
218
+ readonly properties: {
219
+ readonly schemaVersion: {
220
+ readonly const: 3;
221
+ };
222
+ readonly app: {
223
+ readonly type: "object";
224
+ readonly additionalProperties: false;
225
+ readonly required: readonly ["code", "name"];
226
+ readonly properties: {
227
+ readonly code: {
228
+ readonly type: "string";
229
+ readonly pattern: "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$";
230
+ readonly minLength: 2;
231
+ readonly maxLength: 128;
232
+ };
233
+ readonly name: {
234
+ readonly type: "string";
235
+ readonly minLength: 1;
236
+ readonly maxLength: 255;
237
+ };
238
+ };
239
+ };
240
+ readonly frontend: {
241
+ readonly type: "object";
242
+ readonly additionalProperties: false;
243
+ readonly required: readonly ["root"];
244
+ readonly properties: {
245
+ readonly root: {
246
+ readonly type: "string";
247
+ readonly minLength: 1;
248
+ };
249
+ readonly routes: {
250
+ readonly type: "array";
251
+ readonly maxItems: 500;
252
+ readonly items: {
253
+ readonly type: "object";
254
+ };
255
+ };
256
+ readonly admin: {
257
+ readonly type: "object";
258
+ };
259
+ readonly authentication: {
260
+ readonly type: "object";
261
+ };
262
+ readonly publicAccess: {
263
+ readonly type: "object";
264
+ };
265
+ readonly devicePolicy: {
266
+ readonly type: "object";
267
+ readonly additionalProperties: false;
268
+ readonly required: readonly ["kind", "mobileMaxWidthPx", "desktopMinWidthPx"];
269
+ readonly properties: {
270
+ readonly kind: {
271
+ readonly const: "viewport-family";
272
+ };
273
+ readonly mobileMaxWidthPx: {
274
+ readonly type: "integer";
275
+ readonly minimum: 320;
276
+ readonly maximum: 1600;
277
+ };
278
+ readonly desktopMinWidthPx: {
279
+ readonly type: "integer";
280
+ readonly minimum: 320;
281
+ readonly maximum: 1600;
282
+ };
283
+ };
284
+ };
285
+ };
286
+ };
287
+ readonly backend: {
288
+ readonly type: "object";
289
+ readonly additionalProperties: false;
290
+ readonly required: readonly ["root", "runtime", "framework"];
291
+ readonly properties: {
292
+ readonly root: {
293
+ readonly type: "string";
294
+ readonly minLength: 1;
295
+ };
296
+ readonly runtime: {
297
+ readonly const: "node";
298
+ };
299
+ readonly framework: {
300
+ readonly const: "nestjs";
301
+ };
302
+ readonly enabled: {
303
+ readonly type: "boolean";
304
+ };
305
+ readonly isolation: {
306
+ readonly enum: readonly ["shared", "dedicated"];
307
+ };
308
+ readonly resourceProfile: {
309
+ readonly enum: readonly ["light", "standard"];
310
+ };
311
+ readonly secrets: {
312
+ readonly type: "array";
313
+ readonly maxItems: 100;
314
+ readonly items: {
315
+ readonly type: "object";
316
+ readonly additionalProperties: false;
317
+ readonly required: readonly ["name", "env"];
318
+ readonly properties: {
319
+ readonly name: {
320
+ readonly type: "string";
321
+ readonly pattern: "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$";
322
+ readonly maxLength: 128;
323
+ };
324
+ readonly env: {
325
+ readonly type: "string";
326
+ readonly pattern: "^[A-Z][A-Z0-9_]*$";
327
+ readonly maxLength: 128;
328
+ };
329
+ readonly description: {
330
+ readonly type: "string";
331
+ readonly maxLength: 2000;
332
+ };
333
+ readonly required: {
334
+ readonly type: "boolean";
335
+ };
336
+ };
337
+ };
338
+ };
339
+ readonly operations: {
340
+ readonly type: "array";
341
+ readonly maxItems: 500;
342
+ readonly items: {
343
+ readonly type: "object";
344
+ };
345
+ };
346
+ };
347
+ };
348
+ readonly platform: {
349
+ readonly type: "object";
350
+ readonly additionalProperties: false;
351
+ readonly required: readonly ["root"];
352
+ readonly properties: {
353
+ readonly root: {
354
+ readonly type: "string";
355
+ readonly minLength: 1;
356
+ };
357
+ };
358
+ };
359
+ readonly perspectives: {
360
+ readonly type: "array";
361
+ readonly maxItems: 100;
362
+ readonly items: {
363
+ readonly type: "object";
364
+ readonly additionalProperties: false;
365
+ readonly required: readonly ["code", "name", "roleCodes"];
366
+ readonly properties: {
367
+ readonly code: {
368
+ readonly type: "string";
369
+ readonly pattern: "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$";
370
+ readonly maxLength: 128;
371
+ };
372
+ readonly name: {
373
+ readonly type: "string";
374
+ readonly minLength: 1;
375
+ readonly maxLength: 255;
376
+ };
377
+ readonly description: {
378
+ readonly type: "string";
379
+ readonly maxLength: 2000;
380
+ };
381
+ readonly roleCodes: {
382
+ readonly type: "array";
383
+ readonly minItems: 1;
384
+ readonly maxItems: 20;
385
+ readonly uniqueItems: true;
386
+ readonly items: {
387
+ readonly type: "string";
388
+ };
389
+ };
390
+ readonly default: {
391
+ readonly type: "boolean";
392
+ };
393
+ };
394
+ };
395
+ };
396
+ readonly data: {
397
+ readonly type: "object";
398
+ readonly additionalProperties: false;
399
+ readonly required: readonly ["resources"];
400
+ readonly properties: {
401
+ readonly resources: {
402
+ readonly type: "array";
403
+ readonly maxItems: 100;
404
+ readonly items: {
405
+ readonly type: "object";
406
+ };
407
+ };
408
+ };
409
+ };
410
+ readonly authz: {
411
+ readonly type: "object";
412
+ readonly additionalProperties: false;
413
+ readonly required: readonly ["capabilities", "roles"];
414
+ readonly properties: {
415
+ readonly authenticatedUserRoleCode: {
416
+ readonly type: "string";
417
+ readonly pattern: "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$";
418
+ readonly maxLength: 128;
419
+ };
420
+ readonly capabilities: {
421
+ readonly type: "array";
422
+ readonly maxItems: 2000;
423
+ readonly items: {
424
+ readonly type: "object";
425
+ };
426
+ };
427
+ readonly roles: {
428
+ readonly type: "array";
429
+ readonly maxItems: 100;
430
+ readonly items: {
431
+ readonly type: "object";
432
+ };
433
+ };
434
+ readonly scopeDimensions: {
435
+ readonly type: "array";
436
+ readonly maxItems: 100;
437
+ readonly items: {
438
+ readonly type: "object";
439
+ readonly additionalProperties: false;
440
+ readonly required: readonly ["code", "name"];
441
+ readonly properties: {
442
+ readonly code: {
443
+ readonly type: "string";
444
+ };
445
+ readonly name: {
446
+ readonly type: "string";
447
+ };
448
+ readonly resourceCode: {
449
+ readonly type: "string";
450
+ };
451
+ readonly valueType: {
452
+ readonly enum: readonly ["string", "uuid"];
453
+ };
454
+ readonly hierarchyMode: {
455
+ readonly enum: readonly ["flat", "self_parent"];
456
+ };
457
+ readonly valueSource: {
458
+ readonly type: "object";
459
+ readonly additionalProperties: false;
460
+ readonly required: readonly ["kind", "resourceCode", "labelField"];
461
+ readonly properties: {
462
+ readonly kind: {
463
+ readonly const: "native_resource";
464
+ };
465
+ readonly resourceCode: {
466
+ readonly type: "string";
467
+ };
468
+ readonly labelField: {
469
+ readonly type: "string";
470
+ };
471
+ readonly enabledField: {
472
+ readonly type: "string";
473
+ };
474
+ };
475
+ };
476
+ };
477
+ };
478
+ };
479
+ readonly scopeSources: {
480
+ readonly type: "array";
481
+ readonly maxItems: 100;
482
+ readonly items: {
483
+ readonly type: "object";
484
+ };
485
+ };
486
+ readonly roleMembershipSources: {
487
+ readonly type: "array";
488
+ readonly maxItems: 100;
489
+ readonly items: {
490
+ readonly type: "object";
491
+ readonly additionalProperties: false;
492
+ readonly required: readonly ["code", "name", "resourceCode", "userIdField", "roleCode", "failureMode"];
493
+ readonly properties: {
494
+ readonly enabledField: {
495
+ readonly type: "string";
496
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$";
497
+ };
498
+ readonly effectiveFromField: {
499
+ readonly type: "string";
500
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$";
501
+ };
502
+ readonly effectiveToField: {
503
+ readonly type: "string";
504
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$";
505
+ };
506
+ readonly failureMode: {
507
+ readonly const: "strict";
508
+ };
509
+ readonly code: {
510
+ readonly type: "string";
511
+ readonly pattern: "^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$";
512
+ readonly maxLength: 100;
513
+ };
514
+ readonly name: {
515
+ readonly type: "string";
516
+ readonly minLength: 1;
517
+ readonly maxLength: 255;
518
+ };
519
+ readonly resourceCode: {
520
+ readonly type: "string";
521
+ };
522
+ readonly userIdField: {
523
+ readonly type: "string";
524
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}(?:\\.(?:value|snapshot\\.[A-Za-z_][A-Za-z0-9_]{0,127}))?$";
525
+ };
526
+ readonly roleCode: {
527
+ readonly type: "string";
528
+ };
529
+ };
530
+ };
531
+ };
532
+ readonly relationshipGrantSources: {
533
+ readonly type: "array";
534
+ readonly maxItems: 100;
535
+ readonly items: {
536
+ readonly type: "object";
537
+ readonly additionalProperties: false;
538
+ readonly required: readonly ["code", "name", "resourceCode", "subject", "relationCode", "targetResourceCode", "resourceIdField", "operations", "failureMode"];
539
+ readonly properties: {
540
+ readonly enabledField: {
541
+ readonly type: "string";
542
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$";
543
+ };
544
+ readonly effectiveFromField: {
545
+ readonly type: "string";
546
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$";
547
+ };
548
+ readonly effectiveToField: {
549
+ readonly type: "string";
550
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}$";
551
+ };
552
+ readonly failureMode: {
553
+ readonly const: "strict";
554
+ };
555
+ readonly code: {
556
+ readonly type: "string";
557
+ readonly pattern: "^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$";
558
+ readonly maxLength: 100;
559
+ };
560
+ readonly name: {
561
+ readonly type: "string";
562
+ readonly minLength: 1;
563
+ readonly maxLength: 255;
564
+ };
565
+ readonly resourceCode: {
566
+ readonly type: "string";
567
+ };
568
+ readonly subject: {
569
+ readonly oneOf: readonly [{
570
+ readonly type: "object";
571
+ readonly additionalProperties: false;
572
+ readonly required: readonly ["type", "userIdField"];
573
+ readonly properties: {
574
+ readonly type: {
575
+ readonly const: "user";
576
+ };
577
+ readonly userIdField: {
578
+ readonly type: "string";
579
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}(?:\\.(?:value|snapshot\\.[A-Za-z_][A-Za-z0-9_]{0,127}))?$";
580
+ };
581
+ };
582
+ }, {
583
+ readonly type: "object";
584
+ readonly additionalProperties: false;
585
+ readonly required: readonly ["type", "userIdField", "roleCode"];
586
+ readonly properties: {
587
+ readonly type: {
588
+ readonly const: "role_membership";
589
+ };
590
+ readonly userIdField: {
591
+ readonly type: "string";
592
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}(?:\\.(?:value|snapshot\\.[A-Za-z_][A-Za-z0-9_]{0,127}))?$";
593
+ };
594
+ readonly roleCode: {
595
+ readonly type: "string";
596
+ };
597
+ };
598
+ }];
599
+ };
600
+ readonly relationCode: {
601
+ readonly type: "string";
602
+ readonly minLength: 1;
603
+ readonly maxLength: 128;
604
+ };
605
+ readonly targetResourceCode: {
606
+ readonly type: "string";
607
+ };
608
+ readonly resourceIdField: {
609
+ readonly type: "string";
610
+ readonly pattern: "^[A-Za-z_][A-Za-z0-9_]{0,127}(?:\\.(?:value|snapshot\\.[A-Za-z_][A-Za-z0-9_]{0,127}))?$";
611
+ };
612
+ readonly operations: {
613
+ readonly type: "array";
614
+ readonly minItems: 1;
615
+ readonly maxItems: 20;
616
+ readonly uniqueItems: true;
617
+ readonly items: {
618
+ readonly type: "string";
619
+ readonly minLength: 1;
620
+ readonly maxLength: 64;
621
+ readonly pattern: "^[A-Za-z0-9][A-Za-z0-9:._*-]{0,63}$";
622
+ };
623
+ };
624
+ };
625
+ };
626
+ };
627
+ readonly dataPolicies: {
628
+ readonly type: "array";
629
+ readonly maxItems: 100;
630
+ readonly items: {
631
+ readonly type: "object";
632
+ };
633
+ };
634
+ readonly authorizationTransitions: {
635
+ readonly type: "array";
636
+ readonly maxItems: 100;
637
+ readonly items: {
638
+ readonly type: "object";
639
+ readonly additionalProperties: false;
640
+ readonly required: readonly ["fromAuthzDigest", "reason"];
641
+ readonly properties: {
642
+ readonly fromAuthzDigest: {
643
+ readonly type: "string";
644
+ readonly pattern: "^[0-9a-f]{64}$";
645
+ };
646
+ readonly removeRoleCodes: {
647
+ readonly type: "array";
648
+ readonly maxItems: 2000;
649
+ readonly uniqueItems: true;
650
+ readonly items: {
651
+ readonly type: "string";
652
+ readonly pattern: "^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$";
653
+ readonly maxLength: 128;
654
+ };
655
+ };
656
+ readonly removeCapabilityCodes: {
657
+ readonly type: "array";
658
+ readonly maxItems: 2000;
659
+ readonly uniqueItems: true;
660
+ readonly items: {
661
+ readonly type: "string";
662
+ readonly pattern: "^[A-Za-z*][A-Za-z0-9:._*-]{0,254}$";
663
+ readonly maxLength: 255;
664
+ };
665
+ };
666
+ readonly reason: {
667
+ readonly type: "string";
668
+ readonly minLength: 1;
669
+ readonly maxLength: 2000;
670
+ readonly pattern: "\\S";
671
+ };
672
+ };
673
+ };
674
+ };
675
+ };
676
+ };
677
+ readonly events: {
678
+ readonly type: "object";
679
+ readonly additionalProperties: false;
680
+ readonly required: readonly ["subscriptions"];
681
+ readonly properties: {
682
+ readonly schemas: {
683
+ readonly type: "array";
684
+ readonly maxItems: 100;
685
+ readonly items: {
686
+ readonly type: "object";
687
+ };
688
+ };
689
+ readonly subscriptions: {
690
+ readonly type: "array";
691
+ readonly maxItems: 100;
692
+ readonly items: {
693
+ readonly type: "object";
694
+ };
695
+ };
696
+ readonly timers: {
697
+ readonly type: "array";
698
+ readonly maxItems: 100;
699
+ readonly items: {
700
+ readonly type: "object";
701
+ };
702
+ };
703
+ readonly dateTriggers: {
704
+ readonly type: "array";
705
+ readonly maxItems: 100;
706
+ readonly items: {
707
+ readonly type: "object";
708
+ };
709
+ };
710
+ };
711
+ };
712
+ readonly workflows: {
713
+ readonly type: "object";
714
+ readonly additionalProperties: false;
715
+ readonly required: readonly ["definitions", "bindings", "activations"];
716
+ readonly properties: {
717
+ readonly definitions: {
718
+ readonly type: "array";
719
+ readonly maxItems: 100;
720
+ readonly items: {
721
+ readonly type: "object";
722
+ };
723
+ };
724
+ readonly bindings: {
725
+ readonly type: "array";
726
+ readonly maxItems: 100;
727
+ readonly items: {
728
+ readonly type: "object";
729
+ };
730
+ };
731
+ readonly activations: {
732
+ readonly type: "array";
733
+ readonly maxItems: 100;
734
+ readonly items: {
735
+ readonly type: "object";
736
+ };
737
+ };
738
+ readonly providers: {
739
+ readonly type: "array";
740
+ readonly maxItems: 100;
741
+ readonly items: {
742
+ readonly type: "object";
743
+ readonly additionalProperties: false;
744
+ readonly required: readonly ["code", "endpointPath"];
745
+ readonly properties: {
746
+ readonly code: {
747
+ readonly type: "string";
748
+ readonly pattern: "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$";
749
+ };
750
+ readonly endpointPath: {
751
+ readonly type: "string";
752
+ readonly pattern: "^/[A-Za-z0-9/_-]+$";
753
+ };
754
+ readonly timeoutMs: {
755
+ readonly type: "integer";
756
+ readonly minimum: 100;
757
+ readonly maximum: 10000;
758
+ };
759
+ };
760
+ };
761
+ };
762
+ readonly editableParameters: {
763
+ readonly type: "array";
764
+ readonly maxItems: 100;
765
+ readonly items: {
766
+ readonly type: "object";
767
+ };
768
+ };
769
+ };
770
+ };
771
+ };
772
+ };
773
+ /**
774
+ * A backend is opt-in for a resource-only application. Explicit backend
775
+ * declarations (operations, secrets, events or workflows) still imply it.
776
+ */
777
+ export declare function backendRuntimeRequired(config: OpenXiangdaAppConfig): boolean;
778
+ export declare function validateAppConfig(value: unknown): Diagnostic[];
779
+ export declare class AppConfigValidationError extends Error {
780
+ readonly diagnostics: Diagnostic[];
781
+ readonly code = "OPENXIANGDA_APP_CONFIG_INVALID";
782
+ constructor(diagnostics: Diagnostic[]);
783
+ }
784
+ export declare function resourceCapabilityCodes(appCode: string, resourceCode: string): {
785
+ readonly read: `${string}:read`;
786
+ readonly create: `${string}:create`;
787
+ readonly update: `${string}:update`;
788
+ readonly delete: `${string}:delete`;
789
+ };
790
+ export declare function currentUserDataPolicy(input: {
791
+ code: string;
792
+ name: string;
793
+ resourceCode: string;
794
+ field: string;
795
+ roleCodes: string[];
796
+ unrestrictedRoleCodes?: string[];
797
+ }): AppDataPolicyDeclaration;
798
+ export declare const dataPolicyExpression: {
799
+ readonly allOf: (...values: AppDataPolicyExpressionDeclaration[]) => AppDataPolicyExpressionDeclaration;
800
+ readonly anyOf: (...values: AppDataPolicyExpressionDeclaration[]) => AppDataPolicyExpressionDeclaration;
801
+ readonly constant: (input: {
802
+ field: string;
803
+ operator: "eq" | "not_eq" | "in" | "not_in";
804
+ value: string | string[];
805
+ roleCodes?: string[];
806
+ }) => AppDataPolicyRuleDeclaration;
807
+ readonly null: (input: {
808
+ field: string;
809
+ operator: "is_null" | "is_not_null";
810
+ roleCodes?: string[];
811
+ }) => AppDataPolicyRuleDeclaration;
812
+ readonly databaseNow: (input: {
813
+ field: string;
814
+ operator: "lt" | "lte" | "gt" | "gte";
815
+ roleCodes?: string[];
816
+ }) => AppDataPolicyRuleDeclaration;
817
+ readonly currentUser: (input: {
818
+ field: string;
819
+ roleCodes?: string[];
820
+ }) => AppDataPolicyRuleDeclaration;
821
+ readonly dimension: (input: {
822
+ dimensionCode: string;
823
+ field: string;
824
+ roleCodes?: string[];
825
+ operation?: string;
826
+ valuePath?: string;
827
+ emptyMatchesAll?: boolean;
828
+ }) => AppDataPolicyRuleDeclaration;
829
+ readonly relation: (input: {
830
+ relationCode: string;
831
+ resourceCode: string;
832
+ field: string;
833
+ roleCodes?: string[];
834
+ operation?: string;
835
+ valuePath?: string;
836
+ }) => AppDataPolicyRuleDeclaration;
837
+ };
838
+ export declare function resourceReadPolicy(input: {
839
+ code: string;
840
+ name: string;
841
+ resourceCode: string;
842
+ expression: AppDataPolicyExpressionDeclaration;
843
+ unrestrictedRoleCodes?: string[];
844
+ } & ({
845
+ matchMode: 'AND' | 'OR';
846
+ rules: AppDataPolicyRuleDeclaration[];
847
+ writeBoundary?: never;
848
+ } | {
849
+ matchMode?: never;
850
+ rules?: never;
851
+ writeBoundary: 'capability_only';
852
+ })): AppDataPolicyDeclaration;
853
+ export declare function materializeDataResource(appCode: string, declaration: AppDataResourceDeclaration): DataResource;
854
+ export declare function validateAppDeclaration(value: unknown): Diagnostic[];
855
+ export declare function defineOpenXiangdaApp(declaration: OpenXiangdaAppDeclaration): OpenXiangdaAppConfig;
856
+ export {};
857
+ //# sourceMappingURL=config.d.ts.map