@nocobase/plugin-flow-engine 2.0.0-alpha.2

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 (125) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +29 -0
  3. package/build.config.ts +22 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/index.d.ts +15 -0
  7. package/dist/client/index.js +10 -0
  8. package/dist/externalVersion.js +21 -0
  9. package/dist/index.d.ts +10 -0
  10. package/dist/index.js +48 -0
  11. package/dist/locale/en-US.json +61 -0
  12. package/dist/locale/index.d.ts +141 -0
  13. package/dist/locale/index.js +79 -0
  14. package/dist/locale/zh-CN.json +61 -0
  15. package/dist/node_modules/ses/LICENSE +201 -0
  16. package/dist/node_modules/ses/LICENSE-aura +16 -0
  17. package/dist/node_modules/ses/LICENSE-caja +13 -0
  18. package/dist/node_modules/ses/LICENSE-corejs +19 -0
  19. package/dist/node_modules/ses/LICENSE-v8 +9 -0
  20. package/dist/node_modules/ses/assert-shim.js +1 -0
  21. package/dist/node_modules/ses/compartment-shim.js +1 -0
  22. package/dist/node_modules/ses/console-shim.js +1 -0
  23. package/dist/node_modules/ses/dist/lockdown.cjs +13912 -0
  24. package/dist/node_modules/ses/dist/lockdown.umd.js +13912 -0
  25. package/dist/node_modules/ses/dist/lockdown.umd.min.js +1 -0
  26. package/dist/node_modules/ses/dist/ses-hermes.cjs +13912 -0
  27. package/dist/node_modules/ses/dist/ses.cjs +1 -0
  28. package/dist/node_modules/ses/dist/ses.umd.js +13912 -0
  29. package/dist/node_modules/ses/dist/ses.umd.min.js +1 -0
  30. package/dist/node_modules/ses/dist/types.d.cts +606 -0
  31. package/dist/node_modules/ses/index.js +18 -0
  32. package/dist/node_modules/ses/lockdown-shim.js +1 -0
  33. package/dist/node_modules/ses/lockdown.js +1 -0
  34. package/dist/node_modules/ses/package.json +1 -0
  35. package/dist/node_modules/ses/src/assert-shim.js +4 -0
  36. package/dist/node_modules/ses/src/assert-sloppy-mode.js +11 -0
  37. package/dist/node_modules/ses/src/cauterize-property.js +69 -0
  38. package/dist/node_modules/ses/src/commons.js +425 -0
  39. package/dist/node_modules/ses/src/compartment-evaluate.js +93 -0
  40. package/dist/node_modules/ses/src/compartment-shim.js +22 -0
  41. package/dist/node_modules/ses/src/compartment.js +477 -0
  42. package/dist/node_modules/ses/src/console-shim.js +50 -0
  43. package/dist/node_modules/ses/src/enable-property-overrides.js +211 -0
  44. package/dist/node_modules/ses/src/enablements.js +244 -0
  45. package/dist/node_modules/ses/src/error/assert.js +584 -0
  46. package/dist/node_modules/ses/src/error/console.js +541 -0
  47. package/dist/node_modules/ses/src/error/fatal-assert.js +54 -0
  48. package/dist/node_modules/ses/src/error/internal-types.js +98 -0
  49. package/dist/node_modules/ses/src/error/note-log-args.js +77 -0
  50. package/dist/node_modules/ses/src/error/stringify-utils.js +195 -0
  51. package/dist/node_modules/ses/src/error/tame-console.js +197 -0
  52. package/dist/node_modules/ses/src/error/tame-error-constructor.js +284 -0
  53. package/dist/node_modules/ses/src/error/tame-v8-error-constructor.js +386 -0
  54. package/dist/node_modules/ses/src/error/types.js +59 -0
  55. package/dist/node_modules/ses/src/error/unhandled-rejection.js +122 -0
  56. package/dist/node_modules/ses/src/eval-scope.js +89 -0
  57. package/dist/node_modules/ses/src/get-anonymous-intrinsics.js +181 -0
  58. package/dist/node_modules/ses/src/get-source-url.js +50 -0
  59. package/dist/node_modules/ses/src/global-object.js +175 -0
  60. package/dist/node_modules/ses/src/intrinsics.js +192 -0
  61. package/dist/node_modules/ses/src/lockdown-shim.js +37 -0
  62. package/dist/node_modules/ses/src/lockdown.js +558 -0
  63. package/dist/node_modules/ses/src/make-eval-function.js +28 -0
  64. package/dist/node_modules/ses/src/make-evaluate.js +110 -0
  65. package/dist/node_modules/ses/src/make-function-constructor.js +79 -0
  66. package/dist/node_modules/ses/src/make-hardener.js +275 -0
  67. package/dist/node_modules/ses/src/make-safe-evaluator.js +112 -0
  68. package/dist/node_modules/ses/src/module-instance.js +497 -0
  69. package/dist/node_modules/ses/src/module-link.js +159 -0
  70. package/dist/node_modules/ses/src/module-load.js +719 -0
  71. package/dist/node_modules/ses/src/module-proxy.js +200 -0
  72. package/dist/node_modules/ses/src/permits-intrinsics.js +291 -0
  73. package/dist/node_modules/ses/src/permits.js +1761 -0
  74. package/dist/node_modules/ses/src/reporting-types.d.ts +13 -0
  75. package/dist/node_modules/ses/src/reporting.js +105 -0
  76. package/dist/node_modules/ses/src/scope-constants.js +180 -0
  77. package/dist/node_modules/ses/src/shim-arraybuffer-transfer.js +85 -0
  78. package/dist/node_modules/ses/src/sloppy-globals-scope-terminator.js +61 -0
  79. package/dist/node_modules/ses/src/strict-scope-terminator.js +99 -0
  80. package/dist/node_modules/ses/src/tame-date-constructor.js +127 -0
  81. package/dist/node_modules/ses/src/tame-domains.js +41 -0
  82. package/dist/node_modules/ses/src/tame-faux-data-properties.js +210 -0
  83. package/dist/node_modules/ses/src/tame-function-constructors.js +140 -0
  84. package/dist/node_modules/ses/src/tame-function-tostring.js +50 -0
  85. package/dist/node_modules/ses/src/tame-harden.js +29 -0
  86. package/dist/node_modules/ses/src/tame-locale-methods.js +78 -0
  87. package/dist/node_modules/ses/src/tame-math-object.js +41 -0
  88. package/dist/node_modules/ses/src/tame-module-source.js +51 -0
  89. package/dist/node_modules/ses/src/tame-regenerator-runtime.js +29 -0
  90. package/dist/node_modules/ses/src/tame-regexp-constructor.js +65 -0
  91. package/dist/node_modules/ses/src/tame-symbol-constructor.js +64 -0
  92. package/dist/node_modules/ses/src/transforms.js +267 -0
  93. package/dist/node_modules/ses/tools.js +25 -0
  94. package/dist/node_modules/ses/types.d.ts +606 -0
  95. package/dist/server/actions/ui-schema-action.d.ts +27 -0
  96. package/dist/server/actions/ui-schema-action.js +118 -0
  97. package/dist/server/collections/flowModelTreePath.d.ts +11 -0
  98. package/dist/server/collections/flowModelTreePath.js +74 -0
  99. package/dist/server/collections/flowModels.d.ts +11 -0
  100. package/dist/server/collections/flowModels.js +57 -0
  101. package/dist/server/collections/flowsql.d.ts +10 -0
  102. package/dist/server/collections/flowsql.js +51 -0
  103. package/dist/server/dao/ui_schema_node_dao.d.ts +26 -0
  104. package/dist/server/dao/ui_schema_node_dao.js +24 -0
  105. package/dist/server/helper.d.ts +8 -0
  106. package/dist/server/helper.js +9 -0
  107. package/dist/server/index.d.ts +9 -0
  108. package/dist/server/index.js +42 -0
  109. package/dist/server/model.d.ts +12 -0
  110. package/dist/server/model.js +38 -0
  111. package/dist/server/plugin.d.ts +26 -0
  112. package/dist/server/plugin.js +270 -0
  113. package/dist/server/repository.d.ts +116 -0
  114. package/dist/server/repository.js +1209 -0
  115. package/dist/server/server.d.ts +16 -0
  116. package/dist/server/server.js +198 -0
  117. package/dist/server/template/contexts.d.ts +73 -0
  118. package/dist/server/template/contexts.js +233 -0
  119. package/dist/server/template/resolver.d.ts +30 -0
  120. package/dist/server/template/resolver.js +225 -0
  121. package/dist/server/variables/registry.d.ts +42 -0
  122. package/dist/server/variables/registry.js +299 -0
  123. package/package.json +28 -0
  124. package/server.d.ts +2 -0
  125. package/server.js +1 -0
@@ -0,0 +1,606 @@
1
+ /**
2
+ * Types of the SES environment
3
+ * @module
4
+ */
5
+
6
+ /* eslint-disable no-restricted-globals, vars-on-top, no-var */
7
+
8
+ // It's academically tempting to define a hardened type, but TypeScript doesn't
9
+ // strike a good balance in distinguishing "readonly" in the sense that you
10
+ // promise not to change vs "readonly" in the sense that you depend on a thing
11
+ // not changing.
12
+ // type Hardened<T> =
13
+ // T extends number | bigint | string | null | undefined | Function ? T :
14
+ // { readonly [P in keyof T]: Hardened<T[P]> };
15
+
16
+ // So Harden just passes the type through without modification.
17
+ // This will occasionally conflict with the type of Object.freeze.
18
+ // In those cases, we recommend casting the result of Object.freeze to the
19
+ // original thawn type, as if the signature of freeze were identical to this
20
+ // version of harden.
21
+ export type Harden = <T>(value: T) => T; // not Hardened<T>;
22
+
23
+ // TODO Somehow remove the redundancy between these type deinitions and the
24
+ // inline casts on each call to `getenv` in `lockdown.js`. Hopefully we can
25
+ // keep the type info in those casts so it is easily comparable by eye to
26
+ // the parameters of that call to `genev`.
27
+ export interface RepairOptions {
28
+ regExpTaming?: 'safe' | 'unsafe';
29
+ localeTaming?: 'safe' | 'unsafe';
30
+ consoleTaming?: 'safe' | 'unsafe';
31
+ errorTrapping?: 'platform' | 'exit' | 'abort' | 'report' | 'none';
32
+ reporting?: 'platform' | 'console' | 'none';
33
+ unhandledRejectionTrapping?: 'report' | 'none';
34
+ errorTaming?: 'safe' | 'unsafe' | 'unsafe-debug';
35
+ /**
36
+ * @deprecated Deprecated and does nothing. In the future specifying it will be an error.
37
+ */
38
+ dateTaming?: 'safe' | 'unsafe';
39
+ /**
40
+ * @deprecated Deprecated and does nothing. In the future specifying it will be an error.
41
+ */
42
+ mathTaming?: 'safe' | 'unsafe';
43
+ evalTaming?:
44
+ | 'safe-eval'
45
+ | 'unsafe-eval'
46
+ | 'no-eval'
47
+ // deprecated
48
+ | 'safeEval'
49
+ | 'unsafeEval'
50
+ | 'noEval';
51
+ stackFiltering?: 'concise' | 'omit-frames' | 'shorten-paths' | 'verbose';
52
+ overrideTaming?: 'moderate' | 'min' | 'severe';
53
+ overrideDebug?: Array<string>;
54
+ domainTaming?: 'safe' | 'unsafe';
55
+ /**
56
+ * safe (default): do nothing.
57
+ *
58
+ * unsafe-ignore: make %IteratorPrototype%[@@iterator] to a funky accessor which ignores all assignments.
59
+ */
60
+ legacyRegeneratorRuntimeTaming?: 'safe' | 'unsafe-ignore';
61
+ __hardenTaming__?: 'safe' | 'unsafe';
62
+ }
63
+
64
+ // Deprecated in favor of the more specific RepairOptions
65
+ export type LockdownOptions = RepairOptions;
66
+
67
+ export type RepairIntrinsics = (options?: LockdownOptions) => void;
68
+ export type HardenIntrinsics = () => void;
69
+ export type Lockdown = (options?: LockdownOptions) => void;
70
+
71
+ export type ModuleExportsNamespace = Record<string, any>;
72
+
73
+ export type __LiveExportMap__ = Record<string, [string, boolean]>;
74
+ export type __FixedExportMap__ = Record<string, [string]>;
75
+ export type __ReexportMap__ = Record<string, Array<[string, string]>>;
76
+
77
+ export interface PrecompiledModuleSource {
78
+ imports: Array<string>;
79
+ exports: Array<string>;
80
+ reexports: Array<string>;
81
+ __syncModuleProgram__: string;
82
+ __liveExportMap__: __LiveExportMap__;
83
+ __fixedExportMap__: __FixedExportMap__;
84
+ __reexportMap__: __ReexportMap__;
85
+ }
86
+
87
+ export interface VirtualModuleSource {
88
+ imports: Array<string>;
89
+ exports: Array<string>;
90
+ /**
91
+ * Note that this value does _not_ contain any numeric or symbol property keys, which can theoretically be members of `exports` in a CommonJS module.
92
+ */
93
+ execute(
94
+ exportsTarget: Record<string, any>,
95
+ compartment: Compartment,
96
+ resolvedImports: Record<string, string>,
97
+ ): void;
98
+ }
99
+
100
+ export type ModuleSource = PrecompiledModuleSource | VirtualModuleSource;
101
+
102
+ export interface SourceModuleDescriptor {
103
+ source: string | ModuleSource;
104
+ specifier?: string;
105
+ importMeta?: any;
106
+ compartment?: Compartment; // defaults to parent
107
+ }
108
+
109
+ export interface NamespaceModuleDescriptor {
110
+ namespace: string | ModuleExportsNamespace;
111
+ compartment?: Compartment;
112
+ }
113
+
114
+ // Deprecated in favor of SourceModuleDescriptor,
115
+ // but beware the change in default compartment.
116
+ export interface RecordModuleDescriptor {
117
+ specifier: string;
118
+ record?: ModuleSource;
119
+ importMeta?: any;
120
+ compartment?: Compartment; // defaults to self
121
+ }
122
+
123
+ export type ModuleDescriptor =
124
+ | SourceModuleDescriptor
125
+ | NamespaceModuleDescriptor
126
+ // To be deprecated:
127
+ | RecordModuleDescriptor
128
+ | ModuleExportsNamespace
129
+ | VirtualModuleSource
130
+ | PrecompiledModuleSource
131
+ | string;
132
+
133
+ // Deprecated type aliases:
134
+ export type PrecompiledStaticModuleInterface = PrecompiledModuleSource;
135
+ export type ThirdPartyStaticModuleInterface = VirtualModuleSource;
136
+ export type RedirectStaticModuleInterface = RecordModuleDescriptor;
137
+ export type FinalStaticModuleType = ModuleSource;
138
+ export type StaticModuleType = RedirectStaticModuleInterface | ModuleSource;
139
+
140
+ export type Transform = (source: string) => string;
141
+ export type ResolveHook = (
142
+ importSpecifier: string,
143
+ referrerSpecifier: string,
144
+ ) => string;
145
+ export type ModuleMap = Record<string, string | ModuleDescriptor>;
146
+ export type ModuleMapHook = (
147
+ moduleSpecifier: string,
148
+ ) => ModuleDescriptor | undefined;
149
+ export type ImportHook = (moduleSpecifier: string) => Promise<ModuleDescriptor>;
150
+ export type ImportNowHook = (
151
+ moduleSpecifier: string,
152
+ ) => ModuleDescriptor | undefined;
153
+ export type ImportMetaHook = (
154
+ moduleSpecifier: string,
155
+ importMeta: ImportMeta,
156
+ ) => void;
157
+
158
+ export interface CompartmentOptions {
159
+ name?: string;
160
+ transforms?: Array<Transform>;
161
+ moduleMapHook?: ModuleMapHook;
162
+ importHook?: ImportHook;
163
+ importNowHook?: ImportNowHook;
164
+ importMetaHook?: ImportMetaHook;
165
+ resolveHook?: ResolveHook;
166
+ globals?: Map<string, any>;
167
+ modules?: Map<string, ModuleDescriptor>;
168
+ __shimTransforms__?: Array<Transform>;
169
+ __noNamespaceBox__?: boolean;
170
+ /** @deprecated */
171
+ loadHook?: (specifier: string) => Promise<ModuleDescriptor>;
172
+ /** @deprecated */
173
+ loadNowHook?: (specifier: string) => ModuleDescriptor;
174
+ __native__?: boolean;
175
+
176
+ /**
177
+ * If `true`, the first error encountered during module loading will be thrown immediately
178
+ */
179
+ noAggregateLoadErrors?: boolean;
180
+ }
181
+
182
+ export interface EvaluateOptions {
183
+ transforms?: Array<Transform>;
184
+ sloppyGlobalsMode?: boolean;
185
+ __moduleShimLexicals__?: Record<string, any>;
186
+ __evadeHtmlCommentTest__?: boolean;
187
+ __rejectSomeDirectEvalExpressions__?: boolean;
188
+ }
189
+
190
+ /**
191
+ * A call to the `details` template literal makes and returns a fresh details
192
+ * token, which is a frozen empty object associated with the arguments of that
193
+ * `details` template literal expression.
194
+ */
195
+ export type DetailsToken = Record<any, never>;
196
+ /** Either a plain string, or made by the `details` template literal tag. */
197
+ export type Details = string | DetailsToken;
198
+
199
+ export interface AssertMakeErrorOptions {
200
+ /**
201
+ * Does not affect the error.name property. That remains determined by
202
+ * the constructor. Rather, the `errorName` determines how this error is
203
+ * identified in the causal console log's output.
204
+ */
205
+ errorName?: string;
206
+
207
+ /**
208
+ * Discloses the error that caused this one, typically from a lower
209
+ * layer of abstraction. This is represented by a public `cause` data property
210
+ * on the error, not a hidden annotation.
211
+ */
212
+ cause?: Error;
213
+
214
+ /**
215
+ * Normally only used when the ErrorConstuctor is `AggregateError`, to
216
+ * represent the set of prior errors aggregated together in this error,
217
+ * typically by `Promise.any`. But `makeError` allows it on any error.
218
+ * This is represented by a public `errors` data property on the error,
219
+ * not a hidden annotation.
220
+ */
221
+ errors?: Error[];
222
+
223
+ /**
224
+ * Defaults to true. If true, `makeError` will apply `sanitizeError`
225
+ * to the error before returning it. See the comments on
226
+ * {@link sanitizeError}.
227
+ */
228
+ sanitize?: boolean;
229
+ }
230
+
231
+ // TODO inline overloading
232
+
233
+ type AssertTypeofBigint = (
234
+ specimen: any,
235
+ typeName: 'bigint',
236
+ details?: Details,
237
+ ) => asserts specimen is bigint;
238
+ type AssertTypeofBoolean = (
239
+ specimen: any,
240
+ typeName: 'boolean',
241
+ details?: Details,
242
+ ) => asserts specimen is boolean;
243
+ type AssertTypeofFunction = (
244
+ specimen: any,
245
+ typeName: 'function',
246
+ details?: Details,
247
+ ) => asserts specimen is Function;
248
+ type AssertTypeofNumber = (
249
+ specimen: any,
250
+ typeName: 'number',
251
+ details?: Details,
252
+ ) => asserts specimen is number;
253
+ type AssertTypeofObject = (
254
+ specimen: any,
255
+ typeName: 'object',
256
+ details?: Details,
257
+ ) => asserts specimen is Record<any, any> | null;
258
+ type AssertTypeofString = (
259
+ specimen: any,
260
+ typeName: 'string',
261
+ details?: Details,
262
+ ) => asserts specimen is string;
263
+ type AssertTypeofSymbol = (
264
+ specimen: any,
265
+ typeName: 'symbol',
266
+ details?: Details,
267
+ ) => asserts specimen is symbol;
268
+ type AssertTypeofUndefined = (
269
+ specimen: any,
270
+ typeName: 'undefined',
271
+ details?: Details,
272
+ ) => asserts specimen is undefined;
273
+
274
+ export type AssertTypeof = AssertTypeofBigint &
275
+ AssertTypeofBoolean &
276
+ AssertTypeofFunction &
277
+ AssertTypeofNumber &
278
+ AssertTypeofObject &
279
+ AssertTypeofString &
280
+ AssertTypeofSymbol &
281
+ AssertTypeofUndefined;
282
+
283
+ interface StringablePayload {
284
+ toString(): string;
285
+ }
286
+
287
+ /**
288
+ * TypeScript does not treat `AggregateErrorConstructor` as a subtype of
289
+ * `ErrorConstructor`, which makes sense because their constructors
290
+ * have incompatible signatures. However, we want to parameterize some
291
+ * operations by any error constructor, including possible `AggregateError`.
292
+ * So we introduce `GenericErrorConstructor` as a common supertype. Any call
293
+ * to it to make an instance must therefore first case split on whether the
294
+ * constructor is an AggregateErrorConstructor or a normal ErrorConstructor.
295
+ */
296
+ export type GenericErrorConstructor =
297
+ | ErrorConstructor
298
+ | AggregateErrorConstructor;
299
+
300
+ /**
301
+ * To make an `assert` which terminates some larger unit of computation
302
+ * like a transaction, vat, or process, call `makeAssert` with a `Raise`
303
+ * callback, where that callback actually performs that larger termination.
304
+ * If possible, the callback should also report its `reason` parameter as
305
+ * the alleged reason for the termination.
306
+ */
307
+ export type Raise = (reason: Error) => void;
308
+
309
+ /**
310
+ * Makes and returns an `assert` function object that shares the bookkeeping
311
+ * state defined by this module with other `assert` function objects made by
312
+ * `makeAssert`. This state is per-module-instance and is exposed by the
313
+ * `loggedErrorHandler` above. We refer to `assert` as a "function object"
314
+ * because it can be called directly as a function, but also has methods that
315
+ * can be called.
316
+ *
317
+ * If `optRaise` is provided, the returned `assert` function object will call
318
+ * `optRaise(reason)` before throwing the error. This enables `optRaise` to
319
+ * engage in even more violent termination behavior, like terminating the vat,
320
+ * that prevents execution from reaching the following throw. However, if
321
+ * `optRaise` returns normally, which would be unusual, the throw following
322
+ * `optRaise(reason)` would still happen.
323
+ */
324
+ // Behold: recursion.
325
+ // eslint-disable-next-line no-use-before-define
326
+ export type MakeAssert = (raise?: Raise, unredacted?: boolean) => Assert;
327
+
328
+ export type BaseAssert = (
329
+ /** The truthy/falsy value we're testing */
330
+ flag: any,
331
+ /** The details of what was asserted */
332
+ details?: Details,
333
+ /** An optional alternate error constructor to use */
334
+ errConstructor?: GenericErrorConstructor,
335
+ options?: AssertMakeErrorOptions,
336
+ ) => asserts flag;
337
+
338
+ export interface AssertionFunctions extends BaseAssert {
339
+ typeof: AssertTypeof;
340
+
341
+ /**
342
+ * The `assert.equal` method
343
+ *
344
+ * Assert that two values must be `Object.is`.
345
+ */
346
+ equal<T>(
347
+ /** What we received */
348
+ actual: unknown,
349
+ /** What we wanted */
350
+ expected: T,
351
+ /** The details of what was asserted */
352
+ details?: Details,
353
+ /** An optional alternate error constructor to use */
354
+ errConstructor?: GenericErrorConstructor,
355
+ options?: AssertMakeErrorOptions,
356
+ ): asserts actual is T;
357
+
358
+ /**
359
+ * The `assert.string` method.
360
+ *
361
+ * `assert.string(v)` is equivalent to `assert.typeof(v, 'string')`. We
362
+ * special case this one because it is the most frequently used.
363
+ *
364
+ * Assert an expected typeof result.
365
+ */
366
+ string(
367
+ specimen: any,
368
+ /** The details of what was asserted */
369
+ details?: Details,
370
+ ): asserts specimen is string;
371
+
372
+ /**
373
+ * The `assert.fail` method.
374
+ *
375
+ * Fail an assertion, recording full details to the console and
376
+ * raising an exception with a message in which `details` substitution values
377
+ * have been redacted.
378
+ *
379
+ * The optional `optDetails` can be a string for backwards compatibility
380
+ * with the nodejs assertion library.
381
+ */
382
+ fail(
383
+ /** The details of what was asserted */
384
+ details?: Details,
385
+ /** An optional alternate error constructor to use */
386
+ errConstructor?: GenericErrorConstructor,
387
+ options?: AssertMakeErrorOptions,
388
+ ): never;
389
+ }
390
+
391
+ export interface AssertionUtilities {
392
+ /**
393
+ * Aka the `makeError` function as imported from `@endo/errors`
394
+ *
395
+ * Recording unredacted details for the console.
396
+ */
397
+ error(
398
+ /** The details of what was asserted */
399
+ details?: Details,
400
+ /** An optional alternate error constructor to use */
401
+ errConstructor?: GenericErrorConstructor,
402
+ options?: AssertMakeErrorOptions,
403
+ ): Error;
404
+
405
+ /**
406
+ * Aka the `annotateError` function as imported from `@endo/errors`
407
+ *
408
+ * Annotate an error with details, potentially to be used by an
409
+ * augmented console such as the causal console of `console.js`, to
410
+ * provide extra information associated with logged errors.
411
+ */
412
+ note(error: Error, details: Details): void;
413
+
414
+ /**
415
+ * Use the `details` function as a template literal tag to create
416
+ * informative error messages. The assertion functions take such messages
417
+ * as optional arguments:
418
+ * ```js
419
+ * assert(sky.isBlue(), details`${sky.color} should be "blue"`);
420
+ * ```
421
+ * or following the normal convention to locally rename `details` to `X`
422
+ * and `quote` to `q` like `const { details: X, quote: q } = assert;`:
423
+ * ```js
424
+ * assert(sky.isBlue(), X`${sky.color} should be "blue"`);
425
+ * ```
426
+ * However, note that in most cases it is preferable to instead use the `Fail`
427
+ * template literal tag (which has the same input signature as `details`
428
+ * but automatically creates and throws an error):
429
+ * ```js
430
+ * sky.isBlue() || Fail`${sky.color} should be "blue"`;
431
+ * ```
432
+ *
433
+ * The details template tag returns a `DetailsToken` object that can print
434
+ * itself with the formatted message in two ways.
435
+ * It will report full details to the console, but
436
+ * mask embedded substitution values with their typeof information in the thrown error
437
+ * to prevent revealing secrets up the exceptional path. In the example
438
+ * above, the thrown error may reveal only that `sky.color` is a string,
439
+ * whereas the same diagnostic printed to the console reveals that the
440
+ * sky was green. This masking can be disabled for an individual substitution value
441
+ * using `quote`.
442
+ *
443
+ * The `raw` property of an input template array is ignored, so a simple
444
+ * array of strings may be provided directly.
445
+ */
446
+ details(
447
+ template: TemplateStringsArray | string[],
448
+ ...args: any
449
+ ): DetailsToken;
450
+
451
+ /**
452
+ * Use the `Fail` function as a template literal tag to efficiently
453
+ * create and throw a `details`-style error only when a condition is not satisfied.
454
+ * ```js
455
+ * condition || Fail`...complaint...`;
456
+ * ```
457
+ * This avoids the overhead of creating usually-unnecessary errors like
458
+ * ```js
459
+ * assert(condition, details`...complaint...`);
460
+ * ```
461
+ * while improving readability over alternatives like
462
+ * ```js
463
+ * condition || assert.fail(details`...complaint...`);
464
+ * ```
465
+ *
466
+ * However, due to current weakness in TypeScript, static reasoning
467
+ * is less powerful with the `||` patterns than with an `assert` call.
468
+ * Until/unless https://github.com/microsoft/TypeScript/issues/51426 is fixed,
469
+ * for `||`-style assertions where this loss of static reasoning is a problem,
470
+ * instead express the assertion as
471
+ * ```js
472
+ * if (!condition) {
473
+ * Fail`...complaint...`;
474
+ * }
475
+ * ```
476
+ * or, if needed,
477
+ * ```js
478
+ * if (!condition) {
479
+ * // `throw` is noop since `Fail` throws, but it improves static analysis
480
+ * throw Fail`...complaint...`;
481
+ * }
482
+ * ```
483
+ */
484
+ Fail(template: TemplateStringsArray | string[], ...args: any): never;
485
+
486
+ /**
487
+ * To "declassify" and quote a substitution value used in a
488
+ * ``` details`...` ``` template literal, enclose that substitution expression
489
+ * in a call to `quote`. This makes the value appear quoted
490
+ * (as if with `JSON.stringify`) in the message of the thrown error. The
491
+ * payload itself is still passed unquoted to the console as it would be
492
+ * without `quote`.
493
+ *
494
+ * For example, the following will reveal the expected sky color, but not the
495
+ * actual incorrect sky color, in the thrown error's message:
496
+ * ```js
497
+ * sky.color === expectedColor || Fail`${sky.color} should be ${quote(expectedColor)}`;
498
+ * ```
499
+ *
500
+ * The normal convention is to locally rename `details` to `X` and `quote` to `q`
501
+ * like `const { details: X, quote: q } = assert;`, so the above example would then be
502
+ * ```js
503
+ * sky.color === expectedColor || Fail`${sky.color} should be ${q(expectedColor)}`;
504
+ * ```
505
+ */
506
+ quote(
507
+ /** What to declassify */
508
+ payload: any,
509
+ spaces?: string | number,
510
+ ): /** The declassified and quoted payload */ StringablePayload;
511
+
512
+ /**
513
+ * Embed a string directly into error details without wrapping punctuation.
514
+ * To avoid injection attacks that exploit quoting confusion, this must NEVER
515
+ * be used with data that is possibly attacker-controlled.
516
+ * As a further safeguard, we fall back to quoting any input that is not a
517
+ * string of sufficiently word-like parts separated by isolated spaces (rather
518
+ * than throwing an exception, which could hide the original problem for which
519
+ * explanatory details are being constructed---i.e., ``` assert.details`...` ```
520
+ * should never be the source of a new exception, nor should an attempt to
521
+ * render its output, although we _could_ instead decide to handle the latter
522
+ * by inline replacement similar to that of `bestEffortStringify` for producing
523
+ * rendered messages like `(an object) was tagged "[Unsafe bare string]"`).
524
+ */
525
+ bare(
526
+ /** What to declassify */
527
+ payload: any,
528
+ spaces?: string | number,
529
+ ): /** The declassified payload without quotes (beware confusion hazard) */
530
+ StringablePayload;
531
+ }
532
+
533
+ export interface DeprecatedAssertionUtilities {
534
+ makeAssert: MakeAssert;
535
+ }
536
+
537
+ /**
538
+ * assert that expr is truthy, with an optional details to describe
539
+ * the assertion. It is a tagged template literal like
540
+ * ```js
541
+ * assert(expr, details`....`);`
542
+ * ```
543
+ *
544
+ * The literal portions of the template are assumed non-sensitive, as
545
+ * are the `typeof` types of the substitution values. These are
546
+ * assembled into the thrown error message. The actual contents of the
547
+ * substitution values are assumed sensitive, to be revealed to
548
+ * the console only. We assume only the virtual platform's owner can read
549
+ * what is written to the console, where the owner is in a privileged
550
+ * position over computation running on that platform.
551
+ *
552
+ * The optional `optDetails` can be a string for backwards compatibility
553
+ * with the nodejs assertion library.
554
+ */
555
+ export type Assert = AssertionFunctions &
556
+ AssertionUtilities &
557
+ DeprecatedAssertionUtilities;
558
+
559
+ interface CompartmentEvaluateOptions {
560
+ sloppyGlobalsMode?: boolean;
561
+ __moduleShimLexicals__?: Object;
562
+ __evadeHtmlCommentTest__?: boolean;
563
+ __evadeImportExpressionTest__?: boolean;
564
+ __rejectSomeDirectEvalExpressions__?: boolean;
565
+ }
566
+
567
+ declare global {
568
+ var harden: Harden;
569
+
570
+ var repairIntrinsics: RepairIntrinsics;
571
+ var hardenIntrinsics: HardenIntrinsics;
572
+ var lockdown: Lockdown;
573
+
574
+ var assert: Assert;
575
+
576
+ /**
577
+ * Each Compartment constructor is a global. A host that wants to execute
578
+ * code in a context bound to a new global creates a new compartment.
579
+ */
580
+ export class Compartment {
581
+ constructor(options?: CompartmentOptions & { __options__: true });
582
+
583
+ // Deprecated:
584
+ constructor(
585
+ globals?: Record<PropertyKey, any> | undefined,
586
+ modules?: Record<string, ModuleDescriptor>,
587
+ options?: CompartmentOptions,
588
+ );
589
+
590
+ get globalThis(): Record<PropertyKey, any>;
591
+
592
+ get name(): string;
593
+
594
+ evaluate(code: string, options?: CompartmentEvaluateOptions): any;
595
+
596
+ import(
597
+ specifier: string | null,
598
+ ): Promise<{ namespace: ModuleExportsNamespace }>;
599
+
600
+ load(specifier: string): Promise<void>;
601
+
602
+ importNow(specifier: string): ModuleExportsNamespace;
603
+
604
+ module(specifier: string): ModuleExportsNamespace;
605
+ }
606
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Context } from '@nocobase/actions';
10
+ export declare const uiSchemaActions: {
11
+ getJsonSchema: (ctx: any, next: any) => Promise<void>;
12
+ getProperties: (ctx: any, next: any) => Promise<void>;
13
+ getParentJsonSchema: (ctx: any, next: any) => Promise<void>;
14
+ getParentProperty: (ctx: any, next: any) => Promise<void>;
15
+ insert: (ctx: any, next: any) => Promise<void>;
16
+ insertNewSchema: (ctx: any, next: any) => Promise<void>;
17
+ remove: (ctx: any, next: any) => Promise<void>;
18
+ patch: (ctx: any, next: any) => Promise<void>;
19
+ initializeActionContext: (ctx: any, next: any) => Promise<void>;
20
+ batchPatch: (ctx: any, next: any) => Promise<void>;
21
+ clearAncestor: (ctx: any, next: any) => Promise<void>;
22
+ insertAdjacent: (ctx: Context, next: any) => Promise<void>;
23
+ insertBeforeBegin: (ctx: Context, next: any) => Promise<void>;
24
+ insertAfterBegin: (ctx: Context, next: any) => Promise<void>;
25
+ insertBeforeEnd: (ctx: Context, next: any) => Promise<void>;
26
+ insertAfterEnd: (ctx: Context, next: any) => Promise<void>;
27
+ };