Skip to content

Commit

Permalink
feat: added limiter to all routr resources
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Jun 23, 2022
1 parent 79b0d4e commit e7711b6
Show file tree
Hide file tree
Showing 182 changed files with 335 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .scripts/dispatcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion .scripts/services.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion mods/agents/src/client/agents.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/agents/src/client/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/agents/src/service/agents.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/agents/src/service/decoder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
16 changes: 8 additions & 8 deletions mods/apps/src/client/apps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand All @@ -16,12 +16,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {APIClient, ClientOptions} from "@fonoster/common";
import { APIClient, ClientOptions } from "@fonoster/common";
import AppsPB from "../service/protos/apps_pb";
import CommonPB from "../service/protos/common_pb";
import {promisifyAll} from "grpc-promise";
import {AppsClient} from "../service/protos/apps_grpc_pb";
import {Struct} from "google-protobuf/google/protobuf/struct_pb";
import { promisifyAll } from "grpc-promise";
import { AppsClient } from "../service/protos/apps_grpc_pb";
import { Struct } from "google-protobuf/google/protobuf/struct_pb";
import {
App,
CreateAppRequest,
Expand Down Expand Up @@ -74,7 +74,7 @@ export default class Apps extends APIClient implements IAppsClient {
constructor(options?: ClientOptions) {
super(AppsClient, options);
super.init();
promisifyAll(super.getService(), {metadata: super.getMeta()});
promisifyAll(super.getService(), { metadata: super.getMeta() });
}

/**
Expand Down Expand Up @@ -368,11 +368,11 @@ export default class Apps extends APIClient implements IAppsClient {
const req = new AppsPB.DeleteAppRequest();
req.setRef(ref);
await super.getService().deleteApp().sendMessage(req);
return {ref};
return { ref };
}
}

export {App, AppsPB, CommonPB, IAppsClient};
export { App, AppsPB, CommonPB, IAppsClient };

// WARNING: Workaround for support to commonjs clients
module.exports = Apps;
Expand Down
2 changes: 1 addition & 1 deletion mods/apps/src/client/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
16 changes: 8 additions & 8 deletions mods/apps/src/service/apps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable require-jsdoc */
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand All @@ -18,9 +18,9 @@
* limitations under the License.
*/
import grpc from "@grpc/grpc-js";
import {getRedisConnection, getAccessKeyId} from "@fonoster/core";
import {AppsPB} from "../client/apps";
import {AppsService, IAppsServer, IAppsService} from "./protos/apps_grpc_pb";
import { getRedisConnection, getAccessKeyId } from "@fonoster/core";
import { AppsPB } from "../client/apps";
import { AppsService, IAppsServer, IAppsService } from "./protos/apps_grpc_pb";
import {
GetAppRequest,
App,
Expand All @@ -30,10 +30,10 @@ import {
CreateAppRequest,
UpdateAppRequest
} from "./protos/apps_pb";
import {Empty} from "./protos/common_pb";
import {ErrorCodes, FonosterError} from "@fonoster/errors";
import { Empty } from "./protos/common_pb";
import { ErrorCodes, FonosterError } from "@fonoster/errors";
import decoder from "./decoder";
import {nanoid} from "nanoid";
import { nanoid } from "nanoid";
import encoder from "./encoder";

const redis = getRedisConnection();
Expand Down Expand Up @@ -205,4 +205,4 @@ export default class AppsServer implements IAppsServer {
}
}

export {IAppsService, AppsService};
export { IAppsService, AppsService };
8 changes: 4 additions & 4 deletions mods/apps/src/service/decoder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand All @@ -16,9 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Struct} from "google-protobuf/google/protobuf/struct_pb";
import {AppsPB} from "../client/apps";
import {App} from "./protos/apps_pb";
import { Struct } from "google-protobuf/google/protobuf/struct_pb";
import { AppsPB } from "../client/apps";
import { App } from "./protos/apps_pb";

export default (raw: string): App => {
const appJSON = JSON.parse(raw);
Expand Down
4 changes: 2 additions & 2 deletions mods/apps/src/service/encoder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand All @@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {App} from "./protos/apps_pb";
import { App } from "./protos/apps_pb";

export default (app: App): string =>
JSON.stringify({
Expand Down
12 changes: 6 additions & 6 deletions mods/apps/test/apps.unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand All @@ -21,9 +21,9 @@ import sinon from "sinon";
import sinonChai from "sinon-chai";
import chaiAsPromised from "chai-as-promised";
import Apps from "../src/client/apps";
import {APIClient} from "@fonoster/common";
import AppsPB, {TransferConfig} from "../src/service/protos/apps_pb";
import {Struct} from "google-protobuf/google/protobuf/struct_pb";
import { APIClient } from "@fonoster/common";
import AppsPB, { TransferConfig } from "../src/service/protos/apps_pb";
import { Struct } from "google-protobuf/google/protobuf/struct_pb";

const expect = chai.expect;
chai.use(sinonChai);
Expand Down Expand Up @@ -191,7 +191,7 @@ describe("@fonoster/apps/client", () => {
.returns({
deleteApp: () => {
return {
sendMessage: () => Promise.resolve({ref: "Nx05y-ldZa"})
sendMessage: () => Promise.resolve({ ref: "Nx05y-ldZa" })
};
}
});
Expand Down Expand Up @@ -312,7 +312,7 @@ describe("@fonoster/apps/client", () => {
).to.be.deep.equal(
appObj.getIntentsEngineConfig().toJavaScript()
);
return Promise.resolve({getRef: () => appObj.getRef()});
return Promise.resolve({ getRef: () => appObj.getRef() });
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/client/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/client/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/service/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/utils/auth_utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/utils/itoken_manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/utils/jwt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/utils/jwt_payload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/src/utils/role_has_access.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/auth/test/client.unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/callmanager/src/client/callmanager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/callmanager/src/client/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/callmanager/src/service/call.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/callmanager/src/service/callmanager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/api_client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/healthcheck.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/service_runner.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable require-jsdoc */
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/speech/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/speech/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/trust_util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/common/src/web_client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/core/src/common/get_access_key_id.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/core/src/common/get_access_key_secret.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
2 changes: 1 addition & 1 deletion mods/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonoster
*
* This file is part of Fonoster
Expand Down
Loading

0 comments on commit e7711b6

Please sign in to comment.