@contember/binding 0.8.0-alpha.2.1 → 0.8.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/binding.d.ts CHANGED
@@ -1800,9 +1800,9 @@ export declare interface SugarableUnconstrainedQualifiedSingleEntity extends Sug
1800
1800
  hasOneRelationPath?: SugarableHasOneRelation[] | SugarableHasOneRelation;
1801
1801
  }
1802
1802
 
1803
- export declare const SugaredField: NamedExoticComponent<SugaredFieldProps>;
1803
+ export declare const SugaredField: <Persisted extends Scalar = Scalar>(props: SugaredFieldProps<Persisted>) => ReactElement;
1804
1804
 
1805
- export declare interface SugaredFieldProps extends Omit<FieldProps, 'field'> {
1805
+ export declare interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {
1806
1806
  field: string | SugaredRelativeSingleField;
1807
1807
  }
1808
1808
 
@@ -2,8 +2,8 @@ import { Leaf, BranchNode, ChildrenAnalyzer } from '@contember/react-multipass-r
2
2
  import { BindingError } from '../BindingError.js';
3
3
  import { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder.js';
4
4
  import { Environment } from '../dao/Environment.js';
5
- import { EntityFieldMarkersContainer } from '../markers/EntityFieldMarkersContainer.js';
6
5
  import { MarkerTreeRoot } from '../markers/MarkerTreeRoot.js';
6
+ import { EntityFieldMarkersContainer } from '../markers/EntityFieldMarkersContainer.js';
7
7
 
8
8
  class MarkerTreeGenerator {
9
9
  constructor(sourceTree, environment = Environment.create()) {
@@ -14,7 +14,7 @@ class MarkerTreeGenerator {
14
14
  generate() {
15
15
  const processed = MarkerTreeGenerator.childrenAnalyzer.processChildren(this.sourceTree, this.environment);
16
16
  if (processed.length === 0) {
17
- throw new BindingError("Empty data binding tree discovered. Try adding some fields\u2026");
17
+ return new MarkerTreeRoot(new Map(), new Map());
18
18
  }
19
19
  const collectedMarkers = MarkerTreeGenerator.mapNodeResultToEntityFields(processed);
20
20
  if (collectedMarkers instanceof EntityFieldMarkersContainer) {
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../src/core/MarkerTreeGenerator.ts"],"sourcesContent":["import { BranchNode, ChildrenAnalyzer, Leaf, RawNodeRepresentation } from '@contember/react-multipass-rendering'\nimport type { ReactNode } from 'react'\nimport { BindingError } from '../BindingError'\nimport { Environment } from '../dao'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '../markers'\nimport type { Alias } from '../treeParameters'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Fragment = EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker\ntype Terminals = FieldMarker | HasOneRelationMarker | Fragment\ntype Nonterminals = HasOneRelationMarker | HasManyRelationMarker | Fragment\n\nexport class MarkerTreeGenerator {\n\tprivate static childrenAnalyzer = MarkerTreeGenerator.initializeChildrenAnalyzer()\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst processed = MarkerTreeGenerator.childrenAnalyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (processed.length === 0) {\n\t\t\tthrow new BindingError('Empty data binding tree discovered. Try adding some fields…')\n\t\t}\n\n\t\tconst collectedMarkers = MarkerTreeGenerator.mapNodeResultToEntityFields(processed)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: Map<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n\tprivate static mapNodeResultToEntityFields(\n\t\tresult: RawNodeRepresentation<Terminals, Nonterminals>,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\tconst builder = new IncrementalMarkerBuilder()\n\n\t\tif (!result) {\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tif (!Array.isArray(result)) {\n\t\t\tbuilder.mutateIn(result)\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tfor (const marker of result) {\n\t\t\tbuilder.mutateIn(marker)\n\t\t}\n\n\t\treturn builder.getFinalMarker()\n\t}\n\n\tprivate static initializeChildrenAnalyzer(): ChildrenAnalyzer<Terminals, Nonterminals, Environment> {\n\t\tconst fieldMarkerLeaf = new Leaf<any, Environment>('generateLeafMarker')\n\n\t\tconst branchMarkerBranchNode = new BranchNode<any, Environment>(\n\t\t\t'generateBranchMarker',\n\t\t\tthis.mapNodeResultToEntityFields,\n\t\t\t{ childrenAreOptional: true },\n\t\t)\n\n\t\treturn new ChildrenAnalyzer([fieldMarkerLeaf], [branchMarkerBranchNode], {\n\t\t\tstaticRenderFactoryName: 'staticRender',\n\t\t\trenderPropsErrorMessage:\n\t\t\t\t`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`,\n\t\t\tignoreRenderProps: false,\n\t\t\tstaticContextFactoryName: 'generateEnvironment',\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;0BAqBiC;AAAA,EAGzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;AAAhF;AAA+B;AAAA;AAAA,SAF3C,mBAAmB,oBAAoB;AAAA,EAI/C,WAA2B;AACjC,UAAM,YAAY,oBAAoB,iBAAiB,gBAAgB,KAAK,YAAY,KAAK;AAE7F,QAAI,UAAU,WAAW,GAAG;AAC3B,YAAM,IAAI,aAAa;AAAA;AAGxB,UAAM,mBAAmB,oBAAoB,4BAA4B;AAEzE,QAAI,4BAA4B,6BAA6B;AAC5D,YAAM,IAAI;AAAA;AAEX,QAAI,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAI;AAAA;AAEX,QAAI,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAI;AAAA;AAEX,QAAI,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAI;AAAA;AAGX,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAI,eAAe,UAAU,KAAK,8BAA8B;AAAA;AAAA,EAGhE,8BACP,iBACqB;AACrB,UAAM,eAAe,IAAI;AAEzB,eAAW,CAAC,iBAAiB,YAAY,iBAAiB;AACzD,YAAM,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA;AAED,iBAAW,SAAS,SAAS;AAC5B,cAAM,sBAAsB,aAAa,IAAI;AAC7C,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA;AAED,gBAAM,IAAI,aACT,qCAAqC;AAAA;AAGvC,qBAAa,IAAI,OAAO;AAAA;AAAA;AAI1B,WAAO;AAAA;AAAA,SAGO,4BACd,QACiE;AACjE,UAAM,UAAU,IAAI;AAEpB,QAAI,CAAC,QAAQ;AACZ,aAAO,QAAQ;AAAA;AAGhB,QAAI,CAAC,MAAM,QAAQ,SAAS;AAC3B,cAAQ,SAAS;AACjB,aAAO,QAAQ;AAAA;AAGhB,eAAW,UAAU,QAAQ;AAC5B,cAAQ,SAAS;AAAA;AAGlB,WAAO,QAAQ;AAAA;AAAA,SAGD,6BAAqF;AACnG,UAAM,kBAAkB,IAAI,KAAuB;AAEnD,UAAM,yBAAyB,IAAI,WAClC,wBACA,KAAK,6BACL,EAAE,qBAAqB;AAGxB,WAAO,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,yBAAyB;AAAA,MACxE,yBAAyB;AAAA,MACzB,yBACC;AAAA,MAGD,mBAAmB;AAAA,MACnB,0BAA0B;AAAA;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../src/core/MarkerTreeGenerator.ts"],"sourcesContent":["import { BranchNode, ChildrenAnalyzer, Leaf, RawNodeRepresentation } from '@contember/react-multipass-rendering'\nimport type { ReactNode } from 'react'\nimport { BindingError } from '../BindingError'\nimport { Environment } from '../dao'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '../markers'\nimport type { Alias } from '../treeParameters'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Fragment = EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker\ntype Terminals = FieldMarker | HasOneRelationMarker | Fragment\ntype Nonterminals = HasOneRelationMarker | HasManyRelationMarker | Fragment\n\nexport class MarkerTreeGenerator {\n\tprivate static childrenAnalyzer = MarkerTreeGenerator.initializeChildrenAnalyzer()\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst processed = MarkerTreeGenerator.childrenAnalyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (processed.length === 0) {\n\t\t\treturn new MarkerTreeRoot(new Map(), new Map())\n\t\t}\n\n\t\tconst collectedMarkers = MarkerTreeGenerator.mapNodeResultToEntityFields(processed)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: Map<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n\tprivate static mapNodeResultToEntityFields(\n\t\tresult: RawNodeRepresentation<Terminals, Nonterminals>,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\tconst builder = new IncrementalMarkerBuilder()\n\n\t\tif (!result) {\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tif (!Array.isArray(result)) {\n\t\t\tbuilder.mutateIn(result)\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tfor (const marker of result) {\n\t\t\tbuilder.mutateIn(marker)\n\t\t}\n\n\t\treturn builder.getFinalMarker()\n\t}\n\n\tprivate static initializeChildrenAnalyzer(): ChildrenAnalyzer<Terminals, Nonterminals, Environment> {\n\t\tconst fieldMarkerLeaf = new Leaf<any, Environment>('generateLeafMarker')\n\n\t\tconst branchMarkerBranchNode = new BranchNode<any, Environment>(\n\t\t\t'generateBranchMarker',\n\t\t\tthis.mapNodeResultToEntityFields,\n\t\t\t{ childrenAreOptional: true },\n\t\t)\n\n\t\treturn new ChildrenAnalyzer([fieldMarkerLeaf], [branchMarkerBranchNode], {\n\t\t\tstaticRenderFactoryName: 'staticRender',\n\t\t\trenderPropsErrorMessage:\n\t\t\t\t`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`,\n\t\t\tignoreRenderProps: false,\n\t\t\tstaticContextFactoryName: 'generateEnvironment',\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;0BAqBiC;AAAA,EAGzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;AAAhF;AAA+B;AAAA;AAAA,SAF3C,mBAAmB,oBAAoB;AAAA,EAI/C,WAA2B;AACjC,UAAM,YAAY,oBAAoB,iBAAiB,gBAAgB,KAAK,YAAY,KAAK;AAE7F,QAAI,UAAU,WAAW,GAAG;AAC3B,aAAO,IAAI,eAAe,IAAI,OAAO,IAAI;AAAA;AAG1C,UAAM,mBAAmB,oBAAoB,4BAA4B;AAEzE,QAAI,4BAA4B,6BAA6B;AAC5D,YAAM,IAAI;AAAA;AAEX,QAAI,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAI;AAAA;AAEX,QAAI,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAI;AAAA;AAEX,QAAI,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAI;AAAA;AAGX,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAI,eAAe,UAAU,KAAK,8BAA8B;AAAA;AAAA,EAGhE,8BACP,iBACqB;AACrB,UAAM,eAAe,IAAI;AAEzB,eAAW,CAAC,iBAAiB,YAAY,iBAAiB;AACzD,YAAM,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA;AAED,iBAAW,SAAS,SAAS;AAC5B,cAAM,sBAAsB,aAAa,IAAI;AAC7C,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA;AAED,gBAAM,IAAI,aACT,qCAAqC;AAAA;AAGvC,qBAAa,IAAI,OAAO;AAAA;AAAA;AAI1B,WAAO;AAAA;AAAA,SAGO,4BACd,QACiE;AACjE,UAAM,UAAU,IAAI;AAEpB,QAAI,CAAC,QAAQ;AACZ,aAAO,QAAQ;AAAA;AAGhB,QAAI,CAAC,MAAM,QAAQ,SAAS;AAC3B,cAAQ,SAAS;AACjB,aAAO,QAAQ;AAAA;AAGhB,eAAW,UAAU,QAAQ;AAC5B,cAAQ,SAAS;AAAA;AAGlB,WAAO,QAAQ;AAAA;AAAA,SAGD,6BAAqF;AACnG,UAAM,kBAAkB,IAAI,KAAuB;AAEnD,UAAM,yBAAyB,IAAI,WAClC,wBACA,KAAK,6BACL,EAAE,qBAAqB;AAGxB,WAAO,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,yBAAyB;AAAA,MACxE,yBAAyB;AAAA,MACzB,yBACC;AAAA,MAGD,mBAAmB;AAAA,MACnB,0BAA0B;AAAA;AAAA;AAAA;;;;"}
@@ -9,7 +9,7 @@ const aliasToUuidReplacement = "-";
9
9
  const standaloneUuidPrefix = uuidToAliasReplacement;
10
10
  class MutationAlias {
11
11
  static encodeTopLevel(operation) {
12
- const treeRootId = operation.treeRootId === void 0 ? "u" : `t${operation.treeRootId}t`;
12
+ const treeRootId = operation.treeRootId === void 0 ? "u" : `t${operation.treeRootId.replace("-", "_")}t`;
13
13
  const entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement);
14
14
  const alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`;
15
15
  {
@@ -1 +1 @@
1
- {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";;;AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;oBAEF;AAAA,SACZ,eAAe,WAA8C;AAC1E,UAAM,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU;AAC5E,UAAM,WAAW,UAAU,SAAS,QAAQ,kBAAkB;AAE9D,UAAM,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;AAExG,IAAyB;AACxB,YAAM,UAAU,MAAM,MAAM;AAE5B,UAAI,CAAC,SAAS;AACb,cAAM,IAAI;AAAA;AAAA;AAIZ,WAAO;AAAA;AAAA,SAGM,eAAe,OAAsD;AAClF,UAAM,UAAU,MAAM,MAAM;AAE5B,QAAI,CAAC,SAAS;AACb,aAAO;AAAA;AAER,UAAM,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;AACpF,UAAM,qBAAsC,QAAQ;AACpD,UAAM,OAAO,QAAQ;AACrB,UAAM,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;AAC/F,UAAM,WAAW,QAAQ,GAAG,QAAQ,kBAAkB;AAEtD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,SAIY,eAAe,UAA6B;AACzD,WAAO,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB;AAAA;AAAA,SAG7D,eAAe,OAAmC;AAC/D,WAAO,GAAG,MAAM,UAAU,qBAAqB,QAAQ,QAAQ,kBAAkB;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId.replace('-', '_')}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";;;AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;oBAEF;AAAA,SACZ,eAAe,WAA8C;AAC1E,UAAM,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU,WAAW,QAAQ,KAAK;AACpG,UAAM,WAAW,UAAU,SAAS,QAAQ,kBAAkB;AAE9D,UAAM,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;AAExG,IAAyB;AACxB,YAAM,UAAU,MAAM,MAAM;AAE5B,UAAI,CAAC,SAAS;AACb,cAAM,IAAI;AAAA;AAAA;AAIZ,WAAO;AAAA;AAAA,SAGM,eAAe,OAAsD;AAClF,UAAM,UAAU,MAAM,MAAM;AAE5B,QAAI,CAAC,SAAS;AACb,aAAO;AAAA;AAER,UAAM,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;AACpF,UAAM,qBAAsC,QAAQ;AACpD,UAAM,OAAO,QAAQ;AACrB,UAAM,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;AAC/F,UAAM,WAAW,QAAQ,GAAG,QAAQ,kBAAkB;AAEtD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,SAIY,eAAe,UAA6B;AACzD,WAAO,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB;AAAA;AAAA,SAG7D,eAAe,OAAmC;AAC/D,WAAO,GAAG,MAAM,UAAU,qBAAqB,QAAQ,QAAQ,kBAAkB;AAAA;AAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\n\nexport interface SugaredFieldProps extends Omit<FieldProps, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\nexport const SugaredField = Component<SugaredFieldProps>(props => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField')\n"],"names":[],"mappings":";;;;MAOa,eAAe,UAA6B,WAAS;AACjE,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,yCAAQ,OAAD;AAAA,SAAW;AAAA,MAAO,OAAO,MAAM;AAAA;AAAA;AAEvC,uCAAQ,OAAD;AAAA,OAAW;AAAA,OAAW,MAAM;AAAA;AAAA,GACjC;;;;"}
1
+ {"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\nimport { FieldValue } from '../treeParameters'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;;MASa,eAAe,UAAU,CAA4C,UAAwC;AACzH,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,yCAAQ,OAAD;AAAA,SAAW;AAAA,MAAO,OAAO,MAAM;AAAA;AAAA;AAEvC,uCAAQ,OAAD;AAAA,OAAW;AAAA,OAAW,MAAM;AAAA;AAAA,GACjC;;;;"}
@@ -8,8 +8,8 @@ import { Leaf, BranchNode, ChildrenAnalyzer } from "@contember/react-multipass-r
8
8
  import { BindingError } from "../BindingError.js";
9
9
  import { IncrementalMarkerBuilder } from "./IncrementalMarkerBuilder.js";
10
10
  import { Environment } from "../dao/Environment.js";
11
- import { EntityFieldMarkersContainer } from "../markers/EntityFieldMarkersContainer.js";
12
11
  import { MarkerTreeRoot } from "../markers/MarkerTreeRoot.js";
12
+ import { EntityFieldMarkersContainer } from "../markers/EntityFieldMarkersContainer.js";
13
13
  const _MarkerTreeGenerator = class {
14
14
  constructor(sourceTree, environment = Environment.create()) {
15
15
  this.sourceTree = sourceTree;
@@ -18,7 +18,7 @@ const _MarkerTreeGenerator = class {
18
18
  generate() {
19
19
  const processed = _MarkerTreeGenerator.childrenAnalyzer.processChildren(this.sourceTree, this.environment);
20
20
  if (processed.length === 0) {
21
- throw new BindingError("Empty data binding tree discovered. Try adding some fields\u2026");
21
+ return new MarkerTreeRoot(new Map(), new Map());
22
22
  }
23
23
  const collectedMarkers = _MarkerTreeGenerator.mapNodeResultToEntityFields(processed);
24
24
  if (collectedMarkers instanceof EntityFieldMarkersContainer) {
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../src/core/MarkerTreeGenerator.ts"],"sourcesContent":["import { BranchNode, ChildrenAnalyzer, Leaf, RawNodeRepresentation } from '@contember/react-multipass-rendering'\nimport type { ReactNode } from 'react'\nimport { BindingError } from '../BindingError'\nimport { Environment } from '../dao'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '../markers'\nimport type { Alias } from '../treeParameters'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Fragment = EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker\ntype Terminals = FieldMarker | HasOneRelationMarker | Fragment\ntype Nonterminals = HasOneRelationMarker | HasManyRelationMarker | Fragment\n\nexport class MarkerTreeGenerator {\n\tprivate static childrenAnalyzer = MarkerTreeGenerator.initializeChildrenAnalyzer()\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst processed = MarkerTreeGenerator.childrenAnalyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (processed.length === 0) {\n\t\t\tthrow new BindingError('Empty data binding tree discovered. Try adding some fields…')\n\t\t}\n\n\t\tconst collectedMarkers = MarkerTreeGenerator.mapNodeResultToEntityFields(processed)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: Map<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n\tprivate static mapNodeResultToEntityFields(\n\t\tresult: RawNodeRepresentation<Terminals, Nonterminals>,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\tconst builder = new IncrementalMarkerBuilder()\n\n\t\tif (!result) {\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tif (!Array.isArray(result)) {\n\t\t\tbuilder.mutateIn(result)\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tfor (const marker of result) {\n\t\t\tbuilder.mutateIn(marker)\n\t\t}\n\n\t\treturn builder.getFinalMarker()\n\t}\n\n\tprivate static initializeChildrenAnalyzer(): ChildrenAnalyzer<Terminals, Nonterminals, Environment> {\n\t\tconst fieldMarkerLeaf = new Leaf<any, Environment>('generateLeafMarker')\n\n\t\tconst branchMarkerBranchNode = new BranchNode<any, Environment>(\n\t\t\t'generateBranchMarker',\n\t\t\tthis.mapNodeResultToEntityFields,\n\t\t\t{ childrenAreOptional: true },\n\t\t)\n\n\t\treturn new ChildrenAnalyzer([fieldMarkerLeaf], [branchMarkerBranchNode], {\n\t\t\tstaticRenderFactoryName: 'staticRender',\n\t\t\trenderPropsErrorMessage:\n\t\t\t\t`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`,\n\t\t\tignoreRenderProps: false,\n\t\t\tstaticContextFactoryName: 'generateEnvironment',\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;mCAqBiC;AAAA,EAGzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;;;;EAEpG,WAA2B;UAC3B,YAAY,qBAAoB,iBAAiB,gBAAgB,KAAK,YAAY,KAAK;QAEzF,UAAU,WAAW,GAAG;YACrB,IAAI,aAAa;AAAA;UAGlB,mBAAmB,qBAAoB,4BAA4B;QAErE,4BAA4B,6BAA6B;YACtD,IAAI;AAAA;QAEP,iBAAiB,OAAO,QAAQ,MAAM;YACnC,IAAI;AAAA;QAEP,iBAAiB,oBAAoB,QAAW;YAC7C,IAAI;AAAA;QAEP,iBAAiB,aAAa,QAAW;YACtC,IAAI;AAAA;UAGL,WAAW,iBAAiB;WAE3B,IAAI,eAAe,UAAU,KAAK,8BAA8B;AAAA;AAAA,EAGhE,8BACP,iBACqB;UACf,eAAe,IAAI;eAEd,CAAC,iBAAiB,YAAY,iBAAiB;YACnD,UAAU,QAAQ,WAAW;UAC/B,YAAY,UAAa,QAAQ,SAAS,GAAG;;;iBAGtC,SAAS,SAAS;cACtB,sBAAsB,aAAa,IAAI;YACzC,wBAAwB,QAAW;cAClC,wBAAwB,iBAAiB;;;gBAGvC,IAAI,aACT,qCAAqC;AAAA;qBAG1B,IAAI,OAAO;AAAA;AAAA;WAInB;AAAA;AAAA,SAGO,4BACd,QACiE;UAC3D,UAAU,IAAI;QAEhB,CAAC,QAAQ;aACL,QAAQ;AAAA;QAGZ,CAAC,MAAM,QAAQ,SAAS;cACnB,SAAS;aACV,QAAQ;AAAA;eAGL,UAAU,QAAQ;cACpB,SAAS;AAAA;WAGX,QAAQ;AAAA;AAAA,SAGD,6BAAqF;UAC7F,kBAAkB,IAAI,KAAuB;UAE7C,yBAAyB,IAAI,WAClC,wBACA,KAAK,6BACL,EAAE,qBAAqB;WAGjB,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,yBAAyB;AAAA,MACxE,yBAAyB;AAAA,MACzB,yBACC;AAAA,MAGD,mBAAmB;AAAA,MACnB,0BAA0B;AAAA;AAAA;AAAA;;AA/Fb,mCAAA,oBAAmB,qBAAoB;;"}
1
+ {"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../src/core/MarkerTreeGenerator.ts"],"sourcesContent":["import { BranchNode, ChildrenAnalyzer, Leaf, RawNodeRepresentation } from '@contember/react-multipass-rendering'\nimport type { ReactNode } from 'react'\nimport { BindingError } from '../BindingError'\nimport { Environment } from '../dao'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '../markers'\nimport type { Alias } from '../treeParameters'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Fragment = EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker\ntype Terminals = FieldMarker | HasOneRelationMarker | Fragment\ntype Nonterminals = HasOneRelationMarker | HasManyRelationMarker | Fragment\n\nexport class MarkerTreeGenerator {\n\tprivate static childrenAnalyzer = MarkerTreeGenerator.initializeChildrenAnalyzer()\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst processed = MarkerTreeGenerator.childrenAnalyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (processed.length === 0) {\n\t\t\treturn new MarkerTreeRoot(new Map(), new Map())\n\t\t}\n\n\t\tconst collectedMarkers = MarkerTreeGenerator.mapNodeResultToEntityFields(processed)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: Map<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n\tprivate static mapNodeResultToEntityFields(\n\t\tresult: RawNodeRepresentation<Terminals, Nonterminals>,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\tconst builder = new IncrementalMarkerBuilder()\n\n\t\tif (!result) {\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tif (!Array.isArray(result)) {\n\t\t\tbuilder.mutateIn(result)\n\t\t\treturn builder.getFinalMarker()\n\t\t}\n\n\t\tfor (const marker of result) {\n\t\t\tbuilder.mutateIn(marker)\n\t\t}\n\n\t\treturn builder.getFinalMarker()\n\t}\n\n\tprivate static initializeChildrenAnalyzer(): ChildrenAnalyzer<Terminals, Nonterminals, Environment> {\n\t\tconst fieldMarkerLeaf = new Leaf<any, Environment>('generateLeafMarker')\n\n\t\tconst branchMarkerBranchNode = new BranchNode<any, Environment>(\n\t\t\t'generateBranchMarker',\n\t\t\tthis.mapNodeResultToEntityFields,\n\t\t\t{ childrenAreOptional: true },\n\t\t)\n\n\t\treturn new ChildrenAnalyzer([fieldMarkerLeaf], [branchMarkerBranchNode], {\n\t\t\tstaticRenderFactoryName: 'staticRender',\n\t\t\trenderPropsErrorMessage:\n\t\t\t\t`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`,\n\t\t\tignoreRenderProps: false,\n\t\t\tstaticContextFactoryName: 'generateEnvironment',\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;mCAqBiC;AAAA,EAGzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;;;;EAEpG,WAA2B;UAC3B,YAAY,qBAAoB,iBAAiB,gBAAgB,KAAK,YAAY,KAAK;QAEzF,UAAU,WAAW,GAAG;aACpB,IAAI,eAAe,IAAI,OAAO,IAAI;AAAA;UAGpC,mBAAmB,qBAAoB,4BAA4B;QAErE,4BAA4B,6BAA6B;YACtD,IAAI;AAAA;QAEP,iBAAiB,OAAO,QAAQ,MAAM;YACnC,IAAI;AAAA;QAEP,iBAAiB,oBAAoB,QAAW;YAC7C,IAAI;AAAA;QAEP,iBAAiB,aAAa,QAAW;YACtC,IAAI;AAAA;UAGL,WAAW,iBAAiB;WAE3B,IAAI,eAAe,UAAU,KAAK,8BAA8B;AAAA;AAAA,EAGhE,8BACP,iBACqB;UACf,eAAe,IAAI;eAEd,CAAC,iBAAiB,YAAY,iBAAiB;YACnD,UAAU,QAAQ,WAAW;UAC/B,YAAY,UAAa,QAAQ,SAAS,GAAG;;;iBAGtC,SAAS,SAAS;cACtB,sBAAsB,aAAa,IAAI;YACzC,wBAAwB,QAAW;cAClC,wBAAwB,iBAAiB;;;gBAGvC,IAAI,aACT,qCAAqC;AAAA;qBAG1B,IAAI,OAAO;AAAA;AAAA;WAInB;AAAA;AAAA,SAGO,4BACd,QACiE;UAC3D,UAAU,IAAI;QAEhB,CAAC,QAAQ;aACL,QAAQ;AAAA;QAGZ,CAAC,MAAM,QAAQ,SAAS;cACnB,SAAS;aACV,QAAQ;AAAA;eAGL,UAAU,QAAQ;cACpB,SAAS;AAAA;WAGX,QAAQ;AAAA;AAAA,SAGD,6BAAqF;UAC7F,kBAAkB,IAAI,KAAuB;UAE7C,yBAAyB,IAAI,WAClC,wBACA,KAAK,6BACL,EAAE,qBAAqB;WAGjB,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,yBAAyB;AAAA,MACxE,yBAAyB;AAAA,MACzB,yBACC;AAAA,MAGD,mBAAmB;AAAA,MACnB,0BAA0B;AAAA;AAAA;AAAA;;AA/Fb,mCAAA,oBAAmB,qBAAoB;;"}
@@ -7,7 +7,7 @@ const aliasToUuidReplacement = "-";
7
7
  const standaloneUuidPrefix = uuidToAliasReplacement;
8
8
  class MutationAlias {
9
9
  static encodeTopLevel(operation) {
10
- const treeRootId = operation.treeRootId === void 0 ? "u" : `t${operation.treeRootId}t`;
10
+ const treeRootId = operation.treeRootId === void 0 ? "u" : `t${operation.treeRootId.replace("-", "_")}t`;
11
11
  const entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement);
12
12
  const alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`;
13
13
  return alias;
@@ -1 +1 @@
1
- {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;oBAEF;AAAA,SACZ,eAAe,WAA8C;UACpE,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU;UACtE,WAAW,UAAU,SAAS,QAAQ,kBAAkB;UAExD,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;WAUjG;AAAA;AAAA,SAGM,eAAe,OAAsD;UAC5E,UAAU,MAAM,MAAM;QAExB,CAAC,SAAS;aACN;AAAA;UAEF,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;UAC9E,qBAAsC,QAAQ;UAC9C,OAAO,QAAQ;UACf,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;UACzF,WAAW,QAAQ,GAAG,QAAQ,kBAAkB;WAE/C;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,SAIY,eAAe,UAA6B;WAClD,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB;AAAA;AAAA,SAG7D,eAAe,OAAmC;WACxD,GAAG,MAAM,UAAU,qBAAqB,QAAQ,QAAQ,kBAAkB;AAAA;AAAA;;"}
1
+ {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId.replace('-', '_')}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;oBAEF;AAAA,SACZ,eAAe,WAA8C;UACpE,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU,WAAW,QAAQ,KAAK;UAC9F,WAAW,UAAU,SAAS,QAAQ,kBAAkB;UAExD,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;WAUjG;AAAA;AAAA,SAGM,eAAe,OAAsD;UAC5E,UAAU,MAAM,MAAM;QAExB,CAAC,SAAS;aACN;AAAA;UAEF,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;UAC9E,qBAAsC,QAAQ;UAC9C,OAAO,QAAQ;UACf,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;UACzF,WAAW,QAAQ,GAAG,QAAQ,kBAAkB;WAE/C;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,SAIY,eAAe,UAA6B;WAClD,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB;AAAA;AAAA,SAG7D,eAAe,OAAmC;WACxD,GAAG,MAAM,UAAU,qBAAqB,QAAQ,QAAQ,kBAAkB;AAAA;AAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\n\nexport interface SugaredFieldProps extends Omit<FieldProps, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\nexport const SugaredField = Component<SugaredFieldProps>(props => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField')\n"],"names":[],"mappings":";;;MAOa,eAAe,UAA6B,WAAS;MAC7D,OAAO,MAAM,UAAU,UAAU;yCAC5B,OAAD;AAAA,SAAW;AAAA,MAAO,OAAO,MAAM;AAAA;AAAA;uCAE/B,OAAD;AAAA,OAAW;AAAA,OAAW,MAAM;AAAA;AAAA,GACjC;;"}
1
+ {"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\nimport { FieldValue } from '../treeParameters'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;MASa,eAAe,UAAU,CAA4C,UAAwC;MACrH,OAAO,MAAM,UAAU,UAAU;yCAC5B,OAAD;AAAA,SAAW;AAAA,MAAO,OAAO,MAAM;AAAA;AAAA;uCAE/B,OAAD;AAAA,OAAW;AAAA,OAAW,MAAM;AAAA;AAAA,GACjC;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contember/binding",
3
3
  "license": "Apache-2.0",
4
- "version": "0.8.0-alpha.2.1",
4
+ "version": "0.8.0-alpha.6",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/production/index.js",
@@ -18,10 +18,10 @@
18
18
  ],
19
19
  "typings": "./dist/binding.d.ts",
20
20
  "dependencies": {
21
- "@contember/client": "0.8.0-alpha.2.1",
22
- "@contember/react-client": "0.8.0-alpha.2.1",
23
- "@contember/react-multipass-rendering": "0.8.0-alpha.2.1",
24
- "@contember/react-utils": "0.8.0-alpha.2.1",
21
+ "@contember/client": "0.8.0-alpha.6",
22
+ "@contember/react-client": "0.8.0-alpha.6",
23
+ "@contember/react-multipass-rendering": "0.8.0-alpha.6",
24
+ "@contember/react-utils": "0.8.0-alpha.6",
25
25
  "chevrotain": "6.5.0",
26
26
  "js-levenshtein": "1.1.6",
27
27
  "uuid": "8.3.2"