reset metrics b4 stress test and export after
This commit is contained in:
parent
f2445dd850
commit
67c1260748
22 changed files with 1241 additions and 34 deletions
|
|
@ -255,6 +255,11 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
- input: [DebitOperation](#DebitOperation)
|
||||
- This methods has an __empty__ __response__ body
|
||||
|
||||
- ResetMetricsStorages
|
||||
- auth type: __Admin__
|
||||
- This methods has an __empty__ __request__ body
|
||||
- This methods has an __empty__ __response__ body
|
||||
|
||||
- RespondToDebit
|
||||
- auth type: __User__
|
||||
- input: [DebitResponse](#DebitResponse)
|
||||
|
|
@ -295,6 +300,11 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
- This methods has an __empty__ __request__ body
|
||||
- output: [UserHealthState](#UserHealthState)
|
||||
|
||||
- ZipMetricsStorages
|
||||
- auth type: __Admin__
|
||||
- This methods has an __empty__ __request__ body
|
||||
- output: [ZippedMetrics](#ZippedMetrics)
|
||||
|
||||
# HTTP API DEFINITION
|
||||
|
||||
## Supported HTTP Auths
|
||||
|
|
@ -794,6 +804,13 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
- input: [DebitOperation](#DebitOperation)
|
||||
- This methods has an __empty__ __response__ body
|
||||
|
||||
- ResetMetricsStorages
|
||||
- auth type: __Admin__
|
||||
- http method: __post__
|
||||
- http route: __/api/admin/metrics/reset__
|
||||
- This methods has an __empty__ __request__ body
|
||||
- This methods has an __empty__ __response__ body
|
||||
|
||||
- ResetNPubLinkingToken
|
||||
- auth type: __App__
|
||||
- http method: __post__
|
||||
|
|
@ -892,6 +909,13 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
- This methods has an __empty__ __request__ body
|
||||
- output: [UserHealthState](#UserHealthState)
|
||||
|
||||
- ZipMetricsStorages
|
||||
- auth type: __Admin__
|
||||
- http method: __post__
|
||||
- http route: __/api/admin/metrics/zip__
|
||||
- This methods has an __empty__ __request__ body
|
||||
- output: [ZippedMetrics](#ZippedMetrics)
|
||||
|
||||
# INPUTS AND OUTPUTS
|
||||
|
||||
## Messages
|
||||
|
|
@ -1465,6 +1489,9 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
|
||||
### WebRtcMessage
|
||||
- __message__: _[WebRtcMessage_message](#WebRtcMessage_message)_
|
||||
|
||||
### ZippedMetrics
|
||||
- __path__: _string_
|
||||
## Enums
|
||||
### The enumerators used in the messages
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ type Client struct {
|
|||
PayInvoice func(req PayInvoiceRequest) (*PayInvoiceResponse, error)
|
||||
RequestNPubLinkingToken func(req RequestNPubLinkingTokenRequest) (*RequestNPubLinkingTokenResponse, error)
|
||||
ResetDebit func(req DebitOperation) error
|
||||
ResetMetricsStorages func() error
|
||||
ResetNPubLinkingToken func(req RequestNPubLinkingTokenRequest) (*RequestNPubLinkingTokenResponse, error)
|
||||
RespondToDebit func(req DebitResponse) error
|
||||
SendAppUserToAppPayment func(req SendAppUserToAppPaymentRequest) error
|
||||
|
|
@ -132,6 +133,7 @@ type Client struct {
|
|||
UpdateUserOffer func(req OfferConfig) error
|
||||
UseInviteLink func(req UseInviteLinkRequest) error
|
||||
UserHealth func() (*UserHealthState, error)
|
||||
ZipMetricsStorages func() (*ZippedMetrics, error)
|
||||
}
|
||||
|
||||
func NewClient(params ClientParams) *Client {
|
||||
|
|
@ -1752,6 +1754,27 @@ func NewClient(params ClientParams) *Client {
|
|||
}
|
||||
return nil
|
||||
},
|
||||
ResetMetricsStorages: func() error {
|
||||
auth, err := params.RetrieveAdminAuth()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
finalRoute := "/api/admin/metrics/reset"
|
||||
body := []byte{}
|
||||
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result := ResultError{}
|
||||
err = json.Unmarshal(resBody, &result)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if result.Status == "ERROR" {
|
||||
return fmt.Errorf(result.Reason)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
ResetNPubLinkingToken: func(req RequestNPubLinkingTokenRequest) (*RequestNPubLinkingTokenResponse, error) {
|
||||
auth, err := params.RetrieveAppAuth()
|
||||
if err != nil {
|
||||
|
|
@ -2082,5 +2105,31 @@ func NewClient(params ClientParams) *Client {
|
|||
}
|
||||
return &res, nil
|
||||
},
|
||||
ZipMetricsStorages: func() (*ZippedMetrics, error) {
|
||||
auth, err := params.RetrieveAdminAuth()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalRoute := "/api/admin/metrics/zip"
|
||||
body := []byte{}
|
||||
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := ResultError{}
|
||||
err = json.Unmarshal(resBody, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if result.Status == "ERROR" {
|
||||
return nil, fmt.Errorf(result.Reason)
|
||||
}
|
||||
res := ZippedMetrics{}
|
||||
err = json.Unmarshal(resBody, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &res, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -665,6 +665,9 @@ type WebRtcCandidate struct {
|
|||
type WebRtcMessage struct {
|
||||
Message *WebRtcMessage_message `json:"message"`
|
||||
}
|
||||
type ZippedMetrics struct {
|
||||
Path string `json:"path"`
|
||||
}
|
||||
type DebitResponse_response_type string
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -1632,6 +1632,25 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
opts.metricsCallback([{ ...info, ...stats, ...authContext }])
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.ResetMetricsStorages) throw new Error('method: ResetMetricsStorages is not implemented')
|
||||
app.post('/api/admin/metrics/reset', async (req, res) => {
|
||||
const info: Types.RequestInfo = { rpcName: 'ResetMetricsStorages', batch: false, nostr: false, batchSize: 0}
|
||||
const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n }
|
||||
let authCtx: Types.AuthContext = {}
|
||||
try {
|
||||
if (!methods.ResetMetricsStorages) throw new Error('method: ResetMetricsStorages is not implemented')
|
||||
const authContext = await opts.AdminAuthGuard(req.headers['authorization'])
|
||||
authCtx = authContext
|
||||
stats.guard = process.hrtime.bigint()
|
||||
stats.validate = stats.guard
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
await methods.ResetMetricsStorages({rpcName:'ResetMetricsStorages', ctx:authContext })
|
||||
stats.handle = process.hrtime.bigint()
|
||||
res.json({status: 'OK'})
|
||||
opts.metricsCallback([{ ...info, ...stats, ...authContext }])
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.ResetNPubLinkingToken) throw new Error('method: ResetNPubLinkingToken is not implemented')
|
||||
app.post('/api/app/user/npub/token/reset', async (req, res) => {
|
||||
const info: Types.RequestInfo = { rpcName: 'ResetNPubLinkingToken', batch: false, nostr: false, batchSize: 0}
|
||||
|
|
@ -1915,6 +1934,25 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
opts.metricsCallback([{ ...info, ...stats, ...authContext }])
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.ZipMetricsStorages) throw new Error('method: ZipMetricsStorages is not implemented')
|
||||
app.post('/api/admin/metrics/zip', async (req, res) => {
|
||||
const info: Types.RequestInfo = { rpcName: 'ZipMetricsStorages', batch: false, nostr: false, batchSize: 0}
|
||||
const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n }
|
||||
let authCtx: Types.AuthContext = {}
|
||||
try {
|
||||
if (!methods.ZipMetricsStorages) throw new Error('method: ZipMetricsStorages is not implemented')
|
||||
const authContext = await opts.AdminAuthGuard(req.headers['authorization'])
|
||||
authCtx = authContext
|
||||
stats.guard = process.hrtime.bigint()
|
||||
stats.validate = stats.guard
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.ZipMetricsStorages({rpcName:'ZipMetricsStorages', ctx:authContext })
|
||||
stats.handle = process.hrtime.bigint()
|
||||
res.json({status: 'OK', ...response})
|
||||
opts.metricsCallback([{ ...info, ...stats, ...authContext }])
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (opts.staticFiles) {
|
||||
app.use(express.static(opts.staticFiles))
|
||||
app.get('*', function (_, res) { res.sendFile('index.html', { root: opts.staticFiles })})
|
||||
|
|
|
|||
|
|
@ -839,6 +839,17 @@ export default (params: ClientParams) => ({
|
|||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
ResetMetricsStorages: async (): Promise<ResultError | ({ status: 'OK' })> => {
|
||||
const auth = await params.retrieveAdminAuth()
|
||||
if (auth === null) throw new Error('retrieveAdminAuth() returned null')
|
||||
let finalRoute = '/api/admin/metrics/reset'
|
||||
const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } })
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
|
||||
if (data.status === 'OK') {
|
||||
return data
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
ResetNPubLinkingToken: async (request: Types.RequestNPubLinkingTokenRequest): Promise<ResultError | ({ status: 'OK' }& Types.RequestNPubLinkingTokenResponse)> => {
|
||||
const auth = await params.retrieveAppAuth()
|
||||
if (auth === null) throw new Error('retrieveAppAuth() returned null')
|
||||
|
|
@ -995,4 +1006,18 @@ export default (params: ClientParams) => ({
|
|||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
ZipMetricsStorages: async (): Promise<ResultError | ({ status: 'OK' }& Types.ZippedMetrics)> => {
|
||||
const auth = await params.retrieveAdminAuth()
|
||||
if (auth === null) throw new Error('retrieveAdminAuth() returned null')
|
||||
let finalRoute = '/api/admin/metrics/zip'
|
||||
const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } })
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
|
||||
if (data.status === 'OK') {
|
||||
const result = data
|
||||
if(!params.checkResult) return { status: 'OK', ...result }
|
||||
const error = Types.ZippedMetricsValidate(result)
|
||||
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -698,6 +698,17 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ
|
|||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
ResetMetricsStorages: async (): Promise<ResultError | ({ status: 'OK' })> => {
|
||||
const auth = await params.retrieveNostrAdminAuth()
|
||||
if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null')
|
||||
const nostrRequest: NostrRequest = {}
|
||||
const data = await send(params.pubDestination, {rpcName:'ResetMetricsStorages',authIdentifier:auth, ...nostrRequest })
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
|
||||
if (data.status === 'OK') {
|
||||
return data
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
RespondToDebit: async (request: Types.DebitResponse): Promise<ResultError | ({ status: 'OK' })> => {
|
||||
const auth = await params.retrieveNostrUserAuth()
|
||||
if (auth === null) throw new Error('retrieveNostrUserAuth() returned null')
|
||||
|
|
@ -805,4 +816,18 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ
|
|||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
ZipMetricsStorages: async (): Promise<ResultError | ({ status: 'OK' }& Types.ZippedMetrics)> => {
|
||||
const auth = await params.retrieveNostrAdminAuth()
|
||||
if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null')
|
||||
const nostrRequest: NostrRequest = {}
|
||||
const data = await send(params.pubDestination, {rpcName:'ZipMetricsStorages',authIdentifier:auth, ...nostrRequest })
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
|
||||
if (data.status === 'OK') {
|
||||
const result = data
|
||||
if(!params.checkResult) return { status: 'OK', ...result }
|
||||
const error = Types.ZippedMetricsValidate(result)
|
||||
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1091,6 +1091,19 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => {
|
|||
opts.metricsCallback([{ ...info, ...stats, ...authContext }])
|
||||
}catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
|
||||
break
|
||||
case 'ResetMetricsStorages':
|
||||
try {
|
||||
if (!methods.ResetMetricsStorages) throw new Error('method: ResetMetricsStorages is not implemented')
|
||||
const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier)
|
||||
stats.guard = process.hrtime.bigint()
|
||||
authCtx = authContext
|
||||
stats.validate = stats.guard
|
||||
await methods.ResetMetricsStorages({rpcName:'ResetMetricsStorages', ctx:authContext })
|
||||
stats.handle = process.hrtime.bigint()
|
||||
res({status: 'OK'})
|
||||
opts.metricsCallback([{ ...info, ...stats, ...authContext }])
|
||||
}catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
|
||||
break
|
||||
case 'RespondToDebit':
|
||||
try {
|
||||
if (!methods.RespondToDebit) throw new Error('method: RespondToDebit is not implemented')
|
||||
|
|
@ -1213,6 +1226,19 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => {
|
|||
opts.metricsCallback([{ ...info, ...stats, ...authContext }])
|
||||
}catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
|
||||
break
|
||||
case 'ZipMetricsStorages':
|
||||
try {
|
||||
if (!methods.ZipMetricsStorages) throw new Error('method: ZipMetricsStorages is not implemented')
|
||||
const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier)
|
||||
stats.guard = process.hrtime.bigint()
|
||||
authCtx = authContext
|
||||
stats.validate = stats.guard
|
||||
const response = await methods.ZipMetricsStorages({rpcName:'ZipMetricsStorages', ctx:authContext })
|
||||
stats.handle = process.hrtime.bigint()
|
||||
res({status: 'OK', ...response})
|
||||
opts.metricsCallback([{ ...info, ...stats, ...authContext }])
|
||||
}catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e }
|
||||
break
|
||||
default: logger.error('unknown rpc call name from nostr event:'+req.rpcName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ export type RequestMetric = AuthContext & RequestInfo & RequestStats & { error?:
|
|||
export type AdminContext = {
|
||||
admin_id: string
|
||||
}
|
||||
export type AdminMethodInputs = AddApp_Input | AddPeer_Input | AuthApp_Input | BanUser_Input | CloseChannel_Input | CreateOneTimeInviteLink_Input | GetInviteLinkState_Input | GetSeed_Input | ListChannels_Input | LndGetInfo_Input | OpenChannel_Input | UpdateChannelPolicy_Input
|
||||
export type AdminMethodOutputs = AddApp_Output | AddPeer_Output | AuthApp_Output | BanUser_Output | CloseChannel_Output | CreateOneTimeInviteLink_Output | GetInviteLinkState_Output | GetSeed_Output | ListChannels_Output | LndGetInfo_Output | OpenChannel_Output | UpdateChannelPolicy_Output
|
||||
export type AdminMethodInputs = AddApp_Input | AddPeer_Input | AuthApp_Input | BanUser_Input | CloseChannel_Input | CreateOneTimeInviteLink_Input | GetInviteLinkState_Input | GetSeed_Input | ListChannels_Input | LndGetInfo_Input | OpenChannel_Input | ResetMetricsStorages_Input | UpdateChannelPolicy_Input | ZipMetricsStorages_Input
|
||||
export type AdminMethodOutputs = AddApp_Output | AddPeer_Output | AuthApp_Output | BanUser_Output | CloseChannel_Output | CreateOneTimeInviteLink_Output | GetInviteLinkState_Output | GetSeed_Output | ListChannels_Output | LndGetInfo_Output | OpenChannel_Output | ResetMetricsStorages_Output | UpdateChannelPolicy_Output | ZipMetricsStorages_Output
|
||||
export type AppContext = {
|
||||
app_id: string
|
||||
}
|
||||
|
|
@ -253,6 +253,9 @@ export type RequestNPubLinkingToken_Output = ResultError | ({ status: 'OK' } & R
|
|||
export type ResetDebit_Input = {rpcName:'ResetDebit', req: DebitOperation}
|
||||
export type ResetDebit_Output = ResultError | { status: 'OK' }
|
||||
|
||||
export type ResetMetricsStorages_Input = {rpcName:'ResetMetricsStorages'}
|
||||
export type ResetMetricsStorages_Output = ResultError | { status: 'OK' }
|
||||
|
||||
export type ResetNPubLinkingToken_Input = {rpcName:'ResetNPubLinkingToken', req: RequestNPubLinkingTokenRequest}
|
||||
export type ResetNPubLinkingToken_Output = ResultError | ({ status: 'OK' } & RequestNPubLinkingTokenResponse)
|
||||
|
||||
|
|
@ -295,6 +298,9 @@ export type UseInviteLink_Output = ResultError | { status: 'OK' }
|
|||
export type UserHealth_Input = {rpcName:'UserHealth'}
|
||||
export type UserHealth_Output = ResultError | ({ status: 'OK' } & UserHealthState)
|
||||
|
||||
export type ZipMetricsStorages_Input = {rpcName:'ZipMetricsStorages'}
|
||||
export type ZipMetricsStorages_Output = ResultError | ({ status: 'OK' } & ZippedMetrics)
|
||||
|
||||
export type ServerMethods = {
|
||||
AddApp?: (req: AddApp_Input & {ctx: AdminContext }) => Promise<AuthApp>
|
||||
AddAppInvoice?: (req: AddAppInvoice_Input & {ctx: AppContext }) => Promise<NewInvoiceResponse>
|
||||
|
|
@ -359,6 +365,7 @@ export type ServerMethods = {
|
|||
PayInvoice?: (req: PayInvoice_Input & {ctx: UserContext }) => Promise<PayInvoiceResponse>
|
||||
RequestNPubLinkingToken?: (req: RequestNPubLinkingToken_Input & {ctx: AppContext }) => Promise<RequestNPubLinkingTokenResponse>
|
||||
ResetDebit?: (req: ResetDebit_Input & {ctx: UserContext }) => Promise<void>
|
||||
ResetMetricsStorages?: (req: ResetMetricsStorages_Input & {ctx: AdminContext }) => Promise<void>
|
||||
ResetNPubLinkingToken?: (req: ResetNPubLinkingToken_Input & {ctx: AppContext }) => Promise<RequestNPubLinkingTokenResponse>
|
||||
RespondToDebit?: (req: RespondToDebit_Input & {ctx: UserContext }) => Promise<void>
|
||||
SendAppUserToAppPayment?: (req: SendAppUserToAppPayment_Input & {ctx: AppContext }) => Promise<void>
|
||||
|
|
@ -373,6 +380,7 @@ export type ServerMethods = {
|
|||
UpdateUserOffer?: (req: UpdateUserOffer_Input & {ctx: UserContext }) => Promise<void>
|
||||
UseInviteLink?: (req: UseInviteLink_Input & {ctx: GuestWithPubContext }) => Promise<void>
|
||||
UserHealth?: (req: UserHealth_Input & {ctx: UserContext }) => Promise<UserHealthState>
|
||||
ZipMetricsStorages?: (req: ZipMetricsStorages_Input & {ctx: AdminContext }) => Promise<ZippedMetrics>
|
||||
}
|
||||
|
||||
export enum AddressType {
|
||||
|
|
@ -3816,6 +3824,24 @@ export const WebRtcMessageValidate = (o?: WebRtcMessage, opts: WebRtcMessageOpti
|
|||
return null
|
||||
}
|
||||
|
||||
export type ZippedMetrics = {
|
||||
path: string
|
||||
}
|
||||
export const ZippedMetricsOptionalFields: [] = []
|
||||
export type ZippedMetricsOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
path_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const ZippedMetricsValidate = (o?: ZippedMetrics, opts: ZippedMetricsOptions = {}, path: string = 'ZippedMetrics::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.path !== 'string') return new Error(`${path}.path: is not a string`)
|
||||
if (opts.path_CustomCheck && !opts.path_CustomCheck(o.path)) return new Error(`${path}.path: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export enum DebitResponse_response_type {
|
||||
DENIED = 'denied',
|
||||
INVOICE = 'invoice',
|
||||
|
|
|
|||
|
|
@ -234,6 +234,20 @@ service LightningPub {
|
|||
option (nostr) = true;
|
||||
}
|
||||
|
||||
rpc ZipMetricsStorages(structs.Empty) returns (structs.ZippedMetrics) {
|
||||
option (auth_type) = "Admin";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/admin/metrics/zip";
|
||||
option (nostr) = true;
|
||||
}
|
||||
|
||||
rpc ResetMetricsStorages(structs.Empty) returns (structs.Empty) {
|
||||
option (auth_type) = "Admin";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/admin/metrics/reset";
|
||||
option (nostr) = true;
|
||||
}
|
||||
|
||||
rpc CreateOneTimeInviteLink(structs.CreateOneTimeInviteLinkRequest) returns (structs.CreateOneTimeInviteLinkResponse) {
|
||||
option (auth_type) = "Admin";
|
||||
option (http_method) = "post";
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ message LndSeed {
|
|||
repeated string seed = 1;
|
||||
}
|
||||
|
||||
message ZippedMetrics {
|
||||
string path = 1;
|
||||
}
|
||||
|
||||
message EncryptionExchangeRequest {
|
||||
string publicKey = 1;
|
||||
string deviceId = 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue