UNPKG

relay-runtime

Version:

A core runtime for building GraphQL-driven applications.

42 lines (35 loc) 1.07 kB
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format * @oncall relay */ 'use strict'; /** * A unique identifier of the current actor. */ export opaque type ActorIdentifier = string; const invariant = require('invariant'); const INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE: ActorIdentifier = 'INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE'; function assertInternalActorIdentifier(actorIdentifier: ActorIdentifier): void { invariant( actorIdentifier === INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE, 'Expected to use only internal version of the `actorIdentifier`. "%s" was provided.', actorIdentifier, ); } module.exports = { assertInternalActorIdentifier, getActorIdentifier(actorID: string): ActorIdentifier { return (actorID: ActorIdentifier); }, getDefaultActorIdentifier(): ActorIdentifier { throw new Error('Not Implemented'); }, INTERNAL_ACTOR_IDENTIFIER_DO_NOT_USE, };