@contember/binding-legacy 2.2.0-alpha.18 → 2.2.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/development/src/core/operations/FieldOperations.cjs +2 -2
  2. package/dist/development/src/core/operations/FieldOperations.cjs.map +1 -1
  3. package/dist/development/src/core/operations/FieldOperations.js +2 -2
  4. package/dist/development/src/core/operations/FieldOperations.js.map +1 -1
  5. package/dist/development/src/core/operations/ListOperations.cjs +2 -2
  6. package/dist/development/src/core/operations/ListOperations.cjs.map +1 -1
  7. package/dist/development/src/core/operations/ListOperations.js +2 -2
  8. package/dist/development/src/core/operations/ListOperations.js.map +1 -1
  9. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs +2 -2
  10. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +1 -1
  11. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js +2 -2
  12. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  13. package/dist/production/src/core/operations/FieldOperations.cjs +1 -1
  14. package/dist/production/src/core/operations/FieldOperations.cjs.map +1 -1
  15. package/dist/production/src/core/operations/FieldOperations.js +1 -1
  16. package/dist/production/src/core/operations/FieldOperations.js.map +1 -1
  17. package/dist/production/src/core/operations/ListOperations.cjs +2 -2
  18. package/dist/production/src/core/operations/ListOperations.cjs.map +1 -1
  19. package/dist/production/src/core/operations/ListOperations.js +2 -2
  20. package/dist/production/src/core/operations/ListOperations.js.map +1 -1
  21. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs +2 -2
  22. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +1 -1
  23. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js +2 -2
  24. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  25. package/dist/types/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +4 -5
  27. package/src/core/operations/FieldOperations.ts +2 -2
  28. package/src/core/operations/ListOperations.ts +2 -2
  29. package/src/fieldHelpers/helpers/UuidFieldHelper.ts +2 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const uuid = require("uuid");
3
+ const utilities = require("@contember/utilities");
4
4
  const bindingCommon = require("@contember/binding-common");
5
5
  const EventManager = require("../EventManager.cjs");
6
6
  const OperationsHelpers = require("./OperationsHelpers.cjs");
@@ -37,7 +37,7 @@ class FieldOperations {
37
37
  Once set, it is immutable.`
38
38
  );
39
39
  }
40
- if (typeof newValue !== "string" || !uuid.validate(newValue)) {
40
+ if (typeof newValue !== "string" || !utilities.isUuid(newValue)) {
41
41
  throw new bindingCommon.BindingError(
42
42
  `Invalid value supplied for the '${bindingCommon.PRIMARY_KEY_NAME}' field. Expecting a valid uuid but '${newValue}' was given.
43
43
  Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`
@@ -1 +1 @@
1
- {"version":3,"file":"FieldOperations.cjs","sources":["../../../../../../packages/binding-legacy/src/core/operations/FieldOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { FieldValue } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tClientGeneratedUuid,\n\tErrorAccessor,\n\tEventListenersStore,\n\tFieldAccessor,\n\tPRIMARY_KEY_NAME,\n\tServerId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { FieldState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = 'user' }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n`\n\t\t\t\t\t\t\t\t+ `Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !uuidValidate(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `\n\t\t\t\t\t\t\t\t+ `Expecting a valid uuid but '${newValue}' was given.\\n`\n\t\t\t\t\t\t\t\t+ `Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(ServerId.formatUniqueValue(newValue, entity.entityName))) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. `\n\t\t\t\t\t\t\t\t+ `It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue = field.fieldMarker.defaultValue === undefined\n\t\t\t\t\t? newValue\n\t\t\t\t\t: newValue === null\n\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount = !getEntityMarker(parent).fields.hasAtLeastOneBearingField\n\t\t\t\t\t|| !field.fieldMarker.isNonbearing\n\t\t\t\t\t|| field.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":["EventListenersStore","PRIMARY_KEY_NAME","BindingError","uuidValidate","ServerId","OperationsHelpers","ClientGeneratedUuid","StateIterator","getEntityMarker","EventManager"],"mappings":";;;;;;;;AAkBO,MAAM,gBAAgB;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY,KAAK;AAAA,EAC5D;AAAA,EAEO,YAAY,YAAmC;AACrD,WAAO,KAAK,qBAAqB,mBAAmB,UAAU;AAAA,EAC/D;AAAA,EAEO,iBAIN,OACA,OACA,UACa;AACb,QAAI,CAAC,MAAM,gBAAgB;AAC1B,YAAM,iBAAiB,IAAIA,kCAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,YACN,YACA,UACA,EAAE,QAAQ,OAAA,IAAwC,IACjD;AACD,SAAK,aAAa,cAAc,MAAM;AACrC,YAAM,EAAE,iBAAiB,OAAA,IAAW;AACpC,UAAI,oBAAoBC,cAAAA,kBAAkB;AACzC,cAAM,SAAS,WAAW,OAAO;AAER;AACxB,cAAI,aAAa,WAAW,U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D,CAAC,MAAM,YAAY,gBACnB,MAAM,mBAAmB;AAE7B,YAAI,eAAeC,aAAAA,aAAa;AAEhC,YAAI,4BAA4B;AAC/B,cAAI,CAAC,+BAA+B,0BAA0B;AAC7D;AAAA,UACD,WAAW,+BAA+B,CAAC,0BAA0B;AACpE;AAAA,UACD;AAAA,QACD;AAEA,aAAK,aAAa,oBAAoB,OAAO,YAAY;AAAA,MAC1D;AAAA,IACD,CAAC;AAAA,EACF;AACD;;"}
1
+ {"version":3,"file":"FieldOperations.cjs","sources":["../../../../../../packages/binding-legacy/src/core/operations/FieldOperations.ts"],"sourcesContent":["import { isUuid } from '@contember/utilities'\nimport type { FieldValue } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tClientGeneratedUuid,\n\tErrorAccessor,\n\tEventListenersStore,\n\tFieldAccessor,\n\tPRIMARY_KEY_NAME,\n\tServerId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { FieldState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = 'user' }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n`\n\t\t\t\t\t\t\t\t+ `Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !isUuid(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `\n\t\t\t\t\t\t\t\t+ `Expecting a valid uuid but '${newValue}' was given.\\n`\n\t\t\t\t\t\t\t\t+ `Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(ServerId.formatUniqueValue(newValue, entity.entityName))) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. `\n\t\t\t\t\t\t\t\t+ `It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue = field.fieldMarker.defaultValue === undefined\n\t\t\t\t\t? newValue\n\t\t\t\t\t: newValue === null\n\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount = !getEntityMarker(parent).fields.hasAtLeastOneBearingField\n\t\t\t\t\t|| !field.fieldMarker.isNonbearing\n\t\t\t\t\t|| field.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":["EventListenersStore","PRIMARY_KEY_NAME","BindingError","isUuid","ServerId","OperationsHelpers","ClientGeneratedUuid","StateIterator","getEntityMarker","EventManager"],"mappings":";;;;;;;;AAkBO,MAAM,gBAAgB;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY,KAAK;AAAA,EAC5D;AAAA,EAEO,YAAY,YAAmC;AACrD,WAAO,KAAK,qBAAqB,mBAAmB,UAAU;AAAA,EAC/D;AAAA,EAEO,iBAIN,OACA,OACA,UACa;AACb,QAAI,CAAC,MAAM,gBAAgB;AAC1B,YAAM,iBAAiB,IAAIA,kCAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,YACN,YACA,UACA,EAAE,QAAQ,OAAA,IAAwC,IACjD;AACD,SAAK,aAAa,cAAc,MAAM;AACrC,YAAM,EAAE,iBAAiB,OAAA,IAAW;AACpC,UAAI,oBAAoBC,cAAAA,kBAAkB;AACzC,cAAM,SAAS,WAAW,OAAO;AAER;AACxB,cAAI,aAAa,WAAW,UAAU,WAAW,aAAa,UAAa,OAAO,kBAAkB;AACnG,kBAAM,IAAIC,cAAAA;AAAAA,cACT,sBAAsBD,cAAAA,gBAAgB;AAAA;AAAA,YAAA;AAAA,UAGxC;AACA,cAAI,OAAO,aAAa,YAAY,CAACE,UAAAA,OAAO,QAAQ,GAAG;AACtD,kBAAM,IAAID,cAAAA;AAAAA,cACT,mCAAmCD,cAAAA,gBAAgB,wCACjB,QAAQ;AAAA;AAAA,YAAA;AAAA,UAG5C;AACA,cAAI,KAAK,UAAU,YAAY,IAAIG,cAAA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} from "@contember/utilities";
2
2
  import { EventListenersStore, PRIMARY_KEY_NAME, BindingError, ServerId, ClientGeneratedUuid } from "@contember/binding-common";
3
3
  import { EventManager } from "../EventManager.js";
4
4
  import { OperationsHelpers } from "./OperationsHelpers.js";
@@ -35,7 +35,7 @@ class FieldOperations {
35
35
  Once set, it is immutable.`
36
36
  );
37
37
  }
38
- if (typeof newValue !== "string" || !validate(newValue)) {
38
+ if (typeof newValue !== "string" || !isUuid(newValue)) {
39
39
  throw new BindingError(
40
40
  `Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. Expecting a valid uuid but '${newValue}' was given.
41
41
  Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`
@@ -1 +1 @@
1
- {"version":3,"file":"FieldOperations.js","sources":["../../../../../../packages/binding-legacy/src/core/operations/FieldOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { FieldValue } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tClientGeneratedUuid,\n\tErrorAccessor,\n\tEventListenersStore,\n\tFieldAccessor,\n\tPRIMARY_KEY_NAME,\n\tServerId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { FieldState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = 'user' }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n`\n\t\t\t\t\t\t\t\t+ `Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !uuidValidate(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `\n\t\t\t\t\t\t\t\t+ `Expecting a valid uuid but '${newValue}' was given.\\n`\n\t\t\t\t\t\t\t\t+ `Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(ServerId.formatUniqueValue(newValue, entity.entityName))) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. `\n\t\t\t\t\t\t\t\t+ `It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue = field.fieldMarker.defaultValue === undefined\n\t\t\t\t\t? newValue\n\t\t\t\t\t: newValue === null\n\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount = !getEntityMarker(parent).fields.hasAtLeastOneBearingField\n\t\t\t\t\t|| !field.fieldMarker.isNonbearing\n\t\t\t\t\t|| field.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":["uuidValidate"],"mappings":";;;;;;AAkBO,MAAM,gBAAgB;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY,KAAK;AAAA,EAC5D;AAAA,EAEO,YAAY,YAAmC;AACrD,WAAO,KAAK,qBAAqB,mBAAmB,UAAU;AAAA,EAC/D;AAAA,EAEO,iBAIN,OACA,OACA,UACa;AACb,QAAI,CAAC,MAAM,gBAAgB;AAC1B,YAAM,iBAAiB,IAAI,oBAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,YACN,YACA,UACA,EAAE,QAAQ,OAAA,IAAwC,IACjD;AACD,SAAK,aAAa,cAAc,MAAM;AACrC,YAAM,EAAE,iBAAiB,OAAA,IAAW;AACpC,UAAI,oBAAoB,kBAAkB;AACzC,cAAM,SAAS,WAAW,OAAO;AAER;AACxB,cAAI,aAAa,WAAW,UAAU,WAAW,aAAa,UAAa,OAAO,kBAAkB;AACnG,kBAAM,IAAI;AAAA,cACT,sBAAsB,gBAAgB;AAAA;AAAA,YAAA;AAAA,UAGxC;AACA,cAAI,OAAO,aAAa,YAAY,CAACA,SAAa,QAAQ,GAAG;AAC5D,kBAAM,IAAI;AAAA,cACT,mCAAmC,gBAAgB,wCACjB,QAAQ;AAAA;AAAA,YAAA;AAAA,UAG5C;AACA,cAAI,KAAK,UAAU,YAAY,IAAI,SAAS,kBAAkB,UAAU,OAAO,UAAU,CAAC,GAAG;AAC5F,kBAAM,IAAI;AAAA,cACT,sBAAsB,gBAAgB,eAAe,QAAQ;AAAA,YAAA;AAAA,UAG/D;AAAA,QACD;AACA,YAAI,OAAO,aAAa,UAAU;AACjC,gBAAM,IAAI,aAAA;AAAA,QACX;AACA,0BAAkB;AAAA,UACjB,KAAK;AAAA,UACL,KAAK;AAAA,UACL,KAAK;AAAA,UACL;AAAA,UACA,IAAI,oBAAoB,QAAQ;AAAA,QAAA;AAAA,MAElC;AACA,iBAAW,SAAS,cAAc,sBAAsB,KAAK,WAAW,UAAU,GAAG;AACpF,YAAI,aAAa,MAAM,OAAO;AAC7B;AAAA,QACD;AACA,YAAI,MAAM,aAAa,QAAW;AACjC,gBAAM,+BAAe,IAAA;AAAA,QACtB;AACA,cAAM,SAAS,IAAI,KAAK;AACxB,cAAM,QAAQ;AAEd,cAAM,gBAAgB,MAAM,YAAY,iBAAiB,SACtD,WACA,aAAa,OACb,MAAM,YAAY,eAClB;AACH,cAAM,2BAA2B,MAAM,mBAAmB,SAAY,OAAO,MAAM;AACnF,cAAM,8BAA8B,MAAM;AAC1C,cAAM,2BAA2B,kBAAkB;AACnD,cAAM,wBAAwB;AAE9B,cAAM,6BAA6B,CAAC,gBAAgB,MAAM,EAAE,OAAO,6BAC/D,CAAC,MAAM,YAAY,gBACnB,MAAM,mBAAmB;AAE7B,YAAI,eAAe,aAAa;AAEhC,YAAI,4BAA4B;AAC/B,cAAI,CAAC,+BAA+B,0BAA0B;AAC7D;AAAA,UACD,WAAW,+BAA+B,CAAC,0BAA0B;AACpE;AAAA,UACD;AAAA,QACD;AAEA,aAAK,aAAa,oBAAoB,OAAO,YAAY;AAAA,MAC1D;AAAA,IACD,CAAC;AAAA,EACF;AACD;"}
1
+ {"version":3,"file":"FieldOperations.js","sources":["../../../../../../packages/binding-legacy/src/core/operations/FieldOperations.ts"],"sourcesContent":["import { isUuid } from '@contember/utilities'\nimport type { FieldValue } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tClientGeneratedUuid,\n\tErrorAccessor,\n\tEventListenersStore,\n\tFieldAccessor,\n\tPRIMARY_KEY_NAME,\n\tServerId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { FieldState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = 'user' }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n`\n\t\t\t\t\t\t\t\t+ `Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !isUuid(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `\n\t\t\t\t\t\t\t\t+ `Expecting a valid uuid but '${newValue}' was given.\\n`\n\t\t\t\t\t\t\t\t+ `Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(ServerId.formatUniqueValue(newValue, entity.entityName))) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. `\n\t\t\t\t\t\t\t\t+ `It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue = field.fieldMarker.defaultValue === undefined\n\t\t\t\t\t? newValue\n\t\t\t\t\t: newValue === null\n\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount = !getEntityMarker(parent).fields.hasAtLeastOneBearingField\n\t\t\t\t\t|| !field.fieldMarker.isNonbearing\n\t\t\t\t\t|| field.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAkBO,MAAM,gBAAgB;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY,KAAK;AAAA,EAC5D;AAAA,EAEO,YAAY,YAAmC;AACrD,WAAO,KAAK,qBAAqB,mBAAmB,UAAU;AAAA,EAC/D;AAAA,EAEO,iBAI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M,gBAAgB,MAAM,YAAY,iBAAiB,SACtD,WACA,aAAa,OACb,MAAM,YAAY,eAClB;AACH,cAAM,2BAA2B,MAAM,mBAAmB,SAAY,OAAO,MAAM;AACnF,cAAM,8BAA8B,MAAM;AAC1C,cAAM,2BAA2B,kBAAkB;AACnD,cAAM,wBAAwB;AAE9B,cAAM,6BAA6B,CAAC,gBAAgB,MAAM,EAAE,OAAO,6BAC/D,CAAC,MAAM,YAAY,gBACnB,MAAM,mBAAmB;AAE7B,YAAI,eAAe,aAAa;AAEhC,YAAI,4BAA4B;AAC/B,cAAI,CAAC,+BAA+B,0BAA0B;AAC7D;AAAA,UACD,WAAW,+BAA+B,CAAC,0BAA0B;AACpE;AAAA,UACD;AAAA,QACD;AAEA,aAAK,aAAa,oBAAoB,OAAO,YAAY;AAAA,MAC1D;AAAA,IACD,CAAC;AAAA,EACF;AACD;"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const uuid = require("uuid");
3
+ const utilities = require("@contember/utilities");
4
4
  const bindingCommon = require("@contember/binding-common");
5
5
  const EventManager = require("../EventManager.cjs");
6
6
  const RealmKeyGenerator = require("../RealmKeyGenerator.cjs");
@@ -141,7 +141,7 @@ ${error.message}
141
141
  getChildEntityById(state, id) {
142
142
  const realm = state.children.get(id);
143
143
  if (realm === void 0) {
144
- const isRuntimeId = typeof id === "number" || uuid.validate(id) || bindingCommon.UnpersistedEntityDummyId.matchesDummyId(id);
144
+ const isRuntimeId = typeof id === "number" || utilities.isUuid(id) || bindingCommon.UnpersistedEntityDummyId.matchesDummyId(id);
145
145
  if (isRuntimeId) {
146
146
  throw new bindingCommon.BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`);
147
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ListOperations.cjs","sources":["../../../../../../packages/binding-legacy/src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tEntityId,\n\tEventListenersStore,\n\tLocalizedBindingError,\n\tMarkerComparator,\n\tRuntimeId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator.js'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\nimport { ErrorLocator } from '../exceptions/ErrorLocator.js'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.EntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type `\n\t\t\t\t\t\t\t+ `'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n`\n\t\t\t\t\t\t\t+ `Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are `\n\t\t\t\t\t\t\t\t+ `incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n`\n\t\t\t\t\t\t\t\t+ `${error.message}\\n\\n`\n\t\t\t\t\t\t\t\t+ (error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '')\n\t\t\t\t\t\t\t\t+ `Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: { noPersist?: boolean }) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\n\t\t\tif (!listState.children.has(childEntity.id)) {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`Entity list doesn't include an entity with id '${childEntity.id}' and so it cannot remove it.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tstate.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.`\n\t\t\t\t\t+ (looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids `\n\t\t\t\t\t\t\t+ `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and `\n\t\t\t\t\t\t\t+ `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["EventListenersStore","OperationsHelpers","StateIterator","BindingError","ErrorLocator","MarkerComparator","getEntityMarker","LocalizedBindingError","UnpersistedEntityDummyId","EventManager","uuidValidate","RealmKeyGenerator"],"mappings":";;;;;;;;;;AAoBO,MAAM,eAAe;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,WAA4B,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uB,EAAE;AACtI,YAAM,IAAIR,cAAAA;AAAAA,QACT,kDAAkD,EAAE,oCAChD,eACA;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM,YAAA;AAAA,EACd;AACD;;"}
1
+ {"version":3,"file":"ListOperations.cjs","sources":["../../../../../../packages/binding-legacy/src/core/operations/ListOperations.ts"],"sourcesContent":["import { isUuid } from '@contember/utilities'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tEntityId,\n\tEventListenersStore,\n\tLocalizedBindingError,\n\tMarkerComparator,\n\tRuntimeId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator.js'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\nimport { ErrorLocator } from '../exceptions/ErrorLocator.js'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.EntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type `\n\t\t\t\t\t\t\t+ `'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n`\n\t\t\t\t\t\t\t+ `Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are `\n\t\t\t\t\t\t\t\t+ `incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n`\n\t\t\t\t\t\t\t\t+ `${error.message}\\n\\n`\n\t\t\t\t\t\t\t\t+ (error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '')\n\t\t\t\t\t\t\t\t+ `Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: { noPersist?: boolean }) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\n\t\t\tif (!listState.children.has(childEntity.id)) {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`Entity list doesn't include an entity with id '${childEntity.id}' and so it cannot remove it.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tstate.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || isUuid(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.`\n\t\t\t\t\t+ (looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids `\n\t\t\t\t\t\t\t+ `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and `\n\t\t\t\t\t\t\t+ `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["EventListenersStore","OperationsHelpers","StateIterator","BindingError","ErrorLocator","MarkerComparator","getEntityMarker","Localized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OAAO,OAAO,YAAYC,UAAAA,OAAO,EAAE,KAAKF,cAAAA,yBAAyB,eAAe,EAAE;AACtG,UAAI,aAAa;AAChB,cAAM,IAAIL,cAAAA,aAAa,kDAAkD,EAAE,6BAA6B;AAAA,MACzG;AACA,YAAM,eAAe,OAAO,OAAO,aAAa,KAAK,UAAU,iBAAiB,IAAI,EAAE,KAAKQ,kBAAAA,kBAAkB,uBAAuB,EAAE;AACtI,YAAM,IAAIR,cAAAA;AAAAA,QACT,kDAAkD,EAAE,oCAChD,eACA;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM,YAAA;AAAA,EACd;AACD;;"}
@@ -1,4 +1,4 @@
1
- import { validate } from "uuid";
1
+ import { isUuid } from "@contember/utilities";
2
2
  import { EventListenersStore, BindingError, MarkerComparator, LocalizedBindingError, UnpersistedEntityDummyId } from "@contember/binding-common";
3
3
  import { EventManager } from "../EventManager.js";
4
4
  import { RealmKeyGenerator } from "../RealmKeyGenerator.js";
@@ -139,7 +139,7 @@ ${error.message}
139
139
  getChildEntityById(state, id) {
140
140
  const realm = state.children.get(id);
141
141
  if (realm === void 0) {
142
- const isRuntimeId = typeof id === "number" || validate(id) || UnpersistedEntityDummyId.matchesDummyId(id);
142
+ const isRuntimeId = typeof id === "number" || isUuid(id) || UnpersistedEntityDummyId.matchesDummyId(id);
143
143
  if (isRuntimeId) {
144
144
  throw new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`);
145
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ListOperations.js","sources":["../../../../../../packages/binding-legacy/src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tEntityId,\n\tEventListenersStore,\n\tLocalizedBindingError,\n\tMarkerComparator,\n\tRuntimeId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator.js'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\nimport { ErrorLocator } from '../exceptions/ErrorLocator.js'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.EntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type `\n\t\t\t\t\t\t\t+ `'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n`\n\t\t\t\t\t\t\t+ `Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are `\n\t\t\t\t\t\t\t\t+ `incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n`\n\t\t\t\t\t\t\t\t+ `${error.message}\\n\\n`\n\t\t\t\t\t\t\t\t+ (error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '')\n\t\t\t\t\t\t\t\t+ `Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: { noPersist?: boolean }) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\n\t\t\tif (!listState.children.has(childEntity.id)) {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`Entity list doesn't include an entity with id '${childEntity.id}' and so it cannot remove it.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tstate.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.`\n\t\t\t\t\t+ (looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids `\n\t\t\t\t\t\t\t+ `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and `\n\t\t\t\t\t\t\t+ `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["uuidValidate"],"mappings":";;;;;;;;AAoBO,MAAM,eAAe;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,WAA4B,OAAwC;AACnF,WAAO,KAAK,qBAAqB,SAAS,WAAW,KAAK;AAAA,EAC3D;AAAA,EAEO,iBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,mBAAmB,QAAW;AACvC,YAAM,iBAAiB,IAAI,oBAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,sBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,wBAAwB,QAAW;AAC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;AAAA,MAC1D;AAAA,IACD,CAAC;AAAA,EACF;AAAA,EAEO,gBAAgB,YAA6B,YAAuE;AAC1H,WAAO,KAAK,aAAa,cAAc,MAAiB;AAEvD,YAAM,KAAK,IAAI,yBAAA;AAEf,iBAAW,SAAS,cAAc,sBAAsB,KAAK,WAAW,UAAU,GAAG;AACpF,cAAM,YAAY,KAAK,iBAAiB,sBAAsB,IAAI,MAAM,YAAY;AAAA,UACnF,MAAM;AAAA,UACN,QAAQ;AAAA,QAAA,CACR;AAED,aAAK,iBAAiB,+BAA+B,WAAW,UAAU;AAK1E,aAAK,aAAa,oBAAoB,OAAO,aAAa,qBAAqB;AAAA,MAChF;AACA,aAAO;AAAA,IACR,CAAC;AAAA,EACF;AAAA,EAEO,mBAAmB,OAAwB,IAAc;AAC/D,UAAM,QAAQ,MAAM,SAAS,IAAI,EAAE;AACnC,QAAI,UAAU,QAAW;AACxB,YAAM,cAAc,OAAO,OAAO,YAAYA,SAAa,EAAE,KAAK,yBAAyB,eAAe,EAAE;AAC5G,UAAI,aAAa;AAChB,cAAM,IAAI,aAAa,kDAAkD,EAAE,6BAA6B;AAAA,MACzG;AACA,YAAM,eAAe,OAAO,OAAO,aAAa,KAAK,UAAU,iBAAiB,IAAI,EAAE,KAAK,kBAAkB,uBAAuB,EAAE;AACtI,YAAM,IAAI;AAAA,QACT,kDAAkD,EAAE,oCAChD,eACA;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM,YAAA;AAAA,EACd;AACD;"}
1
+ {"version":3,"file":"ListOperations.js","sources":["../../../../../../packages/binding-legacy/src/core/operations/ListOperations.ts"],"sourcesContent":["import { isUuid } from '@contember/utilities'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tEntityId,\n\tEventListenersStore,\n\tLocalizedBindingError,\n\tMarkerComparator,\n\tRuntimeId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator.js'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\nimport { ErrorLocator } from '../exceptions/ErrorLocator.js'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.EntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type `\n\t\t\t\t\t\t\t+ `'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n`\n\t\t\t\t\t\t\t+ `Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are `\n\t\t\t\t\t\t\t\t+ `incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n`\n\t\t\t\t\t\t\t\t+ `${error.message}\\n\\n`\n\t\t\t\t\t\t\t\t+ (error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '')\n\t\t\t\t\t\t\t\t+ `Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: { noPersist?: boolean }) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\n\t\t\tif (!listState.children.has(childEntity.id)) {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`Entity list doesn't include an entity with id '${childEntity.id}' and so it cannot remove it.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tstate.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || isUuid(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.`\n\t\t\t\t\t+ (looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids `\n\t\t\t\t\t\t\t+ `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and `\n\t\t\t\t\t\t\t+ `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAoBO,MAAM,eAAe;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,WAA4B,OAAwC;AACnF,WAAO,KAAK,qBAAqB,SAAS,WAAW,KAAK;AAAA,EAC3D;AAAA,EAEO,iBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,mBAAmB,QAAW;AACvC,YAAM,iBAAiB,IAAI,oBAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,sBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,wBAAwB,QAAW;AAC5C,YAAM,s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1D;AAAA,IACD,CAAC;AAAA,EACF;AAAA,EAEO,gBAAgB,YAA6B,YAAuE;AAC1H,WAAO,KAAK,aAAa,cAAc,MAAiB;AAEvD,YAAM,KAAK,IAAI,yBAAA;AAEf,iBAAW,SAAS,cAAc,sBAAsB,KAAK,WAAW,UAAU,GAAG;AACpF,cAAM,YAAY,KAAK,iBAAiB,sBAAsB,IAAI,MAAM,YAAY;AAAA,UACnF,MAAM;AAAA,UACN,QAAQ;AAAA,QAAA,CACR;AAED,aAAK,iBAAiB,+BAA+B,WAAW,UAAU;AAK1E,aAAK,aAAa,oBAAoB,OAAO,aAAa,qBAAqB;AAAA,MAChF;AACA,aAAO;AAAA,IACR,CAAC;AAAA,EACF;AAAA,EAEO,mBAAmB,OAAwB,IAAc;AAC/D,UAAM,QAAQ,MAAM,SAAS,IAAI,EAAE;AACnC,QAAI,UAAU,QAAW;AACxB,YAAM,cAAc,OAAO,OAAO,YAAY,OAAO,EAAE,KAAK,yBAAyB,eAAe,EAAE;AACtG,UAAI,aAAa;AAChB,cAAM,IAAI,aAAa,kDAAkD,EAAE,6BAA6B;AAAA,MACzG;AACA,YAAM,eAAe,OAAO,OAAO,aAAa,KAAK,UAAU,iBAAiB,IAAI,EAAE,KAAK,kBAAkB,uBAAuB,EAAE;AACtI,YAAM,IAAI;AAAA,QACT,kDAAkD,EAAE,oCAChD,eACA;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM,YAAA;AAAA,EACd;AACD;"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const uuid = require("uuid");
3
+ const utilities = require("@contember/utilities");
4
4
  const FieldHelper = require("./FieldHelper.cjs");
5
5
  class UuidFieldHelper extends FieldHelper.FieldHelper {
6
6
  setToUuid(options) {
7
- this.getAccessor().updateValue(uuid.v4(), options);
7
+ this.getAccessor().updateValue(utilities.generateUuidV4(), options);
8
8
  }
9
9
  }
10
10
  ((UuidFieldHelper2) => {
@@ -1 +1 @@
1
- {"version":3,"file":"UuidFieldHelper.cjs","sources":["../../../../../../packages/binding-legacy/src/fieldHelpers/helpers/UuidFieldHelper.ts"],"sourcesContent":["import { v4 as uuidV4 } from 'uuid'\nimport type { FieldAccessor } from '@contember/binding-common'\nimport { FieldHelper } from './FieldHelper.js'\n\nclass UuidFieldHelper extends FieldHelper<string> {\n\tpublic setToUuid(options?: FieldAccessor.UpdateOptions) {\n\t\tthis.getAccessor().updateValue(uuidV4(), options)\n\t}\n}\nnamespace UuidFieldHelper {\n\texport const setToUuid = (\n\t\tfield: FieldAccessor<string> | FieldAccessor.GetFieldAccessor<string>,\n\t\toptions?: FieldAccessor.UpdateOptions,\n\t) => {\n\t\tnew UuidFieldHelper(field).setToUuid(options)\n\t}\n}\nexport { UuidFieldHelper }\n"],"names":["FieldHelper","uuidV4","UuidFieldHelper"],"mappings":";;;;AAIA,MAAM,wBAAwBA,YAAAA,YAAoB;AAAA,EAC1C,UAAU,SAAuC;AACvD,SAAK,YAAA,EAAc,YAAYC,KAAAA,GAAA,GAAU,OAAO;AAAA,EACjD;AACD;AAAA,CACA,CAAUC,qBAAV;AACcA,mBAAA,YAAY,CACxB,OACA,YACI;AACJ,QAAIA,iBAAgB,KAAK,EAAE,UAAU,OAAO;AAAA,EAC7C;AAAA,GANS,oBAAA,kBAAA,CAAA,EAAA;;"}
1
+ {"version":3,"file":"UuidFieldHelper.cjs","sources":["../../../../../../packages/binding-legacy/src/fieldHelpers/helpers/UuidFieldHelper.ts"],"sourcesContent":["import { generateUuidV4 } from '@contember/utilities'\nimport type { FieldAccessor } from '@contember/binding-common'\nimport { FieldHelper } from './FieldHelper.js'\n\nclass UuidFieldHelper extends FieldHelper<string> {\n\tpublic setToUuid(options?: FieldAccessor.UpdateOptions) {\n\t\tthis.getAccessor().updateValue(generateUuidV4(), options)\n\t}\n}\nnamespace UuidFieldHelper {\n\texport const setToUuid = (\n\t\tfield: FieldAccessor<string> | FieldAccessor.GetFieldAccessor<string>,\n\t\toptions?: FieldAccessor.UpdateOptions,\n\t) => {\n\t\tnew UuidFieldHelper(field).setToUuid(options)\n\t}\n}\nexport { UuidFieldHelper }\n"],"names":["FieldHelper","generateUuidV4","UuidFieldHelper"],"mappings":";;;;AAIA,MAAM,wBAAwBA,YAAAA,YAAoB;AAAA,EAC1C,UAAU,SAAuC;AACvD,SAAK,YAAA,EAAc,YAAYC,UAAAA,eAAA,GAAkB,OAAO;AAAA,EACzD;AACD;AAAA,CACA,CAAUC,qBAAV;AACcA,mBAAA,YAAY,CACxB,OACA,YACI;AACJ,QAAIA,iBAAgB,KAAK,EAAE,UAAU,OAAO;AAAA,EAC7C;AAAA,GANS,oBAAA,kBAAA,CAAA,EAAA;;"}
@@ -1,8 +1,8 @@
1
- import { v4 } from "uuid";
1
+ import { generateUuidV4 } from "@contember/utilities";
2
2
  import { FieldHelper } from "./FieldHelper.js";
3
3
  class UuidFieldHelper extends FieldHelper {
4
4
  setToUuid(options) {
5
- this.getAccessor().updateValue(v4(), options);
5
+ this.getAccessor().updateValue(generateUuidV4(), options);
6
6
  }
7
7
  }
8
8
  ((UuidFieldHelper2) => {
@@ -1 +1 @@
1
- {"version":3,"file":"UuidFieldHelper.js","sources":["../../../../../../packages/binding-legacy/src/fieldHelpers/helpers/UuidFieldHelper.ts"],"sourcesContent":["import { v4 as uuidV4 } from 'uuid'\nimport type { FieldAccessor } from '@contember/binding-common'\nimport { FieldHelper } from './FieldHelper.js'\n\nclass UuidFieldHelper extends FieldHelper<string> {\n\tpublic setToUuid(options?: FieldAccessor.UpdateOptions) {\n\t\tthis.getAccessor().updateValue(uuidV4(), options)\n\t}\n}\nnamespace UuidFieldHelper {\n\texport const setToUuid = (\n\t\tfield: FieldAccessor<string> | FieldAccessor.GetFieldAccessor<string>,\n\t\toptions?: FieldAccessor.UpdateOptions,\n\t) => {\n\t\tnew UuidFieldHelper(field).setToUuid(options)\n\t}\n}\nexport { UuidFieldHelper }\n"],"names":["uuidV4","UuidFieldHelper"],"mappings":";;AAIA,MAAM,wBAAwB,YAAoB;AAAA,EAC1C,UAAU,SAAuC;AACvD,SAAK,YAAA,EAAc,YAAYA,GAAA,GAAU,OAAO;AAAA,EACjD;AACD;AAAA,CACA,CAAUC,qBAAV;AACcA,mBAAA,YAAY,CACxB,OACA,YACI;AACJ,QAAIA,iBAAgB,KAAK,EAAE,UAAU,OAAO;AAAA,EAC7C;AAAA,GANS,oBAAA,kBAAA,CAAA,EAAA;"}
1
+ {"version":3,"file":"UuidFieldHelper.js","sources":["../../../../../../packages/binding-legacy/src/fieldHelpers/helpers/UuidFieldHelper.ts"],"sourcesContent":["import { generateUuidV4 } from '@contember/utilities'\nimport type { FieldAccessor } from '@contember/binding-common'\nimport { FieldHelper } from './FieldHelper.js'\n\nclass UuidFieldHelper extends FieldHelper<string> {\n\tpublic setToUuid(options?: FieldAccessor.UpdateOptions) {\n\t\tthis.getAccessor().updateValue(generateUuidV4(), options)\n\t}\n}\nnamespace UuidFieldHelper {\n\texport const setToUuid = (\n\t\tfield: FieldAccessor<string> | FieldAccessor.GetFieldAccessor<string>,\n\t\toptions?: FieldAccessor.UpdateOptions,\n\t) => {\n\t\tnew UuidFieldHelper(field).setToUuid(options)\n\t}\n}\nexport { UuidFieldHelper }\n"],"names":["UuidFieldHelper"],"mappings":";;AAIA,MAAM,wBAAwB,YAAoB;AAAA,EAC1C,UAAU,SAAuC;AACvD,SAAK,YAAA,EAAc,YAAY,eAAA,GAAkB,OAAO;AAAA,EACzD;AACD;AAAA,CACA,CAAUA,qBAAV;AACcA,mBAAA,YAAY,CACxB,OACA,YACI;AACJ,QAAIA,iBAAgB,KAAK,EAAE,UAAU,OAAO;AAAA,EAC7C;AAAA,GANS,oBAAA,kBAAA,CAAA,EAAA;"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("uuid");
3
+ require("@contember/utilities");
4
4
  const bindingCommon = require("@contember/binding-common");
5
5
  const EventManager = require("../EventManager.cjs");
6
6
  const OperationsHelpers = require("./OperationsHelpers.cjs");
@@ -1 +1 @@
1
- {"version":3,"file":"FieldOperations.cjs","sources":["../../../../../../packages/binding-legacy/src/core/operations/FieldOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { FieldValue } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tClientGeneratedUuid,\n\tErrorAccessor,\n\tEventListenersStore,\n\tFieldAccessor,\n\tPRIMARY_KEY_NAME,\n\tServerId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { FieldState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = 'user' }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n`\n\t\t\t\t\t\t\t\t+ `Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !uuidValidate(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `\n\t\t\t\t\t\t\t\t+ `Expecting a valid uuid but '${newValue}' was given.\\n`\n\t\t\t\t\t\t\t\t+ `Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(ServerId.formatUniqueValue(newValue, entity.entityName))) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. `\n\t\t\t\t\t\t\t\t+ `It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue = field.fieldMarker.defaultValue === undefined\n\t\t\t\t\t? newValue\n\t\t\t\t\t: newValue === null\n\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount = !getEntityMarker(parent).fields.hasAtLeastOneBearingField\n\t\t\t\t\t|| !field.fieldMarker.isNonbearing\n\t\t\t\t\t|| field.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":["EventListenersStore","PRIMARY_KEY_NAME","BindingError","OperationsHelpers","ClientGeneratedUuid","StateIterator","getEntityMarker","EventManager"],"mappings":";;;;;;;;AAkBO,MAAM,gBAAgB;AAA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AACnF,cAAM,8BAA8B,MAAM;AAC1C,cAAM,2BAA2B,kBAAkB;AACnD,cAAM,wBAAwB;AAE9B,cAAM,6BAA6B,CAACC,gBAAAA,gBAAgB,MAAM,EAAE,OAAO,6BAC/D,CAAC,MAAM,YAAY,gBACnB,MAAM,mBAAmB;AAE7B,YAAI,eAAeC,aAAAA,aAAa;AAEhC,YAAI,4BAA4B;AAC/B,cAAI,CAAC,+BAA+B,0BAA0B;AAC7D;AAAA,UACD,WAAW,+BAA+B,CAAC,0BAA0B;AACpE;AAAA,UACD;AAAA,QACD;AAEA,aAAK,aAAa,oBAAoB,OAAO,YAAY;AAAA,MAC1D;AAAA,IACD,CAAC;AAAA,EACF;AACD;;"}
1
+ {"version":3,"file":"FieldOperations.cjs","sources":["../../../../../../packages/binding-legacy/src/core/operations/FieldOperations.ts"],"sourcesContent":["import { isUuid } from '@contember/utilities'\nimport type { FieldValue } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tClientGeneratedUuid,\n\tErrorAccessor,\n\tEventListenersStore,\n\tFieldAccessor,\n\tPRIMARY_KEY_NAME,\n\tServerId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { FieldState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = 'user' }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n`\n\t\t\t\t\t\t\t\t+ `Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !isUuid(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `\n\t\t\t\t\t\t\t\t+ `Expecting a valid uuid but '${newValue}' was given.\\n`\n\t\t\t\t\t\t\t\t+ `Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(ServerId.formatUniqueValue(newValue, entity.entityName))) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. `\n\t\t\t\t\t\t\t\t+ `It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue = field.fieldMarker.defaultValue === undefined\n\t\t\t\t\t? newValue\n\t\t\t\t\t: newValue === null\n\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount = !getEntityMarker(parent).fields.hasAtLeastOneBearingField\n\t\t\t\t\t|| !field.fieldMarker.isNonbearing\n\t\t\t\t\t|| field.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":["EventListenersStore","PRIMARY_KEY_NAME","BindingError","OperationsHelpers","ClientGeneratedUuid","StateIterator","getEntityMarker","EventManager"],"mappings":";;;;;;;;AAkBO,MAAM,gBAAgB;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY,KAAK;AAAA,EAC5D;AAAA,EAEO,YAAY,YAAmC;AACrD,WAAO,KAAK,qBAAqB,mBAAmB,UAAU;AAAA,EAC/D;AAAA,EAEO,iBAIN,OACA,OACA,UACa;AACb,QAAI,CAAC,MAAM,gBAAgB;AAC1B,YAAM,iBAAiB,IAAIA,kCAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,YACN,YACA,UACA,EAAE,QAAQ,OAAA,IAAwC,IACjD;AACD,SAAK,aAAa,cAAc,MAAM;AACrC,YAAM,EAAE,iBAAiB,OAAA,IAAW;AACpC,UAAI,oBAAoBC,cAAAA,kBAAkB;AACzC,cAAM,SAAS,WAAW,OAAO;AAuBjC,YAAI,OAAO,aAAa,UAAU;AACjC,gBAAM,IAAIC,cAAAA,aAAA;AAAA,QACX;AACAC,0BAAAA,kBAAkB;AAAA,UACjB,KAAK;AAAA,UACL,KAAK;AAAA,UACL,KAAK;AAAA,UACL;AAAA,UACA,IAAIC,cAAAA,oBAAoB,QAAQ;AAAA,QAAA;AAAA,MAElC;AACA,iBAAW,SAASC,4BAAc,sBAAsB,KAAK,WAAW,UAAU,GAAG;AACpF,YAAI,aAAa,MAAM,OAAO;AAC7B;AAAA,QACD;AACA,YAAI,MAAM,aAAa,QAAW;AACjC,gBAAM,+BAAe,IAAA;AAAA,QACtB;AACA,cAAM,SAAS,IAAI,KAAK;AACxB,cAAM,QAAQ;AAEd,cAAM,gBAAgB,MAAM,YAAY,iBAAiB,SACtD,WACA,aAAa,OACb,MAAM,YAAY,eAClB;AACH,cAAM,2BAA2B,MAAM,mBAAmB,SAAY,OAAO,MAAM;AACnF,cAAM,8BAA8B,MAAM;AAC1C,cAAM,2BAA2B,kBAAkB;AACnD,cAAM,wBAAwB;AAE9B,cAAM,6BAA6B,CAACC,gBAAAA,gBAAgB,MAAM,EAAE,OAAO,6BAC/D,CAAC,MAAM,YAAY,gBACnB,MAAM,mBAAmB;AAE7B,YAAI,eAAeC,aAAAA,aAAa;AAEhC,YAAI,4BAA4B;AAC/B,cAAI,CAAC,+BAA+B,0BAA0B;AAC7D;AAAA,UACD,WAAW,+BAA+B,CAAC,0BAA0B;AACpE;AAAA,UACD;AAAA,QACD;AAEA,aAAK,aAAa,oBAAoB,OAAO,YAAY;AAAA,MAC1D;AAAA,IACD,CAAC;AAAA,EACF;AACD;;"}
@@ -1,4 +1,4 @@
1
- import "uuid";
1
+ import "@contember/utilities";
2
2
  import { EventListenersStore, PRIMARY_KEY_NAME, BindingError, ClientGeneratedUuid } from "@contember/binding-common";
3
3
  import { EventManager } from "../EventManager.js";
4
4
  import { OperationsHelpers } from "./OperationsHelpers.js";
@@ -1 +1 @@
1
- {"version":3,"file":"FieldOperations.js","sources":["../../../../../../packages/binding-legacy/src/core/operations/FieldOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { FieldValue } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tClientGeneratedUuid,\n\tErrorAccessor,\n\tEventListenersStore,\n\tFieldAccessor,\n\tPRIMARY_KEY_NAME,\n\tServerId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { FieldState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = 'user' }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n`\n\t\t\t\t\t\t\t\t+ `Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !uuidValidate(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `\n\t\t\t\t\t\t\t\t+ `Expecting a valid uuid but '${newValue}' was given.\\n`\n\t\t\t\t\t\t\t\t+ `Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(ServerId.formatUniqueValue(newValue, entity.entityName))) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. `\n\t\t\t\t\t\t\t\t+ `It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue = field.fieldMarker.defaultValue === undefined\n\t\t\t\t\t? newValue\n\t\t\t\t\t: newValue === null\n\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount = !getEntityMarker(parent).fields.hasAtLeastOneBearingField\n\t\t\t\t\t|| !field.fieldMarker.isNonbearing\n\t\t\t\t\t|| field.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAkBO,MAAM,gBAAgB;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY,KAAK;AAAA,EAC5D;AAAA,EAEO,YAAY,YAAmC;AACrD,WAAO,KAAK,qBAAqB,mBAAmB,UAAU;AAAA,EAC/D;AAAA,EAEO,iBAIN,OACA,OACA,UACa;AACb,QAAI,CAAC,MAAM,gBAAgB;AAC1B,YAAM,iBAAiB,IAAI,oBAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,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y/src/core/operations/FieldOperations.ts"],"sourcesContent":["import { isUuid } from '@contember/utilities'\nimport type { FieldValue } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tClientGeneratedUuid,\n\tErrorAccessor,\n\tEventListenersStore,\n\tFieldAccessor,\n\tPRIMARY_KEY_NAME,\n\tServerId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { FieldState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = 'user' }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n`\n\t\t\t\t\t\t\t\t+ `Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !isUuid(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `\n\t\t\t\t\t\t\t\t+ `Expecting a valid uuid but '${newValue}' was given.\\n`\n\t\t\t\t\t\t\t\t+ `Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(ServerId.formatUniqueValue(newValue, entity.entityName))) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. `\n\t\t\t\t\t\t\t\t+ `It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue = field.fieldMarker.defaultValue === undefined\n\t\t\t\t\t? newValue\n\t\t\t\t\t: newValue === null\n\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount = !getEntityMarker(parent).fields.hasAtLeastOneBearingField\n\t\t\t\t\t|| !field.fieldMarker.isNonbearing\n\t\t\t\t\t|| field.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAkBO,MAAM,gBAAgB;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY,KAAK;AAAA,EAC5D;AAAA,EAEO,YAAY,YAAmC;AACrD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ACD,WAAW,+BAA+B,CAAC,0BAA0B;AACpE;AAAA,UACD;AAAA,QACD;AAEA,aAAK,aAAa,oBAAoB,OAAO,YAAY;AAAA,MAC1D;AAAA,IACD,CAAC;AAAA,EACF;AACD;"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const uuid = require("uuid");
3
+ const utilities = require("@contember/utilities");
4
4
  const bindingCommon = require("@contember/binding-common");
5
5
  const EventManager = require("../EventManager.cjs");
6
6
  const RealmKeyGenerator = require("../RealmKeyGenerator.cjs");
@@ -141,7 +141,7 @@ ${error.message}
141
141
  getChildEntityById(state, id) {
142
142
  const realm = state.children.get(id);
143
143
  if (realm === void 0) {
144
- const isRuntimeId = typeof id === "number" || uuid.validate(id) || bindingCommon.UnpersistedEntityDummyId.matchesDummyId(id);
144
+ const isRuntimeId = typeof id === "number" || utilities.isUuid(id) || bindingCommon.UnpersistedEntityDummyId.matchesDummyId(id);
145
145
  if (isRuntimeId) {
146
146
  throw new bindingCommon.BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`);
147
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ListOperations.cjs","sources":["../../../../../../packages/binding-legacy/src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tEntityId,\n\tEventListenersStore,\n\tLocalizedBindingError,\n\tMarkerComparator,\n\tRuntimeId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator.js'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\nimport { ErrorLocator } from '../exceptions/ErrorLocator.js'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.EntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type `\n\t\t\t\t\t\t\t+ `'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n`\n\t\t\t\t\t\t\t+ `Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are `\n\t\t\t\t\t\t\t\t+ `incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n`\n\t\t\t\t\t\t\t\t+ `${error.message}\\n\\n`\n\t\t\t\t\t\t\t\t+ (error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '')\n\t\t\t\t\t\t\t\t+ `Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: { noPersist?: boolean }) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\n\t\t\tif (!listState.children.has(childEntity.id)) {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`Entity list doesn't include an entity with id '${childEntity.id}' and so it cannot remove it.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tstate.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.`\n\t\t\t\t\t+ (looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids `\n\t\t\t\t\t\t\t+ `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and `\n\t\t\t\t\t\t\t+ `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["EventListenersStore","OperationsHelpers","StateIterator","BindingError","ErrorLocator","MarkerComparator","getEntityMarker","LocalizedBindingError","UnpersistedEntityDummyId","EventManager","uuidValidate","RealmKeyGenerator"],"mappings":";;;;;;;;;;AAoBO,MAAM,eAAe;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,WAA4B,OAAwC;AACnF,WAAO,KAAK,qBAAqB,SAAS,WAAW,KAAK;AAAA,EAC3D;AAAA,EAEO,iBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,mBAAmB,QAAW;AACvC,YAAM,iBAAiB,IAAIA,kCAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,sBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,wBAAwB,QAAW;AAC5C,YAAM,sBAAsB,IAAIA,kCAAA;AAAA,IACjC;AACA,WAAO,MAAM,oBAAoB,IAAI,OAAO,QAAQ;AAAA,EACrD;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D;AAAA,IACD,CAAC;AAAA,EACF;AAAA,EAEO,gBAAgB,YAA6B,YAAuE;AAC1H,WAAO,KAAK,aAAa,cAAc,MAAiB;AAEvD,YAAM,KAAK,IAAIM,uCAAA;AAEf,iBAAW,SAASN,4BAAc,sBAAsB,KAAK,WAAW,UAAU,GAAG;AACpF,cAAM,YAAY,KAAK,iBAAiB,sBAAsB,IAAI,MAAM,YAAY;AAAA,UACnF,MAAM;AAAA,UACN,QAAQ;AAAA,QAAA,CACR;AAED,aAAK,iBAAiB,+BAA+B,WAAW,UAAU;AAK1E,aAAK,aAAa,oBAAoB,OAAOO,aAAAA,aAAa,qBAAqB;AAAA,MAChF;AACA,aAAO;AAAA,IACR,CAAC;AAAA,EACF;AAAA,EAEO,mBAAmB,OAAwB,IAAc;AAC/D,UAAM,QAAQ,MAAM,SAAS,IAAI,EAAE;AACnC,QAAI,UAAU,QAAW;AACxB,YAAM,cAAc,OAAO,OAAO,YAAYC,KAAAA,SAAa,EAAE,KAAKF,cAAAA,yBAAyB,eAAe,EAAE;AAC5G,UAAI,aAAa;AAChB,cAAM,IAAIL,cAAAA,aAAa,kDAAkD,EAAE,6BAA6B;AAAA,MACzG;AACA,YAAM,eAAe,OAAO,OAAO,aAAa,KAAK,UAAU,iBAAiB,IAAI,EAAE,KAAKQ,kBAAAA,kBAAkB,uBAAuB,EAAE;AACtI,YAAM,IAAIR,cAAAA;AAAAA,QACT,kDAAkD,EAAE,oCAChD,eACA;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM,YAAA;AAAA,EACd;AACD;;"}
1
+ {"version":3,"file":"ListOperations.cjs","sources":["../../../../../../packages/binding-legacy/src/core/operations/ListOperations.ts"],"sourcesContent":["import { isUuid } from '@contember/utilities'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tEntityId,\n\tEventListenersStore,\n\tLocalizedBindingError,\n\tMarkerComparator,\n\tRuntimeId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator.js'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\nimport { ErrorLocator } from '../exceptions/ErrorLocator.js'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.EntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type `\n\t\t\t\t\t\t\t+ `'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n`\n\t\t\t\t\t\t\t+ `Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are `\n\t\t\t\t\t\t\t\t+ `incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n`\n\t\t\t\t\t\t\t\t+ `${error.message}\\n\\n`\n\t\t\t\t\t\t\t\t+ (error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '')\n\t\t\t\t\t\t\t\t+ `Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: { noPersist?: boolean }) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\n\t\t\tif (!listState.children.has(childEntity.id)) {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`Entity list doesn't include an entity with id '${childEntity.id}' and so it cannot remove it.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tstate.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || isUuid(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.`\n\t\t\t\t\t+ (looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids `\n\t\t\t\t\t\t\t+ `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and `\n\t\t\t\t\t\t\t+ `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["EventListenersStore","OperationsHelpers","StateIterator","BindingError","ErrorLocator","MarkerComparator","getEntityMarker","LocalizedBindingError","UnpersistedEntityDummyId","EventManager","isUuid","RealmKeyGenerator"],"mappings":";;;;;;;;;;AAoBO,MAAM,eAAe;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,WAA4B,OAAwC;AACnF,WAAO,KAAK,qBAAqB,SAAS,WAAW,KAAK;AAAA,EAC3D;AAAA,EAEO,iBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,mBAAmB,QAAW;AACvC,YAAM,i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d;AACD;;"}
@@ -1,4 +1,4 @@
1
- import { validate } from "uuid";
1
+ import { isUuid } from "@contember/utilities";
2
2
  import { EventListenersStore, BindingError, MarkerComparator, LocalizedBindingError, UnpersistedEntityDummyId } from "@contember/binding-common";
3
3
  import { EventManager } from "../EventManager.js";
4
4
  import { RealmKeyGenerator } from "../RealmKeyGenerator.js";
@@ -139,7 +139,7 @@ ${error.message}
139
139
  getChildEntityById(state, id) {
140
140
  const realm = state.children.get(id);
141
141
  if (realm === void 0) {
142
- const isRuntimeId = typeof id === "number" || validate(id) || UnpersistedEntityDummyId.matchesDummyId(id);
142
+ const isRuntimeId = typeof id === "number" || isUuid(id) || UnpersistedEntityDummyId.matchesDummyId(id);
143
143
  if (isRuntimeId) {
144
144
  throw new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`);
145
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ListOperations.js","sources":["../../../../../../packages/binding-legacy/src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tEntityId,\n\tEventListenersStore,\n\tLocalizedBindingError,\n\tMarkerComparator,\n\tRuntimeId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator.js'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\nimport { ErrorLocator } from '../exceptions/ErrorLocator.js'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.EntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type `\n\t\t\t\t\t\t\t+ `'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n`\n\t\t\t\t\t\t\t+ `Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are `\n\t\t\t\t\t\t\t\t+ `incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n`\n\t\t\t\t\t\t\t\t+ `${error.message}\\n\\n`\n\t\t\t\t\t\t\t\t+ (error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '')\n\t\t\t\t\t\t\t\t+ `Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: { noPersist?: boolean }) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\n\t\t\tif (!listState.children.has(childEntity.id)) {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`Entity list doesn't include an entity with id '${childEntity.id}' and so it cannot remove it.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tstate.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.`\n\t\t\t\t\t+ (looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids `\n\t\t\t\t\t\t\t+ `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and `\n\t\t\t\t\t\t\t+ `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["uuidValidate"],"mappings":";;;;;;;;AAoBO,MAAM,eAAe;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,WAA4B,OAAwC;AACnF,WAAO,KAAK,qBAAqB,SAAS,WAAW,KAAK;AAAA,EAC3D;AAAA,EAEO,iBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,mBAAmB,QAAW;AACvC,YAAM,iBAAiB,IAAI,oBAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,sBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,wBAAwB,QAAW;AAC5C,YAAM,sBAAsB,IAAI,oBAAA;AAAA,IACjC;AACA,WAAO,MAAM,oBAAoB,IAAI,OAAO,QAAQ;AAAA,EACrD;AAAA,EAEO,aAAa,OAAwB,gBAAwD;AACnG,SAAK,aAAa,cAAc,MAAM;AACrC,qBAAe,MAAM,aAAa,KAAK,mBAAmB;AAAA,IAC3D,CAAC;AAAA,EACF;AAAA,EAEO,cAAc,YAA6B,iBAAiC;AAClF,SAAK,aAAa,cAAc,MAAM;AACrC,YAAM,qBAAqB,KAAK,UAAU,0BAA0B,UAAU;AAC9E,YAAM,iBAAiB,kBAAkB,iCAAiC,KAAK,WAAW,eAAe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AAqB;AAAA,MAChF;AACA,aAAO;AAAA,IACR,CAAC;AAAA,EACF;AAAA,EAEO,mBAAmB,OAAwB,IAAc;AAC/D,UAAM,QAAQ,MAAM,SAAS,IAAI,EAAE;AACnC,QAAI,UAAU,QAAW;AACxB,YAAM,cAAc,OAAO,OAAO,YAAYA,SAAa,EAAE,KAAK,yBAAyB,eAAe,EAAE;AAC5G,UAAI,aAAa;AAChB,cAAM,IAAI,aAAa,kDAAkD,EAAE,6BAA6B;AAAA,MACzG;AACA,YAAM,eAAe,OAAO,OAAO,aAAa,KAAK,UAAU,iBAAiB,IAAI,EAAE,KAAK,kBAAkB,uBAAuB,EAAE;AACtI,YAAM,IAAI;AAAA,QACT,kDAAkD,EAAE,oCAChD,eACA;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM,YAAA;AAAA,EACd;AACD;"}
1
+ {"version":3,"file":"ListOperations.js","sources":["../../../../../../packages/binding-legacy/src/core/operations/ListOperations.ts"],"sourcesContent":["import { isUuid } from '@contember/utilities'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'\nimport {\n\tBindingError,\n\tEntityId,\n\tEventListenersStore,\n\tLocalizedBindingError,\n\tMarkerComparator,\n\tRuntimeId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport type { AccessorErrorManager } from '../AccessorErrorManager.js'\nimport { EventManager } from '../EventManager.js'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator.js'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state/index.js'\nimport type { StateInitializer } from '../StateInitializer.js'\nimport type { TreeStore } from '../TreeStore.js'\nimport { OperationsHelpers } from './OperationsHelpers.js'\nimport { ErrorLocator } from '../exceptions/ErrorLocator.js'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.EntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type `\n\t\t\t\t\t\t\t+ `'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n`\n\t\t\t\t\t\t\t+ `Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are `\n\t\t\t\t\t\t\t\t+ `incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n`\n\t\t\t\t\t\t\t\t+ `${error.message}\\n\\n`\n\t\t\t\t\t\t\t\t+ (error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '')\n\t\t\t\t\t\t\t\t+ `Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: { noPersist?: boolean }) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\n\t\t\tif (!listState.children.has(childEntity.id)) {\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`Entity list doesn't include an entity with id '${childEntity.id}' and so it cannot remove it.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tstate.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || isUuid(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.`\n\t\t\t\t\t+ (looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids `\n\t\t\t\t\t\t\t+ `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and `\n\t\t\t\t\t\t\t+ `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAoBO,MAAM,eAAe;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,WAA4B,OAAwC;AACnF,WAAO,KAAK,qBAAqB,SAAS,WAAW,KAAK;AAAA,EAC3D;AAAA,EAEO,iBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,mBAAmB,QAAW;AACvC,YAAM,iBAAiB,IAAI,oBAAA;AAAA,IAC5B;AACA,WAAO,MAAM,eAAe,IAAI,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEO,sBACN,OACA,OACA,UACC;AACD,QAAI,MAAM,wBAAwB,QAAW;AAC5C,YAAM,sBAAsB,IAAI,oBAAA;AAAA,IACjC;AACA,WAAO,MAAM,oBAAoB,IAAI,OAAO,QAAQ;AAAA,EACrD;AAAA,EAEO,aAAa,OAAwB,gBAAwD;AACnG,SAAK,aAAa,cAAc,MAAM;AACrC,qBAAe,MAAM,aAAa,KAAK,mBAAmB;AAAA,IAC3D,CAAC;AAAA,EACF;AAAA,EAEO,cAAc,YAA6B,iBAAiC;AAClF,SAAK,aAAa,cAAc,MAAM;AACrC,YAAM,qBAAqB,KAAK,UAAU,0BAA0B,UAAU;AAC9E,YAAM,iBAAiB,kBAAkB,iCAAiC,KAAK,WAAW,eAAe;AACzG,YAA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,MAChF;AACA,aAAO;AAAA,IACR,CAAC;AAAA,EACF;AAAA,EAEO,mBAAmB,OAAwB,IAAc;AAC/D,UAAM,QAAQ,MAAM,SAAS,IAAI,EAAE;AACnC,QAAI,UAAU,QAAW;AACxB,YAAM,cAAc,OAAO,OAAO,YAAY,OAAO,EAAE,KAAK,yBAAyB,eAAe,EAAE;AACtG,UAAI,aAAa;AAChB,cAAM,IAAI,aAAa,kDAAkD,EAAE,6BAA6B;AAAA,MACzG;AACA,YAAM,eAAe,OAAO,OAAO,aAAa,KAAK,UAAU,iBAAiB,IAAI,EAAE,KAAK,kBAAkB,uBAAuB,EAAE;AACtI,YAAM,IAAI;AAAA,QACT,kDAAkD,EAAE,oCAChD,eACA;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM,YAAA;AAAA,EACd;AACD;"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const uuid = require("uuid");
3
+ const utilities = require("@contember/utilities");
4
4
  const FieldHelper = require("./FieldHelper.cjs");
5
5
  class UuidFieldHelper extends FieldHelper.FieldHelper {
6
6
  setToUuid(options) {
7
- this.getAccessor().updateValue(uuid.v4(), options);
7
+ this.getAccessor().updateValue(utilities.generateUuidV4(), options);
8
8
  }
9
9
  }
10
10
  ((UuidFieldHelper2) => {
@@ -1 +1 @@
1
- {"version":3,"file":"UuidFieldHelper.cjs","sources":["../../../../../../packages/binding-legacy/src/fieldHelpers/helpers/UuidFieldHelper.ts"],"sourcesContent":["import { v4 as uuidV4 } from 'uuid'\nimport type { FieldAccessor } from '@contember/binding-common'\nimport { FieldHelper } from './FieldHelper.js'\n\nclass UuidFieldHelper extends FieldHelper<string> {\n\tpublic setToUuid(options?: FieldAccessor.UpdateOptions) {\n\t\tthis.getAccessor().updateValue(uuidV4(), options)\n\t}\n}\nnamespace UuidFieldHelper {\n\texport const setToUuid = (\n\t\tfield: FieldAccessor<string> | FieldAccessor.GetFieldAccessor<string>,\n\t\toptions?: FieldAccessor.UpdateOptions,\n\t) => {\n\t\tnew UuidFieldHelper(field).setToUuid(options)\n\t}\n}\nexport { UuidFieldHelper }\n"],"names":["FieldHelper","uuidV4","UuidFieldHelper"],"mappings":";;;;AAIA,MAAM,wBAAwBA,YAAAA,YAAoB;AAAA,EAC1C,UAAU,SAAuC;AACvD,SAAK,YAAA,EAAc,YAAYC,KAAAA,GAAA,GAAU,OAAO;AAAA,EACjD;AACD;AAAA,CACA,CAAUC,qBAAV;AACcA,mBAAA,YAAY,CACxB,OACA,YACI;AACJ,QAAIA,iBAAgB,KAAK,EAAE,UAAU,OAAO;AAAA,EAC7C;AAAA,GANS,oBAAA,kBAAA,CAAA,EAAA;;"}
1
+ {"version":3,"file":"UuidFieldHelper.cjs","sources":["../../../../../../packages/binding-legacy/src/fieldHelpers/helpers/UuidFieldHelper.ts"],"sourcesContent":["import { generateUuidV4 } from '@contember/utilities'\nimport type { FieldAccessor } from '@contember/binding-common'\nimport { FieldHelper } from './FieldHelper.js'\n\nclass UuidFieldHelper extends FieldHelper<string> {\n\tpublic setToUuid(options?: FieldAccessor.UpdateOptions) {\n\t\tthis.getAccessor().updateValue(generateUuidV4(), options)\n\t}\n}\nnamespace UuidFieldHelper {\n\texport const setToUuid = (\n\t\tfield: FieldAccessor<string> | FieldAccessor.GetFieldAccessor<string>,\n\t\toptions?: FieldAccessor.UpdateOptions,\n\t) => {\n\t\tnew UuidFieldHelper(field).setToUuid(options)\n\t}\n}\nexport { UuidFieldHelper }\n"],"names":["FieldHelper","generateUuidV4","UuidFieldHelper"],"mappings":";;;;AAIA,MAAM,wBAAwBA,YAAAA,YAAoB;AAAA,EAC1C,UAAU,SAAuC;AACvD,SAAK,YAAA,EAAc,YAAYC,UAAAA,eAAA,GAAkB,OAAO;AAAA,EACzD;AACD;AAAA,CACA,CAAUC,qBAAV;AACcA,mBAAA,YAAY,CACxB,OACA,YACI;AACJ,QAAIA,iBAAgB,KAAK,EAAE,UAAU,OAAO;AAAA,EAC7C;AAAA,GANS,oBAAA,kBAAA,CAAA,EAAA;;"}
@@ -1,8 +1,8 @@
1
- import { v4 } from "uuid";
1
+ import { generateUuidV4 } from "@contember/utilities";
2
2
  import { FieldHelper } from "./FieldHelper.js";
3
3
  class UuidFieldHelper extends FieldHelper {
4
4
  setToUuid(options) {
5
- this.getAccessor().updateValue(v4(), options);
5
+ this.getAccessor().updateValue(generateUuidV4(), options);
6
6
  }
7
7
  }
8
8
  ((UuidFieldHelper2) => {
@@ -1 +1 @@
1
- {"version":3,"file":"UuidFieldHelper.js","sources":["../../../../../../packages/binding-legacy/src/fieldHelpers/helpers/UuidFieldHelper.ts"],"sourcesContent":["import { v4 as uuidV4 } from 'uuid'\nimport type { FieldAccessor } from '@contember/binding-common'\nimport { FieldHelper } from './FieldHelper.js'\n\nclass UuidFieldHelper extends FieldHelper<string> {\n\tpublic setToUuid(options?: FieldAccessor.UpdateOptions) {\n\t\tthis.getAccessor().updateValue(uuidV4(), options)\n\t}\n}\nnamespace UuidFieldHelper {\n\texport const setToUuid = (\n\t\tfield: FieldAccessor<string> | FieldAccessor.GetFieldAccessor<string>,\n\t\toptions?: FieldAccessor.UpdateOptions,\n\t) => {\n\t\tnew UuidFieldHelper(field).setToUuid(options)\n\t}\n}\nexport { UuidFieldHelper }\n"],"names":["uuidV4","UuidFieldHelper"],"mappings":";;AAIA,MAAM,wBAAwB,YAAoB;AAAA,EAC1C,UAAU,SAAuC;AACvD,SAAK,YAAA,EAAc,YAAYA,GAAA,GAAU,OAAO;AAAA,EACjD;AACD;AAAA,CACA,CAAUC,qBAAV;AACcA,mBAAA,YAAY,CACxB,OACA,YACI;AACJ,QAAIA,iBAAgB,KAAK,EAAE,UAAU,OAAO;AAAA,EAC7C;AAAA,GANS,oBAAA,kBAAA,CAAA,EAAA;"}
1
+ {"version":3,"file":"UuidFieldHelper.js","sources":["../../../../../../packages/binding-legacy/src/fieldHelpers/helpers/UuidFieldHelper.ts"],"sourcesContent":["import { generateUuidV4 } from '@contember/utilities'\nimport type { FieldAccessor } from '@contember/binding-common'\nimport { FieldHelper } from './FieldHelper.js'\n\nclass UuidFieldHelper extends FieldHelper<string> {\n\tpublic setToUuid(options?: FieldAccessor.UpdateOptions) {\n\t\tthis.getAccessor().updateValue(generateUuidV4(), options)\n\t}\n}\nnamespace UuidFieldHelper {\n\texport const setToUuid = (\n\t\tfield: FieldAccessor<string> | FieldAccessor.GetFieldAccessor<string>,\n\t\toptions?: FieldAccessor.UpdateOptions,\n\t) => {\n\t\tnew UuidFieldHelper(field).setToUuid(options)\n\t}\n}\nexport { UuidFieldHelper }\n"],"names":["UuidFieldHelper"],"mappings":";;AAIA,MAAM,wBAAwB,YAAoB;AAAA,EAC1C,UAAU,SAAuC;AACvD,SAAK,YAAA,EAAc,YAAY,eAAA,GAAkB,OAAO;AAAA,EACzD;AACD;AAAA,CACA,CAAUA,qBAAV;AACcA,mBAAA,YAAY,CACxB,OACA,YACI;AACJ,QAAIA,iBAAgB,KAAK,EAAE,UAAU,OAAO;AAAA,EAC7C;AAAA,GANS,oBAAA,kBAAA,CAAA,EAAA;"}
@@ -1 +1 @@
1
- {"version":"7.0.1-rc","root":[90,[269,321]],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.es2024.d.ts","lib.es2025.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.es2024.arraybuffer.d.ts","lib.es2024.collection.d.ts","lib.es2024.object.d.ts","lib.es2024.promise.d.ts","lib.es2024.regexp.d.ts","lib.es2024.sharedmemory.d.ts","lib.es2024.string.d.ts","lib.es2025.collection.d.ts","lib.es2025.float16.d.ts","lib.es2025.intl.d.ts","lib.es2025.iterator.d.ts","lib.es2025.promise.d.ts","lib.es2025.regexp.d.ts","lib.esnext.array.d.ts","lib.esnext.collection.d.ts","lib.esnext.date.d.ts","lib.esnext.decorators.d.ts","lib.esnext.disposable.d.ts","lib.esnext.error.d.ts","lib.esnext.intl.d.ts","lib.esnext.sharedmemory.d.ts","lib.esnext.temporal.d.ts","lib.esnext.typedarrays.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../../src/accessors/BindingConfig.ts","../../../binding-common/dist/types/treeParameters/primitives/Alias.d.ts","../../../binding-common/dist/types/treeParameters/primitives/EntityId.d.ts","../../../binding-common/dist/types/treeParameters/primitives/EntityName.d.ts","../../../binding-common/dist/types/treeParameters/primitives/EntityRealmKey.d.ts","../../../binding-common/dist/types/treeParameters/primitives/ExpectedEntityCount.d.ts","../../../binding-common/dist/types/treeParameters/primitives/ExpectedQualifiedEntityMutation.d.ts","../../../binding-common/dist/types/treeParameters/primitives/ExpectedRelationMutation.d.ts","../../../binding-common/dist/types/treeParameters/primitives/FieldName.d.ts","../../../binding-common/dist/types/schema/SchemaColumnType.d.ts","../../../binding-common/dist/types/schema/SchemaEnums.d.ts","../../../binding-common/dist/types/schema/SchemaColumn.d.ts","../../../binding-common/dist/types/schema/SchemaRelationOrderBy.d.ts","../../../binding-common/dist/types/schema/SchemaRelation.d.ts","../../../binding-common/dist/types/schema/RawSchemaEntity.d.ts","../../../binding-common/dist/types/schema/RawSchemaEnum.d.ts","../../../binding-common/dist/types/schema/RawSchema.d.ts","../../../binding-common/dist/types/schema/SchemaField.d.ts","../../../binding-common/dist/types/schema/SchemaFields.d.ts","../../../binding-common/dist/types/schema/SchemaUniqueConstraint.d.ts","../../../binding-common/dist/types/schema/SchemaEntity.d.ts","../../../binding-common/dist/types/schema/SchemaEntities.d.ts","../../../binding-common/dist/types/schema/SchemaStore.d.ts","../../../binding-common/dist/types/schema/Schema.d.ts","../../../graphql-builder/dist/types/nodes/GraphQlFragmentSpread.d.ts","../../../graphql-builder/dist/types/nodes/GraphQlInlineFragment.d.ts","../../../schema/dist/types/schema/value.d.ts","../../../schema/dist/types/schema/input.d.ts","../../../schema/dist/types/schema/json.d.ts","../../../schema/dist/types/schema/acl.d.ts","../../../schema/dist/types/schema/actions.d.ts","../../../schema/dist/types/schema/actionsPayload.d.ts","../../../schema/dist/types/schema/model.d.ts","../../../schema/dist/types/schema/result.d.ts","../../../schema/dist/types/schema/settings.d.ts","../../../schema/dist/types/schema/validation.d.ts","../../../schema/dist/types/schema/index.d.ts","../../../schema/dist/types/ProjectRole.d.ts","../../../schema/dist/types/index.d.ts","../../../graphql-builder/dist/types/nodes/GraphQlField.d.ts","../../../graphql-builder/dist/types/nodes/GraphQlFragment.d.ts","../../../graphql-builder/dist/types/nodes/index.d.ts","../../../graphql-builder/dist/types/GraphQlQueryPrinter.d.ts","../../../graphql-builder/dist/types/index.d.ts","../../../client/dist/types/GenerateUploadUrlMutationBuilder.d.ts","../../../graphql-client/dist/types/PrimaryReadWindow.d.ts","../../../graphql-client/dist/types/GraphQlClientRequestOptions.d.ts","../../../graphql-client/dist/types/GraphQlClient.d.ts","../../../graphql-client/dist/types/GraphQlClientError.d.ts","../../../graphql-client/dist/types/index.d.ts","../../../client-content/dist/types/types/Schema.d.ts","../../../client-content/dist/types/types/Input.d.ts","../../../client-content/dist/types/types/Result.d.ts","../../../client-content/dist/types/types/index.d.ts","../../../client-content/dist/types/nodes/ContentEntitySelection.d.ts","../../../client-content/dist/types/nodes/ContentOperation.d.ts","../../../client-content/dist/types/nodes/TypedEntitySelection.d.ts","../../../client-content/dist/types/nodes/index.d.ts","../../../client-content/dist/types/ContentClient.d.ts","../../../client-content/dist/types/ContentQueryBuilder.d.ts","../../../client-content/dist/types/TypedContentQueryBuilder.d.ts","../../../client-content/dist/types/utils/mutationFragments.d.ts","../../../client-content/dist/types/index.d.ts","../../../client/dist/types/index.d.ts","../../../binding-common/dist/types/schema/SchemaLoader.d.ts","../../../binding-common/dist/types/schema/SchemaPreprocessor.d.ts","../../../binding-common/dist/types/schema/index.d.ts","../../../binding-common/dist/types/environment/Environment.d.ts","../../../binding-common/dist/types/environment/TreeNodeEnvironmentFactory.d.ts","../../../binding-common/dist/types/environment/VariableFieldValue.d.ts","../../../binding-common/dist/types/environment/VariableInputTransformer.d.ts","../../../binding-common/dist/types/environment/index.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Json.d.ts","../../../binding-common/dist/types/treeParameters/primitives/FieldValue.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Filter.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Limit.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Offset.d.ts","../../../binding-common/dist/types/treeParameters/primitives/OrderBy.d.ts","../../../binding-common/dist/types/treeParameters/primitives/PlaceholderName.d.ts","../../../binding-common/dist/types/treeParameters/primitives/RemovalType.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Scalar.d.ts","../../../binding-common/dist/types/treeParameters/primitives/UniqueWhere.d.ts","../../../binding-common/dist/types/treeParameters/primitives/SetOnCreate.d.ts","../../../binding-common/dist/types/treeParameters/primitives/TreeRootId.d.ts","../../../binding-common/dist/types/treeParameters/primitives/index.d.ts","../../../binding-common/dist/types/treeParameters/helpers/wrapFilterInHasOnes.d.ts","../../../binding-common/dist/types/treeParameters/helpers/index.d.ts","../../../binding-common/dist/types/treeParameters/EventListenersStore.d.ts","../../../binding-common/dist/types/types/ErrorAccessor.d.ts","../../../binding-common/dist/types/types/Errorable.d.ts","../../../binding-common/dist/types/types/PersistErrorOptions.d.ts","../../../binding-common/dist/types/types/PersistSuccessOptions.d.ts","../../../binding-common/dist/types/RuntimeId.d.ts","../../../binding-common/dist/types/types/EntityListAccessor.d.ts","../../../binding-common/dist/types/types/FieldAccessor.d.ts","../../../binding-common/dist/types/types/EntityAccessor.d.ts","../../../binding-common/dist/types/types/GetEntityByKey.d.ts","../../../binding-common/dist/types/types/GetEntityListSubTree.d.ts","../../../binding-common/dist/types/types/GetEntitySubTree.d.ts","../../../binding-common/dist/types/types/BatchUpdatesOptions.d.ts","../../../binding-common/dist/types/types/AsyncBatchUpdatesOptions.d.ts","../../../binding-common/dist/types/types/ExtendTree.d.ts","../../../binding-common/dist/types/types/QueryRequestResponse.d.ts","../../../binding-common/dist/types/types/DataBindingTransactionResult.d.ts","../../../binding-common/dist/types/types/PersistResult.d.ts","../../../binding-common/dist/types/types/Persist.d.ts","../../../binding-common/dist/types/types/DataBindingEvents.d.ts","../../../binding-common/dist/types/types/BindingOperations.d.ts","../../../binding-common/dist/types/types/TreeRootAccessor.d.ts","../../../binding-common/dist/types/types/index.d.ts","../../../binding-common/dist/types/treeParameters/Normalized.d.ts","../../../binding-common/dist/types/treeParameters/TreeParameterMerger.d.ts","../../../binding-common/dist/types/treeParameters/Sugared.d.ts","../../../binding-common/dist/types/treeParameters/defaults.d.ts","../../../binding-common/dist/types/treeParameters/index.d.ts","../../../binding-common/dist/types/markers/FieldMarker.d.ts","../../../binding-common/dist/types/markers/EntityFieldPlaceholders.d.ts","../../../binding-common/dist/types/markers/EntityFieldMarkersContainer.d.ts","../../../binding-common/dist/types/markers/HasManyRelationMarker.d.ts","../../../binding-common/dist/types/markers/HasOneRelationMarker.d.ts","../../../binding-common/dist/types/markers/EntityFieldMarkers.d.ts","../../../binding-common/dist/types/markers/EntityListSubTreeMarker.d.ts","../../../binding-common/dist/types/markers/EntitySubTreeMarker.d.ts","../../../binding-common/dist/types/markers/SubTreeMarkers.d.ts","../../../binding-common/dist/types/markers/EntityFieldsWithHoistablesMarker.d.ts","../../../binding-common/dist/types/markers/MarkerTreeRoot.d.ts","../../../binding-common/dist/types/markers/MeaningfulMarker.d.ts","../../../binding-common/dist/types/markers/PlaceholderGenerator.d.ts","../../../binding-common/dist/types/markers/PlaceholderParametersGenerator.d.ts","../../../binding-common/dist/types/markers/MarkerMerger.d.ts","../../../binding-common/dist/types/markers/MarkerComparator.d.ts","../../../binding-common/dist/types/markers/index.d.ts","../../../binding-common/dist/types/queryLanguage/MarkerFactory.d.ts","../../../../node_modules/chevrotain/lib/chevrotain.d.ts","../../../binding-common/dist/types/queryLanguage/ParserResults.d.ts","../../../binding-common/dist/types/queryLanguage/Parser.d.ts","../../../binding-common/dist/types/queryLanguage/QueryLanguage.d.ts","../../../binding-common/dist/types/queryLanguage/QueryLanguageError.d.ts","../../../binding-common/dist/types/queryLanguage/tokenList.d.ts","../../../binding-common/dist/types/queryLanguage/index.d.ts","../../../binding-common/dist/types/consts.d.ts","../../../binding-common/dist/types/BindingError.d.ts","../../../binding-common/dist/types/DataBindingExtendAborted.d.ts","../../../binding-common/dist/types/LocalizedBindingError.d.ts","../../../binding-common/dist/types/utils/TreeNodeUtils.d.ts","../../../binding-common/dist/types/utils/assertNever.d.ts","../../../binding-common/dist/types/utils/createQueryBuilder.d.ts","../../../binding-common/dist/types/utils/whereToFilter.d.ts","../../../../node_modules/uuid/dist/types.d.ts","../../../../node_modules/uuid/dist/max.d.ts","../../../../node_modules/uuid/dist/nil.d.ts","../../../../node_modules/uuid/dist/parse.d.ts","../../../../node_modules/uuid/dist/stringify.d.ts","../../../../node_modules/uuid/dist/v1.d.ts","../../../../node_modules/uuid/dist/v1ToV6.d.ts","../../../../node_modules/uuid/dist/v35.d.ts","../../../../node_modules/uuid/dist/v3.d.ts","../../../../node_modules/uuid/dist/v4.d.ts","../../../../node_modules/uuid/dist/v5.d.ts","../../../../node_modules/uuid/dist/v6.d.ts","../../../../node_modules/uuid/dist/v6ToV1.d.ts","../../../../node_modules/uuid/dist/v7.d.ts","../../../../node_modules/uuid/dist/validate.d.ts","../../../../node_modules/uuid/dist/version.d.ts","../../../../node_modules/uuid/dist/index.d.ts","../../../binding-common/dist/types/index.d.ts","../../../utilities/dist/types/assert-types/assertNever.d.ts","../../../utilities/dist/types/assert-types/index.d.ts","../../../utilities/dist/types/deprecate/types.d.ts","../../../utilities/dist/types/deprecate/deprecate.d.ts","../../../utilities/dist/types/deprecate/index.d.ts","../../../utilities/dist/types/dom/dataAttribute.d.ts","../../../utilities/dist/types/dom/svgSizeProps.d.ts","../../../utilities/dist/types/dom/index.d.ts","../../../utilities/dist/types/structures/BijectiveIndexedMap.d.ts","../../../utilities/dist/types/structures/LRUCache.d.ts","../../../utilities/dist/types/structures/WeakIdCache.d.ts","../../../utilities/dist/types/structures/index.d.ts","../../../utilities/dist/types/index.d.ts","../../src/core/state/EntityState.ts","../../src/core/state/FieldState.ts","../../src/core/state/StateNode.ts","../../src/core/state/EntityRealmState.ts","../../src/core/state/EntityListState.ts","../../src/core/state/getEntityMarker.ts","../../src/accessorTree/NormalizedPersistedData.ts","../../src/accessorTree/index.ts","../../src/utils/assertNever.ts","../../src/utils/generateEnumerabilityPreventingEntropy.ts","../../src/utils/isEmptyObject.ts","../../src/utils/index.ts","../../src/core/QueryGenerator.ts","../../src/core/requestAliases/MutationAlias.ts","../../src/core/requestAliases/index.ts","../../src/core/MutationGenerator.ts","../../src/core/RequestResponseNormalizer.ts","../../src/core/TreeStore.ts","../../src/core/state/StateIterator.ts","../../src/core/state/index.ts","../../src/core/ErrorsPreprocessor.ts","../../src/core/Config.ts","../../src/core/DirtinessTracker.ts","../../src/core/UpdateMetadata.ts","../../src/core/EventManager.ts","../../src/core/AccessorErrorManager.ts","../../src/core/RealmKeyGenerator.ts","../../src/core/StateInitializer.ts","../../src/core/operations/OperationsHelpers.ts","../../src/core/exceptions/TreeParameterSugarer.ts","../../src/core/exceptions/MarkerSugarer.ts","../../src/core/exceptions/ErrorLocator.ts","../../src/core/operations/EntityOperations.ts","../../src/core/operations/FieldOperations.ts","../../src/core/operations/ListOperations.ts","../../src/core/operations/index.ts","../../src/accessors/EntityAccessorImpl.ts","../../src/accessors/EntityListAccessorImpl.ts","../../src/fieldHelpers/helpers/FieldHelper.ts","../../src/fieldHelpers/helpers/TemporalFieldHelper.ts","../../src/fieldHelpers/helpers/UuidFieldHelper.ts","../../src/fieldHelpers/helpers/index.ts","../../src/fieldHelpers/index.ts","../../src/accessors/FieldAccessorImpl.ts","../../src/accessors/index.ts","../../src/core/factories/createBatchUpdatesOptions.ts","../../src/core/factories/index.ts","../../src/core/TreeAugmenter.ts","../../src/core/utils/getCombinedSignal.ts","../../src/core/utils/index.ts","../../src/core/DataBinding.ts","../../src/core/index.ts","../../src/index.ts","../../../../node_modules/vite/types/hmrPayload.d.ts","../../../../node_modules/vite/types/customEvent.d.ts","../../../../node_modules/vite/types/hot.d.ts","../../../../node_modules/vite/types/importGlob.d.ts","../../../../node_modules/vite/types/importMeta.d.ts","../../../../node_modules/vite/client.d.ts"],"fileInfos":[{"version":"a1aa1a5e065d48ef5c7bb99e38412f96","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7","9443a7f109277ffaa79d893ed2549995","793cee405385076e27c24f409659dccd","09f69c6610266eaee1ac9e3e30df2c71","62bad718844246b8e17547f37bad6085",{"version":"aae8996e8b5684814785a42cbbefcd79","affectsGlobalScope":true,"impliedNodeFormat":1},"abad6dd56cc8caf095c165df8124d237",{"version":"01ac052ec4a79e87229f90466a9645f8","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"edba5df642941aa062a62f6328c6df3d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bb3a710cbcda0533bb127712927cbe37","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7a42de379b489e8f7b647455bebfc576","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"692bcd75364db0f65d428801c7884466","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8cf777fe00349b71ee9c4b6f3fe7fd19","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f96bc192530c9723f572bfff3d3078","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1df91c56b25955c56387426f378173c5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38856f70edcd2115c355d96ec77cc09e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"de8700156c1275465bcd473c28b359aa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d47cfdb6ede40518357bb5a4cd7cd9fb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6e5773860cd9e5b15e683113f642ab47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"30ff5fe1682f7fcd629880476ca3c2e0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bf23d7d1b40b9015b694ddc2f011752f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2cc585d42e2c548f9f24a30a1989fd33","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"713906ce9d332d2242b7f05ed9304be3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0219894bfe5042c7e1aa2d22e4a91ed0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6009ffff7e43c93318804d2d28e37fe3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"03be89b227587594fbb50509fc1c2e45","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b30df52dc24740c0bad7c55c3511df7d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8d3c9b5ed5c2ab8f383607eef439f0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d950ec671d0a8e07f3c1a31e94abed86","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1abef2ace5eccb02d60dd73cd5a5ee4c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f5f0a3044029d1cc081b5887eb4deb07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d57c697f1446940ec4bfe669c962e2c4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"be41035d7b941482a1e1ae6a5c5dcca5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"10f7d9da7564f27f8ddf4a162b6da6d3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1d0520af549e0c3581f15173cc713ca1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d65083f97fd741cff028472563eddb79","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"da7f24f00653ebac660ac1c0821ed33d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7cb5ae9e65516ea2235f0721f6aac43c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c2e0450ea482c636ac7fad3bd58f9c86","signature":"d9d96dad68bb344e5af336ffcb54b82a","impliedNodeFormat":1},"3512afeb33cf5e52089ebccd309ca4c3","480d64288535716709f2c337fb595238","238ae51799b8949af2cf9b6e5499b701","a3f642aa940f7d667eef548854e4c1d8","66c4588c00e8472e3eded15ce6463caf","8e7c6af72f7a9f692bc0a778c6d670db","e4563cbb08d5340c00629547ebd3fa00","3ef6a97077841be08b8896f86aab99fa","105888e49cba2c7a372422e94b055613","b46ffc517cdb1ca80e2e711684bb740b","473ebd78215a1715c6253cb7291dc759","692037503296ba25357677f686aa4309","722717929b4d839aa6520aef8e47d59a","4832d972cd0cced66bf686fde23e174c","5b04445920057120fdfbde5556f78e40","21f85d6b945ec851ec627f3feeacbd29","4f690a8acd8e82adb8e704c732b2f8c2","e8127fb438ad22c61fe7dcb4c2fb2706","27d4457e39ee9f3d97d753e66294ffa3","fc3f327d2ede32e435f208b2bbe6abdb","f5a37e30aa8796a025ee9f89891b73f0","a060cbbe35c3aecd25fa819034f7492a","c7ef313c7f9cd2f50fa1b5805e7cde2b","4b7fe4d93992b2b9d079b1c3bae8707c","4f96fc5213ba46ab56ebce3ddd275393","6d13d72e6edde2776af61e7e6f43a6c7","1b3d3973208b0df323219a5f2f32bd83","db9837352169e3722270f39bd896d9eb","d60c3608e026e7ebb5ee17cb32901afe","c9bca94af23f5b6478f1caaec59168f5","af61cf343114f53162ee9cbf87dfc476","d6f4183eab98f156875bd4afc311ce22","133e63b3b844406000c3ef5e9633943c","d30401b9b670626dc86ca82ceb5b14b1","d6433f4eb936b57d58ca8052ee4f2c2a","994ba6dbd0849926f7cee07420f41cc1","814e4b695f97214aa97736b079e81225","ae757ed463a715a9571d836c0628e520","aaac8c2a681fadf5f4c0e5dc6530c477","e3cc1c890da57806846d019e3dcc94f8","bc9d90120bee546e143d11431237496e","1cff455284ebb3f8abb5b991cf140bfe","ae2a4a2167151e0797bb717b3efd2a83","7357dde96d70fec8e929123cf4c7778a","aa8e8b7fab38edc4eac217c965879b49","f3ab1bd5949cf3a31ddcb66fbb95e4ad","5bcef1d1b354649ef9901b60d4ae8d74","43dad7ac32d3648d3cb8d37aae30f14b","98a3613f689fdc2f21dc4a2e53baa352","15f9448236834eaeb54b8c0c9e47cdab","1038b8b32e05667ac99cbe3ac9b27dc4","a5d821d0671e1d115ed791ba4ad72403","f40566f9d429454c90597ef50db77e0e","712885b9ff68ff0b95f704fc9953ab51","3dfbb9dbbdfee223adad1f2be2deff37","f81d4f2748cfb62e2047515a3f350a80","dd5c05a6d99ec64e123f2831a4358151","5a2da875dd8f8db04bcd3e2a472674e6","79af01e4a4cd6e81a4566f378af669ac","f921d3af300289c7178e3e9a7b61ed89","1e1595ba7094c5d08498569ccccad2ed","d6c9fdd7b51c775b9cd093c9b6f7bd5f","f10fb32be389e69cc35e416c1761e1d9","14fe99b97b94c5f907217091ad7b36b4","2b4a726ffa347a1a1ff97b4f247addd4","8eda59ddc7428e8ae28453924f3125c5","70a8e1fe29c8ef80ffa3486d5b6b2009","e643a53e6387519a5cd451e644ee0f21","9396ae2d4c7f5f5dbc74081b09d26aa1","ab1f7c0f712b87e3c1eff7d232736fbf","d552d54da0b6e247d05dffcbf68fc2c0","81de688b79084b39a9f27ae87d7996d6","5e92c454558b99e5047be483cbaad51c","36efab0999e4a2e7e679ce35172d08d6","00fed26a3bf8d55f29b20dba837cc43b","ca9aa78d53e7ab4f6591a37ad4aeb210","662a7e348bef70549587b2791cd8c6f0","24a9560c94a62e67131ddaeee0fe2e04","26298144575604b00ebf092a9fd1dd79","a9d5826a6ae590fdfa665ab1f1d0e4f6","c0e5d575dbd4fe4c4c213f3f1159dccb","5760bd6522353695c2ddc02c54bb5296","5735999f862ed77fb15dd0a07af4c690","8a3fa5ffd9b69552eda0406b10aff6b6","f361096d64bf956068f347890051b922","5c0642a58bad41b11f1c9e01e6a6df8a","f3e2787916207766f4464adbe152b1c6","01fd15d97c0b2b2ee442305aa66f0867","9060117794fd69e9c7d1d07e9f7d7eee","0209b42a543773ca4faa5a421c67523c","3034314dbab58ff802ddad66300f8dd0","6b91ae5e84a57d0f78b2ba73864b3641","31b91f9fb5a184f0fe64d3568731d49c","0976fcebfe0b72f20022457705ceca62","db6da118202c7a6062a4b6165fb931c3","f05be3ecb1dd287fa42bf3f976d192a7","3ee897072c5fc98c53e87a6c2985e424","f351aa39a59f4227ab03cf8a45877766","986fc601b935a91b1d7a174d23521f01","d8df98c857afac105a74f4c444fff29d","97ee58b38eb8e3f29fb10506e553987a","a06cafbc0814bb2ada53d6acbe572400","d0a59ec90b5e56234b6af813e57999a4","f0ce2b6c6a4907b2e4ed106af451d54c","0a5b543909bb54fbf0e7b3522852afc1","07c2e3503cde93af88df4ce394c73df4","68f2b483aba07fc465193eac614e722f","2f3fe0bb3570d798e001fef558ea0804","e4b278f3bf00faae70a36cd0d7dd7e8e","3dd6b5b1deedc3ed4a3c00234b2b2591","d483508d112d58eebeab08513f728be5","507efbe95f9749e66d3838357f0df16d","baf7ffc32e7cae4da2ccbf4ffe32d1a7","e653d44ced10f7420c1bed907c234fdc","9576edf0ee00cc8cee985b71f619254c","a6a6d2a01d7323fe1d0179a2e827375b","a4e33c0b6354c50ecac0c6b0164dfcd0","0fc742b3abd9a9e266fbf1da4cd05d48","256bb29a082c04b01ab5afcb9fc84138","95be0a295b9339ad52a51afadf778163","8c90ea824e7e747cfa4034c9ceb541ca","9c3d7489815844afd869ba4463e900d8","53b1bc54d28c5a7e39dc5d39e1c23ffa","8d1fe365493f8457e0cfd314c50037b2","25c48f982859e2b5ac7fea0f5b5f9244","e0efaeec4e09a914b689db7fccbcd122","70b967b402e6a36271cb0205bc0f03cf","69ae570eb60b205ad0b973c075a0908f","b5770878ae6c834f4ed269b83a97d823","9d169215e3e82facf8acb4b0346fd8b0","f003f3388e5e25e1c61a4211a7385fb0","05498cd331cd54e27937ddc97d3e91d7","c87c3ce0f441ef8c617db14ad5e66294","1c83f32889a7362b824944345a062b57","a856354623efaee640e22f8fb74bb8bd","26340c4213be1a2ef5eb1ae41466c868","35173c5b4f54e9fbd7967259ac2cf9b6","1b8f3b207e274641184699268317a397","bf874bee540cd2d6996f83f13ca08cc1","903c7125f77d6dedcb4e603b4096b687","45558f972578178cb10321e901d61444","40960105ff26fb1afb981a363515653f","d69d8f57c22ccb149c66fa433c364bd0","cfc4b138f260b64d7369e570716fc8c9","34171980a15ec5be19f102c95d9495e2","a9c4cf02f2d81dd2f75e40b4c5ee1850","5090907d8712395e579d66dae8946172",{"version":"a36c13283f16ab3631c2b1c90abe6ef8","impliedNodeFormat":99},{"version":"b50f87570a01f782cfa3401a3e6b3602","impliedNodeFormat":99},{"version":"6f47562fea657617d51178a6b628d1df","impliedNodeFormat":99},{"version":"ad12786d0b3f0dc2f1de4fe315b26b7e","impliedNodeFormat":99},{"version":"aa85a9e8e0f5ca21dde7e0298b2b8146","impliedNodeFormat":99},{"version":"1551f5acd9d5a85310b725414d0b4fa5","impliedNodeFormat":99},{"version":"3a625e8d4174dc6919bd049c31ca6b20","impliedNodeFormat":99},{"version":"394af2608e902900680cd67fa065f6c6","impliedNodeFormat":99},{"version":"cc4e641a1cb6c071372873d1ca2fee40","impliedNodeFormat":99},{"version":"150b410f8058ea9e39790e6d2ac3d32d","impliedNodeFormat":99},{"version":"1b0ea2d3e52774945764baea8eb10b91","impliedNodeFormat":99},{"version":"c6961b4ba8702bb2542fcfa461550151","impliedNodeFormat":99},{"version":"d6a199693f2d5a2a224c7e35b3826e9d","impliedNodeFormat":99},{"version":"e600b341a3395e7da358b367546a3fa3","impliedNodeFormat":99},{"version":"39328de4080d47acd2e4421605ab13df","impliedNodeFormat":99},{"version":"cb649b306728659696c74598e74c2b74","impliedNodeFormat":99},{"version":"23d47d5e271225f54f94ac4ff632b962","impliedNodeFormat":99},"c5ba448a6b8b834fe782eaba8faca1dc","34171980a15ec5be19f102c95d9495e2","3715a3f4b3bd84ea36ed27e4215e5ab0","d8f003ba4a5b9aa7029eb57a44a86850","df1804c5dc3ddd2cb8276304519bbcd0","c09dea60079c9ee1a1a93822ea50e228","de17e043f79da7cd4e85821cd25d1db5","1d63154cea053fb35d1dd86b32ecc2c1","e22862e18afc2634bb64fd38d7cb9f05","c82b93f65c64fc5cc377b8cc7c100fc2","cf23c49d7f10fc30a5f10f43a72d554c","dc593ad1bf3398091a142d2f2295d062","f09c5497ccf71c9cf5ece945780b7935","d2b19807dc0402ca4c0599433079a627",{"version":"4e2be8508a016d290eb0cc1c1e7208a7","signature":"0ae66f61c8079fad8e92c4cdd0d62425","impliedNodeFormat":1},{"version":"cdac6629454cbb3acfdf074a2bd411ba","signature":"f1f29fabf2a88f83bb4c83f2432a9f0d","impliedNodeFormat":1},{"version":"f282963a0106b5921b3b1387635ed39e","signature":"b9932caaae8565c014c85fae75cab98c","impliedNodeFormat":1},{"version":"9051c111fabdb1c68176b7b6947d62dd","signature":"d3c73a5ce7eb640cb3c70ec45b909e7d","impliedNodeFormat":1},{"version":"34e1589576aa751b21ddd5209741d51c","signature":"f29c714003aa12e0afe266226571db62","impliedNodeFormat":1},{"version":"48a6705cab420d892b9b4c00ceb48edc","signature":"d57d2b71ce3e2b57087d4e263b373b30","impliedNodeFormat":1},{"version":"873aac9f05942b16a9117b1f30f080ad","signature":"a8619d81bcc20286662a38308accab3c","impliedNodeFormat":1},{"version":"0e21f1afd3d70a81acdf43b45ed6e839","signature":"bd5929b48ce9825c36f9d8518eea6ea9","impliedNodeFormat":1},{"version":"889ed7c2ab7886a1944a2684c92ffc2d","signature":"44058d29ff93b9ceaddca6f164244a30","impliedNodeFormat":1},{"version":"c9c9edff5968d731344bc74a7ab2b93d","signature":"91732910a0cd05726da629b5ddf70fb5","impliedNodeFormat":1},{"version":"5477876f88511cb4a741d354eee74df9","signature":"406376ebe2e416ba406d58d93dd3faa8","impliedNodeFormat":1},{"version":"ddf283b027c743173086228befecbb62","signature":"c305a33508f0aee17ba4de19bbaf547d","impliedNodeFormat":1},{"version":"92962deb744164b6ed9b25be24b21e7c","signature":"f6618f9acf003f362df807814fce0a16","impliedNodeFormat":1},{"version":"1b7853ee07bf07f643f2ee95990e3472","signature":"322371764c759221562b42ac2e59d2da","impliedNodeFormat":1},{"version":"2b7503b21610fb2cbcf549f8b7d9e98f","signature":"fe2abec6a1f290c910cf0b1d2f727aae","impliedNodeFormat":1},{"version":"384d891957ed0bb9a6ff145f6b288cba","signature":"48b654e15d0619d8054fbc8fdd8c8077","impliedNodeFormat":1},{"version":"d2da6152d2505c2458141588116da188","signature":"167c56442d7777849e1c47dde17e0936","impliedNodeFormat":1},{"version":"c6c8c3a1d4febc6b17c8014ece0c3dd2","signature":"4b90e8a367b78fba69d61933a56b3b4c","impliedNodeFormat":1},{"version":"1809d78179e543f1a9d00c6a22030e2d","signature":"be426e2d02d338be93608a272c8dd60d","impliedNodeFormat":1},{"version":"db73a48397b22c48ba3fdbd76136c2bd","signature":"6a447dc1918d54eda1a3a024950a3b42","impliedNodeFormat":1},{"version":"26a8cc4d604f58459b6fab8c38c18575","signature":"6592218e89f70e0d4e85c11c79515c36","impliedNodeFormat":1},{"version":"8c9882ddf02508f7ceb0d2c1011f76cd","signature":"3da4b5fc25f03a476802f2753db5d55b","impliedNodeFormat":1},{"version":"220fa06bb20d7e32f309d93a5bb33efe","signature":"0b63d3bd79d514925534a33e80e8dabd","impliedNodeFormat":1},{"version":"f128674b7be8e23067ec0a261d29ec2d","signature":"71f3f8ab7917eb405e8d0d2187ad224f","impliedNodeFormat":1},{"version":"6a97ab2f766c2d58c5c768e26f08b0b9","signature":"153a26fd359cbe14c2503e0877bd5fa0","impliedNodeFormat":1},{"version":"146b82f9287c309b3af7bfda58ce5c1e","signature":"2d1b51bfb8a4ea625c6c278855203d33","impliedNodeFormat":1},{"version":"c525d476a29c0afb956c95b0d15c9554","signature":"b98f8a9585310f448d5aa3c997f070fe","impliedNodeFormat":1},{"version":"1c4faa52ad1400fd76e49fa239073543","signature":"66efaa49c28c60397922f987001a2b13","impliedNodeFormat":1},{"version":"735ecbe0e1fd9fc992a3827731145367","signature":"af7efe939d7dfdc28c75acbcc3a90af6","impliedNodeFormat":1},{"version":"29abcc2923612df10b4986c983672106","signature":"0b5d516f9c38650bbf016fbe0f396560","impliedNodeFormat":1},{"version":"60afa2abab8aee65ff90d7407e4ea55b","signature":"c0592727cd7823ba8a196ffabd02834f","impliedNodeFormat":1},{"version":"c5436bd9f193ee87ed5f51efaac716ee","signature":"7be777bd4c614b2e7001765649ab7c64","impliedNodeFormat":1},{"version":"34cfc3f4b4899503970f22d24a123874","signature":"e109adc4c85ef3c32261ad05569bb9bd","impliedNodeFormat":1},{"version":"7a3ee9f972c19b092b4d93c72d54d502","signature":"d1450d5caf65eb4e2d81c85d3e691b60","impliedNodeFormat":1},{"version":"4aa12944094d182299fcd2ceeccd1286","signature":"ccc8b48c4fbf2117c9b80a0abe100aa8","impliedNodeFormat":1},{"version":"39b8e0283ab9030ebf2523b7a7de28f3","signature":"7a6b5db6d4eb5370c5e9ea01f6cee7e6","impliedNodeFormat":1},{"version":"fc0a1b7a2ade16b34eea476f917ad4a3","signature":"ba3c89d70b63699c5937739f8d1bf453","impliedNodeFormat":1},{"version":"a333552bb2b20f0adc73f79bb0c71e59","signature":"24597f0db3fe521ac9e5c35ea014538c","impliedNodeFormat":1},{"version":"3288ca3d36de6e63a7c1b9fc795217b1","signature":"2628b2dbf98d65e686cb23c6f378e351","impliedNodeFormat":1},{"version":"4b7820f89a9eb65e85f196e21d1bb3c4","signature":"68a1874e351c63292b1d3d5632293c89","impliedNodeFormat":1},{"version":"461323e5808465059303022a236148db","signature":"696b5e7ec807f5dd14478ff023917063","impliedNodeFormat":1},{"version":"ac01c9e2bb2c102207b05fd42eceaf95","signature":"457fcb19d3e52f527f4882a62996d3ae","impliedNodeFormat":1},{"version":"36b8079291140b62802526a83528ceef","signature":"4ed12fb6954a046b296dae6519b381dc","impliedNodeFormat":1},{"version":"296a94f956853c06e1c94483dc48380f","signature":"955b659851dec193f3eb91f2fc245784","impliedNodeFormat":1},{"version":"843a37e9fa044304e2d0b7502e4fd014","signature":"277ae9a36388c141a78453200e2352cd","impliedNodeFormat":1},{"version":"d9c6099f5bb8bdd1e9a2fc78d0e2821b","signature":"f38068c858bdd81c313a0054bfc1215a","impliedNodeFormat":1},{"version":"5a8bd4ee1a1c9b3d0c646a197187544a","signature":"d29cdc81245db45f66c6c8609ebf056e","impliedNodeFormat":1},{"version":"f430dc478f0fad831a5ce177b5734588","signature":"015a503488bbe061aef8f1f16505890a","impliedNodeFormat":1},{"version":"42723680dedeba91da2e249b94763879","signature":"49606c6146b4306dd89400b0fda145c6","impliedNodeFormat":1},{"version":"5714c1dbaed933bc9f12fc2586a75c70","signature":"5f6d07f7c411fd085b5568c640f2f54d","impliedNodeFormat":1},{"version":"f12bcced42feac7f20b9e344d8f4558d","signature":"e5d8f74103b702f1da0d87c1562d4ad5","impliedNodeFormat":1},{"version":"95381f4aa867b5ce19ea94afc4e6cdf7","signature":"d6a3cf55f200c55027f67f63158cbe89","impliedNodeFormat":1},{"version":"3709923ea58ece172d3cd948385513eb","signature":"8141ea8968b9d9044a15ce2d8c868ea7","impliedNodeFormat":1},"ab8e1ea59f16bc290a0451d09dc5a52e","24367c4ec7d778084b3a83bbdc5a23d4","edbf4843929ee5fe6521503f424e4464",{"version":"c15a3f94d92e048c199fe585e50b2297","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"5b83f00203fc116f466f7588477a7cab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fcb0cf1fa7d03295b48a25ebd55a6af9","affectsGlobalScope":true,"impliedNodeFormat":99}],"fileIdsList":[[327],[238,239,240,241,242,243,244,246,247,248,249,250,251,252,253,327],[238,327],[238,245,327],[326],[322,327],[323,327],[324,325,327],[221,231,327],[204,327],[156,204,327],[157,204,255,327],[157,159,204,327],[157,158,159,160,327],[156,161,182,199,204,221,229,230,231,232,233,234,235,236,237,254,327],[204,205,208,209,327],[206,210,327],[204,207,213,327],[161,204,207,327],[221,327],[161,204,221,327],[204,213,327],[205,208,209,211,212,327],[161,204,327],[204,211,212,327],[205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,327],[153,161,204,223,224,327],[161,204,224,255,327],[222,225,226,227,228,327],[223,327],[104,105,327],[101,103,204,327],[100,327],[100,101,103,107,110,112,204,327],[99,100,204,327],[110,204,327],[108,109,204,327],[101,103,327],[107,204,327],[113,153,327],[106,112,327],[102,204,327],[100,111,327],[99,100,101,102,103,106,107,108,109,110,111,112,113,154,155,327],[174,177,199,327],[174,199,200,327],[175,327],[174,176,177,200,201,202,203,327],[161,162,327],[153,327],[171,327],[91,92,93,94,95,96,97,98,162,163,164,165,166,167,168,169,170,171,172,173,327],[153,189,327],[186,187,188,327],[161,189,190,191,192,195,196,221,327],[194,327],[153,192,327],[161,178,179,180,181,183,184,189,190,204,221,327],[161,178,179,180,181,182,185,189,190,204,221,327],[178,327],[156,178,179,185,189,204,327],[185,327],[161,183,204,327],[161,185,204,327],[180,181,194,327],[190,327],[178,193,204,327],[197,327],[178,179,180,181,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,327],[156,161,327],[152,156,327],[255,327],[275,327],[255,276,288,304,327],[255,288,304,327],[255,288,304,311,327],[90,305,306,312,327],[153,255,284,286,288,289,293,327],[313,327],[153,255,280,281,284,286,288,290,291,292,293,294,296,315,316,318,327],[153,255,283,284,327],[255,286,288,290,291,292,327],[153,255,276,280,281,283,286,288,327],[153,255,327],[255,268,288,327],[255,276,284,327],[255,268,276,286,288,293,294,295,304,313,327],[255,276,284,286,288,293,296,297,327],[255,276,284,285,288,327],[255,288,298,299,327],[255,298,327],[255,286,327],[314,327],[281,284,286,290,291,293,296,316,319,327],[255,286,288,293,294,296,297,300,327],[254,255,286,288,293,294,296,297,327],[254,255,286,288,293,294,295,296,297,300,327],[255,286,288,293,295,296,327],[301,302,303,327],[282,327],[255,268,272,327],[255,269,271,273,327],[255,272,327],[255,270,271,272,273,274,286,327],[255,270,272,273,327],[272,327],[269,270,271,272,273,274,287,327],[317,327],[255,307,327],[254,255,307,327],[308,309,327],[310,327],[255,276,313,320,327],[277,278,279,327],[139,143,147,327],[128,143,147,327],[143,147,149,327],[143,147,148,149,150,151,327],[128,133,143,327],[133,327],[143,144,327],[144,145,146,327],[128,140,327],[128,327],[140,141,142,327],[128,134,139,152,327],[128,131,327],[131,132,327],[114,115,128,327],[129,327],[114,115,129,130,327],[136,327],[135,327],[135,136,137,138,327],[126,127,327],[117,118,327],[118,327],[116,117,118,119,120,121,122,123,124,125,327],[116,327],[256,327],[258,327],[258,259,327],[261,262,327],[257,260,263,267,327],[264,265,266,327]],"options":{"composite":true,"emitDeclarationOnly":true,"declaration":true,"declarationMap":true,"experimentalDecorators":true,"jsx":4,"module":99,"noEmitOnError":true,"noImplicitOverride":true,"outDir":"./","skipLibCheck":true,"strict":true,"sourceMap":true,"target":7,"useDefineForClassFields":true,"allowSyntheticDefaultImports":true,"esModuleInterop":true},"referencedMap":[[88,1],[89,1],[14,1],[15,1],[17,1],[16,1],[2,1],[18,1],[19,1],[20,1],[21,1],[22,1],[23,1],[24,1],[25,1],[3,1],[26,1],[27,1],[4,1],[28,1],[32,1],[29,1],[30,1],[31,1],[33,1],[34,1],[35,1],[5,1],[36,1],[37,1],[38,1],[39,1],[6,1],[43,1],[40,1],[41,1],[42,1],[44,1],[7,1],[45,1],[50,1],[51,1],[46,1],[47,1],[48,1],[49,1],[8,1],[55,1],[52,1],[53,1],[54,1],[56,1],[9,1],[57,1],[58,1],[59,1],[61,1],[60,1],[62,1],[63,1],[10,1],[64,1],[65,1],[66,1],[11,1],[67,1],[68,1],[69,1],[70,1],[71,1],[72,1],[12,1],[73,1],[74,1],[75,1],[76,1],[77,1],[1,1],[78,1],[79,1],[13,1],[80,1],[81,1],[82,1],[83,1],[84,1],[85,1],[86,1],[87,1],[223,1],[254,2],[239,1],[240,1],[241,1],[242,1],[238,1],[243,3],[244,1],[246,4],[245,3],[247,3],[248,4],[249,3],[250,1],[251,3],[252,1],[253,1],[327,5],[323,6],[322,1],[324,7],[325,1],[326,8],[231,1],[232,1],[233,9],[182,10],[230,1],[157,11],[158,12],[159,1],[160,13],[161,14],[255,15],[210,16],[207,17],[206,10],[214,18],[211,19],[212,19],[205,10],[208,19],[209,19],[220,20],[219,21],[215,22],[216,23],[217,24],[218,24],[213,25],[221,26],[222,21],[225,27],[224,10],[226,28],[227,1],[229,29],[228,30],[106,31],[104,32],[105,33],[113,34],[101,35],[99,1],[111,36],[110,37],[100,1],[107,38],[108,39],[154,40],[155,41],[103,42],[102,1],[112,43],[109,10],[156,44],[177,1],[200,45],[202,46],[201,10],[203,1],[176,47],[175,10],[204,48],[91,1],[92,1],[93,1],[94,1],[95,1],[96,1],[97,1],[98,1],[163,49],[164,50],[162,1],[165,1],[166,1],[167,50],[168,1],[169,1],[170,1],[172,51],[173,1],[171,50],[174,52],[190,53],[189,54],[197,55],[196,56],[193,57],[185,58],[183,59],[178,50],[179,60],[191,24],[184,61],[186,62],[187,63],[188,64],[195,65],[180,66],[194,67],[181,66],[192,10],[198,68],[199,69],[234,70],[235,1],[236,71],[237,50],[275,72],[276,73],[90,1],[305,74],[306,75],[312,76],[313,77],[294,78],[290,79],[319,80],[291,1],[289,81],[293,82],[284,83],[281,84],[295,85],[285,86],[296,87],[316,88],[286,89],[292,1],[300,90],[299,91],[298,72],[314,92],[315,93],[320,94],[301,95],[302,96],[303,97],[297,98],[304,99],[282,72],[283,100],[273,101],[272,102],[269,103],[270,103],[287,104],[271,105],[274,106],[288,107],[317,1],[318,108],[307,72],[308,109],[309,110],[310,111],[311,112],[321,113],[277,72],[278,1],[280,114],[279,1],[148,115],[149,116],[150,117],[152,118],[144,119],[145,120],[146,121],[147,122],[141,123],[142,124],[140,124],[143,125],[151,120],[134,120],[153,126],[132,127],[133,128],[129,129],[130,130],[114,1],[115,130],[131,131],[137,132],[138,1],[136,133],[135,1],[139,134],[127,1],[128,135],[119,136],[120,137],[121,136],[126,138],[117,139],[118,1],[122,136],[123,139],[124,1],[125,137],[116,1],[256,1],[257,140],[259,141],[260,142],[258,1],[261,1],[263,143],[262,1],[268,144],[264,1],[265,1],[266,1],[267,145]],"latestChangedDtsFile":"./index.d.ts"}
1
+ {"version":"7.0.1-rc","root":[90,[257,309]],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.es2024.d.ts","lib.es2025.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.es2024.arraybuffer.d.ts","lib.es2024.collection.d.ts","lib.es2024.object.d.ts","lib.es2024.promise.d.ts","lib.es2024.regexp.d.ts","lib.es2024.sharedmemory.d.ts","lib.es2024.string.d.ts","lib.es2025.collection.d.ts","lib.es2025.float16.d.ts","lib.es2025.intl.d.ts","lib.es2025.iterator.d.ts","lib.es2025.promise.d.ts","lib.es2025.regexp.d.ts","lib.esnext.array.d.ts","lib.esnext.collection.d.ts","lib.esnext.date.d.ts","lib.esnext.decorators.d.ts","lib.esnext.disposable.d.ts","lib.esnext.error.d.ts","lib.esnext.intl.d.ts","lib.esnext.sharedmemory.d.ts","lib.esnext.temporal.d.ts","lib.esnext.typedarrays.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../../src/accessors/BindingConfig.ts","../../../binding-common/dist/types/treeParameters/primitives/Alias.d.ts","../../../binding-common/dist/types/treeParameters/primitives/EntityId.d.ts","../../../binding-common/dist/types/treeParameters/primitives/EntityName.d.ts","../../../binding-common/dist/types/treeParameters/primitives/EntityRealmKey.d.ts","../../../binding-common/dist/types/treeParameters/primitives/ExpectedEntityCount.d.ts","../../../binding-common/dist/types/treeParameters/primitives/ExpectedQualifiedEntityMutation.d.ts","../../../binding-common/dist/types/treeParameters/primitives/ExpectedRelationMutation.d.ts","../../../binding-common/dist/types/treeParameters/primitives/FieldName.d.ts","../../../binding-common/dist/types/schema/SchemaColumnType.d.ts","../../../binding-common/dist/types/schema/SchemaEnums.d.ts","../../../binding-common/dist/types/schema/SchemaColumn.d.ts","../../../binding-common/dist/types/schema/SchemaRelationOrderBy.d.ts","../../../binding-common/dist/types/schema/SchemaRelation.d.ts","../../../binding-common/dist/types/schema/RawSchemaEntity.d.ts","../../../binding-common/dist/types/schema/RawSchemaEnum.d.ts","../../../binding-common/dist/types/schema/RawSchema.d.ts","../../../binding-common/dist/types/schema/SchemaField.d.ts","../../../binding-common/dist/types/schema/SchemaFields.d.ts","../../../binding-common/dist/types/schema/SchemaUniqueConstraint.d.ts","../../../binding-common/dist/types/schema/SchemaEntity.d.ts","../../../binding-common/dist/types/schema/SchemaEntities.d.ts","../../../binding-common/dist/types/schema/SchemaStore.d.ts","../../../binding-common/dist/types/schema/Schema.d.ts","../../../graphql-builder/dist/types/nodes/GraphQlFragmentSpread.d.ts","../../../graphql-builder/dist/types/nodes/GraphQlInlineFragment.d.ts","../../../schema/dist/types/schema/value.d.ts","../../../schema/dist/types/schema/input.d.ts","../../../schema/dist/types/schema/json.d.ts","../../../schema/dist/types/schema/acl.d.ts","../../../schema/dist/types/schema/actions.d.ts","../../../schema/dist/types/schema/actionsPayload.d.ts","../../../schema/dist/types/schema/model.d.ts","../../../schema/dist/types/schema/result.d.ts","../../../schema/dist/types/schema/settings.d.ts","../../../schema/dist/types/schema/validation.d.ts","../../../schema/dist/types/schema/index.d.ts","../../../schema/dist/types/ProjectRole.d.ts","../../../schema/dist/types/index.d.ts","../../../graphql-builder/dist/types/nodes/GraphQlField.d.ts","../../../graphql-builder/dist/types/nodes/GraphQlFragment.d.ts","../../../graphql-builder/dist/types/nodes/index.d.ts","../../../graphql-builder/dist/types/GraphQlQueryPrinter.d.ts","../../../graphql-builder/dist/types/index.d.ts","../../../client/dist/types/GenerateUploadUrlMutationBuilder.d.ts","../../../graphql-client/dist/types/PrimaryReadWindow.d.ts","../../../graphql-client/dist/types/GraphQlClientRequestOptions.d.ts","../../../graphql-client/dist/types/GraphQlClient.d.ts","../../../graphql-client/dist/types/GraphQlClientError.d.ts","../../../graphql-client/dist/types/index.d.ts","../../../client-content/dist/types/types/Schema.d.ts","../../../client-content/dist/types/types/Input.d.ts","../../../client-content/dist/types/types/Result.d.ts","../../../client-content/dist/types/types/index.d.ts","../../../client-content/dist/types/nodes/ContentEntitySelection.d.ts","../../../client-content/dist/types/nodes/ContentOperation.d.ts","../../../client-content/dist/types/nodes/TypedEntitySelection.d.ts","../../../client-content/dist/types/nodes/index.d.ts","../../../client-content/dist/types/ContentClient.d.ts","../../../client-content/dist/types/ContentQueryBuilder.d.ts","../../../client-content/dist/types/TypedContentQueryBuilder.d.ts","../../../client-content/dist/types/utils/mutationFragments.d.ts","../../../client-content/dist/types/index.d.ts","../../../client/dist/types/index.d.ts","../../../binding-common/dist/types/schema/SchemaLoader.d.ts","../../../binding-common/dist/types/schema/SchemaPreprocessor.d.ts","../../../binding-common/dist/types/schema/index.d.ts","../../../binding-common/dist/types/environment/Environment.d.ts","../../../binding-common/dist/types/environment/TreeNodeEnvironmentFactory.d.ts","../../../binding-common/dist/types/environment/VariableFieldValue.d.ts","../../../binding-common/dist/types/environment/VariableInputTransformer.d.ts","../../../binding-common/dist/types/environment/index.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Json.d.ts","../../../binding-common/dist/types/treeParameters/primitives/FieldValue.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Filter.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Limit.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Offset.d.ts","../../../binding-common/dist/types/treeParameters/primitives/OrderBy.d.ts","../../../binding-common/dist/types/treeParameters/primitives/PlaceholderName.d.ts","../../../binding-common/dist/types/treeParameters/primitives/RemovalType.d.ts","../../../binding-common/dist/types/treeParameters/primitives/Scalar.d.ts","../../../binding-common/dist/types/treeParameters/primitives/UniqueWhere.d.ts","../../../binding-common/dist/types/treeParameters/primitives/SetOnCreate.d.ts","../../../binding-common/dist/types/treeParameters/primitives/TreeRootId.d.ts","../../../binding-common/dist/types/treeParameters/primitives/index.d.ts","../../../binding-common/dist/types/treeParameters/helpers/wrapFilterInHasOnes.d.ts","../../../binding-common/dist/types/treeParameters/helpers/index.d.ts","../../../binding-common/dist/types/treeParameters/EventListenersStore.d.ts","../../../binding-common/dist/types/types/ErrorAccessor.d.ts","../../../binding-common/dist/types/types/Errorable.d.ts","../../../binding-common/dist/types/types/PersistErrorOptions.d.ts","../../../binding-common/dist/types/types/PersistSuccessOptions.d.ts","../../../binding-common/dist/types/RuntimeId.d.ts","../../../binding-common/dist/types/types/EntityListAccessor.d.ts","../../../binding-common/dist/types/types/FieldAccessor.d.ts","../../../binding-common/dist/types/types/EntityAccessor.d.ts","../../../binding-common/dist/types/types/GetEntityByKey.d.ts","../../../binding-common/dist/types/types/GetEntityListSubTree.d.ts","../../../binding-common/dist/types/types/GetEntitySubTree.d.ts","../../../binding-common/dist/types/types/BatchUpdatesOptions.d.ts","../../../binding-common/dist/types/types/AsyncBatchUpdatesOptions.d.ts","../../../binding-common/dist/types/types/ExtendTree.d.ts","../../../binding-common/dist/types/types/QueryRequestResponse.d.ts","../../../binding-common/dist/types/types/DataBindingTransactionResult.d.ts","../../../binding-common/dist/types/types/PersistResult.d.ts","../../../binding-common/dist/types/types/Persist.d.ts","../../../binding-common/dist/types/types/DataBindingEvents.d.ts","../../../binding-common/dist/types/types/BindingOperations.d.ts","../../../binding-common/dist/types/types/TreeRootAccessor.d.ts","../../../binding-common/dist/types/types/index.d.ts","../../../binding-common/dist/types/treeParameters/Normalized.d.ts","../../../binding-common/dist/types/treeParameters/TreeParameterMerger.d.ts","../../../binding-common/dist/types/treeParameters/Sugared.d.ts","../../../binding-common/dist/types/treeParameters/defaults.d.ts","../../../binding-common/dist/types/treeParameters/index.d.ts","../../../binding-common/dist/types/markers/FieldMarker.d.ts","../../../binding-common/dist/types/markers/EntityFieldPlaceholders.d.ts","../../../binding-common/dist/types/markers/EntityFieldMarkersContainer.d.ts","../../../binding-common/dist/types/markers/HasManyRelationMarker.d.ts","../../../binding-common/dist/types/markers/HasOneRelationMarker.d.ts","../../../binding-common/dist/types/markers/EntityFieldMarkers.d.ts","../../../binding-common/dist/types/markers/EntityListSubTreeMarker.d.ts","../../../binding-common/dist/types/markers/EntitySubTreeMarker.d.ts","../../../binding-common/dist/types/markers/SubTreeMarkers.d.ts","../../../binding-common/dist/types/markers/EntityFieldsWithHoistablesMarker.d.ts","../../../binding-common/dist/types/markers/MarkerTreeRoot.d.ts","../../../binding-common/dist/types/markers/MeaningfulMarker.d.ts","../../../binding-common/dist/types/markers/PlaceholderGenerator.d.ts","../../../binding-common/dist/types/markers/PlaceholderParametersGenerator.d.ts","../../../binding-common/dist/types/markers/MarkerMerger.d.ts","../../../binding-common/dist/types/markers/MarkerComparator.d.ts","../../../binding-common/dist/types/markers/index.d.ts","../../../binding-common/dist/types/queryLanguage/MarkerFactory.d.ts","../../../../node_modules/chevrotain/lib/chevrotain.d.ts","../../../binding-common/dist/types/queryLanguage/ParserResults.d.ts","../../../binding-common/dist/types/queryLanguage/Parser.d.ts","../../../binding-common/dist/types/queryLanguage/QueryLanguage.d.ts","../../../binding-common/dist/types/queryLanguage/QueryLanguageError.d.ts","../../../binding-common/dist/types/queryLanguage/tokenList.d.ts","../../../binding-common/dist/types/queryLanguage/index.d.ts","../../../binding-common/dist/types/consts.d.ts","../../../binding-common/dist/types/BindingError.d.ts","../../../binding-common/dist/types/DataBindingExtendAborted.d.ts","../../../binding-common/dist/types/LocalizedBindingError.d.ts","../../../binding-common/dist/types/utils/TreeNodeUtils.d.ts","../../../binding-common/dist/types/utils/assertNever.d.ts","../../../binding-common/dist/types/utils/createQueryBuilder.d.ts","../../../binding-common/dist/types/utils/whereToFilter.d.ts","../../../utilities/dist/types/assert-types/assertNever.d.ts","../../../utilities/dist/types/assert-types/index.d.ts","../../../utilities/dist/types/deprecate/types.d.ts","../../../utilities/dist/types/deprecate/deprecate.d.ts","../../../utilities/dist/types/deprecate/index.d.ts","../../../utilities/dist/types/dom/composeEventHandlers.d.ts","../../../utilities/dist/types/dom/dataAttribute.d.ts","../../../utilities/dist/types/dom/svgSizeProps.d.ts","../../../utilities/dist/types/dom/index.d.ts","../../../utilities/dist/types/equality/deepEqual.d.ts","../../../utilities/dist/types/equality/index.d.ts","../../../utilities/dist/types/structures/BijectiveIndexedMap.d.ts","../../../utilities/dist/types/structures/LRUCache.d.ts","../../../utilities/dist/types/structures/WeakIdCache.d.ts","../../../utilities/dist/types/structures/index.d.ts","../../../utilities/dist/types/uuid/uuid.d.ts","../../../utilities/dist/types/uuid/index.d.ts","../../../utilities/dist/types/index.d.ts","../../../binding-common/dist/types/index.d.ts","../../src/core/state/EntityState.ts","../../src/core/state/FieldState.ts","../../src/core/state/StateNode.ts","../../src/core/state/EntityRealmState.ts","../../src/core/state/EntityListState.ts","../../src/core/state/getEntityMarker.ts","../../src/accessorTree/NormalizedPersistedData.ts","../../src/accessorTree/index.ts","../../src/utils/assertNever.ts","../../src/utils/generateEnumerabilityPreventingEntropy.ts","../../src/utils/isEmptyObject.ts","../../src/utils/index.ts","../../src/core/QueryGenerator.ts","../../src/core/requestAliases/MutationAlias.ts","../../src/core/requestAliases/index.ts","../../src/core/MutationGenerator.ts","../../src/core/RequestResponseNormalizer.ts","../../src/core/TreeStore.ts","../../src/core/state/StateIterator.ts","../../src/core/state/index.ts","../../src/core/ErrorsPreprocessor.ts","../../src/core/Config.ts","../../src/core/DirtinessTracker.ts","../../src/core/UpdateMetadata.ts","../../src/core/EventManager.ts","../../src/core/AccessorErrorManager.ts","../../src/core/RealmKeyGenerator.ts","../../src/core/StateInitializer.ts","../../src/core/operations/OperationsHelpers.ts","../../src/core/exceptions/TreeParameterSugarer.ts","../../src/core/exceptions/MarkerSugarer.ts","../../src/core/exceptions/ErrorLocator.ts","../../src/core/operations/EntityOperations.ts","../../src/core/operations/FieldOperations.ts","../../src/core/operations/ListOperations.ts","../../src/core/operations/index.ts","../../src/accessors/EntityAccessorImpl.ts","../../src/accessors/EntityListAccessorImpl.ts","../../src/fieldHelpers/helpers/FieldHelper.ts","../../src/fieldHelpers/helpers/TemporalFieldHelper.ts","../../src/fieldHelpers/helpers/UuidFieldHelper.ts","../../src/fieldHelpers/helpers/index.ts","../../src/fieldHelpers/index.ts","../../src/accessors/FieldAccessorImpl.ts","../../src/accessors/index.ts","../../src/core/factories/createBatchUpdatesOptions.ts","../../src/core/factories/index.ts","../../src/core/TreeAugmenter.ts","../../src/core/utils/getCombinedSignal.ts","../../src/core/utils/index.ts","../../src/core/DataBinding.ts","../../src/core/index.ts","../../src/index.ts","../../../../node_modules/vite/types/hmrPayload.d.ts","../../../../node_modules/vite/types/customEvent.d.ts","../../../../node_modules/vite/types/hot.d.ts","../../../../node_modules/vite/types/importGlob.d.ts","../../../../node_modules/vite/types/importMeta.d.ts","../../../../node_modules/vite/client.d.ts"],"fileInfos":[{"version":"a1aa1a5e065d48ef5c7bb99e38412f96","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7","9443a7f109277ffaa79d893ed2549995","793cee405385076e27c24f409659dccd","09f69c6610266eaee1ac9e3e30df2c71","62bad718844246b8e17547f37bad6085",{"version":"aae8996e8b5684814785a42cbbefcd79","affectsGlobalScope":true,"impliedNodeFormat":1},"abad6dd56cc8caf095c165df8124d237",{"version":"01ac052ec4a79e87229f90466a9645f8","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"edba5df642941aa062a62f6328c6df3d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bb3a710cbcda0533bb127712927cbe37","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7a42de379b489e8f7b647455bebfc576","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"692bcd75364db0f65d428801c7884466","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8cf777fe00349b71ee9c4b6f3fe7fd19","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f96bc192530c9723f572bfff3d3078","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1df91c56b25955c56387426f378173c5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38856f70edcd2115c355d96ec77cc09e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"de8700156c1275465bcd473c28b359aa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d47cfdb6ede40518357bb5a4cd7cd9fb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6e5773860cd9e5b15e683113f642ab47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"30ff5fe1682f7fcd629880476ca3c2e0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bf23d7d1b40b9015b694ddc2f011752f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2cc585d42e2c548f9f24a30a1989fd33","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"713906ce9d332d2242b7f05ed9304be3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0219894bfe5042c7e1aa2d22e4a91ed0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6009ffff7e43c93318804d2d28e37fe3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"03be89b227587594fbb50509fc1c2e45","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b30df52dc24740c0bad7c55c3511df7d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8d3c9b5ed5c2ab8f383607eef439f0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d950ec671d0a8e07f3c1a31e94abed86","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1abef2ace5eccb02d60dd73cd5a5ee4c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f5f0a3044029d1cc081b5887eb4deb07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d57c697f1446940ec4bfe669c962e2c4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"be41035d7b941482a1e1ae6a5c5dcca5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"10f7d9da7564f27f8ddf4a162b6da6d3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1d0520af549e0c3581f15173cc713ca1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d65083f97fd741cff028472563eddb79","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"da7f24f00653ebac660ac1c0821ed33d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7cb5ae9e65516ea2235f0721f6aac43c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c2e0450ea482c636ac7fad3bd58f9c86","signature":"d9d96dad68bb344e5af336ffcb54b82a","impliedNodeFormat":1},"3512afeb33cf5e52089ebccd309ca4c3","480d64288535716709f2c337fb595238","238ae51799b8949af2cf9b6e5499b701","a3f642aa940f7d667eef548854e4c1d8","66c4588c00e8472e3eded15ce6463caf","8e7c6af72f7a9f692bc0a778c6d670db","e4563cbb08d5340c00629547ebd3fa00","3ef6a97077841be08b8896f86aab99fa","105888e49cba2c7a372422e94b055613","b46ffc517cdb1ca80e2e711684bb740b","473ebd78215a1715c6253cb7291dc759","692037503296ba25357677f686aa4309","722717929b4d839aa6520aef8e47d59a","4832d972cd0cced66bf686fde23e174c","5b04445920057120fdfbde5556f78e40","21f85d6b945ec851ec627f3feeacbd29","4f690a8acd8e82adb8e704c732b2f8c2","e8127fb438ad22c61fe7dcb4c2fb2706","27d4457e39ee9f3d97d753e66294ffa3","fc3f327d2ede32e435f208b2bbe6abdb","f5a37e30aa8796a025ee9f89891b73f0","a060cbbe35c3aecd25fa819034f7492a","c7ef313c7f9cd2f50fa1b5805e7cde2b","4b7fe4d93992b2b9d079b1c3bae8707c","4f96fc5213ba46ab56ebce3ddd275393","6d13d72e6edde2776af61e7e6f43a6c7","6a0734a43914fd5c79ed82ed393f6c57","db9837352169e3722270f39bd896d9eb","d60c3608e026e7ebb5ee17cb32901afe","c9bca94af23f5b6478f1caaec59168f5","af61cf343114f53162ee9cbf87dfc476","2fed1413de012a88e8db9644ec7f8f4f","f20a23a7412af08e90a1d7bb4a594d54","d30401b9b670626dc86ca82ceb5b14b1","d6433f4eb936b57d58ca8052ee4f2c2a","994ba6dbd0849926f7cee07420f41cc1","814e4b695f97214aa97736b079e81225","ae757ed463a715a9571d836c0628e520","aaac8c2a681fadf5f4c0e5dc6530c477","e3cc1c890da57806846d019e3dcc94f8","bc9d90120bee546e143d11431237496e","1cff455284ebb3f8abb5b991cf140bfe","ae2a4a2167151e0797bb717b3efd2a83","7357dde96d70fec8e929123cf4c7778a","aa8e8b7fab38edc4eac217c965879b49","f3ab1bd5949cf3a31ddcb66fbb95e4ad","5bcef1d1b354649ef9901b60d4ae8d74","43dad7ac32d3648d3cb8d37aae30f14b","98a3613f689fdc2f21dc4a2e53baa352","15f9448236834eaeb54b8c0c9e47cdab","ab3681d3f3ada64be5178bf6a2eea350","a5d821d0671e1d115ed791ba4ad72403","f40566f9d429454c90597ef50db77e0e","712885b9ff68ff0b95f704fc9953ab51","3dfbb9dbbdfee223adad1f2be2deff37","f81d4f2748cfb62e2047515a3f350a80","dd5c05a6d99ec64e123f2831a4358151","5a2da875dd8f8db04bcd3e2a472674e6","79af01e4a4cd6e81a4566f378af669ac","f921d3af300289c7178e3e9a7b61ed89","1e1595ba7094c5d08498569ccccad2ed","d6c9fdd7b51c775b9cd093c9b6f7bd5f","f10fb32be389e69cc35e416c1761e1d9","14fe99b97b94c5f907217091ad7b36b4","2b4a726ffa347a1a1ff97b4f247addd4","8eda59ddc7428e8ae28453924f3125c5","70a8e1fe29c8ef80ffa3486d5b6b2009","e643a53e6387519a5cd451e644ee0f21","9396ae2d4c7f5f5dbc74081b09d26aa1","ab1f7c0f712b87e3c1eff7d232736fbf","d552d54da0b6e247d05dffcbf68fc2c0","81de688b79084b39a9f27ae87d7996d6","5e92c454558b99e5047be483cbaad51c","36efab0999e4a2e7e679ce35172d08d6","00fed26a3bf8d55f29b20dba837cc43b","ca9aa78d53e7ab4f6591a37ad4aeb210","662a7e348bef70549587b2791cd8c6f0","24a9560c94a62e67131ddaeee0fe2e04","26298144575604b00ebf092a9fd1dd79","a9d5826a6ae590fdfa665ab1f1d0e4f6","c0e5d575dbd4fe4c4c213f3f1159dccb","5760bd6522353695c2ddc02c54bb5296","5735999f862ed77fb15dd0a07af4c690","8a3fa5ffd9b69552eda0406b10aff6b6","f361096d64bf956068f347890051b922","5c0642a58bad41b11f1c9e01e6a6df8a","f3e2787916207766f4464adbe152b1c6","01fd15d97c0b2b2ee442305aa66f0867","9060117794fd69e9c7d1d07e9f7d7eee","0209b42a543773ca4faa5a421c67523c","3034314dbab58ff802ddad66300f8dd0","6b91ae5e84a57d0f78b2ba73864b3641","31b91f9fb5a184f0fe64d3568731d49c","0976fcebfe0b72f20022457705ceca62","db6da118202c7a6062a4b6165fb931c3","f05be3ecb1dd287fa42bf3f976d192a7","3ee897072c5fc98c53e87a6c2985e424","f351aa39a59f4227ab03cf8a45877766","986fc601b935a91b1d7a174d23521f01","d8df98c857afac105a74f4c444fff29d","97ee58b38eb8e3f29fb10506e553987a","a06cafbc0814bb2ada53d6acbe572400","d0a59ec90b5e56234b6af813e57999a4","f0ce2b6c6a4907b2e4ed106af451d54c","0a5b543909bb54fbf0e7b3522852afc1","07c2e3503cde93af88df4ce394c73df4","68f2b483aba07fc465193eac614e722f","2f3fe0bb3570d798e001fef558ea0804","e4b278f3bf00faae70a36cd0d7dd7e8e","3dd6b5b1deedc3ed4a3c00234b2b2591","d483508d112d58eebeab08513f728be5","507efbe95f9749e66d3838357f0df16d","baf7ffc32e7cae4da2ccbf4ffe32d1a7","e653d44ced10f7420c1bed907c234fdc","9576edf0ee00cc8cee985b71f619254c","a6a6d2a01d7323fe1d0179a2e827375b","a4e33c0b6354c50ecac0c6b0164dfcd0","0fc742b3abd9a9e266fbf1da4cd05d48","256bb29a082c04b01ab5afcb9fc84138","95be0a295b9339ad52a51afadf778163","8c90ea824e7e747cfa4034c9ceb541ca","9c3d7489815844afd869ba4463e900d8","53b1bc54d28c5a7e39dc5d39e1c23ffa","8d1fe365493f8457e0cfd314c50037b2","25c48f982859e2b5ac7fea0f5b5f9244","e0efaeec4e09a914b689db7fccbcd122","70b967b402e6a36271cb0205bc0f03cf","69ae570eb60b205ad0b973c075a0908f","b5770878ae6c834f4ed269b83a97d823","9d169215e3e82facf8acb4b0346fd8b0","f003f3388e5e25e1c61a4211a7385fb0","05498cd331cd54e27937ddc97d3e91d7","c87c3ce0f441ef8c617db14ad5e66294","1c83f32889a7362b824944345a062b57","a856354623efaee640e22f8fb74bb8bd","26340c4213be1a2ef5eb1ae41466c868","35173c5b4f54e9fbd7967259ac2cf9b6","1b8f3b207e274641184699268317a397","bf874bee540cd2d6996f83f13ca08cc1","903c7125f77d6dedcb4e603b4096b687","45558f972578178cb10321e901d61444","40960105ff26fb1afb981a363515653f","d69d8f57c22ccb149c66fa433c364bd0","cfc4b138f260b64d7369e570716fc8c9","34171980a15ec5be19f102c95d9495e2","a9c4cf02f2d81dd2f75e40b4c5ee1850","5090907d8712395e579d66dae8946172","34171980a15ec5be19f102c95d9495e2","3715a3f4b3bd84ea36ed27e4215e5ab0","d8f003ba4a5b9aa7029eb57a44a86850","df1804c5dc3ddd2cb8276304519bbcd0","c09dea60079c9ee1a1a93822ea50e228","b212d98be739bccffd177e932ceb6aef","de17e043f79da7cd4e85821cd25d1db5","1d63154cea053fb35d1dd86b32ecc2c1","7eca5eb4a2afd7f14cad93e790fec5f3","d9f1dd13d74311956e8e445a7f826305","ca7eac8865032851b5aee27601ce8efa","c82b93f65c64fc5cc377b8cc7c100fc2","fad491ae822685b1a62c9cb66c10c21e","dc593ad1bf3398091a142d2f2295d062","f09c5497ccf71c9cf5ece945780b7935","b83a42af795d3ff7359e50adfacb1a2c","aeba358ab459fdd540142ed9cbc7a8a2","8d440e83e307414c27ec2592ea71ec5c","2d03c506628ea91bb96206cead2db30f",{"version":"4e2be8508a016d290eb0cc1c1e7208a7","signature":"0ae66f61c8079fad8e92c4cdd0d62425","impliedNodeFormat":1},{"version":"cdac6629454cbb3acfdf074a2bd411ba","signature":"f1f29fabf2a88f83bb4c83f2432a9f0d","impliedNodeFormat":1},{"version":"f282963a0106b5921b3b1387635ed39e","signature":"b9932caaae8565c014c85fae75cab98c","impliedNodeFormat":1},{"version":"9051c111fabdb1c68176b7b6947d62dd","signature":"d3c73a5ce7eb640cb3c70ec45b909e7d","impliedNodeFormat":1},{"version":"34e1589576aa751b21ddd5209741d51c","signature":"f29c714003aa12e0afe266226571db62","impliedNodeFormat":1},{"version":"48a6705cab420d892b9b4c00ceb48edc","signature":"d57d2b71ce3e2b57087d4e263b373b30","impliedNodeFormat":1},{"version":"873aac9f05942b16a9117b1f30f080ad","signature":"a8619d81bcc20286662a38308accab3c","impliedNodeFormat":1},{"version":"0e21f1afd3d70a81acdf43b45ed6e839","signature":"bd5929b48ce9825c36f9d8518eea6ea9","impliedNodeFormat":1},{"version":"889ed7c2ab7886a1944a2684c92ffc2d","signature":"44058d29ff93b9ceaddca6f164244a30","impliedNodeFormat":1},{"version":"c9c9edff5968d731344bc74a7ab2b93d","signature":"91732910a0cd05726da629b5ddf70fb5","impliedNodeFormat":1},{"version":"5477876f88511cb4a741d354eee74df9","signature":"406376ebe2e416ba406d58d93dd3faa8","impliedNodeFormat":1},{"version":"ddf283b027c743173086228befecbb62","signature":"c305a33508f0aee17ba4de19bbaf547d","impliedNodeFormat":1},{"version":"92962deb744164b6ed9b25be24b21e7c","signature":"f6618f9acf003f362df807814fce0a16","impliedNodeFormat":1},{"version":"1b7853ee07bf07f643f2ee95990e3472","signature":"322371764c759221562b42ac2e59d2da","impliedNodeFormat":1},{"version":"2b7503b21610fb2cbcf549f8b7d9e98f","signature":"fe2abec6a1f290c910cf0b1d2f727aae","impliedNodeFormat":1},{"version":"384d891957ed0bb9a6ff145f6b288cba","signature":"48b654e15d0619d8054fbc8fdd8c8077","impliedNodeFormat":1},{"version":"d2da6152d2505c2458141588116da188","signature":"167c56442d7777849e1c47dde17e0936","impliedNodeFormat":1},{"version":"c6c8c3a1d4febc6b17c8014ece0c3dd2","signature":"4b90e8a367b78fba69d61933a56b3b4c","impliedNodeFormat":1},{"version":"1809d78179e543f1a9d00c6a22030e2d","signature":"be426e2d02d338be93608a272c8dd60d","impliedNodeFormat":1},{"version":"db73a48397b22c48ba3fdbd76136c2bd","signature":"6a447dc1918d54eda1a3a024950a3b42","impliedNodeFormat":1},{"version":"26a8cc4d604f58459b6fab8c38c18575","signature":"6592218e89f70e0d4e85c11c79515c36","impliedNodeFormat":1},{"version":"8c9882ddf02508f7ceb0d2c1011f76cd","signature":"3da4b5fc25f03a476802f2753db5d55b","impliedNodeFormat":1},{"version":"220fa06bb20d7e32f309d93a5bb33efe","signature":"0b63d3bd79d514925534a33e80e8dabd","impliedNodeFormat":1},{"version":"f128674b7be8e23067ec0a261d29ec2d","signature":"71f3f8ab7917eb405e8d0d2187ad224f","impliedNodeFormat":1},{"version":"6a97ab2f766c2d58c5c768e26f08b0b9","signature":"153a26fd359cbe14c2503e0877bd5fa0","impliedNodeFormat":1},{"version":"146b82f9287c309b3af7bfda58ce5c1e","signature":"2d1b51bfb8a4ea625c6c278855203d33","impliedNodeFormat":1},{"version":"c525d476a29c0afb956c95b0d15c9554","signature":"b98f8a9585310f448d5aa3c997f070fe","impliedNodeFormat":1},{"version":"1c4faa52ad1400fd76e49fa239073543","signature":"66efaa49c28c60397922f987001a2b13","impliedNodeFormat":1},{"version":"735ecbe0e1fd9fc992a3827731145367","signature":"af7efe939d7dfdc28c75acbcc3a90af6","impliedNodeFormat":1},{"version":"29abcc2923612df10b4986c983672106","signature":"0b5d516f9c38650bbf016fbe0f396560","impliedNodeFormat":1},{"version":"60afa2abab8aee65ff90d7407e4ea55b","signature":"c0592727cd7823ba8a196ffabd02834f","impliedNodeFormat":1},{"version":"c5436bd9f193ee87ed5f51efaac716ee","signature":"7be777bd4c614b2e7001765649ab7c64","impliedNodeFormat":1},{"version":"34cfc3f4b4899503970f22d24a123874","signature":"e109adc4c85ef3c32261ad05569bb9bd","impliedNodeFormat":1},{"version":"4df5bcf68c36d26601bc11bc36aa160e","signature":"d1450d5caf65eb4e2d81c85d3e691b60","impliedNodeFormat":1},{"version":"f3bfdb06839a850db74df82c3ba9b897","signature":"ccc8b48c4fbf2117c9b80a0abe100aa8","impliedNodeFormat":1},{"version":"39b8e0283ab9030ebf2523b7a7de28f3","signature":"7a6b5db6d4eb5370c5e9ea01f6cee7e6","impliedNodeFormat":1},{"version":"fc0a1b7a2ade16b34eea476f917ad4a3","signature":"ba3c89d70b63699c5937739f8d1bf453","impliedNodeFormat":1},{"version":"a333552bb2b20f0adc73f79bb0c71e59","signature":"24597f0db3fe521ac9e5c35ea014538c","impliedNodeFormat":1},{"version":"3288ca3d36de6e63a7c1b9fc795217b1","signature":"2628b2dbf98d65e686cb23c6f378e351","impliedNodeFormat":1},{"version":"4b7820f89a9eb65e85f196e21d1bb3c4","signature":"68a1874e351c63292b1d3d5632293c89","impliedNodeFormat":1},{"version":"75fefdd3bf15d8c7bb0fbfae1f29cdfa","signature":"696b5e7ec807f5dd14478ff023917063","impliedNodeFormat":1},{"version":"ac01c9e2bb2c102207b05fd42eceaf95","signature":"457fcb19d3e52f527f4882a62996d3ae","impliedNodeFormat":1},{"version":"36b8079291140b62802526a83528ceef","signature":"4ed12fb6954a046b296dae6519b381dc","impliedNodeFormat":1},{"version":"296a94f956853c06e1c94483dc48380f","signature":"955b659851dec193f3eb91f2fc245784","impliedNodeFormat":1},{"version":"843a37e9fa044304e2d0b7502e4fd014","signature":"277ae9a36388c141a78453200e2352cd","impliedNodeFormat":1},{"version":"d9c6099f5bb8bdd1e9a2fc78d0e2821b","signature":"f38068c858bdd81c313a0054bfc1215a","impliedNodeFormat":1},{"version":"5a8bd4ee1a1c9b3d0c646a197187544a","signature":"d29cdc81245db45f66c6c8609ebf056e","impliedNodeFormat":1},{"version":"f430dc478f0fad831a5ce177b5734588","signature":"015a503488bbe061aef8f1f16505890a","impliedNodeFormat":1},{"version":"42723680dedeba91da2e249b94763879","signature":"49606c6146b4306dd89400b0fda145c6","impliedNodeFormat":1},{"version":"5714c1dbaed933bc9f12fc2586a75c70","signature":"5f6d07f7c411fd085b5568c640f2f54d","impliedNodeFormat":1},{"version":"f12bcced42feac7f20b9e344d8f4558d","signature":"e5d8f74103b702f1da0d87c1562d4ad5","impliedNodeFormat":1},{"version":"95381f4aa867b5ce19ea94afc4e6cdf7","signature":"d6a3cf55f200c55027f67f63158cbe89","impliedNodeFormat":1},{"version":"3709923ea58ece172d3cd948385513eb","signature":"8141ea8968b9d9044a15ce2d8c868ea7","impliedNodeFormat":1},"ab8e1ea59f16bc290a0451d09dc5a52e","24367c4ec7d778084b3a83bbdc5a23d4","edbf4843929ee5fe6521503f424e4464",{"version":"c15a3f94d92e048c199fe585e50b2297","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"5b83f00203fc116f466f7588477a7cab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fcb0cf1fa7d03295b48a25ebd55a6af9","affectsGlobalScope":true,"impliedNodeFormat":99}],"fileIdsList":[[315],[314],[310,315],[311,315],[312,313,315],[221,231,315],[204,315],[156,204,315],[157,204,256,315],[157,159,204,315],[157,158,159,160,315],[156,161,182,199,204,221,229,230,231,232,233,234,235,236,237,255,315],[204,205,208,209,315],[206,210,315],[204,207,213,315],[161,204,207,315],[221,315],[161,204,221,315],[204,213,315],[205,208,209,211,212,315],[161,204,315],[204,211,212,315],[205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,315],[153,161,204,223,224,315],[161,204,224,256,315],[222,225,226,227,228,315],[223,315],[104,105,315],[101,103,204,315],[100,315],[100,101,103,107,110,112,204,315],[99,100,204,315],[110,204,315],[108,109,204,315],[101,103,315],[107,204,315],[113,153,315],[106,112,315],[102,204,315],[100,111,315],[99,100,101,102,103,106,107,108,109,110,111,112,113,154,155,315],[174,177,199,315],[174,199,200,315],[175,315],[174,176,177,200,201,202,203,315],[161,162,315],[153,315],[171,315],[91,92,93,94,95,96,97,98,162,163,164,165,166,167,168,169,170,171,172,173,315],[153,189,315],[186,187,188,315],[161,189,190,191,192,195,196,221,315],[194,315],[153,192,315],[161,178,179,180,181,183,184,189,190,204,221,315],[161,178,179,180,181,182,185,189,190,204,221,315],[178,315],[156,178,179,185,189,204,315],[185,315],[161,183,204,315],[161,185,204,315],[180,181,194,315],[190,315],[178,193,204,315],[197,315],[178,179,180,181,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,315],[156,161,315],[152,156,315],[256,315],[263,315],[256,264,276,292,315],[256,276,292,315],[256,276,292,299,315],[90,293,294,300,315],[153,256,272,274,276,277,281,315],[301,315],[153,256,268,269,272,274,276,278,279,280,281,282,284,303,304,306,315],[153,256,271,272,315],[256,274,276,278,279,280,315],[153,256,264,268,269,271,274,276,315],[153,256,315],[255,256,276,315],[256,264,272,315],[255,256,264,274,276,281,282,283,292,301,315],[256,264,272,274,276,281,284,285,315],[256,264,272,273,276,315],[256,276,286,287,315],[256,286,315],[256,274,315],[302,315],[269,272,274,278,279,281,284,304,307,315],[256,274,276,281,282,284,285,288,315],[255,256,274,276,281,282,284,285,315],[255,256,274,276,281,282,283,284,285,288,315],[256,274,276,281,283,284,315],[289,290,291,315],[270,315],[255,256,260,315],[256,257,259,261,315],[256,260,315],[256,258,259,260,261,262,274,315],[256,258,260,261,315],[260,315],[257,258,259,260,261,262,275,315],[305,315],[256,295,315],[255,256,295,315],[296,297,315],[298,315],[256,264,301,308,315],[265,266,267,315],[139,143,147,315],[128,143,147,315],[143,147,149,315],[143,147,148,149,150,151,315],[128,133,143,315],[133,315],[143,144,315],[144,145,146,315],[128,140,315],[128,315],[140,141,142,315],[128,134,139,152,315],[128,131,315],[131,132,315],[114,115,128,315],[129,315],[114,115,129,130,315],[136,315],[135,315],[135,136,137,138,315],[126,127,315],[117,118,315],[118,315],[116,117,118,119,120,121,122,123,124,125,315],[116,315],[238,315],[240,315],[240,241,315],[243,244,245,315],[247,315],[239,242,246,248,252,254,315],[249,250,251,315],[253,315]],"options":{"composite":true,"emitDeclarationOnly":true,"declaration":true,"declarationMap":true,"experimentalDecorators":true,"jsx":4,"module":99,"noEmitOnError":true,"noImplicitOverride":true,"outDir":"./","skipLibCheck":true,"strict":true,"sourceMap":true,"target":7,"useDefineForClassFields":true,"allowSyntheticDefaultImports":true,"esModuleInterop":true},"referencedMap":[[88,1],[89,1],[14,1],[15,1],[17,1],[16,1],[2,1],[18,1],[19,1],[20,1],[21,1],[22,1],[23,1],[24,1],[25,1],[3,1],[26,1],[27,1],[4,1],[28,1],[32,1],[29,1],[30,1],[31,1],[33,1],[34,1],[35,1],[5,1],[36,1],[37,1],[38,1],[39,1],[6,1],[43,1],[40,1],[41,1],[42,1],[44,1],[7,1],[45,1],[50,1],[51,1],[46,1],[47,1],[48,1],[49,1],[8,1],[55,1],[52,1],[53,1],[54,1],[56,1],[9,1],[57,1],[58,1],[59,1],[61,1],[60,1],[62,1],[63,1],[10,1],[64,1],[65,1],[66,1],[11,1],[67,1],[68,1],[69,1],[70,1],[71,1],[72,1],[12,1],[73,1],[74,1],[75,1],[76,1],[77,1],[1,1],[78,1],[79,1],[13,1],[80,1],[81,1],[82,1],[83,1],[84,1],[85,1],[86,1],[87,1],[223,1],[315,2],[311,3],[310,1],[312,4],[313,1],[314,5],[231,1],[232,1],[233,6],[182,7],[230,1],[157,8],[158,9],[159,1],[160,10],[161,11],[256,12],[210,13],[207,14],[206,7],[214,15],[211,16],[212,16],[205,7],[208,16],[209,16],[220,17],[219,18],[215,19],[216,20],[217,21],[218,21],[213,22],[221,23],[222,18],[225,24],[224,7],[226,25],[227,1],[229,26],[228,27],[106,28],[104,29],[105,30],[113,31],[101,32],[99,1],[111,33],[110,34],[100,1],[107,35],[108,36],[154,37],[155,38],[103,39],[102,1],[112,40],[109,7],[156,41],[177,1],[200,42],[202,43],[201,7],[203,1],[176,44],[175,7],[204,45],[91,1],[92,1],[93,1],[94,1],[95,1],[96,1],[97,1],[98,1],[163,46],[164,47],[162,1],[165,1],[166,1],[167,47],[168,1],[169,1],[170,1],[172,48],[173,1],[171,47],[174,49],[190,50],[189,51],[197,52],[196,53],[193,54],[185,55],[183,56],[178,47],[179,57],[191,21],[184,58],[186,59],[187,60],[188,61],[195,62],[180,63],[194,64],[181,63],[192,7],[198,65],[199,66],[234,67],[235,1],[236,68],[237,47],[263,69],[264,70],[90,1],[293,71],[294,72],[300,73],[301,74],[282,75],[278,76],[307,77],[279,1],[277,78],[281,79],[272,80],[269,81],[283,82],[273,83],[284,84],[304,85],[274,86],[280,1],[288,87],[287,88],[286,69],[302,89],[303,90],[308,91],[289,92],[290,93],[291,94],[285,95],[292,96],[270,69],[271,97],[261,98],[260,99],[257,100],[258,100],[275,101],[259,102],[262,103],[276,104],[305,1],[306,105],[295,69],[296,106],[297,107],[298,108],[299,109],[309,110],[265,69],[266,1],[268,111],[267,1],[148,112],[149,113],[150,114],[152,115],[144,116],[145,117],[146,118],[147,119],[141,120],[142,121],[140,121],[143,122],[151,117],[134,117],[153,123],[132,124],[133,125],[129,126],[130,127],[114,1],[115,127],[131,128],[137,129],[138,1],[136,130],[135,1],[139,131],[127,1],[128,132],[119,133],[120,134],[121,133],[126,135],[117,136],[118,1],[122,133],[123,136],[124,1],[125,134],[116,1],[238,1],[239,137],[241,138],[242,139],[240,1],[243,1],[244,1],[246,140],[245,1],[247,1],[248,141],[255,142],[249,1],[250,1],[251,1],[252,143],[254,144],[253,1]],"latestChangedDtsFile":"./index.d.ts"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contember/binding-legacy",
3
3
  "license": "Apache-2.0",
4
- "version": "2.2.0-alpha.18",
4
+ "version": "2.2.0-alpha.19",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/production/index.js",
@@ -29,10 +29,9 @@
29
29
  "ae:test": "api-extractor run"
30
30
  },
31
31
  "dependencies": {
32
- "@contember/binding-common": "2.2.0-alpha.18",
33
- "@contember/client": "2.2.0-alpha.18",
34
- "@contember/utilities": "2.2.0-alpha.18",
35
- "uuid": "^13.0.0"
32
+ "@contember/binding-common": "2.2.0-alpha.19",
33
+ "@contember/client": "2.2.0-alpha.19",
34
+ "@contember/utilities": "2.2.0-alpha.19"
36
35
  },
37
36
  "repository": {
38
37
  "type": "git",
@@ -1,4 +1,4 @@
1
- import { validate as uuidValidate } from 'uuid'
1
+ import { isUuid } from '@contember/utilities'
2
2
  import type { FieldValue } from '@contember/binding-common'
3
3
  import {
4
4
  BindingError,
@@ -63,7 +63,7 @@ export class FieldOperations {
63
63
  + `Once set, it is immutable.`,
64
64
  )
65
65
  }
66
- if (typeof newValue !== 'string' || !uuidValidate(newValue)) {
66
+ if (typeof newValue !== 'string' || !isUuid(newValue)) {
67
67
  throw new BindingError(
68
68
  `Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. `
69
69
  + `Expecting a valid uuid but '${newValue}' was given.\n`
@@ -1,4 +1,4 @@
1
- import { validate as uuidValidate } from 'uuid'
1
+ import { isUuid } from '@contember/utilities'
2
2
  import type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '@contember/binding-common'
3
3
  import {
4
4
  BindingError,
@@ -199,7 +199,7 @@ export class ListOperations {
199
199
  public getChildEntityById(state: EntityListState, id: EntityId) {
200
200
  const realm = state.children.get(id)
201
201
  if (realm === undefined) {
202
- const isRuntimeId = typeof id === 'number' || uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)
202
+ const isRuntimeId = typeof id === 'number' || isUuid(id) || UnpersistedEntityDummyId.matchesDummyId(id)
203
203
  if (isRuntimeId) {
204
204
  throw new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)
205
205
  }
@@ -1,10 +1,10 @@
1
- import { v4 as uuidV4 } from 'uuid'
1
+ import { generateUuidV4 } from '@contember/utilities'
2
2
  import type { FieldAccessor } from '@contember/binding-common'
3
3
  import { FieldHelper } from './FieldHelper.js'
4
4
 
5
5
  class UuidFieldHelper extends FieldHelper<string> {
6
6
  public setToUuid(options?: FieldAccessor.UpdateOptions) {
7
- this.getAccessor().updateValue(uuidV4(), options)
7
+ this.getAccessor().updateValue(generateUuidV4(), options)
8
8
  }
9
9
  }
10
10
  namespace UuidFieldHelper {