snack-sdk 3.10.0 → 4.0.1

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 (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/Session.d.ts +4 -2
  3. package/build/Session.js +30 -29
  4. package/build/Session.js.map +1 -1
  5. package/build/defaultConfig.d.ts +2 -0
  6. package/build/defaultConfig.js +3 -1
  7. package/build/defaultConfig.js.map +1 -1
  8. package/build/transports/CompositeTransport.d.ts +8 -0
  9. package/build/transports/CompositeTransport.js +33 -0
  10. package/build/transports/CompositeTransport.js.map +1 -0
  11. package/build/transports/CompositedTransport.d.ts +8 -0
  12. package/build/transports/CompositedTransport.js +33 -0
  13. package/build/transports/CompositedTransport.js.map +1 -0
  14. package/build/transports/ConnectionMetricsEmitter.d.ts +23 -0
  15. package/build/transports/ConnectionMetricsEmitter.js +49 -0
  16. package/build/transports/ConnectionMetricsEmitter.js.map +1 -0
  17. package/build/transports/TrafficMirroringTransport.d.ts +8 -0
  18. package/build/transports/TrafficMirroringTransport.js +33 -0
  19. package/build/transports/TrafficMirroringTransport.js.map +1 -0
  20. package/build/transports/TransportImplBase.d.ts +52 -0
  21. package/build/transports/TransportImplBase.js +233 -0
  22. package/build/transports/TransportImplBase.js.map +1 -0
  23. package/build/transports/TransportImplComposited.d.ts +8 -0
  24. package/build/transports/TransportImplComposited.js +33 -0
  25. package/build/transports/TransportImplComposited.js.map +1 -0
  26. package/build/transports/TransportImplPubNub.d.ts +15 -0
  27. package/build/transports/TransportImplPubNub.js +169 -0
  28. package/build/transports/TransportImplPubNub.js.map +1 -0
  29. package/build/transports/TransportImplSocketIO.d.ts +18 -0
  30. package/build/transports/TransportImplSocketIO.js +120 -0
  31. package/build/transports/TransportImplSocketIO.js.map +1 -0
  32. package/build/transports/TransportImplWebPlayer.d.ts +23 -0
  33. package/build/transports/TransportImplWebPlayer.js +128 -0
  34. package/build/transports/TransportImplWebPlayer.js.map +1 -0
  35. package/build/transports/index.d.ts +3 -0
  36. package/build/transports/index.js +11 -3
  37. package/build/transports/index.js.map +1 -1
  38. package/build/transports/types.d.ts +2 -3
  39. package/build/transports/types.js.map +1 -1
  40. package/build/transports/webPlayer.d.ts +1 -2
  41. package/build/transports/webPlayer.js +5 -57
  42. package/build/transports/webPlayer.js.map +1 -1
  43. package/build/types.d.ts +1 -1
  44. package/build/types.js.map +1 -1
  45. package/package.json +2 -1
@@ -1,64 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getWebPlayerIFrameURL = exports.createWebPlayerTransport = void 0;
7
+ var TransportImplWebPlayer_1 = __importDefault(require("./TransportImplWebPlayer"));
4
8
  function createWebPlayerTransport(config) {
5
- var transport = null;
6
- function getTransport() {
7
- var _a;
8
- transport = transport !== null && transport !== void 0 ? transport : config.createTransport({
9
- name: (_a = config.name) !== null && _a !== void 0 ? _a : 'webplayer',
10
- verbose: config.verbose,
11
- });
12
- return transport;
13
- }
14
- var origin = new URL(config.webPlayerURL).origin;
15
- var windowListener;
16
- var transportListener;
17
- return {
18
- addEventListener: function (type, listener) {
19
- var _a;
20
- if (!windowListener) {
21
- windowListener = function (event) {
22
- if (event.origin === origin && typeof event.data === 'string') {
23
- if (transport) {
24
- transport.postMessage({
25
- type: 'synthetic_event',
26
- data: event.data,
27
- });
28
- }
29
- }
30
- };
31
- (_a = config.window) === null || _a === void 0 ? void 0 : _a.addEventListener(type, windowListener);
32
- }
33
- if (!transportListener) {
34
- transportListener = function (event) {
35
- var _a;
36
- var message = event;
37
- if (message.type === 'synthetic_event') {
38
- (_a = config.ref.current) === null || _a === void 0 ? void 0 : _a.postMessage(JSON.stringify(message.data), origin);
39
- }
40
- else {
41
- listener(message);
42
- }
43
- };
44
- }
45
- getTransport().addEventListener(type, transportListener);
46
- },
47
- removeEventListener: function (type, _listener) {
48
- var _a;
49
- if (windowListener) {
50
- (_a = config.window) === null || _a === void 0 ? void 0 : _a.removeEventListener(type, windowListener);
51
- windowListener = undefined;
52
- }
53
- if (transportListener) {
54
- transport === null || transport === void 0 ? void 0 : transport.removeEventListener(type, transportListener);
55
- transportListener = undefined;
56
- }
57
- },
58
- postMessage: function (message) { return getTransport().postMessage(message); },
59
- // @ts-ignore: Dirty hack to allow snack web to to communicate with older web-players
60
- updateOrigin: function (newOrigin) { return (origin = newOrigin); },
61
- };
9
+ return new TransportImplWebPlayer_1.default(config);
62
10
  }
63
11
  exports.createWebPlayerTransport = createWebPlayerTransport;
64
12
  function getWebPlayerIFrameURL(webPlayerURL, sdkVersion, initialURL, verbose) {
@@ -1 +1 @@
1
- {"version":3,"file":"webPlayer.js","sourceRoot":"","sources":["../../src/transports/webPlayer.ts"],"names":[],"mappings":"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","sourcesContent":["import { SDKVersion } from 'snack-content';\n\nimport { SnackWindowRef } from '../types';\nimport {\n SnackTransport,\n SnackTransportOptions,\n SnackTransportListener,\n SnackTransportMessage,\n} from './types';\n\nexport function createWebPlayerTransport(config: {\n name?: string;\n verbose?: boolean;\n webPlayerURL: string;\n window: Window;\n ref: SnackWindowRef;\n createTransport: (options: SnackTransportOptions) => SnackTransport;\n}): SnackTransport {\n let transport: SnackTransport | null = null;\n function getTransport(): SnackTransport {\n transport =\n transport ??\n config.createTransport({\n name: config.name ?? 'webplayer',\n verbose: config.verbose,\n });\n return transport;\n }\n\n let { origin } = new URL(config.webPlayerURL);\n\n let windowListener: ((event: any) => void) | undefined;\n let transportListener: ((event: any) => void) | undefined;\n return {\n addEventListener: (type: 'message', listener: SnackTransportListener) => {\n if (!windowListener) {\n windowListener = (event: any) => {\n if (event.origin === origin && typeof event.data === 'string') {\n if (transport) {\n transport.postMessage({\n type: 'synthetic_event',\n data: event.data,\n });\n }\n }\n };\n config.window?.addEventListener(type, windowListener);\n }\n if (!transportListener) {\n transportListener = (event: any) => {\n const message = event;\n if (message.type === 'synthetic_event') {\n config.ref.current?.postMessage(JSON.stringify(message.data), origin);\n } else {\n listener(message);\n }\n };\n }\n getTransport().addEventListener(type, transportListener);\n },\n removeEventListener: (type: 'message', _listener: SnackTransportListener) => {\n if (windowListener) {\n config.window?.removeEventListener(type, windowListener);\n windowListener = undefined;\n }\n if (transportListener) {\n transport?.removeEventListener(type, transportListener);\n transportListener = undefined;\n }\n },\n postMessage: (message: SnackTransportMessage) => getTransport().postMessage(message),\n // @ts-ignore: Dirty hack to allow snack web to to communicate with older web-players\n updateOrigin: (newOrigin: string) => (origin = newOrigin),\n };\n}\n\nexport function getWebPlayerIFrameURL(\n webPlayerURL: string,\n sdkVersion: SDKVersion,\n initialURL: string,\n verbose: boolean\n) {\n if (sdkVersion < '40.0.0' || typeof window === 'undefined') {\n return undefined;\n }\n\n return `${webPlayerURL.replace(\n '%%SDK_VERSION%%',\n sdkVersion.split('.')[0]\n )}/index.html?initialUrl=${encodeURIComponent(initialURL)}&origin=${encodeURIComponent(\n window.location.origin\n )}&verbose=${verbose}`;\n}\n"]}
1
+ {"version":3,"file":"webPlayer.js","sourceRoot":"","sources":["../../src/transports/webPlayer.ts"],"names":[],"mappings":";;;;;;AAGA,oFAA8D;AAG9D,SAAgB,wBAAwB,CAAC,MAMxC;IACC,OAAO,IAAI,gCAAsB,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AARD,4DAQC;AAED,SAAgB,qBAAqB,CACnC,YAAoB,EACpB,UAAsB,EACtB,UAAkB,EAClB,OAAgB;IAEhB,IAAI,UAAU,GAAG,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAC1D,OAAO,SAAS,CAAC;KAClB;IAED,OAAU,YAAY,CAAC,OAAO,CAC5B,iBAAiB,EACjB,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACzB,+BAA0B,kBAAkB,CAAC,UAAU,CAAC,gBAAW,kBAAkB,CACpF,MAAM,CAAC,QAAQ,CAAC,MAAM,CACvB,iBAAY,OAAS,CAAC;AACzB,CAAC;AAhBD,sDAgBC","sourcesContent":["import { SDKVersion } from 'snack-content';\n\nimport { SnackWindowRef } from '../types';\nimport TransportImplWebPlayer from './TransportImplWebPlayer';\nimport { SnackTransport } from './types';\n\nexport function createWebPlayerTransport(config: {\n name?: string;\n verbose?: boolean;\n webPlayerURL: string;\n window: Window;\n ref: SnackWindowRef;\n}): SnackTransport {\n return new TransportImplWebPlayer(config);\n}\n\nexport function getWebPlayerIFrameURL(\n webPlayerURL: string,\n sdkVersion: SDKVersion,\n initialURL: string,\n verbose: boolean\n) {\n if (sdkVersion < '40.0.0' || typeof window === 'undefined') {\n return undefined;\n }\n\n return `${webPlayerURL.replace(\n '%%SDK_VERSION%%',\n sdkVersion.split('.')[0]\n )}/index.html?initialUrl=${encodeURIComponent(initialURL)}&origin=${encodeURIComponent(\n window.location.origin\n )}&verbose=${verbose}`;\n}\n"]}
package/build/types.d.ts CHANGED
@@ -107,7 +107,7 @@ export declare type SnackState = {
107
107
  */
108
108
  online: boolean;
109
109
  /**
110
- * Communication channel ("pubnub") through which live updates are transferred.
110
+ * Communication channel ("pubsub") through which live updates are transferred.
111
111
  * The communication channel is only used when the Snack is "online".
112
112
  */
113
113
  channel: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n SDKVersion,\n SnackDependencies,\n SnackDependencyVersions,\n SnackFiles,\n SnackMissingDependencies,\n} from 'snack-content';\n\nimport { SnackTransport } from './transports';\n\n/**\n * An error that can optionally hold a file-name and line/column location.\n */\nexport interface SnackError extends Error {\n fileName?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\nexport type SnackConnectedClientStatus = 'ok' | 'error' | 'reloading';\n\n/**\n * Client which connected to the Snack.\n *\n * Clients are only able to connect when the Snack is `online`.\n */\nexport type SnackConnectedClient = {\n transport: string;\n id: string;\n name: string;\n platform: string;\n status: SnackConnectedClientStatus;\n error?: SnackError;\n previewURL?: string;\n previewTimestamp?: number;\n};\n\n/**\n * Collection of connected clients.\n */\nexport type SnackConnectedClients = {\n [key: string]: SnackConnectedClient;\n};\n\n/**\n * User that is used for communicating with the Expo servers.\n */\nexport type SnackUser = {\n sessionSecret?: string;\n accessToken?: string;\n};\n\n/**\n * Request data to be used with the `sendBeacon` API.\n */\nexport type SnackSendBeaconRequest = {\n url: string;\n data: any;\n};\n\nexport type SnackListenerSubscription = () => any;\n\n/**\n * Log data for when a connected client calls one of the\n * `console.[log,info,warn,error]` to log information to the\n * console.\n */\nexport type SnackLogEvent = {\n type: 'error' | 'warn' | 'log' | 'info';\n message: string;\n connectedClient?: SnackConnectedClient;\n error?: SnackError;\n};\n\nexport type SnackWindowRef = {\n current: Window | null;\n};\n\nexport type SnackState = {\n /**\n * Expo SDK version.\n */\n sdkVersion: SDKVersion;\n\n /**\n * Files that make up the content (code & assets) of the Snack. There should\n * always be a file called \"App.js\" or \"App.tsx\" as the main entry point.\n */\n files: SnackFiles;\n\n /**\n * Packages that can be used in the code files. Packages that are pre-loaded\n * by the sdk may be ommited, but it is recommended to add them anyway.\n */\n dependencies: SnackDependencies;\n\n /**\n * Optional name. The name is used when saving or downloading the Snack; and is used\n * for the onlineName property.\n */\n name: string;\n\n /**\n * Additional description of the Snack. The description is used when saving the Snack\n * and may also be used for searching purposes.\n */\n description: string;\n\n /**\n * Collection of dependencies that are missing but are required by one or more of\n * the dependencies.\n */\n missingDependencies: SnackMissingDependencies;\n\n /**\n * Collection of packages and versions that are compatible with the selected\n * SDK version. This is similar to using `expo install`, which ensures the latest\n * compatible version is installed.\n */\n wantedDependencyVersions?: SnackDependencyVersions;\n\n /**\n * Disabled state. When the Snack is disabled it will not resolve any dependencies\n * or upload any asset files. It also disables the ability to go online.\n */\n disabled: boolean;\n\n /**\n * When online is true, Expo clients can connect to the Snack and receive live updates\n * when code or dependencies are changed. It also makes the Snack visible in the\n * \"Recently in Development\" section of the Expo client.\n */\n online: boolean;\n\n /**\n * Communication channel (\"pubnub\") through which live updates are transferred.\n * The communication channel is only used when the Snack is \"online\".\n */\n channel: string;\n\n /**\n * Device-id of the Expo client. When set causes the Snack to be visible in the\n * \"Recently in Development\" section of the Expo client with that device-id.\n * The device-id is only used when the Snack is \"online\".\n */\n deviceId?: string;\n\n /**\n * Unique experience url which can be used to open the Expo client and connect\n * to the Snack (e.g. \"exp://exp.host/@snack/sdk.38.0.0-78173941\").\n */\n url: string;\n\n /**\n * Name of the Snack as shown in the \"Recently in Development\" section in the\n * Expo client. The online-name will be empty when the Snack is not \"online\".\n */\n onlineName?: string;\n\n /**\n * A close request that should be send using the browser `sendBeacon` API\n * whenever the browser session is unloaded. This gives the Snack a last opportunity\n * to gracefully close its connections so that the \"Recently in Development\"\n * section in the Expo client no longer shows the Snack.\n */\n sendBeaconCloseRequest?: SnackSendBeaconRequest;\n\n /**\n * @internal\n */\n transports: { [id: string]: SnackTransport };\n\n /**\n * Clients that are currently connected.\n */\n connectedClients: SnackConnectedClients;\n\n /**\n *\n */\n user?: SnackUser;\n\n /**\n * Unsaved status of the Snack. Becomes `true` when the Snack code is changed and\n * `false` whenever the Snack is saved.\n */\n unsaved: boolean;\n\n /**\n * Full name of the saved Snack.\n */\n id?: string;\n\n /**\n * Id of this version of the saved Snack. Each Snack can have many different versions or revisions, each revision has its own snackId.\n */\n snackId?: string;\n\n /**\n * Id of a Snack saved to an account. This id points to the latest version of a Snack revision and associated user.\n */\n accountSnackId?: string;\n\n /**\n * URL of the saved Snack.\n * The URL is empty when no save \"id\" is available.\n */\n saveURL?: string;\n\n /**\n * Last saved (non-draft) Expo SDK version.\n */\n savedSDKVersion?: string;\n\n /**\n * URL to use to when loading the web-preview in an iframe.\n *\n * Web-preview is supported from SDK 40 and higher.\n * To enable it, set the `webPreviewRef` to the contentWindow\n * of the iframe.\n */\n webPreviewURL?: string;\n\n /**\n * The runtime URL to serve webPlayer.\n */\n webPlayerURL?: string;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n SDKVersion,\n SnackDependencies,\n SnackDependencyVersions,\n SnackFiles,\n SnackMissingDependencies,\n} from 'snack-content';\n\nimport { SnackTransport } from './transports';\n\n/**\n * An error that can optionally hold a file-name and line/column location.\n */\nexport interface SnackError extends Error {\n fileName?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\nexport type SnackConnectedClientStatus = 'ok' | 'error' | 'reloading';\n\n/**\n * Client which connected to the Snack.\n *\n * Clients are only able to connect when the Snack is `online`.\n */\nexport type SnackConnectedClient = {\n transport: string;\n id: string;\n name: string;\n platform: string;\n status: SnackConnectedClientStatus;\n error?: SnackError;\n previewURL?: string;\n previewTimestamp?: number;\n};\n\n/**\n * Collection of connected clients.\n */\nexport type SnackConnectedClients = {\n [key: string]: SnackConnectedClient;\n};\n\n/**\n * User that is used for communicating with the Expo servers.\n */\nexport type SnackUser = {\n sessionSecret?: string;\n accessToken?: string;\n};\n\n/**\n * Request data to be used with the `sendBeacon` API.\n */\nexport type SnackSendBeaconRequest = {\n url: string;\n data: any;\n};\n\nexport type SnackListenerSubscription = () => any;\n\n/**\n * Log data for when a connected client calls one of the\n * `console.[log,info,warn,error]` to log information to the\n * console.\n */\nexport type SnackLogEvent = {\n type: 'error' | 'warn' | 'log' | 'info';\n message: string;\n connectedClient?: SnackConnectedClient;\n error?: SnackError;\n};\n\nexport type SnackWindowRef = {\n current: Window | null;\n};\n\nexport type SnackState = {\n /**\n * Expo SDK version.\n */\n sdkVersion: SDKVersion;\n\n /**\n * Files that make up the content (code & assets) of the Snack. There should\n * always be a file called \"App.js\" or \"App.tsx\" as the main entry point.\n */\n files: SnackFiles;\n\n /**\n * Packages that can be used in the code files. Packages that are pre-loaded\n * by the sdk may be ommited, but it is recommended to add them anyway.\n */\n dependencies: SnackDependencies;\n\n /**\n * Optional name. The name is used when saving or downloading the Snack; and is used\n * for the onlineName property.\n */\n name: string;\n\n /**\n * Additional description of the Snack. The description is used when saving the Snack\n * and may also be used for searching purposes.\n */\n description: string;\n\n /**\n * Collection of dependencies that are missing but are required by one or more of\n * the dependencies.\n */\n missingDependencies: SnackMissingDependencies;\n\n /**\n * Collection of packages and versions that are compatible with the selected\n * SDK version. This is similar to using `expo install`, which ensures the latest\n * compatible version is installed.\n */\n wantedDependencyVersions?: SnackDependencyVersions;\n\n /**\n * Disabled state. When the Snack is disabled it will not resolve any dependencies\n * or upload any asset files. It also disables the ability to go online.\n */\n disabled: boolean;\n\n /**\n * When online is true, Expo clients can connect to the Snack and receive live updates\n * when code or dependencies are changed. It also makes the Snack visible in the\n * \"Recently in Development\" section of the Expo client.\n */\n online: boolean;\n\n /**\n * Communication channel (\"pubsub\") through which live updates are transferred.\n * The communication channel is only used when the Snack is \"online\".\n */\n channel: string;\n\n /**\n * Device-id of the Expo client. When set causes the Snack to be visible in the\n * \"Recently in Development\" section of the Expo client with that device-id.\n * The device-id is only used when the Snack is \"online\".\n */\n deviceId?: string;\n\n /**\n * Unique experience url which can be used to open the Expo client and connect\n * to the Snack (e.g. \"exp://exp.host/@snack/sdk.38.0.0-78173941\").\n */\n url: string;\n\n /**\n * Name of the Snack as shown in the \"Recently in Development\" section in the\n * Expo client. The online-name will be empty when the Snack is not \"online\".\n */\n onlineName?: string;\n\n /**\n * A close request that should be send using the browser `sendBeacon` API\n * whenever the browser session is unloaded. This gives the Snack a last opportunity\n * to gracefully close its connections so that the \"Recently in Development\"\n * section in the Expo client no longer shows the Snack.\n */\n sendBeaconCloseRequest?: SnackSendBeaconRequest;\n\n /**\n * @internal\n */\n transports: { [id: string]: SnackTransport };\n\n /**\n * Clients that are currently connected.\n */\n connectedClients: SnackConnectedClients;\n\n /**\n *\n */\n user?: SnackUser;\n\n /**\n * Unsaved status of the Snack. Becomes `true` when the Snack code is changed and\n * `false` whenever the Snack is saved.\n */\n unsaved: boolean;\n\n /**\n * Full name of the saved Snack.\n */\n id?: string;\n\n /**\n * Id of this version of the saved Snack. Each Snack can have many different versions or revisions, each revision has its own snackId.\n */\n snackId?: string;\n\n /**\n * Id of a Snack saved to an account. This id points to the latest version of a Snack revision and associated user.\n */\n accountSnackId?: string;\n\n /**\n * URL of the saved Snack.\n * The URL is empty when no save \"id\" is available.\n */\n saveURL?: string;\n\n /**\n * Last saved (non-draft) Expo SDK version.\n */\n savedSDKVersion?: string;\n\n /**\n * URL to use to when loading the web-preview in an iframe.\n *\n * Web-preview is supported from SDK 40 and higher.\n * To enable it, set the `webPreviewRef` to the contentWindow\n * of the iframe.\n */\n webPreviewURL?: string;\n\n /**\n * The runtime URL to serve webPlayer.\n */\n webPlayerURL?: string;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snack-sdk",
3
- "version": "3.10.0",
3
+ "version": "4.0.1",
4
4
  "description": "The Expo Snack SDK",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -69,6 +69,7 @@
69
69
  "pubnub": "^7.2.0",
70
70
  "semver": "^7.3.4",
71
71
  "snack-content": "~1.3.0",
72
+ "socket.io-client": "~4.5.4",
72
73
  "ua-parser-js": "^0.7.22",
73
74
  "validate-npm-package-name": "^3.0.0"
74
75
  }