@routier/core 0.2.1 → 0.4.0
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/LICENSE +21 -0
- package/{readme.md → README.md} +3 -3
- package/dist/assertions/index.cjs +191 -0
- package/dist/assertions/index.cjs.map +1 -0
- package/dist/assertions/index.js +43 -63
- package/dist/assertions/index.js.map +1 -1
- package/dist/capabilities/index.cjs +820 -0
- package/dist/capabilities/index.cjs.map +1 -0
- package/dist/capabilities/index.js +584 -558
- package/dist/capabilities/index.js.map +1 -1
- package/dist/codegen/handlers/CloneHandlerBuilder.d.ts +10 -1
- package/dist/codegen/handlers/clone/CloneArrayHandler.d.ts +3 -0
- package/dist/codegen/handlers/clone/CloneDateHandler.d.ts +13 -0
- package/dist/codegen/handlers/clone/CloneValueHandler.d.ts +16 -0
- package/dist/codegen/handlers/compare/CompareComputedHandler.d.ts +10 -0
- package/dist/codegen/handlers/compare/CompareFunctionHandler.d.ts +10 -0
- package/dist/codegen/handlers/deserialize/DeserializeArrayHandler.d.ts +14 -0
- package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingArrayHandler.d.ts +11 -0
- package/dist/codegen/handlers/enrichment/EnrichmentArrayHandler.d.ts +11 -0
- package/dist/codegen/handlers/freeze/FreezeArrayHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashArrayHandler.d.ts +10 -0
- package/dist/codegen/handlers/hash/HashFileHandler.d.ts +24 -0
- package/dist/codegen/handlers/hash/HashObjectHandler.d.ts +10 -0
- package/dist/codegen/handlers/hash/HashTransformHandler.d.ts +23 -0
- package/dist/codegen/handlers/merge/MergeArrayHandler.d.ts +20 -0
- package/dist/codegen/handlers/merge/MergeObjectHandler.d.ts +10 -0
- package/dist/codegen/handlers/serialize/SerializeArrayHandler.d.ts +19 -0
- package/dist/codegen/handlers/strip/StripComputedHandler.d.ts +10 -0
- package/dist/codegen/handlers/strip/StripFunctionHandler.d.ts +9 -0
- package/dist/codegen/handlers/types.d.ts +55 -1
- package/dist/codegen/index.cjs +618 -0
- package/dist/codegen/index.cjs.map +1 -0
- package/dist/codegen/index.js +99 -127
- package/dist/codegen/index.js.map +1 -1
- package/dist/collections/MemoryDataCollection.d.ts +15 -1
- package/dist/collections/TagCollection.d.ts +0 -1
- package/dist/collections/index.cjs +702 -0
- package/dist/collections/index.cjs.map +1 -0
- package/dist/collections/index.js +282 -276
- package/dist/collections/index.js.map +1 -1
- package/dist/errors/OptimisticConcurrencyError.d.ts +18 -0
- package/dist/errors/PluginDestroyedError.d.ts +10 -0
- package/dist/errors/index.cjs +132 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +61 -19
- package/dist/errors/index.js.map +1 -1
- package/dist/expressions/evaluate.d.ts +53 -0
- package/dist/expressions/index.cjs +2087 -0
- package/dist/expressions/index.cjs.map +1 -0
- package/dist/expressions/index.d.ts +1 -1
- package/dist/expressions/index.js +1727 -1082
- package/dist/expressions/index.js.map +1 -1
- package/dist/expressions/parser.d.ts +19 -0
- package/dist/expressions/types.d.ts +87 -2
- package/dist/index.cjs +14377 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +12374 -7931
- package/dist/index.js.map +1 -1
- package/dist/performance/index.cjs +217 -0
- package/dist/performance/index.cjs.map +1 -0
- package/dist/performance/index.js +120 -55
- package/dist/performance/index.js.map +1 -1
- package/dist/pipeline/index.cjs +576 -0
- package/dist/pipeline/index.cjs.map +1 -0
- package/dist/pipeline/index.js +223 -161
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugins/BatchingDbPlugin.d.ts +139 -0
- package/dist/plugins/CacheDbPlugin.d.ts +70 -0
- package/dist/plugins/ConcurrencyDbPlugin.d.ts +78 -0
- package/dist/plugins/EphemeralDataPlugin.d.ts +57 -1
- package/dist/plugins/RetryDbPlugin.d.ts +77 -0
- package/dist/plugins/index.cjs +6551 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +6271 -1170
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/query/QueryOptionsCollection.d.ts +34 -0
- package/dist/plugins/query/explain.d.ts +82 -0
- package/dist/plugins/query/formatExplanation.d.ts +9 -0
- package/dist/plugins/query/index.d.ts +4 -0
- package/dist/plugins/query/join.d.ts +210 -0
- package/dist/plugins/query/similarity.d.ts +38 -0
- package/dist/plugins/query/types.d.ts +75 -1
- package/dist/plugins/translators/DataTranslator.d.ts +28 -0
- package/dist/plugins/translators/JsonTranslator.d.ts +27 -0
- package/dist/plugins/translators/SqlTranslator.d.ts +45 -0
- package/dist/plugins/translators/TupleTranslator.d.ts +45 -0
- package/dist/plugins/translators/index.d.ts +1 -0
- package/dist/plugins/types.d.ts +125 -3
- package/dist/plugins/wire/handler.d.ts +122 -0
- package/dist/plugins/wire/index.d.ts +4 -0
- package/dist/plugins/wire/persist.d.ts +43 -0
- package/dist/plugins/wire/query.d.ts +49 -0
- package/dist/plugins/wire/types.d.ts +139 -0
- package/dist/results/index.cjs +174 -0
- package/dist/results/index.cjs.map +1 -0
- package/dist/results/index.js +29 -44
- package/dist/results/index.js.map +1 -1
- package/dist/schema/PropertyInfo.d.ts +31 -2
- package/dist/schema/SchemaDefinition.d.ts +23 -1
- package/dist/schema/builder.d.ts +35 -1
- package/dist/schema/communication/broadcast.d.ts +17 -1
- package/dist/schema/index.cjs +6911 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.js +5330 -4541
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/property/base/SchemaBase.d.ts +48 -2
- package/dist/schema/property/modifiers/SchemaNullable.d.ts +10 -0
- package/dist/schema/property/modifiers/SchemaOptional.d.ts +19 -0
- package/dist/schema/property/modifiers/SchemaSearchable.d.ts +34 -0
- package/dist/schema/property/modifiers/index.d.ts +1 -0
- package/dist/schema/property/types/SchemaFile.d.ts +60 -0
- package/dist/schema/property/types/SchemaString.d.ts +21 -1
- package/dist/schema/property/types/SchemaVector.d.ts +61 -0
- package/dist/schema/property/types/index.d.ts +2 -0
- package/dist/schema/table/SchemaTransform.d.ts +40 -0
- package/dist/schema/table/index.d.ts +1 -0
- package/dist/schema/types.d.ts +166 -8
- package/dist/schema/utils/propertyKind.d.ts +4 -0
- package/dist/types/index.cjs +23 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.js +0 -14
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/index.cjs +1013 -0
- package/dist/utilities/index.cjs.map +1 -0
- package/dist/utilities/index.js +541 -379
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/logger.d.ts +48 -0
- package/package.json +156 -98
- package/dist/codegen/SlotPath.test.d.ts +0 -1
- package/dist/codegen/blocks.test.d.ts +0 -1
- package/dist/codegen/utils.test.d.ts +0 -1
- package/dist/collections/Changes.test.d.ts +0 -1
- package/dist/collections/IdSet.test.d.ts +0 -1
- package/dist/collections/MemoryDataCollection.test.d.ts +0 -1
- package/dist/collections/TagCollection.contract.test.d.ts +0 -1
- package/dist/collections/TagCollection.test.d.ts +0 -1
- package/dist/expressions/parser.test.d.ts +0 -1
- package/dist/expressions/sql.d.ts +0 -28
- package/dist/expressions/sql.test.d.ts +0 -1
- package/dist/expressions/utils.test.d.ts +0 -1
- package/dist/pipeline/SyncronousQueue.test.d.ts +0 -1
- package/dist/plugins/EphemeralDataPlugin.test.d.ts +0 -1
- package/dist/plugins/query/Query.test.d.ts +0 -1
- package/dist/plugins/query/QueryOptionsCollection.test.d.ts +0 -1
- package/dist/plugins/translators/JsonTranslator.test.d.ts +0 -1
- package/dist/plugins/translators/SqlTranslator.test.d.ts +0 -1
- package/dist/plugins/translators/TranslatedValues.test.d.ts +0 -1
- package/dist/results/Result.test.d.ts +0 -1
- package/dist/results/utils.test.d.ts +0 -1
- package/dist/schema/PropertyInfo.test.d.ts +0 -1
- package/dist/schema/communication/broadcast.test.d.ts +0 -1
- package/dist/schema/schemaGeneration.test.d.ts +0 -1
- package/dist/schema/utils/standardJsonSchema.test.d.ts +0 -1
- package/dist/utilities/arrays.test.d.ts +0 -1
- package/dist/utilities/dates.test.d.ts +0 -1
- package/dist/utilities/runtime.test.d.ts +0 -1
- package/dist/utilities/strings.test.d.ts +0 -1
- package/dist/utilities/uuid.test.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen/index.cjs","sources":["webpack://@routier/core/./src/codegen/blocks.ts","webpack://@routier/core/./src/utilities/uuid.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/codegen/index.ts"],"sourcesContent":["import { uuid } from \"../utilities\";\nimport { CreateBlockOptions } from \"./types\";\n\ntype Line = string | Block;\n\ntype Param = { name: string, value: any };\ntype GenericParam = { name: string, callName: string };\n\n\nexport abstract class Block {\n readonly name: string;\n protected _lines: Line[] = [];\n protected _indent: string = \"\";\n protected _parent?: Block;\n\n constructor(name?: string, parentIndent: string = \"\", parent?: Block) {\n this.name = name != null ? name : uuid();\n this._indent = parentIndent;\n this._parent = parent;\n }\n\n indexOf(name: string) {\n return this._lines.findIndex(w => typeof w !== \"string\" && w.name === name);\n }\n\n getLines() {\n return this._lines;\n }\n\n getParent() {\n return this._parent;\n }\n\n getIndent() {\n return this._indent;\n }\n\n setLines(lines: Line[]) {\n this._lines = lines;\n }\n\n setParent(block: Block) {\n this._parent = block;\n }\n\n setIndent(indent: string) {\n this._indent = indent;\n }\n\n getOrDefault<T extends Block>(name: string): T | undefined {\n\n if (name.includes('.') === false) {\n return this._lines.find(w => typeof w !== \"string\" && w.name === name) as T | undefined;\n }\n\n const split = name.match(/(\\[[^\\]]+\\]|[^.]+)/g);\n // oxlint-disable-next-line no-this-alias\n let result: Block = this;\n\n for (const item of split) {\n const found = result._lines.find(w => typeof w !== \"string\" && w.name === item) as Block;\n\n if (found == null) {\n\n if (\"getValue\" in result && result.getValue instanceof Block && result.getValue.name === item) {\n result = result.getValue;\n continue;\n }\n\n return undefined;\n }\n\n result = found;\n }\n\n return result as T;\n }\n\n get<T extends Block>(name: string): T {\n const found = this.getOrDefault(name);\n\n if (found == null) {\n throw new Error(`Error finding code block for given path. Path: ${name}`)\n }\n\n return found as T;\n }\n\n has(name: string) {\n return this._lines.some(w => typeof w !== \"string\" && w.name === name);\n }\n\n remove(name: string) {\n this._lines = this._lines.filter(x => typeof x === \"object\" && typeof x.name === \"string\" && x.name !== name);\n }\n\n replace(name: string, line: Block) {\n\n const foundIndex = this._lines.findIndex(x => typeof x !== \"string\" && x.name === name);\n\n if (foundIndex === -1) {\n throw new Error(`Cannot find line by name. Name: ${name}`)\n }\n\n const found = this._lines[foundIndex];\n\n if (typeof found === \"string\") {\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n return;\n }\n\n line.setLines(found.getLines());\n line.setIndent(found.getIndent());\n line.setParent(found.getParent());\n\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n\n return;\n }\n\n protected push(line: Line) {\n this._lines.push(line);\n }\n\n protected unshift(line: Line) {\n this._lines.unshift(line);\n }\n\n protected indent(text: string): string {\n return this._indent + text;\n }\n\n\n abstract toString(): string;\n}\n\nexport abstract class ContainerBlock extends Block {\n if(condition: string, options?: CreateBlockOptions): IfBuilder {\n const builder = new IfBuilder(condition, options?.name, this._indent + \" \", this);\n if (options?.unshift === true) {\n this.unshift(builder);\n } else {\n this.push(builder);\n }\n\n return builder;\n }\n\n raw(raw: string, options?: CreateBlockOptions): RawBuilder {\n const builder = new RawBuilder(raw, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n function(name?: string, options?: CreateBlockOptions): FunctionBuilder {\n const builder = new FunctionBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n factory(name?: string, options?: CreateBlockOptions): FunctionFactoryBuilder {\n const builder = new FunctionFactoryBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n variable(declaration: string, options?: CreateBlockOptions): VariableBuilder {\n const builder = new VariableBuilder(declaration, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n assign(variableName: string, options?: CreateBlockOptions): AssignmentBuilder {\n const builder = new AssignmentBuilder(variableName, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const builder = new ObjectBuilder(options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n slot(name: string) {\n const builder = new SlotBlock(name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n array(accessor: string, options?: CreateBlockOptions) {\n const builder = new ArrayBuilder(accessor, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n}\n\nexport type StringType = \"template\" | \"default\";\n\nexport class StringBuilder extends Block {\n\n private _type: StringType;\n\n constructor(type: StringType, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._type = type;\n }\n\n append(value: string) {\n this._lines.push(value);\n return this;\n }\n\n toString() {\n if (this._type === \"template\") {\n return \"`\" + this._lines.join(\"\") + \"`\";\n }\n\n return `\"${this._lines.join(\"\")}\"`;\n }\n}\n\nexport class SlotBlock extends ContainerBlock {\n\n constructor(name: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n }\n\n insert(line: string | Block) {\n this.push(line);\n }\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}\n\nexport class AssignmentBuilder extends ContainerBlock {\n protected _variableName: string;\n protected _value?: string | Block;\n protected _functionName?: string;\n\n get getValue() {\n return this._value;\n }\n\n constructor(variableName: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._variableName = variableName;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n and(and: string, options?: CreateBlockOptions): this {\n this._value = new AndBuilder(and, options?.name, this._indent, this);\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n call(functionName: string, options?: CreateBlockOptions): ObjectBuilder {\n this._functionName = functionName;\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n string(type: StringType, options?: CreateBlockOptions) {\n const stringBuilder = new StringBuilder(type, options?.name, this._indent, this);\n\n this._value = stringBuilder;\n\n return stringBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for AssignmentBuilder Builder\")\n }\n\n if (this._functionName != null) {\n return this.indent(`${this._variableName} = ${this._functionName}(${this._value.toString()});`);\n }\n\n return this.indent(`${this._variableName} = ${this._value.toString()};`);\n }\n}\n\nexport class AndBuilder extends ContainerBlock {\n\n constructor(and: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(and);\n }\n\n and(and: string) {\n this._lines.push(and);\n }\n\n toString() {\n return this._lines.join(\" && \")\n }\n}\n\nexport class VariableBuilder extends Block {\n protected _declaration: string;\n protected _value?: string | Block;\n\n get getValue() {\n return this._value;\n }\n\n constructor(declaration: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._declaration = declaration;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n array(accessor: string, options?: CreateBlockOptions): ArrayBuilder {\n const arrayBuilder = new ArrayBuilder(accessor, options?.name, this._indent, this);\n\n this._value = arrayBuilder;\n\n return arrayBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for Variable Builder\")\n }\n\n return this.indent(`const ${this._declaration} = ${this._value.toString()};`);\n }\n}\n\nexport class RawBuilder extends ContainerBlock {\n private _raw: string;\n\n constructor(raw: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._raw = raw;\n }\n\n toString(): string {\n return `${this._raw}\\n`;\n }\n}\n\nexport class ObjectBuilder extends Block {\n\n property(line: string) {\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n this.push(line);\n return this;\n }\n\n nested(propertyName: string, name?: string) {\n const builder = new ObjectBuilder(name, this._indent + \" \", this);\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n // Add the property name and opening brace\n this.push(`${propertyName}: {`);\n // Add the nested builder\n this.push(builder);\n // Add the closing brace\n this.push(\"}\");\n return builder;\n }\n\n toString(): string {\n // Check if this is a nested object's content\n const isNestedContent = this._parent instanceof ObjectBuilder;\n\n if (isNestedContent) {\n // For nested object contents, just return the lines\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ).join('\\n');\n }\n\n // For root objects, include the braces\n const lines = [\n \"{\",\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionFactoryBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: Param[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n getParameters() {\n return [...this._params];\n }\n\n createParameter(value: any): Param {\n const name = `injection${this._params.length}`;\n return {\n name,\n value\n }\n }\n\n parameters(...params: Param[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n invoke() {\n const body = this.toString();\n const parameterNames = this._getParameterNames();\n const parameterValues = this._getParameterValues();\n\n return Function(...parameterNames, body)(...parameterValues)\n }\n\n private _getParameterNames() {\n return this._params.map(w => w.name).join(\", \")\n }\n\n private _getParameterValues() {\n return this._params.map(w => w.value);\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterNames()})`\n : `${r}function(${this._getParameterNames()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: (string | GenericParam)[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n parameters(...params: (string | GenericParam)[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n private _getParameterKeys() {\n return this._params.map(w => typeof w === \"object\" ? w.name : w).join(\", \")\n }\n\n toCallable() {\n return `${this._functionName}(${this._params.map(w => typeof w === \"object\" ? w.callName : w).join(\", \")})`\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterKeys()})`\n : `${r}function(${this._getParameterKeys()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class ArrayBuilder extends Block {\n constructor(accessor: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(accessor);\n }\n\n append(accessor: string) {\n this._lines.push(accessor);\n return this;\n }\n\n toString() {\n return `[${this._lines.join(\",\")}]`\n }\n}\n\nexport class IfBuilder extends ContainerBlock {\n private _condition: string;\n\n constructor(condition: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._condition = condition;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n unshiftBody(line: string): this {\n this.unshift(line);\n return this;\n }\n\n private stringifyLine(line: Line) {\n if (typeof line === 'string') {\n return this.indent(\" \" + line);\n }\n\n if (Array.isArray(line)) {\n return line.join(\"\\r\\n\")\n }\n\n return line.toString();\n }\n\n toString(): string {\n // need to join with \\r\\n because we are not an object\n const lines = [\n this.indent(`if (${this._condition}) {`),\n this._lines.map(x => this.stringifyLine(x)).join(\"\\r\\n\"),\n this.indent(\"}\")\n ]\n\n return lines.join(\"\\n\\n\");\n }\n}\n\nexport class CodeBuilder extends ContainerBlock {\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}","export const uuid = (length: number = 16): string => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const charLength = chars.length;\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.random() * charLength | 0];\n }\n return result;\n}\n\nconst HEX_CHARS = '0123456789abcdef';\nconst UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\nconst hasCrypto =\n typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n\nconst hasRandomUUID =\n typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function';\n\nexport const uuidv4 = (): string => {\n if (hasRandomUUID) {\n return crypto.randomUUID();\n }\n\n return uuidv4Fallback();\n};\n\nconst uuidv4Fallback = (): string => {\n let randomBytes: Uint8Array | null = null;\n if (hasCrypto) {\n randomBytes = crypto.getRandomValues(new Uint8Array(16));\n }\n\n let byteIndex = 0;\n let uuid = '';\n\n for (let i = 0; i < UUID_TEMPLATE.length; i++) {\n const c = UUID_TEMPLATE[i];\n if (c === '-') {\n uuid += '-';\n continue;\n }\n\n let r: number;\n if (hasCrypto && randomBytes) {\n // Each byte gives two hex digits (nibbles)\n r =\n (i % 2 === 0\n ? randomBytes[byteIndex] >> 4\n : randomBytes[byteIndex++] & 0x0f);\n } else {\n r = Math.floor(Math.random() * 16);\n }\n\n if (c === 'x') {\n uuid += HEX_CHARS[r];\n } else if (c === 'y') {\n // Variant bits: 8, 9, A, or B\n uuid += HEX_CHARS[(r & 0x3) | 0x8];\n } else if (c === '4') {\n uuid += '4';\n }\n }\n\n return uuid;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './blocks';\nexport * from './types';"],"names":["uuid","Block","name","parentIndent","parent","w","lines","block","indent","split","result","item","found","undefined","Error","x","line","foundIndex","text","ContainerBlock","condition","options","builder","IfBuilder","raw","RawBuilder","FunctionBuilder","FunctionFactoryBuilder","declaration","VariableBuilder","variableName","AssignmentBuilder","ObjectBuilder","SlotBlock","accessor","ArrayBuilder","StringBuilder","type","value","and","AndBuilder","objectBuilder","functionName","stringBuilder","arrayBuilder","lastLine","propertyName","isNestedContent","sectionName","params","body","parameterNames","parameterValues","Function","r","signature","Array","CodeBuilder","length","chars","charLength","i","Math","HEX_CHARS","UUID_TEMPLATE","hasCrypto","crypto","hasRandomUUID","uuidv4","uuidv4Fallback","randomBytes","Uint8Array","byteIndex","c"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAoC;AAS7B,MAAeC;IACT,KAAa;IACZ,SAAiB,EAAE,CAAC;IACpB,UAAkB,GAAG;IACrB,QAAgB;IAE1B,YAAYC,IAAa,EAAEC,eAAuB,EAAE,EAAEC,MAAc,CAAE;QAClE,IAAI,CAAC,IAAI,GAAGF,QAAQ,OAAOA,OAAOF,4CAAIA;QACtC,IAAI,CAAC,OAAO,GAAGG;QACf,IAAI,CAAC,OAAO,GAAGC;IACnB;IAEA,QAAQF,IAAY,EAAE;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAACG,CAAAA,IAAK,OAAOA,MAAM,YAAYA,EAAE,IAAI,KAAKH;IAC1E;IAEA,WAAW;QACP,OAAO,IAAI,CAAC,MAAM;IACtB;IAEA,YAAY;QACR,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,YAAY;QACR,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,SAASI,KAAa,EAAE;QACpB,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEA,UAAUC,KAAY,EAAE;QACpB,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,UAAUC,MAAc,EAAE;QACtB,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,aAA8BN,IAAY,EAAiB;QAEvD,IAAIA,KAAK,QAAQ,CAAC,SAAS,OAAO;YAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAACG,CAAAA,IAAK,OAAOA,MAAM,YAAYA,EAAE,IAAI,KAAKH;QACrE;QAEA,MAAMO,QAAQP,KAAK,KAAK,CAAC;QACzB,yCAAyC;QACzC,IAAIQ,SAAgB,IAAI;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
__webpack_require__.r(__webpack_exports__);
|
|
2
|
+
980(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
3
|
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
$j: () => (ArrayBuilder),
|
|
5
|
+
E2: () => (SlotBlock),
|
|
6
|
+
Nl: () => (CodeBuilder),
|
|
7
|
+
No: () => (AndBuilder),
|
|
8
|
+
O_: () => (FunctionFactoryBuilder),
|
|
9
|
+
Tl: () => (ObjectBuilder),
|
|
10
|
+
Zm: () => (IfBuilder),
|
|
11
|
+
eB: () => (Block),
|
|
12
|
+
fe: () => (StringBuilder),
|
|
13
|
+
hL: () => (AssignmentBuilder),
|
|
14
|
+
j7: () => (ContainerBlock),
|
|
15
|
+
kF: () => (FunctionBuilder),
|
|
16
|
+
ot: () => (VariableBuilder),
|
|
17
|
+
qY: () => (RawBuilder)
|
|
19
18
|
});
|
|
20
|
-
/* import */ var _utilities__rspack_import_0 = __webpack_require__(
|
|
19
|
+
/* import */ var _utilities__rspack_import_0 = __webpack_require__(618);
|
|
21
20
|
|
|
22
21
|
class Block {
|
|
23
22
|
name;
|
|
24
23
|
_lines = [];
|
|
25
24
|
_indent = "";
|
|
26
25
|
_parent;
|
|
27
|
-
constructor(name, parentIndent = "", parent)
|
|
28
|
-
this.name = name != null ? name : (0,_utilities__rspack_import_0.uuid)();
|
|
26
|
+
constructor(name, parentIndent = "", parent){
|
|
27
|
+
this.name = name != null ? name : (0,_utilities__rspack_import_0/* .uuid */.u)();
|
|
29
28
|
this._indent = parentIndent;
|
|
30
29
|
this._parent = parent;
|
|
31
30
|
}
|
|
32
31
|
indexOf(name) {
|
|
33
|
-
return this._lines.findIndex(w
|
|
32
|
+
return this._lines.findIndex((w)=>typeof w !== "string" && w.name === name);
|
|
34
33
|
}
|
|
35
34
|
getLines() {
|
|
36
35
|
return this._lines;
|
|
@@ -52,13 +51,13 @@ class Block {
|
|
|
52
51
|
}
|
|
53
52
|
getOrDefault(name) {
|
|
54
53
|
if (name.includes('.') === false) {
|
|
55
|
-
return this._lines.find(w
|
|
54
|
+
return this._lines.find((w)=>typeof w !== "string" && w.name === name);
|
|
56
55
|
}
|
|
57
56
|
const split = name.match(/(\[[^\]]+\]|[^.]+)/g);
|
|
58
57
|
// oxlint-disable-next-line no-this-alias
|
|
59
58
|
let result = this;
|
|
60
|
-
for (const item of split)
|
|
61
|
-
const found = result._lines.find(w
|
|
59
|
+
for (const item of split){
|
|
60
|
+
const found = result._lines.find((w)=>typeof w !== "string" && w.name === item);
|
|
62
61
|
if (found == null) {
|
|
63
62
|
if ("getValue" in result && result.getValue instanceof Block && result.getValue.name === item) {
|
|
64
63
|
result = result.getValue;
|
|
@@ -78,13 +77,13 @@ class Block {
|
|
|
78
77
|
return found;
|
|
79
78
|
}
|
|
80
79
|
has(name) {
|
|
81
|
-
return this._lines.some(w
|
|
80
|
+
return this._lines.some((w)=>typeof w !== "string" && w.name === name);
|
|
82
81
|
}
|
|
83
82
|
remove(name) {
|
|
84
|
-
this._lines = this._lines.filter(x
|
|
83
|
+
this._lines = this._lines.filter((x)=>typeof x === "object" && typeof x.name === "string" && x.name !== name);
|
|
85
84
|
}
|
|
86
85
|
replace(name, line) {
|
|
87
|
-
const foundIndex = this._lines.findIndex(x
|
|
86
|
+
const foundIndex = this._lines.findIndex((x)=>typeof x !== "string" && x.name === name);
|
|
88
87
|
if (foundIndex === -1) {
|
|
89
88
|
throw new Error(`Cannot find line by name. Name: ${name}`);
|
|
90
89
|
}
|
|
@@ -116,8 +115,7 @@ class ContainerBlock extends Block {
|
|
|
116
115
|
const builder = new IfBuilder(condition, options?.name, this._indent + " ", this);
|
|
117
116
|
if (options?.unshift === true) {
|
|
118
117
|
this.unshift(builder);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
118
|
+
} else {
|
|
121
119
|
this.push(builder);
|
|
122
120
|
}
|
|
123
121
|
return builder;
|
|
@@ -165,7 +163,7 @@ class ContainerBlock extends Block {
|
|
|
165
163
|
}
|
|
166
164
|
class StringBuilder extends Block {
|
|
167
165
|
_type;
|
|
168
|
-
constructor(type, name, parentIndent = "", parent)
|
|
166
|
+
constructor(type, name, parentIndent = "", parent){
|
|
169
167
|
super(name, parentIndent, parent);
|
|
170
168
|
this._type = type;
|
|
171
169
|
}
|
|
@@ -181,16 +179,14 @@ class StringBuilder extends Block {
|
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
181
|
class SlotBlock extends ContainerBlock {
|
|
184
|
-
constructor(name, parentIndent = "", parent)
|
|
182
|
+
constructor(name, parentIndent = "", parent){
|
|
185
183
|
super(name, parentIndent, parent);
|
|
186
184
|
}
|
|
187
185
|
insert(line) {
|
|
188
186
|
this.push(line);
|
|
189
187
|
}
|
|
190
188
|
toString() {
|
|
191
|
-
return this._lines.map(line
|
|
192
|
-
? this.indent(line)
|
|
193
|
-
: line.toString()).join('\n\n');
|
|
189
|
+
return this._lines.map((line)=>typeof line === 'string' ? this.indent(line) : line.toString()).join('\n\n');
|
|
194
190
|
}
|
|
195
191
|
}
|
|
196
192
|
class AssignmentBuilder extends ContainerBlock {
|
|
@@ -200,7 +196,7 @@ class AssignmentBuilder extends ContainerBlock {
|
|
|
200
196
|
get getValue() {
|
|
201
197
|
return this._value;
|
|
202
198
|
}
|
|
203
|
-
constructor(variableName, name, parentIndent = "", parent)
|
|
199
|
+
constructor(variableName, name, parentIndent = "", parent){
|
|
204
200
|
super(name, parentIndent, parent);
|
|
205
201
|
this._variableName = variableName;
|
|
206
202
|
}
|
|
@@ -239,7 +235,7 @@ class AssignmentBuilder extends ContainerBlock {
|
|
|
239
235
|
}
|
|
240
236
|
}
|
|
241
237
|
class AndBuilder extends ContainerBlock {
|
|
242
|
-
constructor(and, name, parentIndent = "", parent)
|
|
238
|
+
constructor(and, name, parentIndent = "", parent){
|
|
243
239
|
super(name, parentIndent, parent);
|
|
244
240
|
this._lines.push(and);
|
|
245
241
|
}
|
|
@@ -256,7 +252,7 @@ class VariableBuilder extends Block {
|
|
|
256
252
|
get getValue() {
|
|
257
253
|
return this._value;
|
|
258
254
|
}
|
|
259
|
-
constructor(declaration, name, parentIndent = "", parent)
|
|
255
|
+
constructor(declaration, name, parentIndent = "", parent){
|
|
260
256
|
super(name, parentIndent, parent);
|
|
261
257
|
this._declaration = declaration;
|
|
262
258
|
}
|
|
@@ -283,7 +279,7 @@ class VariableBuilder extends Block {
|
|
|
283
279
|
}
|
|
284
280
|
class RawBuilder extends ContainerBlock {
|
|
285
281
|
_raw;
|
|
286
|
-
constructor(raw, name, parentIndent = "", parent)
|
|
282
|
+
constructor(raw, name, parentIndent = "", parent){
|
|
287
283
|
super(name, parentIndent, parent);
|
|
288
284
|
this._raw = raw;
|
|
289
285
|
}
|
|
@@ -325,16 +321,12 @@ class ObjectBuilder extends Block {
|
|
|
325
321
|
const isNestedContent = this._parent instanceof ObjectBuilder;
|
|
326
322
|
if (isNestedContent) {
|
|
327
323
|
// For nested object contents, just return the lines
|
|
328
|
-
return this._lines.map(line
|
|
329
|
-
? this.indent(" " + line)
|
|
330
|
-
: line.toString()).join('\n');
|
|
324
|
+
return this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()).join('\n');
|
|
331
325
|
}
|
|
332
326
|
// For root objects, include the braces
|
|
333
327
|
const lines = [
|
|
334
328
|
"{",
|
|
335
|
-
...this._lines.map(line
|
|
336
|
-
? this.indent(" " + line)
|
|
337
|
-
: line.toString()),
|
|
329
|
+
...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
|
|
338
330
|
this.indent("}")
|
|
339
331
|
];
|
|
340
332
|
return lines.join('\n');
|
|
@@ -344,12 +336,14 @@ class FunctionFactoryBuilder extends ContainerBlock {
|
|
|
344
336
|
_functionName;
|
|
345
337
|
_params = [];
|
|
346
338
|
_return = false;
|
|
347
|
-
constructor(functionName, sectionName, parentIndent = "", parent)
|
|
339
|
+
constructor(functionName, sectionName, parentIndent = "", parent){
|
|
348
340
|
super(sectionName, parentIndent, parent);
|
|
349
341
|
this._functionName = functionName;
|
|
350
342
|
}
|
|
351
343
|
getParameters() {
|
|
352
|
-
return [
|
|
344
|
+
return [
|
|
345
|
+
...this._params
|
|
346
|
+
];
|
|
353
347
|
}
|
|
354
348
|
createParameter(value) {
|
|
355
349
|
const name = `injection${this._params.length}`;
|
|
@@ -377,21 +371,17 @@ class FunctionFactoryBuilder extends ContainerBlock {
|
|
|
377
371
|
return Function(...parameterNames, body)(...parameterValues);
|
|
378
372
|
}
|
|
379
373
|
_getParameterNames() {
|
|
380
|
-
return this._params.map(w
|
|
374
|
+
return this._params.map((w)=>w.name).join(", ");
|
|
381
375
|
}
|
|
382
376
|
_getParameterValues() {
|
|
383
|
-
return this._params.map(w
|
|
377
|
+
return this._params.map((w)=>w.value);
|
|
384
378
|
}
|
|
385
379
|
toString() {
|
|
386
380
|
const r = this._return === true ? "return " : "";
|
|
387
|
-
const signature = this._functionName
|
|
388
|
-
? `${r}function ${this._functionName}(${this._getParameterNames()})`
|
|
389
|
-
: `${r}function(${this._getParameterNames()})`;
|
|
381
|
+
const signature = this._functionName ? `${r}function ${this._functionName}(${this._getParameterNames()})` : `${r}function(${this._getParameterNames()})`;
|
|
390
382
|
const lines = [
|
|
391
383
|
this.indent(signature + " {"),
|
|
392
|
-
...this._lines.map(line
|
|
393
|
-
? this.indent(" " + line)
|
|
394
|
-
: line.toString()),
|
|
384
|
+
...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
|
|
395
385
|
this.indent("}")
|
|
396
386
|
];
|
|
397
387
|
return lines.join('\n');
|
|
@@ -401,7 +391,7 @@ class FunctionBuilder extends ContainerBlock {
|
|
|
401
391
|
_functionName;
|
|
402
392
|
_params = [];
|
|
403
393
|
_return = false;
|
|
404
|
-
constructor(functionName, sectionName, parentIndent = "", parent)
|
|
394
|
+
constructor(functionName, sectionName, parentIndent = "", parent){
|
|
405
395
|
super(sectionName, parentIndent, parent);
|
|
406
396
|
this._functionName = functionName;
|
|
407
397
|
}
|
|
@@ -418,28 +408,24 @@ class FunctionBuilder extends ContainerBlock {
|
|
|
418
408
|
return this;
|
|
419
409
|
}
|
|
420
410
|
_getParameterKeys() {
|
|
421
|
-
return this._params.map(w
|
|
411
|
+
return this._params.map((w)=>typeof w === "object" ? w.name : w).join(", ");
|
|
422
412
|
}
|
|
423
413
|
toCallable() {
|
|
424
|
-
return `${this._functionName}(${this._params.map(w
|
|
414
|
+
return `${this._functionName}(${this._params.map((w)=>typeof w === "object" ? w.callName : w).join(", ")})`;
|
|
425
415
|
}
|
|
426
416
|
toString() {
|
|
427
417
|
const r = this._return === true ? "return " : "";
|
|
428
|
-
const signature = this._functionName
|
|
429
|
-
? `${r}function ${this._functionName}(${this._getParameterKeys()})`
|
|
430
|
-
: `${r}function(${this._getParameterKeys()})`;
|
|
418
|
+
const signature = this._functionName ? `${r}function ${this._functionName}(${this._getParameterKeys()})` : `${r}function(${this._getParameterKeys()})`;
|
|
431
419
|
const lines = [
|
|
432
420
|
this.indent(signature + " {"),
|
|
433
|
-
...this._lines.map(line
|
|
434
|
-
? this.indent(" " + line)
|
|
435
|
-
: line.toString()),
|
|
421
|
+
...this._lines.map((line)=>typeof line === 'string' ? this.indent(" " + line) : line.toString()),
|
|
436
422
|
this.indent("}")
|
|
437
423
|
];
|
|
438
424
|
return lines.join('\n');
|
|
439
425
|
}
|
|
440
426
|
}
|
|
441
427
|
class ArrayBuilder extends Block {
|
|
442
|
-
constructor(accessor, name, parentIndent = "", parent)
|
|
428
|
+
constructor(accessor, name, parentIndent = "", parent){
|
|
443
429
|
super(name, parentIndent, parent);
|
|
444
430
|
this._lines.push(accessor);
|
|
445
431
|
}
|
|
@@ -453,7 +439,7 @@ class ArrayBuilder extends Block {
|
|
|
453
439
|
}
|
|
454
440
|
class IfBuilder extends ContainerBlock {
|
|
455
441
|
_condition;
|
|
456
|
-
constructor(condition, name, parentIndent = "", parent)
|
|
442
|
+
constructor(condition, name, parentIndent = "", parent){
|
|
457
443
|
super(name, parentIndent, parent);
|
|
458
444
|
this._condition = condition;
|
|
459
445
|
}
|
|
@@ -478,7 +464,7 @@ class IfBuilder extends ContainerBlock {
|
|
|
478
464
|
// need to join with \r\n because we are not an object
|
|
479
465
|
const lines = [
|
|
480
466
|
this.indent(`if (${this._condition}) {`),
|
|
481
|
-
this._lines.map(x
|
|
467
|
+
this._lines.map((x)=>this.stringifyLine(x)).join("\r\n"),
|
|
482
468
|
this.indent("}")
|
|
483
469
|
];
|
|
484
470
|
return lines.join("\n\n");
|
|
@@ -486,25 +472,21 @@ class IfBuilder extends ContainerBlock {
|
|
|
486
472
|
}
|
|
487
473
|
class CodeBuilder extends ContainerBlock {
|
|
488
474
|
toString() {
|
|
489
|
-
return this._lines.map(line
|
|
490
|
-
? this.indent(line)
|
|
491
|
-
: line.toString()).join('\n\n');
|
|
475
|
+
return this._lines.map((line)=>typeof line === 'string' ? this.indent(line) : line.toString()).join('\n\n');
|
|
492
476
|
}
|
|
493
477
|
}
|
|
494
478
|
|
|
495
479
|
|
|
496
480
|
},
|
|
497
|
-
|
|
498
|
-
__webpack_require__.r(__webpack_exports__);
|
|
481
|
+
618(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
499
482
|
__webpack_require__.d(__webpack_exports__, {
|
|
500
|
-
|
|
501
|
-
uuidv4: () => (uuidv4)
|
|
483
|
+
u: () => (uuid)
|
|
502
484
|
});
|
|
503
|
-
const uuid = (length = 16)
|
|
485
|
+
const uuid = (length = 16)=>{
|
|
504
486
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
505
487
|
const charLength = chars.length;
|
|
506
488
|
let result = '';
|
|
507
|
-
for
|
|
489
|
+
for(let i = 0; i < length; i++){
|
|
508
490
|
result += chars[Math.random() * charLength | 0];
|
|
509
491
|
}
|
|
510
492
|
return result;
|
|
@@ -512,14 +494,21 @@ const uuid = (length = 16) => {
|
|
|
512
494
|
const HEX_CHARS = '0123456789abcdef';
|
|
513
495
|
const UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
514
496
|
const hasCrypto = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';
|
|
515
|
-
const
|
|
497
|
+
const hasRandomUUID = typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function';
|
|
498
|
+
const uuidv4 = ()=>{
|
|
499
|
+
if (hasRandomUUID) {
|
|
500
|
+
return crypto.randomUUID();
|
|
501
|
+
}
|
|
502
|
+
return uuidv4Fallback();
|
|
503
|
+
};
|
|
504
|
+
const uuidv4Fallback = ()=>{
|
|
516
505
|
let randomBytes = null;
|
|
517
506
|
if (hasCrypto) {
|
|
518
507
|
randomBytes = crypto.getRandomValues(new Uint8Array(16));
|
|
519
508
|
}
|
|
520
509
|
let byteIndex = 0;
|
|
521
510
|
let uuid = '';
|
|
522
|
-
for
|
|
511
|
+
for(let i = 0; i < UUID_TEMPLATE.length; i++){
|
|
523
512
|
const c = UUID_TEMPLATE[i];
|
|
524
513
|
if (c === '-') {
|
|
525
514
|
uuid += '-';
|
|
@@ -528,22 +517,16 @@ const uuidv4 = () => {
|
|
|
528
517
|
let r;
|
|
529
518
|
if (hasCrypto && randomBytes) {
|
|
530
519
|
// Each byte gives two hex digits (nibbles)
|
|
531
|
-
r =
|
|
532
|
-
|
|
533
|
-
? randomBytes[byteIndex] >> 4
|
|
534
|
-
: randomBytes[byteIndex++] & 0x0f);
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
520
|
+
r = i % 2 === 0 ? randomBytes[byteIndex] >> 4 : randomBytes[byteIndex++] & 0x0f;
|
|
521
|
+
} else {
|
|
537
522
|
r = Math.floor(Math.random() * 16);
|
|
538
523
|
}
|
|
539
524
|
if (c === 'x') {
|
|
540
525
|
uuid += HEX_CHARS[r];
|
|
541
|
-
}
|
|
542
|
-
else if (c === 'y') {
|
|
526
|
+
} else if (c === 'y') {
|
|
543
527
|
// Variant bits: 8, 9, A, or B
|
|
544
|
-
uuid += HEX_CHARS[
|
|
545
|
-
}
|
|
546
|
-
else if (c === '4') {
|
|
528
|
+
uuid += HEX_CHARS[r & 0x3 | 0x8];
|
|
529
|
+
} else if (c === '4') {
|
|
547
530
|
uuid += '4';
|
|
548
531
|
}
|
|
549
532
|
}
|
|
@@ -591,56 +574,45 @@ __webpack_require__.d = (exports, definition) => {
|
|
|
591
574
|
(() => {
|
|
592
575
|
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
593
576
|
})();
|
|
594
|
-
// webpack/runtime/make_namespace_object
|
|
595
|
-
(() => {
|
|
596
|
-
// define __esModule on exports
|
|
597
|
-
__webpack_require__.r = (exports) => {
|
|
598
|
-
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
599
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
600
|
-
}
|
|
601
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
602
|
-
};
|
|
603
|
-
})();
|
|
604
577
|
var __webpack_exports__ = {};
|
|
605
578
|
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
606
579
|
(() => {
|
|
607
|
-
__webpack_require__.r(__webpack_exports__);
|
|
608
580
|
__webpack_require__.d(__webpack_exports__, {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
581
|
+
$j: () => (/* reexport safe */ _blocks__rspack_import_0.$j),
|
|
582
|
+
E2: () => (/* reexport safe */ _blocks__rspack_import_0.E2),
|
|
583
|
+
Nl: () => (/* reexport safe */ _blocks__rspack_import_0.Nl),
|
|
584
|
+
No: () => (/* reexport safe */ _blocks__rspack_import_0.No),
|
|
585
|
+
O_: () => (/* reexport safe */ _blocks__rspack_import_0.O_),
|
|
586
|
+
Tl: () => (/* reexport safe */ _blocks__rspack_import_0.Tl),
|
|
587
|
+
Zm: () => (/* reexport safe */ _blocks__rspack_import_0.Zm),
|
|
588
|
+
eB: () => (/* reexport safe */ _blocks__rspack_import_0.eB),
|
|
589
|
+
fe: () => (/* reexport safe */ _blocks__rspack_import_0.fe),
|
|
590
|
+
hL: () => (/* reexport safe */ _blocks__rspack_import_0.hL),
|
|
591
|
+
j7: () => (/* reexport safe */ _blocks__rspack_import_0.j7),
|
|
592
|
+
kF: () => (/* reexport safe */ _blocks__rspack_import_0.kF),
|
|
593
|
+
ot: () => (/* reexport safe */ _blocks__rspack_import_0.ot),
|
|
594
|
+
qY: () => (/* reexport safe */ _blocks__rspack_import_0.qY)
|
|
623
595
|
});
|
|
624
|
-
/* import */ var _blocks__rspack_import_0 = __webpack_require__(
|
|
596
|
+
/* import */ var _blocks__rspack_import_0 = __webpack_require__(980);
|
|
625
597
|
|
|
626
598
|
|
|
627
599
|
|
|
628
600
|
})();
|
|
629
601
|
|
|
630
|
-
var __webpack_exports__AndBuilder = __webpack_exports__.
|
|
631
|
-
var __webpack_exports__ArrayBuilder = __webpack_exports__
|
|
632
|
-
var __webpack_exports__AssignmentBuilder = __webpack_exports__.
|
|
633
|
-
var __webpack_exports__Block = __webpack_exports__.
|
|
634
|
-
var __webpack_exports__CodeBuilder = __webpack_exports__.
|
|
635
|
-
var __webpack_exports__ContainerBlock = __webpack_exports__.
|
|
636
|
-
var __webpack_exports__FunctionBuilder = __webpack_exports__.
|
|
637
|
-
var __webpack_exports__FunctionFactoryBuilder = __webpack_exports__.
|
|
638
|
-
var __webpack_exports__IfBuilder = __webpack_exports__.
|
|
639
|
-
var __webpack_exports__ObjectBuilder = __webpack_exports__.
|
|
640
|
-
var __webpack_exports__RawBuilder = __webpack_exports__.
|
|
641
|
-
var __webpack_exports__SlotBlock = __webpack_exports__.
|
|
642
|
-
var __webpack_exports__StringBuilder = __webpack_exports__.
|
|
643
|
-
var __webpack_exports__VariableBuilder = __webpack_exports__.
|
|
602
|
+
var __webpack_exports__AndBuilder = __webpack_exports__.No;
|
|
603
|
+
var __webpack_exports__ArrayBuilder = __webpack_exports__.$j;
|
|
604
|
+
var __webpack_exports__AssignmentBuilder = __webpack_exports__.hL;
|
|
605
|
+
var __webpack_exports__Block = __webpack_exports__.eB;
|
|
606
|
+
var __webpack_exports__CodeBuilder = __webpack_exports__.Nl;
|
|
607
|
+
var __webpack_exports__ContainerBlock = __webpack_exports__.j7;
|
|
608
|
+
var __webpack_exports__FunctionBuilder = __webpack_exports__.kF;
|
|
609
|
+
var __webpack_exports__FunctionFactoryBuilder = __webpack_exports__.O_;
|
|
610
|
+
var __webpack_exports__IfBuilder = __webpack_exports__.Zm;
|
|
611
|
+
var __webpack_exports__ObjectBuilder = __webpack_exports__.Tl;
|
|
612
|
+
var __webpack_exports__RawBuilder = __webpack_exports__.qY;
|
|
613
|
+
var __webpack_exports__SlotBlock = __webpack_exports__.E2;
|
|
614
|
+
var __webpack_exports__StringBuilder = __webpack_exports__.fe;
|
|
615
|
+
var __webpack_exports__VariableBuilder = __webpack_exports__.ot;
|
|
644
616
|
export { __webpack_exports__AndBuilder as AndBuilder, __webpack_exports__ArrayBuilder as ArrayBuilder, __webpack_exports__AssignmentBuilder as AssignmentBuilder, __webpack_exports__Block as Block, __webpack_exports__CodeBuilder as CodeBuilder, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__FunctionBuilder as FunctionBuilder, __webpack_exports__FunctionFactoryBuilder as FunctionFactoryBuilder, __webpack_exports__IfBuilder as IfBuilder, __webpack_exports__ObjectBuilder as ObjectBuilder, __webpack_exports__RawBuilder as RawBuilder, __webpack_exports__SlotBlock as SlotBlock, __webpack_exports__StringBuilder as StringBuilder, __webpack_exports__VariableBuilder as VariableBuilder };
|
|
645
617
|
|
|
646
618
|
//# sourceMappingURL=index.js.map
|