MCPcopy Create free account
hub / github.com/atomicdata-dev/atomic-data-browser / constructor

Method constructor

lib/src/store.ts:37–52  ·  view source on GitHub ↗
(
    opts: {
      /** The default store URL, where to send commits and where to create new instances */
      serverUrl?: string;
      /** Default Agent, used for signing commits. Is required for posting things. */
      agent?: Agent;
    } = {},
  )

Source from the content-addressed store, hash-verified

35 public errorHandler: (e: Error) => unknown;
36
37 constructor(
38 opts: {
39 /** The default store URL, where to send commits and where to create new instances */
40 serverUrl?: string;
41 /** Default Agent, used for signing commits. Is required for posting things. */
42 agent?: Agent;
43 } = {},
44 ) {
45 opts.serverUrl && this.setServerUrl(opts.serverUrl);
46 opts.serverUrl && this.setAgent(opts.agent);
47 this.resources = new Map();
48 this.subscribers = new Map();
49 this.errorHandler = (e: Error) => {
50 throw e;
51 };
52 }
53
54 /**
55 * Adds a Resource to the store and notifies subscribers. Replaces existing

Callers

nothing calls this directly

Calls 2

setServerUrlMethod · 0.95
setAgentMethod · 0.95

Tested by

no test coverage detected