How to use the immutable.OrderedMap function in immutable

To help you get started, we’ve selected a few immutable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / react-devtools / plugins / Relay / Store.js View on Github external
constructor(bridge: Bridge, mainStore: Object) {
    super();
    this.storeData = null;
    this.storeDateSubscriptionCount = 0;
    this.selectedQuery = null;
    this.queries = new OrderedMap();
    this._bridge = bridge;
    this._mainStore = mainStore;
    // initial population of the store
    bridge.on('relay:store', data => {
      this.storeData = data;
      this.emit('storeData');
    });
    this.queriesByDataID = {};
    // queries and mutations
    bridge.on('relay:pending', pendingQueries => {
      pendingQueries.forEach(pendingQuery => {
        this.queries = this.queries.set(
          pendingQuery.id,
          new Map({
            ...pendingQuery,
            status: 'pending',
github PacktPublishing / Building-Enterprise-JavaScript-Applications / Chapter10 / hobnob / docs / src / core / plugins / oas3 / selectors.js View on Github external
// locationData may take one of two forms, for backwards compatibility
    // Object: ({server, namespace?}) or String:(server)
    if(typeof locationData !== "string") {
      const { server, namespace } = locationData
      if(namespace) {
        path = [namespace, "serverVariableValues", server]
      } else {
        path = ["serverVariableValues", server]
      }
    } else {
      const server = locationData
      path = ["serverVariableValues", server]
    }

    return state.getIn(path) || OrderedMap()
  }
)
github bcvsolutions / CzechIdMng / Realization / frontend / czechidm-app / src / Index_old.js View on Github external
mergePersistedState((initialState, persistedState) => {
    // constuct immutable maps
    const result = merge({}, initialState, persistedState);
    let composedMessages = new Immutable.OrderedMap({});
    persistedState.messages.messages.map(message => {
      composedMessages = composedMessages.set(message.id, message);
    });
    result.messages.messages = composedMessages;
    //
    return result;
  })
)(reducersApp);
github Simon-Initiative / authoring-client / src / components / objectives / ObjectiveSkillView.tsx View on Github external
// find all edges that have a destinationId linked to this sourceId
              const linkedEdges = combinedEdges.filter(e => e.destinationId === edge.sourceId);
              const isDeepLinked = linkedEdges.some(e => directLookup.has(resourceId(e.sourceId)));

              if (isDeepLinked) {
                return true;
              }
            }

            return !directLookup.has(resourceId(edge.destinationId))
              && directLookup.has(resourceId(edge.sourceId));
          })
          .map(edge => resourceId(edge.destinationId)),
      ];

      const organizationResourceMap = Immutable.OrderedMap(
        transitiveResources.map(r => [r, r]));

      // Now that we have the full transitive set of this organization's
      // resources, we can use that to filter down the pages and questions
      // to those that are included in this selected organization
      const isValidResource = (resourceId) => {
        return organizationResourceMap.has(resourceId);
      };

      const workbookPageRefs = reduceObjectiveWorkbookPageRefs(
        objectivesModel.objectives, workbookpageToObjectiveEdges, isValidResource);
      const skillFormativeQuestionRefs = reduceSkillFormativeQuestionRefs(
        skills, formativeToSkillEdges, isValidResource);
      const skillSummativeQuestionRefs = reduceSkillSummativeQuestionRefs(
        skills, summativeToSkillEdges, isValidResource);
github luckymarmot / API-Flow / src / serializers / raml / v1.0 / __tests__ / Serializer.spec.js View on Github external
it('should work with variable', () => {
      spyOn(__internals__, 'convertParameterIntoNamedParameter').andCall(({ a }, p) => {
        return { key: p.get('key'), value: a }
      })

      const inputs = [
        [ { a: 123 }, new Api() ],
        [ { a: 123 }, new Api({ store: new Store() }) ],
        [ { a: 123 }, new Api({ store: new Store({ variable: OrderedMap() }) }) ],
        [ { a: 123 }, new Api({ store: new Store({ variable: OrderedMap({
          b: new Variable()
        }) }) }) ],
        [ { a: 123 }, new Api({ store: new Store({ variable: OrderedMap({
          b: new Variable({
            values: OrderedMap({ default: 'https://echo.paw.cloud/base' })
          })
        }) }) }) ],
        [ { a: 123 }, new Api({ store: new Store({ variable: OrderedMap({
          b: new Variable({
            values: OrderedMap({
              default: 'https://echo.paw.cloud/base',
              fallback: 'http://echo.paw.cloud/fallback'
            })
          })
        }) }) }) ],
github Simon-Initiative / authoring-client / src / editors / content / learning / FlashEditor.tsx View on Github external
onAddParam() {
    const c = new contentTypes.ParamText().with({
      text: 'Value',
    });
    const param = new contentTypes.Param().with({
      name: 'Name ' + (this.props.model.params.size + 1),
      content: Immutable.OrderedMap()
        .set(c.guid, c),
    });

    const params = this.props.model.params.set(param.guid, param);

    const model = this.props.model.with({ params });

    this.props.onEdit(model, model);
  }
github physiii / open-automation / src / state / ducks / devices-list / models / device-record.js View on Github external
constructor (values) {
		super({
			...values,
			services: Immutable.OrderedMap(values.services.map(({id, type}) => [
				id,
				{id, type}
			])),
			settings_definitions: Immutable.OrderedMap(values.settings_definitions),
			settings: Immutable.Map(values.settings),
			state: Immutable.Map(values.state)
		});
	}
github strapi / strapi / packages / strapi-plugin-settings-manager / admin / src / containers / HomePage / reducer.js View on Github external
.set('initialData', Map())
        .set('dbNameTarget', action.dbNameTarget)
        .set('formValidations', action.formValidations)
        .set('formErrors', [])
        .set('modifiedData', Map(action.modifiedData));
    case LANGUAGE_DELETE:
      return state
        .updateIn(['configsDisplay', 'sections'], list => remove(list, (language) => language.name !== action.languageToDelete));
    case DATABASE_DELETE:
      return state
        .updateIn(['configsDisplay', 'sections'], list => remove(list, (database) => database.name !== action.databaseToDelete));
    case LANGUAGES_FETCH_SUCCEEDED:
      return state
        .set('loading', false)
        .set('didCreatedNewLanguage', false)
        .set('configsDisplay', OrderedMap(action.configs))
        .set('initialData', Map(action.selectedLanguage))
        .set('modifiedData', Map(action.selectedLanguage))
        .set('selectOptions', Map(action.selectOptions))
        .set('formErrors', [])
        .set('listLanguages', Map(action.listLanguages));
    case EDIT_SETTINGS_SUCCEEDED:
      return state
        .set('initialData', state.get('modifiedData'))
        .set('error', !state.get('error'))
        .set('formErrors', []);
    case CHANGE_DEFAULT_LANGUAGE:
      return state
        .set('configsDisplay', OrderedMap(action.configsDisplay))
        .updateIn(['modifiedData', 'language.defaultLocale'], () => action.newLanguage);
    case LANGUAGE_ACTION_SUCCEEDED:
      return state.set('error', !state.get('error')).set('modifiedData', state.get('initialData'));
github youzan / show-me-the-code / client / reducer.ts View on Github external
output: OrderedMap;
};

export type State = Record & Readonly;

const StateRecord = Record({
  clientId: null,
  codeId: '',
  codeName: '',
  userName: '',
  hostId: null,
  clientType: null,
  language: 'javascript',
  fontSize: 12,
  clients: Map(),
  output: OrderedMap(),
  hostName: '',
});

type Action =
  | LanguageDidChangeAction
  | FontSizeChangeAction
  | ExecutionAction
  | ExecutionOutputAction
  | ClearAction
  | ConnectedAction
  | DisconnectAction
  | CreateAction
  | JoinStartAction
  | JoinAcceptedAction
  | JoinRejectAction
  | JoinAckAction
github luckymarmot / API-Flow / src / parsers / dummy / Parser.js View on Github external
uuid: '654',
                key: 'Content-Type',
                description: 'the MIME type of the body of this request',
                default: 'multipart/form-data',
                applicableContexts: List([
                  new Parameter({
                    key: 'Content-Type',
                    type: 'string',
                    constraints: List([
                      new Constraint.Enum([ 'multipart/form-data' ])
                    ])
                  })
                ])
              })
            }),
            body: OrderedMap({
              '345': new Parameter({
                uuid: '345',
                key: 'ownerId',
                in: 'body',
                description: 'the id of the owner',
                type: 'string',
                constraints: List([ new Constraint.Pattern('^[0-9a-f]{15}$') ]),
                applicableContexts: List([
                  new Parameter({
                    key: 'Content-Type',
                    type: 'string',
                    constraints: List([
                      new Constraint.Enum([
                        'application/x-www-form-urlencoded',
                        'multipart/form-data'
                      ])