@blocklet/server-js 1.16.54-beta-20251017-133309-7d40faa6 → 1.16.54-beta-20251023-041534-36eec6b9
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 +4 -1
- package/dist/base.js.map +1 -1
- package/dist/browser.d.ts +2 -1
- package/dist/bundle.js +1 -1
- package/dist/report.html +2 -2
- package/dist/schema/graphql.json +10 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/docs/QUERIES.md +1 -1
- package/lib/base.js +4 -1
- package/lib/base.js.map +1 -1
- package/lib/node.d.ts +2 -1
- package/lib/node.js +7 -5
- package/lib/node.js.map +1 -1
- package/lib/schema/graphql.json +10 -0
- package/lib/types.js +1 -0
- package/lib/types.js.map +1 -1
- package/package.json +6 -6
package/dist/base.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.promise.js");
|
|
3
4
|
require("core-js/modules/es.regexp.exec.js");
|
|
4
5
|
require("core-js/modules/es.string.ends-with.js");
|
|
5
6
|
require("core-js/modules/es.string.replace.js");
|
|
@@ -56,7 +57,9 @@ class ABTNodeClient extends BaseClient {
|
|
|
56
57
|
} = _ref;
|
|
57
58
|
return [];
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
|
|
61
|
+
// eslint-disable-next-line require-await
|
|
62
|
+
async _getAuthHeaders() {
|
|
60
63
|
const headers = {};
|
|
61
64
|
const token = this._authToken;
|
|
62
65
|
if (token) {
|
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 _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":"
|
|
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;AACA;AACA,MAAMK,aAAa,SAASN,UAAU,CAAC;EACrCO,WAAWA,CAAA,EAA6D;IAAA,IAA5DC,YAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,2BAA2B;IAAA,IAAEG,SAAS,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IACpE,MAAMI,MAAM,GAAG;MACbC,UAAU,EAAE,OAAO;MACnBN,YAAY;MACZO,cAAc,EAAEA,CAAA,KAAM,IAAI,CAACC,kBAAkB,CAACR,YAAY,CAAC;MAC3DS,WAAW,EAAE,IAAI;MACjBC,kBAAkB,EAAE,I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CAACC,QAAQ,CAAC,CAAC;MACtDL,OAAO,CAAC,iBAAiB,CAAC,GAAGM,QAAQ;MACrCN,OAAO,CAAC,aAAa,CAAC,GAAGO,IAAI;MAC7BP,OAAO,CAAC,iBAAiB,CAAC,GAAGQ,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,QAAQ,CAACE,SAAS,CAAC,CAAC,EAAEF,QAAQ,CAACjC,MAAM,GAAG,CAAC,CAAC,GAAGiC,QAAQ;IAC7G;IAEA,IAAI,IAAI,CAACpB,UAAU,EAAE;MACnBY,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAACZ,UAAU;IACzC;;IAEA;IACAY,OAAO,CAAC,YAAY,CAAC,GAAGjC,KAAK,CAAC4C,EAAE,CAACC,KAAK,CAAC,CAAC;IAExC,OAAOZ,OAAO;EAChB;AACF;AAEAa,MAAM,CAACC,OAAO,GAAG3C,aAAa","ignoreList":[]}
|
package/dist/browser.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ declare class ABTNodeClient {
|
|
|
30
30
|
type: any;
|
|
31
31
|
}): void;
|
|
32
32
|
|
|
33
|
-
protected _getAuthHeaders(): Record<string, string> | undefined
|
|
33
|
+
protected _getAuthHeaders(): Promise<Record<string, string> | undefined>;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Send raw query to ocap and return results
|
|
@@ -2110,6 +2110,7 @@ declare namespace ABTNodeClient {
|
|
|
2110
2110
|
interface RequestTeamUserOptionsInput {
|
|
2111
2111
|
enableConnectedAccount: boolean;
|
|
2112
2112
|
includeTags: boolean;
|
|
2113
|
+
includeFederated: boolean;
|
|
2113
2114
|
}
|
|
2114
2115
|
|
|
2115
2116
|
interface RequestUpdateAccessKeyInput {
|