@blocklet/server-js 1.17.12-beta-20260422-075550-7bd6bb1a → 1.17.12
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.
- package/dist/base.js +1 -1
- package/dist/base.js.map +1 -1
- package/dist/report.html +2 -2
- package/lib/base.js +1 -1
- package/lib/base.js.map +1 -1
- package/package.json +14 -14
package/dist/base.js
CHANGED
package/dist/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":["BaseClient","require","dayjs","timezone","extend","schema","ABTNodeClient","constructor","httpEndpoint","arguments","length","undefined","userAgent","config","dataSource","socketEndpoint","_getSocketEndpoint","enableQuery","enableSubscription","enableMutation","maxQueryDepth","_endpoint","_authToken","_userAgent","setAuthToken","token","endpoint","replace","indexOf","concat","_getSchema","_getIgnoreFields","_ref","name","_getAuthHeaders","headers","val","Authorization","encodeURIComponent","window","location","hostname","port","protocol","endsWith","substring","tz","guess","module","exports"],"sources":["../src/base.js"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nconst BaseClient = require('@arcblock/sdk-util');\nconst dayjs = require('dayjs');\nconst timezone = require('dayjs/plugin/timezone');\n\ndayjs.extend(timezone);\n\nconst schema = require('./schema/graphql.json');\n\n/**\n * Provides a readonly client to forge\n * Its recommended to use this version in browser to get smaller bundle size\n *\n * @class ABTNodeClient\n * @extends {BaseClient}\n */\nclass ABTNodeClient extends BaseClient {\n constructor(httpEndpoint = 'http://localhost:4000/api', userAgent = '') {\n const config = {\n dataSource: 'forge',\n httpEndpoint,\n socketEndpoint: () => this._getSocketEndpoint(httpEndpoint),\n enableQuery: true,\n enableSubscription: true,\n enableMutation: true,\n maxQueryDepth: 6,\n };\n\n super(config);\n\n this._endpoint = httpEndpoint;\n this._authToken = null;\n this._userAgent = userAgent;\n }\n\n setAuthToken(token) {\n this._authToken = token;\n }\n\n _getSocketEndpoint(endpoint) {\n let socketEndpoint = endpoint.replace(/https?:\\/\\//, 'ws://');\n if (endpoint.indexOf('https://') === 0) {\n socketEndpoint = socketEndpoint.replace('ws://', 'wss://');\n }\n\n return `${socketEndpoint}/socket`;\n }\n\n _getSchema() {\n return schema;\n }\n\n // eslint-disable-next-line\n _getIgnoreFields({ name }) {\n return [];\n }\n\n // eslint-disable-next-line require-await\n async _getAuthHeaders() {\n const headers = {};\n const token = this._authToken;\n if (token) {\n const val = typeof token === 'function' ? token() : token;\n headers.Authorization = `Bearer ${encodeURIComponent(val)}`;\n }\n\n // eslint-disable-next-line no-undef\n if (typeof window !== 'undefined' && typeof window.location !== 'undefined') {\n const { hostname, port, protocol } = window.location; // eslint-disable-line no-undef\n headers['x-real-hostname'] = hostname;\n headers['x-real-port'] = port;\n headers['x-real-protocol'] = protocol.endsWith(':') ? protocol.substring(0, protocol.length - 1) : protocol;\n }\n\n if (this._userAgent) {\n headers['User-Agent'] = this._userAgent;\n }\n\n //
|
|
1
|
+
{"version":3,"file":"base.js","names":["BaseClient","require","dayjs","timezone","extend","schema","ABTNodeClient","constructor","httpEndpoint","arguments","length","undefined","userAgent","config","dataSource","socketEndpoint","_getSocketEndpoint","enableQuery","enableSubscription","enableMutation","maxQueryDepth","_endpoint","_authToken","_userAgent","setAuthToken","token","endpoint","replace","indexOf","concat","_getSchema","_getIgnoreFields","_ref","name","_getAuthHeaders","headers","val","Authorization","encodeURIComponent","window","location","hostname","port","protocol","endsWith","substring","tz","guess","module","exports"],"sources":["../src/base.js"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nconst BaseClient = require('@arcblock/sdk-util');\nconst dayjs = require('dayjs');\nconst timezone = require('dayjs/plugin/timezone');\n\ndayjs.extend(timezone);\n\nconst schema = require('./schema/graphql.json');\n\n/**\n * Provides a readonly client to forge\n * Its recommended to use this version in browser to get smaller bundle size\n *\n * @class ABTNodeClient\n * @extends {BaseClient}\n */\nclass ABTNodeClient extends BaseClient {\n constructor(httpEndpoint = 'http://localhost:4000/api', userAgent = '') {\n const config = {\n dataSource: 'forge',\n httpEndpoint,\n socketEndpoint: () => this._getSocketEndpoint(httpEndpoint),\n enableQuery: true,\n enableSubscription: true,\n enableMutation: true,\n maxQueryDepth: 6,\n };\n\n super(config);\n\n this._endpoint = httpEndpoint;\n this._authToken = null;\n this._userAgent = userAgent;\n }\n\n setAuthToken(token) {\n this._authToken = token;\n }\n\n _getSocketEndpoint(endpoint) {\n let socketEndpoint = endpoint.replace(/https?:\\/\\//, 'ws://');\n if (endpoint.indexOf('https://') === 0) {\n socketEndpoint = socketEndpoint.replace('ws://', 'wss://');\n }\n\n return `${socketEndpoint}/socket`;\n }\n\n _getSchema() {\n return schema;\n }\n\n // eslint-disable-next-line\n _getIgnoreFields({ name }) {\n return [];\n }\n\n // eslint-disable-next-line require-await\n async _getAuthHeaders() {\n const headers = {};\n const token = this._authToken;\n if (token) {\n const val = typeof token === 'function' ? token() : token;\n headers.Authorization = `Bearer ${encodeURIComponent(val)}`;\n }\n\n // eslint-disable-next-line no-undef\n if (typeof window !== 'undefined' && typeof window.location !== 'undefined') {\n const { hostname, port, protocol } = window.location; // eslint-disable-line no-undef\n headers['x-real-hostname'] = hostname;\n headers['x-real-port'] = port;\n headers['x-real-protocol'] = protocol.endsWith(':') ? protocol.substring(0, protocol.length - 1) : protocol;\n }\n\n if (this._userAgent) {\n headers['User-Agent'] = this._userAgent;\n }\n\n // 获取时区\n headers['x-timezone'] = dayjs.tz.guess();\n\n return headers;\n }\n}\n\nmodule.exports = ABTNodeClient;\n"],"mappings":";;;;;;AAAA;AACA,MAAMA,UAAU,GAAGC,OAAO,CAAC,oBAAoB,CAAC;AAChD,MAAMC,KAAK,GAAGD,OAAO,CAAC,OAAO,CAAC;AAC9B,MAAME,QAAQ,GAAGF,OAAO,CAAC,uBAAuB,CAAC;AAEjDC,KAAK,CAACE,MAAM,CAACD,QAAQ,CAAC;AAEtB,MAAME,MAAM,GAAGJ,OAAO,CAAC,uBAAuB,CAAC;;AAE/C;AACA;AACA;AACA;AACA;AACA;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