@metapages/metapage 1.8.18 → 1.8.21

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.
@@ -1,13 +1,13 @@
1
- import { ListenerFn } from 'eventemitter3';
2
- import { MetaframeId, MetaframePipeId, MetapageId } from './core';
3
- import { MetapageEvents } from './events';
4
- import { MinimumClientMessage } from './jsonrpc';
5
- import { MetapageIFrameRpcClient } from './MetapageIFrameRpcClient';
6
- import { MetapageShared } from './Shared';
7
- import { MetaframeInputMap, MetaframeInstance, MetapageInstanceInputs, PipeInput, PipeUpdateBlob } from './v0_4';
8
- import { MetapageOptionsV1 } from './v1';
9
- import { MetapageDefinitionV2, MetapageMetadataV2 } from './v2';
10
- import { VersionsMetapage } from './versions';
1
+ import { ListenerFn } from "eventemitter3";
2
+ import { MetaframeId, MetaframePipeId, MetapageId } from "./core";
3
+ import { MetapageEvents } from "./events";
4
+ import { MinimumClientMessage } from "./jsonrpc";
5
+ import { MetapageIFrameRpcClient } from "./MetapageIFrameRpcClient";
6
+ import { MetapageShared } from "./Shared";
7
+ import { MetaframeInputMap, MetaframeInstance, MetapageInstanceInputs, PipeInput, PipeUpdateBlob } from "./v0_4";
8
+ import { MetapageOptionsV1 } from "./v1";
9
+ import { MetapageDefinitionV2, MetapageMetadataV2 } from "./v2";
10
+ import { VersionsMetapage } from "./versions";
11
11
  interface MetapageStatePartial {
12
12
  inputs: MetapageInstanceInputs;
13
13
  outputs: MetapageInstanceInputs;
@@ -92,7 +92,10 @@ export declare class Metapage extends MetapageShared {
92
92
  _setStateOnlyMetaframeInputValue(isInputs: boolean, metaframeId: MetaframeId, metaframePipeId: MetaframePipeId, value?: PipeUpdateBlob): void;
93
93
  _setStateOnlyMetaframeInputMap(isInputs: boolean, metaframeId: MetaframeId, metaframeValuesNew: MetaframeInputMap): void;
94
94
  _setStateOnlyMetaframes(isInputs: boolean, inputsMetaframesNew: MetapageInstanceInputs): void;
95
+ setMetaframeOutputs(metaframeId: MetaframeId, outputs: MetaframeInputMap): void;
96
+ setOutputs(outputs: MetapageInstanceInputs): void;
95
97
  onMessage(e: MessageEvent): void;
98
+ onMessageJsonRpc(jsonrpc: MinimumClientMessage<any>): void;
96
99
  logInternal(o: any, color?: string, backgroundColor?: string): void;
97
100
  }
98
101
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Metapage.d.ts","sourceRoot":"","sources":["../../src/metapage/Metapage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,OAAO,EACL,WAAW,EACX,eAAe,EACf,UAAU,EACX,MAAM,QAAQ,CAAC;AAKhB,OAAO,EAEL,cAAc,EAEf,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,oBAAoB,EAErB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAOpE,OAAO,EAEL,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,SAAS,EACT,cAAc,EACf,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,UAAU,oBAAoB;IAC5B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,oBAAoB,CAAC;CAClC;AAYD,eAAO,MAAM,yBAAyB,YAC3B,MAAM,KACd,gBAEF,CAAC;AAEF,eAAO,MAAM,SAAS,eAAgB,MAAM,WAAW,MAAM,KAAG,OA+B/D,CAAC;AAEF,KAAK,+BAA+B,GAAG;IACrC,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,EAAE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kC,CAChC,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,iBAAiB;IAKvC,gCAAgC,CAC9B,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,KAAK,CAAC,EAAE,cAAc,GACrB,IAAI;IAwCP,8BAA8B,CAC5B,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,iBAAiB,GACpC,IAAI;IAiCP,uBAAuB,CACrB,QAAQ,EAAE,OAAO,EACjB,mBAAmB,EAAE,sBAAsB,GAC1C,IAAI;IA+CP,mBAAmB,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB;IAgBxE,UAAU,CAAC,OAAO,EAAE,sBAAsB;IAM1C,SAAS,CAAC,CAAC,EAAE,YAAY;IAYzB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC;IA6LnD,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM;CAe7D"}
@@ -1,6 +1,6 @@
1
- import { Metapage } from './Metapage.js';
2
- import { MetapageInstanceInputs } from './v0_4/index.js';
3
- import { MetapageDefinitionV2 } from './v2/metapage.js';
1
+ import { Metapage } from "./Metapage.js";
2
+ import { MetapageInstanceInputs } from "./v0_4/index.js";
3
+ import { MetapageDefinitionV2 } from "./v2/metapage.js";
4
4
  export interface RenderingOptions {
5
5
  hideBorder?: boolean;
6
6
  hideFrameBorders?: boolean;
@@ -11,6 +11,7 @@ export interface RenderingOptions {
11
11
  }
12
12
  export interface MetapageRendererResult {
13
13
  setInputs: (inputs: MetapageInstanceInputs) => void;
14
+ setOutputs: (outputs: MetapageInstanceInputs) => void;
14
15
  dispose: () => void;
15
16
  metapage: Metapage;
16
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"metapageRenderer.d.ts","sourceRoot":"","sources":["../../src/metapage/metapageR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AAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACpD,UAAU,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACtD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AA6FD,wBAAsB,cAAc,CAAC,KAAK,EAAE;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACtD,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAyRlC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@metapages/metapage",
3
3
  "public": true,
4
- "version": "1.8.18",
4
+ "version": "1.8.21",
5
5
  "description": "Connect web pages together",
6
6
  "repository": "https://github.com/metapages/metapage",
7
7
  "homepage": "https://metapage.io/",
@@ -1,55 +1,42 @@
1
- import { ListenerFn } from 'eventemitter3';
2
- import { create } from 'mutative';
3
- import picomatch from 'picomatch-browser';
1
+ import { ListenerFn } from "eventemitter3";
2
+ import { create } from "mutative";
3
+ import picomatch from "picomatch-browser";
4
4
 
5
- import { VERSION_METAPAGE } from './Constants';
5
+ import { VERSION_METAPAGE } from "./Constants";
6
6
  import {
7
7
  convertMetapageDefinitionToCurrentVersion,
8
8
  getMatchingMetapageVersion,
9
- } from './conversions-metapage';
10
- import {
11
- MetaframeId,
12
- MetaframePipeId,
13
- MetapageId,
14
- } from './core';
15
- import {
16
- deserializeInputs,
17
- serializeInputs,
18
- } from './data';
9
+ } from "./conversions-metapage";
10
+ import { MetaframeId, MetaframePipeId, MetapageId } from "./core";
11
+ import { deserializeInputs, serializeInputs } from "./data";
19
12
  import {
20
13
  MetapageEventDefinition,
21
14
  MetapageEvents,
22
15
  MetapageEventUrlHashUpdate,
23
- } from './events';
16
+ } from "./events";
24
17
  import {
25
18
  JsonRpcMethodsFromChild,
26
19
  MinimumClientMessage,
27
20
  SetupIframeClientAckData,
28
- } from './jsonrpc';
29
- import { MetapageIFrameRpcClient } from './MetapageIFrameRpcClient';
21
+ } from "./jsonrpc";
22
+ import { MetapageIFrameRpcClient } from "./MetapageIFrameRpcClient";
30
23
  import {
31
24
  generateMetapageId,
32
25
  isDebugFromUrlsParams,
33
26
  log as MetapageToolsLog,
34
27
  pageLoaded,
35
- } from './MetapageTools';
36
- import {
37
- INITIAL_NULL_METAPAGE_DEFINITION,
38
- MetapageShared,
39
- } from './Shared';
28
+ } from "./MetapageTools";
29
+ import { INITIAL_NULL_METAPAGE_DEFINITION, MetapageShared } from "./Shared";
40
30
  import {
41
31
  MetaframeInputMap,
42
32
  MetaframeInstance,
43
33
  MetapageInstanceInputs,
44
34
  PipeInput,
45
35
  PipeUpdateBlob,
46
- } from './v0_4';
47
- import { MetapageOptionsV1 } from './v1';
48
- import {
49
- MetapageDefinitionV2,
50
- MetapageMetadataV2,
51
- } from './v2';
52
- import { VersionsMetapage } from './versions';
36
+ } from "./v0_4";
37
+ import { MetapageOptionsV1 } from "./v1";
38
+ import { MetapageDefinitionV2, MetapageMetadataV2 } from "./v2";
39
+ import { VersionsMetapage } from "./versions";
53
40
 
54
41
  interface MetapageStatePartial {
55
42
  inputs: MetapageInstanceInputs;
@@ -225,12 +212,15 @@ export class Metapage extends MetapageShared {
225
212
  this.metaframeIds = this.metaframeIds.bind(this);
226
213
  this.metaframes = this.metaframes.bind(this);
227
214
  this.onMessage = this.onMessage.bind(this);
215
+ this.onMessageJsonRpc = this.onMessageJsonRpc.bind(this);
228
216
  this.removeAll = this.removeAll.bind(this);
229
217
  this.removeMetaframe = this.removeMetaframe.bind(this);
230
218
  this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this);
231
219
  this.setDefinition = this.setDefinition.bind(this);
232
220
  this.setInput = this.setInput.bind(this);
233
221
  this.setInputs = this.setInputs.bind(this);
222
+ this.setOutputs = this.setOutputs.bind(this);
223
+ this.setMetaframeOutputs = this.setMetaframeOutputs.bind(this);
234
224
  this.setInputStateOnlyMetaframeInputValue =
235
225
  this.setInputStateOnlyMetaframeInputValue.bind(this);
236
226
  this.setInputStateOnlyMetaframeInputMap =
@@ -966,6 +956,34 @@ export class Metapage extends MetapageShared {
966
956
  });
967
957
  }
968
958
 
959
+ /**
960
+ * Set the outputs for a metaframe manually, useful for when the
961
+ * metapage is modifying the outputs directly
962
+ * @param metaframeId
963
+ * @param outputs
964
+ */
965
+ setMetaframeOutputs(metaframeId: MetaframeId, outputs: MetaframeInputMap) {
966
+ this.onMessageJsonRpc({
967
+ iframeId: metaframeId,
968
+ parentId: this._id,
969
+ jsonrpc: "2.0",
970
+ method: JsonRpcMethodsFromChild.OutputsUpdate,
971
+ id: "_",
972
+ params: outputs,
973
+ });
974
+ }
975
+
976
+ /**
977
+ * Set the outputs manually, useful for when the
978
+ * parent wants to modify the outputs directly
979
+ * @param outputs
980
+ */
981
+ setOutputs(outputs: MetapageInstanceInputs) {
982
+ for (const metaframeId in outputs) {
983
+ this.setMetaframeOutputs(metaframeId, outputs[metaframeId]);
984
+ }
985
+ }
986
+
969
987
  onMessage(e: MessageEvent) {
970
988
  // any other type of messages are ignored
971
989
  // maybe in the future we can pass around strings or ArrayBuffers
@@ -974,190 +992,196 @@ export class Metapage extends MetapageShared {
974
992
  if (!this.isValidJSONRpcMessage(jsonrpc)) {
975
993
  return;
976
994
  }
977
- //Verify here
978
- var method = jsonrpc.method as JsonRpcMethodsFromChild;
979
- const metaframeId = jsonrpc.iframeId;
980
- // The metaframe gets its id from the window.name field so the iframe knows
981
- // its id from the very beginning
982
- if (!metaframeId) {
983
- // so if it's missing, bail early
984
- return;
985
- }
986
-
987
- // ignore messages from other metapages
988
- if (method !== "SetupIframeClientRequest" && jsonrpc.parentId !== this._id) {
989
- return;
990
- }
991
-
992
- const metaframe = this.getMetaframe(metaframeId);
993
- if (!metaframe) {
994
- // SetupIframeClientRequest from other metapages is ignored
995
- // this.error(`💥 onMessage method=${method}no metaframe id=${metaframeId}`);
996
- return;
997
- }
995
+ this.onMessageJsonRpc(jsonrpc);
996
+ }
997
+ }
998
998
 
999
- // debugging: track messsages internally
1000
- (jsonrpc as any)["_messageCount"] = ++this
1001
- ._internalReceivedMessageCounter;
999
+ onMessageJsonRpc(jsonrpc: MinimumClientMessage<any>) {
1000
+ //Verify here
1001
+ var method = jsonrpc.method as JsonRpcMethodsFromChild;
1002
+ const metaframeId = jsonrpc.iframeId;
1003
+ // The metaframe gets its id from the window.name field so the iframe knows
1004
+ // its id from the very beginning
1005
+ if (!metaframeId) {
1006
+ // so if it's missing, bail early
1007
+ return;
1008
+ }
1002
1009
 
1003
- if (this.debug) {
1004
- this.log(
1005
- `processing ${JSON.stringify(jsonrpc, null, " ").substring(0, 500)}`
1006
- );
1007
- }
1010
+ // ignore messages from other metapages
1011
+ if (
1012
+ method !== "SetupIframeClientRequest" &&
1013
+ jsonrpc.parentId !== this._id
1014
+ ) {
1015
+ return;
1016
+ }
1008
1017
 
1009
- switch (method) {
1010
- /**
1011
- * An iframe is sending a connection request.
1012
- * Here we register it to set up a secure
1013
- * communication channel.
1014
- */
1015
- case JsonRpcMethodsFromChild.SetupIframeClientRequest:
1016
- metaframe.register();
1017
- break;
1018
+ const metaframe = this.getMetaframe(metaframeId);
1019
+ if (!metaframe) {
1020
+ // SetupIframeClientRequest from other metapages is ignored
1021
+ // this.error(`💥 onMessage method=${method}no metaframe id=${metaframeId}`);
1022
+ return;
1023
+ }
1018
1024
 
1019
- /* A client iframe responded */
1020
- case JsonRpcMethodsFromChild.SetupIframeServerResponseAck:
1021
- /* Send all inputs when a client has registered. */
1022
- if (metaframe) {
1023
- const params = jsonrpc.params as SetupIframeClientAckData<any>;
1024
- metaframe.registered(params.version);
1025
- }
1026
- break;
1025
+ // debugging: track messsages internally
1026
+ (jsonrpc as any)["_messageCount"] = ++this._internalReceivedMessageCounter;
1027
1027
 
1028
- case JsonRpcMethodsFromChild.OutputsUpdate:
1029
- const outputs: MetaframeInputMap = jsonrpc.params;
1030
- if (!outputs || Object.keys(outputs).length === 0) {
1031
- break;
1032
- }
1028
+ if (this.debug) {
1029
+ this.log(
1030
+ `processing ${JSON.stringify(jsonrpc, null, " ").substring(0, 500)}`
1031
+ );
1032
+ }
1033
1033
 
1034
- if (this._metaframes[metaframeId]) {
1035
- var iframe = this._metaframes[metaframeId];
1036
-
1037
- // set the internal state, no event yet, nor downstream inputs update (yet)
1038
- this.setOutputStateOnlyMetaframeInputMap(metaframeId, outputs);
1039
- // iframe outputs, metaframe only event sent
1040
- iframe.setOutputs(outputs);
1041
- // let's not send the state event until AFTER
1042
- // cached lookup of where those outputs are going
1043
- // Multiple outputs going to multiple inputs on the same metaframe must
1044
- // arrive as a single blob
1045
- var modified = false;
1046
- const outputKeys = Object.keys(outputs);
1047
- const collectedOutputs: { [key in string]: MetaframeInputMap } = {};
1048
- outputKeys.forEach((outputKey, i) => {
1049
- const targets: MetaframeInputTargetsFromOutput[] =
1050
- this.getInputsFromOutput(metaframeId!, outputKey);
1051
-
1052
- if (targets.length > 0) {
1053
- targets.forEach((target) => {
1054
- if (!collectedOutputs[target.metaframe]) {
1055
- collectedOutputs[target.metaframe] = {};
1056
- }
1057
- collectedOutputs[target.metaframe][target.pipe] =
1058
- outputs[outputKey];
1059
- modified = true;
1060
- });
1061
- }
1062
- });
1063
- if (modified) {
1064
- this.setInputStateOnlyMetapageInstanceInputs(collectedOutputs);
1065
- Object.keys(collectedOutputs).forEach((metaframeId) => {
1066
- this._metaframes[metaframeId].setInputs(
1067
- collectedOutputs[metaframeId]
1068
- // then actually set the inputs once collected
1069
- );
1070
- });
1071
- }
1072
- // only send a state event if downstream inputs were modified
1073
- if (
1074
- this.listenerCount(MetapageEvents.State) > 0 &&
1075
- emptyState !== this._state
1076
- ) {
1077
- this.emit(MetapageEvents.State, this._state);
1078
- }
1079
- if (this.debug) {
1080
- iframe.ack({ jsonrpc: jsonrpc, state: this._state });
1081
- }
1082
- } else {
1083
- this.error(`missing metaframe=${metaframeId}`);
1084
- }
1034
+ switch (method) {
1035
+ /**
1036
+ * An iframe is sending a connection request.
1037
+ * Here we register it to set up a secure
1038
+ * communication channel.
1039
+ */
1040
+ case JsonRpcMethodsFromChild.SetupIframeClientRequest:
1041
+ metaframe.register();
1042
+ break;
1043
+
1044
+ /* A client iframe responded */
1045
+ case JsonRpcMethodsFromChild.SetupIframeServerResponseAck:
1046
+ /* Send all inputs when a client has registered. */
1047
+ if (metaframe) {
1048
+ const params = jsonrpc.params as SetupIframeClientAckData<any>;
1049
+ metaframe.registered(params.version);
1050
+ }
1051
+ break;
1085
1052
 
1053
+ case JsonRpcMethodsFromChild.OutputsUpdate:
1054
+ const outputs: MetaframeInputMap = jsonrpc.params;
1055
+ if (!outputs || Object.keys(outputs).length === 0) {
1086
1056
  break;
1057
+ }
1087
1058
 
1088
- case JsonRpcMethodsFromChild.InputsUpdate:
1089
- // This is triggered by the metaframe itself, meaning the metaframe
1090
- // decided to save this state info.
1091
- // We store it in the local state, then send it back so
1092
- // the metaframe is notified of its input state.
1093
- var inputs: MetaframeInputMap = jsonrpc.params;
1094
- if (this.debug)
1095
- this.log(`inputs ${JSON.stringify(inputs)} from ${metaframeId}`);
1096
- if (this._metaframes[metaframeId]) {
1097
- // Set the internal inputs state first so that anything that
1098
- // responds to events will get the updated state if requested
1099
- // Currently on for setting metaframe inputs that haven't loaded yet
1100
- this.setInputStateOnlyMetaframeInputMap(metaframeId, inputs);
1101
- this._metaframes[metaframeId].setInputs(inputs);
1102
- if (
1103
- this.listenerCount(MetapageEvents.State) > 0 &&
1104
- emptyState !== this._state
1105
- ) {
1106
- this.emit(MetapageEvents.State, this._state);
1107
- }
1108
-
1109
- if (this.debug) {
1110
- this._metaframes[metaframeId].ack({
1111
- jsonrpc: jsonrpc,
1112
- state: this._state,
1059
+ if (this._metaframes[metaframeId]) {
1060
+ var iframe = this._metaframes[metaframeId];
1061
+
1062
+ // set the internal state, no event yet, nor downstream inputs update (yet)
1063
+ this.setOutputStateOnlyMetaframeInputMap(metaframeId, outputs);
1064
+ // iframe outputs, metaframe only event sent
1065
+ iframe.setOutputs(outputs);
1066
+ // let's not send the state event until AFTER
1067
+ // cached lookup of where those outputs are going
1068
+ // Multiple outputs going to multiple inputs on the same metaframe must
1069
+ // arrive as a single blob
1070
+ var modified = false;
1071
+ const outputKeys = Object.keys(outputs);
1072
+ const collectedOutputs: { [key in string]: MetaframeInputMap } = {};
1073
+ outputKeys.forEach((outputKey, i) => {
1074
+ const targets: MetaframeInputTargetsFromOutput[] =
1075
+ this.getInputsFromOutput(metaframeId!, outputKey);
1076
+
1077
+ if (targets.length > 0) {
1078
+ targets.forEach((target) => {
1079
+ if (!collectedOutputs[target.metaframe]) {
1080
+ collectedOutputs[target.metaframe] = {};
1081
+ }
1082
+ collectedOutputs[target.metaframe][target.pipe] =
1083
+ outputs[outputKey];
1084
+ modified = true;
1113
1085
  });
1114
1086
  }
1115
- } else {
1116
- console.error(
1117
- `InputsUpdate failed no metaframe id: "${metaframeId}"`
1118
- );
1119
- this.error(`InputsUpdate failed no metaframe id: "${metaframeId}"`);
1087
+ });
1088
+ if (modified) {
1089
+ this.setInputStateOnlyMetapageInstanceInputs(collectedOutputs);
1090
+ Object.keys(collectedOutputs).forEach((metaframeId) => {
1091
+ this._metaframes[metaframeId].setInputs(
1092
+ collectedOutputs[metaframeId]
1093
+ // then actually set the inputs once collected
1094
+ );
1095
+ });
1120
1096
  }
1121
- break;
1122
- case JsonRpcMethodsFromChild.HashParamsUpdate:
1123
- // Not really sure how to "automatically" process this right here
1124
- // It's a potential automatic security concern, IF we want to put credentials
1125
- // in the hash params (and we do)
1126
- // So for now, just emit an event, and let the parent context handle it
1127
- // In the current use case this app: https://github.com/metapages/metapage-app
1128
- // will listen for the event and update the definition accordingly
1129
- if (metaframe) {
1130
- // Update in place the local references to the new metaframe URL with the
1131
- // new hash params:
1132
- // - if you call metapage.getDefinition() it will include the new URL
1133
- // - compare metapage.getDefinition() with any updates outside of this
1134
- // context to decide wether to re-render or recreate
1135
- const hashParamsUpdatePayload: MetapageEventUrlHashUpdate =
1136
- jsonrpc.params;
1137
- const url = new URL(metaframe.url);
1138
- url.hash = hashParamsUpdatePayload.hash;
1139
- // Update the local metaframe client reference
1140
- metaframe.url = url.href;
1141
- // Update the definition in place
1142
- this._definition = create<MetapageDefinitionV2>(
1143
- this._definition,
1144
- (draft) => {
1145
- draft.metaframes[hashParamsUpdatePayload.metaframe].url =
1146
- url.href;
1147
- }
1148
- );
1097
+ // only send a state event if downstream inputs were modified
1098
+ if (
1099
+ this.listenerCount(MetapageEvents.State) > 0 &&
1100
+ emptyState !== this._state
1101
+ ) {
1102
+ this.emit(MetapageEvents.State, this._state);
1103
+ }
1104
+ if (this.debug) {
1105
+ iframe.ack({ jsonrpc: jsonrpc, state: this._state });
1106
+ }
1107
+ } else {
1108
+ this.error(`missing metaframe=${metaframeId}`);
1109
+ }
1149
1110
 
1150
- this._emitDefinitionEvent();
1111
+ break;
1112
+
1113
+ case JsonRpcMethodsFromChild.InputsUpdate:
1114
+ // This is triggered by the metaframe itself, meaning the metaframe
1115
+ // decided to save this state info.
1116
+ // We store it in the local state, then send it back so
1117
+ // the metaframe is notified of its input state.
1118
+ var inputs: MetaframeInputMap = jsonrpc.params;
1119
+ if (this.debug)
1120
+ this.log(`inputs ${JSON.stringify(inputs)} from ${metaframeId}`);
1121
+ if (this._metaframes[metaframeId]) {
1122
+ // Set the internal inputs state first so that anything that
1123
+ // responds to events will get the updated state if requested
1124
+ // Currently on for setting metaframe inputs that haven't loaded yet
1125
+ this.setInputStateOnlyMetaframeInputMap(metaframeId, inputs);
1126
+ this._metaframes[metaframeId].setInputs(inputs);
1127
+ if (
1128
+ this.listenerCount(MetapageEvents.State) > 0 &&
1129
+ emptyState !== this._state
1130
+ ) {
1131
+ this.emit(MetapageEvents.State, this._state);
1151
1132
  }
1152
- break;
1153
- default:
1133
+
1154
1134
  if (this.debug) {
1155
- this.log(`Unknown RPC method: "${method}"`);
1135
+ this._metaframes[metaframeId].ack({
1136
+ jsonrpc: jsonrpc,
1137
+ state: this._state,
1138
+ });
1156
1139
  }
1157
- }
1158
- if (this.listenerCount(MetapageEvents.Message) > 0) {
1159
- this.emit(MetapageEvents.Message, jsonrpc);
1160
- }
1140
+ } else {
1141
+ console.error(
1142
+ `InputsUpdate failed no metaframe id: "${metaframeId}"`
1143
+ );
1144
+ this.error(`InputsUpdate failed no metaframe id: "${metaframeId}"`);
1145
+ }
1146
+ break;
1147
+ case JsonRpcMethodsFromChild.HashParamsUpdate:
1148
+ // Not really sure how to "automatically" process this right here
1149
+ // It's a potential automatic security concern, IF we want to put credentials
1150
+ // in the hash params (and we do)
1151
+ // So for now, just emit an event, and let the parent context handle it
1152
+ // In the current use case this app: https://github.com/metapages/metapage-app
1153
+ // will listen for the event and update the definition accordingly
1154
+ if (metaframe) {
1155
+ // Update in place the local references to the new metaframe URL with the
1156
+ // new hash params:
1157
+ // - if you call metapage.getDefinition() it will include the new URL
1158
+ // - compare metapage.getDefinition() with any updates outside of this
1159
+ // context to decide wether to re-render or recreate
1160
+ const hashParamsUpdatePayload: MetapageEventUrlHashUpdate =
1161
+ jsonrpc.params;
1162
+ const url = new URL(metaframe.url);
1163
+ url.hash = hashParamsUpdatePayload.hash;
1164
+ // Update the local metaframe client reference
1165
+ metaframe.url = url.href;
1166
+ // Update the definition in place
1167
+ this._definition = create<MetapageDefinitionV2>(
1168
+ this._definition,
1169
+ (draft) => {
1170
+ draft.metaframes[hashParamsUpdatePayload.metaframe].url =
1171
+ url.href;
1172
+ }
1173
+ );
1174
+
1175
+ this._emitDefinitionEvent();
1176
+ }
1177
+ break;
1178
+ default:
1179
+ if (this.debug) {
1180
+ this.log(`Unknown RPC method: "${method}"`);
1181
+ }
1182
+ }
1183
+ if (this.listenerCount(MetapageEvents.Message) > 0) {
1184
+ this.emit(MetapageEvents.Message, jsonrpc);
1161
1185
  }
1162
1186
  }
1163
1187