diff --git a/proto/autogenerated/client.md b/proto/autogenerated/client.md index 38eb55c5..4cba96b7 100644 --- a/proto/autogenerated/client.md +++ b/proto/autogenerated/client.md @@ -256,7 +256,7 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __response__ body - ResetMetricsStorages - - auth type: __Admin__ + - auth type: __Metrics__ - This methods has an __empty__ __request__ body - This methods has an __empty__ __response__ body @@ -301,7 +301,7 @@ The nostr server will send back a message response, and inside the body there wi - output: [UserHealthState](#UserHealthState) - ZipMetricsStorages - - auth type: __Admin__ + - auth type: __Metrics__ - This methods has an __empty__ __request__ body - output: [ZippedMetrics](#ZippedMetrics) @@ -805,7 +805,7 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __response__ body - ResetMetricsStorages - - auth type: __Admin__ + - auth type: __Metrics__ - http method: __post__ - http route: __/api/admin/metrics/reset__ - This methods has an __empty__ __request__ body @@ -910,7 +910,7 @@ The nostr server will send back a message response, and inside the body there wi - output: [UserHealthState](#UserHealthState) - ZipMetricsStorages - - auth type: __Admin__ + - auth type: __Metrics__ - http method: __post__ - http route: __/api/admin/metrics/zip__ - This methods has an __empty__ __request__ body diff --git a/proto/autogenerated/go/http_client.go b/proto/autogenerated/go/http_client.go index 652a0838..ec489a7a 100644 --- a/proto/autogenerated/go/http_client.go +++ b/proto/autogenerated/go/http_client.go @@ -1755,7 +1755,7 @@ func NewClient(params ClientParams) *Client { return nil }, ResetMetricsStorages: func() error { - auth, err := params.RetrieveAdminAuth() + auth, err := params.RetrieveMetricsAuth() if err != nil { return err } @@ -2106,7 +2106,7 @@ func NewClient(params ClientParams) *Client { return &res, nil }, ZipMetricsStorages: func() (*ZippedMetrics, error) { - auth, err := params.RetrieveAdminAuth() + auth, err := params.RetrieveMetricsAuth() if err != nil { return nil, err } diff --git a/proto/autogenerated/ts/express_server.ts b/proto/autogenerated/ts/express_server.ts index 9bed5af5..37170364 100644 --- a/proto/autogenerated/ts/express_server.ts +++ b/proto/autogenerated/ts/express_server.ts @@ -1639,7 +1639,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { let authCtx: Types.AuthContext = {} try { if (!methods.ResetMetricsStorages) throw new Error('method: ResetMetricsStorages is not implemented') - const authContext = await opts.AdminAuthGuard(req.headers['authorization']) + const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) authCtx = authContext stats.guard = process.hrtime.bigint() stats.validate = stats.guard @@ -1941,7 +1941,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { let authCtx: Types.AuthContext = {} try { if (!methods.ZipMetricsStorages) throw new Error('method: ZipMetricsStorages is not implemented') - const authContext = await opts.AdminAuthGuard(req.headers['authorization']) + const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) authCtx = authContext stats.guard = process.hrtime.bigint() stats.validate = stats.guard diff --git a/proto/autogenerated/ts/http_client.ts b/proto/autogenerated/ts/http_client.ts index afe6ea6a..757f9021 100644 --- a/proto/autogenerated/ts/http_client.ts +++ b/proto/autogenerated/ts/http_client.ts @@ -840,8 +840,8 @@ export default (params: ClientParams) => ({ return { status: 'ERROR', reason: 'invalid response' } }, ResetMetricsStorages: async (): Promise => { - const auth = await params.retrieveAdminAuth() - if (auth === null) throw new Error('retrieveAdminAuth() returned null') + const auth = await params.retrieveMetricsAuth() + if (auth === null) throw new Error('retrieveMetricsAuth() 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 @@ -1007,8 +1007,8 @@ export default (params: ClientParams) => ({ return { status: 'ERROR', reason: 'invalid response' } }, ZipMetricsStorages: async (): Promise => { - const auth = await params.retrieveAdminAuth() - if (auth === null) throw new Error('retrieveAdminAuth() returned null') + const auth = await params.retrieveMetricsAuth() + if (auth === null) throw new Error('retrieveMetricsAuth() 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 diff --git a/proto/autogenerated/ts/nostr_client.ts b/proto/autogenerated/ts/nostr_client.ts index 2a2cf713..d7dc1d06 100644 --- a/proto/autogenerated/ts/nostr_client.ts +++ b/proto/autogenerated/ts/nostr_client.ts @@ -699,8 +699,8 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ return { status: 'ERROR', reason: 'invalid response' } }, ResetMetricsStorages: async (): Promise => { - const auth = await params.retrieveNostrAdminAuth() - if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') + const auth = await params.retrieveNostrMetricsAuth() + if (auth === null) throw new Error('retrieveNostrMetricsAuth() 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 @@ -817,8 +817,8 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ return { status: 'ERROR', reason: 'invalid response' } }, ZipMetricsStorages: async (): Promise => { - const auth = await params.retrieveNostrAdminAuth() - if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') + const auth = await params.retrieveNostrMetricsAuth() + if (auth === null) throw new Error('retrieveNostrMetricsAuth() 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 diff --git a/proto/autogenerated/ts/nostr_transport.ts b/proto/autogenerated/ts/nostr_transport.ts index 6603f973..99d7ec86 100644 --- a/proto/autogenerated/ts/nostr_transport.ts +++ b/proto/autogenerated/ts/nostr_transport.ts @@ -1094,7 +1094,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { case 'ResetMetricsStorages': try { if (!methods.ResetMetricsStorages) throw new Error('method: ResetMetricsStorages is not implemented') - const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) + const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) stats.guard = process.hrtime.bigint() authCtx = authContext stats.validate = stats.guard @@ -1229,7 +1229,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { case 'ZipMetricsStorages': try { if (!methods.ZipMetricsStorages) throw new Error('method: ZipMetricsStorages is not implemented') - const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) + const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) stats.guard = process.hrtime.bigint() authCtx = authContext stats.validate = stats.guard diff --git a/proto/autogenerated/ts/types.ts b/proto/autogenerated/ts/types.ts index 6997ecef..6bdaa118 100644 --- a/proto/autogenerated/ts/types.ts +++ b/proto/autogenerated/ts/types.ts @@ -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 | 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 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 AppContext = { app_id: string } @@ -28,8 +28,8 @@ export type MetricsContext = { app_id: string operator_id: string } -export type MetricsMethodInputs = GetAppsMetrics_Input | GetBundleMetrics_Input | GetErrorStats_Input | GetLndMetrics_Input | GetSingleBundleMetrics_Input | GetSingleUsageMetrics_Input | GetUsageMetrics_Input | SubmitWebRtcMessage_Input -export type MetricsMethodOutputs = GetAppsMetrics_Output | GetBundleMetrics_Output | GetErrorStats_Output | GetLndMetrics_Output | GetSingleBundleMetrics_Output | GetSingleUsageMetrics_Output | GetUsageMetrics_Output | SubmitWebRtcMessage_Output +export type MetricsMethodInputs = GetAppsMetrics_Input | GetBundleMetrics_Input | GetErrorStats_Input | GetLndMetrics_Input | GetSingleBundleMetrics_Input | GetSingleUsageMetrics_Input | GetUsageMetrics_Input | ResetMetricsStorages_Input | SubmitWebRtcMessage_Input | ZipMetricsStorages_Input +export type MetricsMethodOutputs = GetAppsMetrics_Output | GetBundleMetrics_Output | GetErrorStats_Output | GetLndMetrics_Output | GetSingleBundleMetrics_Output | GetSingleUsageMetrics_Output | GetUsageMetrics_Output | ResetMetricsStorages_Output | SubmitWebRtcMessage_Output | ZipMetricsStorages_Output export type UserContext = { app_id: string app_user_id: string @@ -365,7 +365,7 @@ export type ServerMethods = { PayInvoice?: (req: PayInvoice_Input & {ctx: UserContext }) => Promise RequestNPubLinkingToken?: (req: RequestNPubLinkingToken_Input & {ctx: AppContext }) => Promise ResetDebit?: (req: ResetDebit_Input & {ctx: UserContext }) => Promise - ResetMetricsStorages?: (req: ResetMetricsStorages_Input & {ctx: AdminContext }) => Promise + ResetMetricsStorages?: (req: ResetMetricsStorages_Input & {ctx: MetricsContext }) => Promise ResetNPubLinkingToken?: (req: ResetNPubLinkingToken_Input & {ctx: AppContext }) => Promise RespondToDebit?: (req: RespondToDebit_Input & {ctx: UserContext }) => Promise SendAppUserToAppPayment?: (req: SendAppUserToAppPayment_Input & {ctx: AppContext }) => Promise @@ -380,7 +380,7 @@ export type ServerMethods = { UpdateUserOffer?: (req: UpdateUserOffer_Input & {ctx: UserContext }) => Promise UseInviteLink?: (req: UseInviteLink_Input & {ctx: GuestWithPubContext }) => Promise UserHealth?: (req: UserHealth_Input & {ctx: UserContext }) => Promise - ZipMetricsStorages?: (req: ZipMetricsStorages_Input & {ctx: AdminContext }) => Promise + ZipMetricsStorages?: (req: ZipMetricsStorages_Input & {ctx: MetricsContext }) => Promise } export enum AddressType { diff --git a/proto/service/methods.proto b/proto/service/methods.proto index ee287fb8..f1aebe7b 100644 --- a/proto/service/methods.proto +++ b/proto/service/methods.proto @@ -235,14 +235,14 @@ service LightningPub { } rpc ZipMetricsStorages(structs.Empty) returns (structs.ZippedMetrics) { - option (auth_type) = "Admin"; + option (auth_type) = "Metrics"; 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 (auth_type) = "Metrics"; option (http_method) = "post"; option (http_route) = "/api/admin/metrics/reset"; option (nostr) = true;