Files
directus/packages/utils/shared/number-generator.ts
Rijk van Zanten 76f60913e3 Secure Extensions (#20031)
* start setting up types

* Add types for sandbox flag

* Add initial secure API extensions implementation

* Remove erroneous file

* Delete old exec implementation

* Read sandbox from extension manifest

* Rename \0virtual to @directus/virtual-ent4y

* Test register exec

* Add exec function using ivm callback

* Throw error on invalid type

* Make extensions individually unregisterable

* Remove support for secure bundle extensions

* Rework context passing to fix async

* Remove unused promise.resolve

* Start implementing secure extension register and context functions

* Rename secure to sandbox

* Only dispose isolate on catastrophic error

* Use callback copy option instead of explicit ExternalCopy

* Add registerOperation handler

* Add registerRoute handler

* Rename some return values

* Rename sandbox registration file

* Expose utils through sdk import

* Remove unused files

* Rename timeout to sleep for consistency with flows

* Make registerRoute method uppercase

* Add request util

* Abort process on catastrophic error

* Update api extension sdk import name

* Add variables for reference parameters for consistency

* Add permissions to request util

* Fix non-determinism when registering sandboxed extensions

* Improve stack trace readability

* Initialize isolated-vm for Vitest

* Format files

* Fix request options undefined check

* Always copy host function result into isolate

* Split up host function reference generation

* Add workaround for async error from host not thrown in isolate

* Use undefined instead of null as first argument to apply

* Abort process if sandbox has reached memory limit

* Reorganize files

* Use type error for assertion

* Use typeerrors in sdk generators, restructure some more

* Document

* Add changeset

---------

Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-10-21 10:31:46 -04:00

11 lines
188 B
TypeScript

/**
* Generator function to generate parameter indices.
*/
export function* numberGenerator(): Generator<number, number, number> {
let index = 0;
while (true) {
yield index++;
}
}