@friggframework/core 2.0.0--canary.522.cbd3d5a.0 → 2.0.0--canary.517.35ee143.0
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/CHANGELOG.md +67 -66
- package/CLAUDE.md +124 -148
- package/README.md +130 -165
- package/admin-scripts/index.js +16 -30
- package/admin-scripts/repositories/{admin-api-key-repository-documentdb.js → admin-process-repository-documentdb.js} +5 -5
- package/admin-scripts/repositories/{admin-api-key-repository-factory.js → admin-process-repository-factory.js} +15 -19
- package/admin-scripts/repositories/admin-process-repository-interface.js +150 -0
- package/admin-scripts/repositories/admin-process-repository-mongo.js +213 -0
- package/admin-scripts/repositories/admin-process-repository-postgres.js +251 -0
- package/admin-scripts/repositories/script-schedule-repository-factory.js +2 -6
- package/admin-scripts/repositories/script-schedule-repository-interface.js +14 -36
- package/admin-scripts/repositories/script-schedule-repository-mongo.js +13 -25
- package/admin-scripts/repositories/script-schedule-repository-postgres.js +13 -25
- package/application/commands/admin-script-commands.js +102 -266
- package/application/commands/integration-commands.js +6 -12
- package/application/index.js +3 -1
- package/assertions/get.js +4 -1
- package/associations/association.js +57 -59
- package/associations/model.js +41 -41
- package/core/CLAUDE.md +156 -222
- package/core/Worker.js +1 -5
- package/credential/repositories/credential-repository-documentdb.js +1 -71
- package/credential/repositories/credential-repository-interface.js +2 -8
- package/credential/repositories/credential-repository-mongo.js +4 -45
- package/credential/repositories/credential-repository-postgres.js +3 -44
- package/credential/repositories/credential-repository.js +4 -6
- package/credential/use-cases/get-credential-for-user.js +3 -21
- package/credential/use-cases/update-authentication-status.js +2 -5
- package/database/MONGODB_TRANSACTION_FIX.md +52 -72
- package/database/adapters/lambda-invoker.js +7 -8
- package/database/config.js +13 -15
- package/database/documentdb-encryption-service.js +13 -29
- package/database/documentdb-utils.js +12 -21
- package/database/encryption/README.md +36 -53
- package/database/encryption/encryption-schema-registry.js +9 -21
- package/database/encryption/field-encryption-service.js +4 -15
- package/database/encryption/logger.js +2 -3
- package/database/encryption/prisma-encryption-extension.js +8 -5
- package/database/index.js +2 -4
- package/database/models/IndividualUser.js +15 -15
- package/database/models/OrganizationUser.js +4 -6
- package/database/models/UserModel.js +2 -2
- package/database/models/WebsocketConnection.js +1 -4
- package/database/mongoose.js +2 -2
- package/database/prisma.js +14 -22
- package/database/repositories/health-check-repository-documentdb.js +7 -22
- package/database/repositories/health-check-repository-factory.js +3 -9
- package/database/repositories/health-check-repository-interface.js +5 -15
- package/database/repositories/health-check-repository-mongodb.js +6 -9
- package/database/repositories/health-check-repository-postgres.js +1 -1
- package/database/repositories/migration-status-repository-s3.js +5 -10
- package/database/use-cases/check-database-health-use-case.js +2 -3
- package/database/use-cases/check-database-state-use-case.js +7 -9
- package/database/use-cases/get-database-state-via-worker-use-case.js +12 -15
- package/database/use-cases/get-migration-status-use-case.js +2 -4
- package/database/use-cases/run-database-migration-use-case.js +9 -41
- package/database/use-cases/test-encryption-use-case.js +5 -4
- package/database/use-cases/trigger-database-migration-use-case.js +8 -9
- package/database/utils/mongodb-collection-utils.js +3 -11
- package/database/utils/mongodb-schema-init.js +4 -10
- package/database/utils/prisma-runner.js +74 -144
- package/database/utils/prisma-schema-parser.js +2 -2
- package/docs/PROCESS_MANAGEMENT_QUEUE_SPEC.md +80 -135
- package/encrypt/Cryptor.js +2 -8
- package/errors/fetch-error.js +1 -1
- package/generated/prisma-mongodb/edge.js +16 -59
- package/generated/prisma-mongodb/index-browser.js +12 -62
- package/generated/prisma-mongodb/index.d.ts +4850 -8136
- package/generated/prisma-mongodb/index.js +16 -59
- package/generated/prisma-mongodb/package.json +1 -1
- package/generated/prisma-mongodb/schema.prisma +33 -75
- package/generated/prisma-mongodb/wasm.js +16 -59
- package/generated/prisma-postgresql/edge.js +15 -59
- package/generated/prisma-postgresql/index-browser.js +11 -62
- package/generated/prisma-postgresql/index.d.ts +5963 -8930
- package/generated/prisma-postgresql/index.js +15 -59
- package/generated/prisma-postgresql/package.json +1 -1
- package/generated/prisma-postgresql/schema.prisma +33 -73
- package/generated/prisma-postgresql/wasm.js +15 -59
- package/handlers/WEBHOOKS.md +81 -104
- package/handlers/app-definition-loader.js +1 -1
- package/handlers/app-handler-helpers.js +2 -14
- package/handlers/backend-utils.js +1 -0
- package/handlers/database-migration-handler.js +45 -64
- package/handlers/middleware/admin-auth.js +53 -0
- package/handlers/routers/HEALTHCHECK.md +135 -170
- package/handlers/routers/auth.js +2 -23
- package/handlers/routers/db-migration.handler.js +3 -2
- package/handlers/routers/db-migration.js +33 -69
- package/handlers/routers/health.js +8 -23
- package/handlers/routers/integration-defined-routers.js +4 -4
- package/handlers/routers/integration-webhook-routers.js +7 -17
- package/handlers/routers/websocket.js +3 -9
- package/handlers/use-cases/check-integrations-health-use-case.js +6 -13
- package/handlers/workers/db-migration.js +26 -54
- package/index.js +9 -5
- package/integrations/WEBHOOK-QUICKSTART.md +14 -21
- package/integrations/index.js +0 -4
- package/integrations/integration-base.js +6 -9
- package/integrations/integration-router.js +146 -1817
- package/integrations/options.js +20 -47
- package/integrations/repositories/integration-repository-documentdb.js +24 -53
- package/integrations/repositories/integration-repository-factory.js +2 -6
- package/integrations/repositories/integration-repository-interface.js +9 -27
- package/integrations/repositories/integration-repository-postgres.js +3 -3
- package/integrations/repositories/process-repository-factory.js +1 -0
- package/integrations/repositories/process-repository-interface.js +5 -9
- package/integrations/repositories/process-repository-mongo.js +3 -7
- package/integrations/repositories/process-repository-postgres.js +2 -2
- package/integrations/tests/doubles/config-capturing-integration.js +8 -9
- package/integrations/tests/doubles/dummy-integration-class.js +8 -81
- package/integrations/tests/doubles/test-integration-repository.js +11 -51
- package/integrations/use-cases/create-integration.js +32 -36
- package/integrations/use-cases/create-process.js +9 -20
- package/integrations/use-cases/delete-integration-for-user.js +4 -5
- package/integrations/use-cases/get-integration-for-user.js +10 -25
- package/integrations/use-cases/get-integration-instance-by-definition.js +7 -13
- package/integrations/use-cases/get-integrations-for-user.js +1 -4
- package/integrations/use-cases/get-possible-integrations.js +1 -1
- package/integrations/use-cases/get-process.js +6 -5
- package/integrations/use-cases/index.js +1 -3
- package/integrations/use-cases/load-integration-context.js +5 -1
- package/integrations/use-cases/update-process-state.js +8 -10
- package/integrations/utils/map-integration-dto.js +3 -9
- package/jest-setup.js +1 -1
- package/jest-teardown.js +1 -1
- package/lambda/TimeoutCatcher.js +30 -32
- package/lambda/index.js +1 -1
- package/logs/index.js +3 -3
- package/modules/module.js +1 -3
- package/modules/repositories/module-repository-documentdb.js +48 -114
- package/modules/repositories/module-repository-interface.js +0 -13
- package/modules/repositories/module-repository-mongo.js +6 -46
- package/modules/repositories/module-repository-postgres.js +6 -48
- package/modules/repositories/module-repository.js +1 -34
- package/modules/requester/api-key.js +2 -0
- package/modules/requester/basic.js +1 -0
- package/modules/requester/oauth-2.js +2 -3
- package/modules/test/mock-api/definition.js +10 -15
- package/modules/test/mock-api/mocks/hubspot.js +36 -36
- package/modules/tests/doubles/test-module-factory.js +4 -10
- package/modules/tests/doubles/test-module-repository.js +1 -1
- package/modules/use-cases/get-entities-for-user.js +1 -1
- package/modules/use-cases/get-entity-options-by-id.js +6 -8
- package/modules/use-cases/get-module.js +9 -12
- package/modules/use-cases/process-authorization-callback.js +6 -12
- package/modules/use-cases/refresh-entity-options.js +6 -8
- package/modules/use-cases/test-module-auth.js +6 -8
- package/modules/utils/map-module-dto.js +2 -2
- package/package.json +5 -7
- package/prisma-mongodb/schema.prisma +33 -75
- package/prisma-postgresql/schema.prisma +33 -73
- package/queues/queuer-util.js +1 -5
- package/syncs/model.js +51 -51
- package/syncs/repositories/sync-repository-documentdb.js +19 -39
- package/syncs/repositories/sync-repository-interface.js +2 -6
- package/syncs/repositories/sync-repository-postgres.js +13 -19
- package/syncs/sync.js +100 -104
- package/token/repositories/token-repository-factory.js +3 -1
- package/types/assertions/index.d.ts +72 -72
- package/types/associations/index.d.ts +57 -57
- package/types/core/index.d.ts +53 -59
- package/types/database/index.d.ts +2 -2
- package/types/encrypt/index.d.ts +3 -3
- package/types/errors/index.d.ts +54 -61
- package/types/eslint-config/index.d.ts +40 -40
- package/types/integrations/index.d.ts +183 -185
- package/types/lambda/index.d.ts +26 -26
- package/types/logs/index.d.ts +4 -4
- package/types/module-plugin/index.d.ts +237 -239
- package/types/prettier-config/index.d.ts +5 -5
- package/types/syncs/index.d.ts +108 -102
- package/types/test-environment/index.d.ts +14 -14
- package/types/tsconfig.json +93 -95
- package/user/tests/doubles/test-user-repository.js +2 -5
- package/user/use-cases/authenticate-user.js +4 -2
- package/user/use-cases/authenticate-with-shared-secret.js +1 -1
- package/user/use-cases/create-individual-user.js +7 -8
- package/user/use-cases/create-organization-user.js +1 -1
- package/user/use-cases/create-token-for-user-id.js +1 -1
- package/user/use-cases/get-user-from-adopter-jwt.js +2 -0
- package/user/use-cases/get-user-from-bearer-token.js +3 -7
- package/user/use-cases/get-user-from-x-frigg-headers.js +11 -14
- package/user/use-cases/login-user.js +8 -8
- package/user/user.js +4 -18
- package/utils/backend-path.js +2 -2
- package/utils/index.js +1 -4
- package/websocket/repositories/websocket-connection-repository-documentdb.js +8 -21
- package/websocket/repositories/websocket-connection-repository-mongo.js +4 -8
- package/websocket/repositories/websocket-connection-repository-postgres.js +4 -8
- package/websocket/repositories/websocket-connection-repository.js +4 -8
- package/admin-scripts/repositories/admin-api-key-repository-interface.js +0 -121
- package/admin-scripts/repositories/admin-api-key-repository-mongo.js +0 -155
- package/admin-scripts/repositories/admin-api-key-repository-postgres.js +0 -189
- package/admin-scripts/repositories/script-execution-repository-documentdb.js +0 -21
- package/admin-scripts/repositories/script-execution-repository-factory.js +0 -55
- package/admin-scripts/repositories/script-execution-repository-interface.js +0 -193
- package/admin-scripts/repositories/script-execution-repository-mongo.js +0 -278
- package/admin-scripts/repositories/script-execution-repository-postgres.js +0 -320
- package/credential/credential-router.js +0 -262
- package/credential/use-cases/delete-credential-for-user.js +0 -50
- package/credential/use-cases/list-credentials-for-user.js +0 -31
- package/credential/use-cases/reauthorize-credential.js +0 -103
- package/handlers/routers/admin.js +0 -450
- package/handlers/routers/docs.js +0 -180
- package/handlers/routers/middleware/loadUser.js +0 -39
- package/handlers/routers/middleware/requireAdmin.js +0 -41
- package/handlers/routers/middleware/requireLoggedInUser.js +0 -19
- package/integrations/use-cases/execute-proxy-request.js +0 -564
- package/modules/domain/entities/AuthorizationSession.js +0 -131
- package/modules/domain/entities/index.js +0 -10
- package/modules/repositories/authorization-session-repository-factory.js +0 -55
- package/modules/repositories/authorization-session-repository-interface.js +0 -75
- package/modules/repositories/authorization-session-repository-mongo.js +0 -169
- package/modules/repositories/authorization-session-repository-postgres.js +0 -170
- package/modules/use-cases/delete-module-entity.js +0 -23
- package/modules/use-cases/get-authorization-requirements.js +0 -110
- package/modules/use-cases/get-module-entity-by-id.js +0 -16
- package/modules/use-cases/process-authorization-step.js +0 -160
- package/modules/use-cases/start-authorization-session.js +0 -86
- package/modules/use-cases/update-module-entity.js +0 -27
- package/openapi/openapi-spec-generator.js +0 -370
- package/openapi/openapi-v1.yaml +0 -1360
- package/openapi/openapi-v2.yaml +0 -1535
- package/user/use-cases/delete-user.js +0 -47
package/types/errors/index.d.ts
CHANGED
|
@@ -1,73 +1,66 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
options?: ErrorOptions,
|
|
6
|
-
...otherOptions: any
|
|
7
|
-
);
|
|
8
|
-
}
|
|
1
|
+
declare module "@friggframework/errors" {
|
|
2
|
+
export class BaseError extends Error {
|
|
3
|
+
constructor(message?: string, options?: ErrorOptions, ...otherOptions: any);
|
|
4
|
+
}
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export class FetchError extends BaseError {
|
|
7
|
+
constructor(options?: FetchErrorConstructor);
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
static create(options?: CreateFetchErrorParams): Promise<FetchError>;
|
|
10
|
+
}
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
responseBody?: any;
|
|
12
|
+
type FetchErrorConstructor = {
|
|
13
|
+
resource?: string;
|
|
14
|
+
init?: Partial<{
|
|
15
|
+
method: string;
|
|
16
|
+
credentials: string;
|
|
17
|
+
headers: object;
|
|
18
|
+
query: object;
|
|
19
|
+
body: URLSearchParams | any;
|
|
20
|
+
returnFullRes: false;
|
|
21
|
+
}>;
|
|
22
|
+
response?: {
|
|
23
|
+
headers?: object;
|
|
24
|
+
status?: number;
|
|
25
|
+
statusText?: string;
|
|
26
|
+
text?: () => Promise<string>;
|
|
33
27
|
};
|
|
28
|
+
responseBody?: any;
|
|
29
|
+
};
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
> & {
|
|
39
|
-
body: any;
|
|
40
|
-
};
|
|
31
|
+
type CreateFetchErrorParams = Omit<FetchErrorConstructor, "responseBody"> & {
|
|
32
|
+
body: any;
|
|
33
|
+
};
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
export class HaltError extends BaseError {
|
|
36
|
+
isHaltError: boolean;
|
|
37
|
+
}
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
export class RequiredPropertyError extends BaseError {
|
|
40
|
+
constructor(
|
|
41
|
+
options: RequiredPropertyErrorOptions,
|
|
42
|
+
otherOptions?: ErrorOptions
|
|
43
|
+
);
|
|
44
|
+
}
|
|
52
45
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
type RequiredPropertyErrorOptions = {
|
|
47
|
+
parent?: new () => Class;
|
|
48
|
+
key: string;
|
|
49
|
+
};
|
|
57
50
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
export class ParameterTypeError extends BaseError {
|
|
52
|
+
constructor(
|
|
53
|
+
options: ParameterTypeErrorOptions,
|
|
54
|
+
otherOptions?: ErrorOptions
|
|
55
|
+
);
|
|
56
|
+
}
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
type ParameterTypeErrorOptions = {
|
|
59
|
+
parent?: new () => Class;
|
|
60
|
+
key: string;
|
|
61
|
+
value: string;
|
|
62
|
+
expectedType: new () => Class;
|
|
63
|
+
};
|
|
71
64
|
|
|
72
|
-
|
|
65
|
+
type Class<T = any> = new (...args: any[]) => T;
|
|
73
66
|
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
declare module "@friggframework/eslint-config" {
|
|
2
|
+
const config: {
|
|
3
|
+
env: {
|
|
4
|
+
commonjs: true,
|
|
5
|
+
es2020: true,
|
|
6
|
+
jest: true,
|
|
7
|
+
},
|
|
8
|
+
extends: ["prettier", "plugin:markdown/recommended"],
|
|
9
|
+
parser: "@babel/eslint-parser",
|
|
10
|
+
parserOptions: {
|
|
11
|
+
ecmaVersion: 11,
|
|
12
|
+
requireConfigFile: false,
|
|
13
|
+
},
|
|
14
|
+
plugins: ["no-only-tests"],
|
|
15
|
+
ignorePatterns: ["coverage/", ".nyc_output/"],
|
|
16
|
+
overrides: [
|
|
17
|
+
{
|
|
18
|
+
files: ["*.json"],
|
|
19
|
+
plugins: ["json"],
|
|
20
|
+
extends: ["plugin:json/recommended"],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
files: ["*.yaml", "*.yml"],
|
|
24
|
+
plugins: ["yaml"],
|
|
25
|
+
extends: ["plugin:yaml/recommended"],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
rules: {
|
|
29
|
+
"no-only-tests/no-only-tests": ["error", { fix: false }],
|
|
30
|
+
"no-unused-vars": [
|
|
31
|
+
"warn",
|
|
32
|
+
{ vars: "all", args: "after-used", ignoreRestSiblings: false },
|
|
33
|
+
],
|
|
34
|
+
"no-console": ["warn"],
|
|
35
|
+
camelcase: ["warn"],
|
|
36
|
+
"no-mixed-requires": ["warn"],
|
|
37
|
+
"no-warning-comments": ["warn"],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export default config;
|
|
41
41
|
}
|
|
@@ -1,189 +1,187 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class IntegrationManager
|
|
20
|
-
extends Delegate
|
|
21
|
-
implements IFriggIntegrationManager
|
|
22
|
-
{
|
|
23
|
-
integration: Integration;
|
|
24
|
-
primaryInstance: any;
|
|
25
|
-
targetInstance: any;
|
|
26
|
-
|
|
27
|
-
static Config: {
|
|
28
|
-
name: string;
|
|
29
|
-
version: string;
|
|
30
|
-
supportedVersions: string[];
|
|
31
|
-
events: string[];
|
|
32
|
-
};
|
|
33
|
-
static integrationManagerClasses: any[];
|
|
34
|
-
static integrationTypes: string[];
|
|
35
|
-
|
|
36
|
-
constructor(params: any);
|
|
37
|
-
|
|
38
|
-
static getInstanceFromIntegrationId(params: {
|
|
39
|
-
integrationId: string;
|
|
40
|
-
userId?: string;
|
|
41
|
-
}): Promise<any>;
|
|
42
|
-
static getName(): string;
|
|
43
|
-
static getCurrentVersion(): string;
|
|
44
|
-
|
|
45
|
-
validateConfig(): Promise<void>;
|
|
46
|
-
testAuth(): Promise<void>;
|
|
47
|
-
|
|
48
|
-
static getInstance(params: {
|
|
49
|
-
userId: string;
|
|
50
|
-
integrationId: string;
|
|
51
|
-
}): Promise<IntegrationManager>;
|
|
52
|
-
static getIntegrationManagerClasses(type: string): any[];
|
|
53
|
-
|
|
54
|
-
static createIntegration(
|
|
55
|
-
entities: { id: string; user: any },
|
|
56
|
-
userId: string,
|
|
57
|
-
config: any
|
|
58
|
-
): Promise<any>;
|
|
59
|
-
|
|
60
|
-
static getFormattedIntegration(
|
|
61
|
-
integration: Integration
|
|
62
|
-
): Promise<FormattedIntegration[]>;
|
|
63
|
-
static getIntegrationsForUserId(
|
|
64
|
-
userId: string
|
|
65
|
-
): Promise<FormattedIntegration[]>;
|
|
66
|
-
static getIntegrationForUserById(
|
|
67
|
-
userId: string,
|
|
68
|
-
integrationId: string
|
|
69
|
-
): Promise<Integration>;
|
|
70
|
-
static deleteIntegrationForUserById(
|
|
71
|
-
userId: string,
|
|
72
|
-
integrationId: string
|
|
73
|
-
): Promise<void>;
|
|
74
|
-
static getIntegrationById(id: string): Promise<Integration>;
|
|
75
|
-
static getFilteredIntegrationsForUserId(
|
|
76
|
-
userId: string,
|
|
77
|
-
filter: any
|
|
78
|
-
): Promise<Integration[]>;
|
|
79
|
-
static getCredentialById(credential_id: string): Promise<any>;
|
|
80
|
-
static listCredentials(options: any): Promise<any>;
|
|
81
|
-
static getEntityById(entity_id: any): Promise<any>;
|
|
82
|
-
static listEntities(options: any): Promise<any>;
|
|
83
|
-
|
|
84
|
-
processCreate(params: any): Promise<any>;
|
|
85
|
-
processUpdate(params: any): Promise<any>;
|
|
86
|
-
processDelete(params: any): Promise<any>;
|
|
87
|
-
|
|
88
|
-
getConfigOptions(): Promise<any>;
|
|
89
|
-
getSampleData(): Promise<any>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
type FormattedIntegration = {
|
|
93
|
-
entities: any[];
|
|
94
|
-
messages: any;
|
|
95
|
-
id: any;
|
|
96
|
-
config: any;
|
|
97
|
-
version: any;
|
|
98
|
-
status: any;
|
|
1
|
+
declare module "@friggframework/integrations" {
|
|
2
|
+
import { Delegate, IFriggDelegate } from "@friggframework/core";
|
|
3
|
+
import { Model } from "mongoose";
|
|
4
|
+
|
|
5
|
+
export class Integration extends Model {
|
|
6
|
+
entities: any[];
|
|
7
|
+
userId: string;
|
|
8
|
+
status: string; // IntegrationStatus
|
|
9
|
+
config: any;
|
|
10
|
+
version: string;
|
|
11
|
+
messages: {
|
|
12
|
+
errors: [];
|
|
13
|
+
warnings: [];
|
|
14
|
+
info: [];
|
|
15
|
+
logs: [];
|
|
99
16
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export class IntegrationConfigManager
|
|
117
|
-
implements IFriggIntegrationConfigManager
|
|
118
|
-
{
|
|
119
|
-
options: IntegrationOptions[];
|
|
120
|
-
primary: any;
|
|
121
|
-
|
|
122
|
-
getIntegrationOptions(): Promise<GetIntegrationOptions>;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
interface IFriggIntegrationConfigManager {
|
|
126
|
-
options: IntegrationOptions[];
|
|
127
|
-
primary: any;
|
|
128
|
-
|
|
129
|
-
getIntegrationOptions(): Promise<GetIntegrationOptions>;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
type GetIntegrationOptions = {
|
|
133
|
-
entities: {
|
|
134
|
-
primary: any;
|
|
135
|
-
options: any[];
|
|
136
|
-
autorized: any[];
|
|
137
|
-
};
|
|
138
|
-
integrations: any[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class IntegrationManager
|
|
20
|
+
extends Delegate
|
|
21
|
+
implements IFriggIntegrationManager {
|
|
22
|
+
integration: Integration;
|
|
23
|
+
primaryInstance: any;
|
|
24
|
+
targetInstance: any;
|
|
25
|
+
|
|
26
|
+
static Config: {
|
|
27
|
+
name: string;
|
|
28
|
+
version: string;
|
|
29
|
+
supportedVersions: string[];
|
|
30
|
+
events: string[];
|
|
139
31
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
32
|
+
static integrationManagerClasses: any[];
|
|
33
|
+
static integrationTypes: string[];
|
|
34
|
+
|
|
35
|
+
constructor(params: any);
|
|
36
|
+
|
|
37
|
+
static getInstanceFromIntegrationId(params: {
|
|
38
|
+
integrationId: string;
|
|
39
|
+
userId?: string;
|
|
40
|
+
}): Promise<any>;
|
|
41
|
+
static getName(): string;
|
|
42
|
+
static getCurrentVersion(): string;
|
|
43
|
+
|
|
44
|
+
validateConfig(): Promise<void>;
|
|
45
|
+
testAuth(): Promise<void>;
|
|
46
|
+
|
|
47
|
+
static getInstance(params: {
|
|
48
|
+
userId: string;
|
|
49
|
+
integrationId: string;
|
|
50
|
+
}): Promise<IntegrationManager>;
|
|
51
|
+
static getIntegrationManagerClasses(type: string): any[];
|
|
52
|
+
|
|
53
|
+
static createIntegration(
|
|
54
|
+
entities: { id: string; user: any },
|
|
55
|
+
userId: string,
|
|
56
|
+
config: any,
|
|
57
|
+
): Promise<any>;
|
|
58
|
+
|
|
59
|
+
static getFormattedIntegration(
|
|
60
|
+
integration: Integration
|
|
61
|
+
): Promise<FormattedIntegration[]>;
|
|
62
|
+
static getIntegrationsForUserId(
|
|
63
|
+
userId: string
|
|
64
|
+
): Promise<FormattedIntegration[]>;
|
|
65
|
+
static getIntegrationForUserById(
|
|
66
|
+
userId: string,
|
|
67
|
+
integrationId: string
|
|
68
|
+
): Promise<Integration>;
|
|
69
|
+
static deleteIntegrationForUserById(
|
|
70
|
+
userId: string,
|
|
71
|
+
integrationId: string
|
|
72
|
+
): Promise<void>;
|
|
73
|
+
static getIntegrationById(id: string): Promise<Integration>;
|
|
74
|
+
static getFilteredIntegrationsForUserId(
|
|
75
|
+
userId: string,
|
|
76
|
+
filter: any
|
|
77
|
+
): Promise<Integration[]>;
|
|
78
|
+
static getCredentialById(credential_id: string): Promise<any>;
|
|
79
|
+
static listCredentials(options: any): Promise<any>;
|
|
80
|
+
static getEntityById(entity_id: any): Promise<any>;
|
|
81
|
+
static listEntities(options: any): Promise<any>;
|
|
82
|
+
|
|
83
|
+
processCreate(params: any): Promise<any>;
|
|
84
|
+
processUpdate(params: any): Promise<any>;
|
|
85
|
+
processDelete(params: any): Promise<any>;
|
|
86
|
+
|
|
87
|
+
getConfigOptions(): Promise<any>;
|
|
88
|
+
getSampleData(): Promise<any>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type FormattedIntegration = {
|
|
92
|
+
entities: any[];
|
|
93
|
+
messages: any;
|
|
94
|
+
id: any;
|
|
95
|
+
config: any;
|
|
96
|
+
version: any;
|
|
97
|
+
status: any;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
interface IFriggIntegrationManager extends IFriggDelegate {
|
|
101
|
+
primaryInstance: any; // Returns the Freshbooks manager instance
|
|
102
|
+
targetInstance: any; // Returns a manager e.g. StripeManager instance containing the entitiy, credential, api etc
|
|
103
|
+
integration: Integration; // Integration model instance
|
|
104
|
+
|
|
105
|
+
validateConfig(): Promise<void>;
|
|
106
|
+
testAuth(): Promise<void>;
|
|
107
|
+
processCreate(params: any): Promise<any>;
|
|
108
|
+
processUpdate(params: any): Promise<any>;
|
|
109
|
+
processDelete(params: any): Promise<any>;
|
|
110
|
+
|
|
111
|
+
getConfigOptions(): Promise<any>;
|
|
112
|
+
getSampleData(): Promise<any>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export class IntegrationConfigManager
|
|
116
|
+
implements IFriggIntegrationConfigManager {
|
|
117
|
+
options: IntegrationOptions[];
|
|
118
|
+
primary: any;
|
|
119
|
+
|
|
120
|
+
getIntegrationOptions(): Promise<GetIntegrationOptions>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface IFriggIntegrationConfigManager {
|
|
124
|
+
options: IntegrationOptions[];
|
|
125
|
+
primary: any;
|
|
126
|
+
|
|
127
|
+
getIntegrationOptions(): Promise<GetIntegrationOptions>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
type GetIntegrationOptions = {
|
|
131
|
+
entities: {
|
|
132
|
+
primary: any;
|
|
133
|
+
options: any[];
|
|
134
|
+
autorized: any[];
|
|
177
135
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
136
|
+
integrations: any[];
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export class Options implements IFriggIntegrationOptions {
|
|
140
|
+
display: IntegrationOptionDisplay;
|
|
141
|
+
hasUserConfig: boolean;
|
|
142
|
+
isMany: boolean;
|
|
143
|
+
module: any;
|
|
144
|
+
requiresNewEntity: boolean;
|
|
145
|
+
type: string;
|
|
146
|
+
|
|
147
|
+
constructor(params: {
|
|
148
|
+
display: Partial<IntegrationOptionDisplay>;
|
|
149
|
+
type?: string;
|
|
150
|
+
hasUserConfig?: boolean;
|
|
151
|
+
isMany?: boolean;
|
|
152
|
+
requiresNewEntity?: boolean;
|
|
153
|
+
module?: any;
|
|
154
|
+
});
|
|
155
|
+
get(): IntegrationOptions;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface IFriggIntegrationOptions {
|
|
159
|
+
module: any;
|
|
160
|
+
type: string;
|
|
161
|
+
hasUserConfig: boolean;
|
|
162
|
+
isMany: boolean;
|
|
163
|
+
requiresNewEntity: boolean;
|
|
164
|
+
display: IntegrationOptionDisplay;
|
|
165
|
+
|
|
166
|
+
get(): IntegrationOptions;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
type IntegrationOptions = {
|
|
170
|
+
type: string;
|
|
171
|
+
hasUserConfig: boolean;
|
|
172
|
+
isMany: boolean;
|
|
173
|
+
requiresNewEntity: boolean;
|
|
174
|
+
display: IntegrationOptionDisplay;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
type IntegrationOptionDisplay = {
|
|
178
|
+
name: string;
|
|
179
|
+
description: string;
|
|
180
|
+
detailsUrl: string;
|
|
181
|
+
icon: string;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
interface IFriggIntegrationsPackage {
|
|
185
|
+
IntegrationManager: IFriggIntegrationManager;
|
|
186
|
+
}
|
|
189
187
|
}
|
package/types/lambda/index.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
declare module "@friggframework/lambda/TimeoutCatcher" {
|
|
2
|
+
export class TimeoutCatcher implements IFriggTimeoutCatcher {
|
|
3
|
+
isFinished: boolean;
|
|
4
|
+
waitTime: number;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
constructor(params: TimeoutCatcherConstructor);
|
|
7
|
+
work(): Promise<any>;
|
|
8
|
+
cleanUp(): Promise<any>;
|
|
9
|
+
doWork(): Promise<void>;
|
|
10
|
+
exitBeforeTimeout(): Promise<void>;
|
|
11
|
+
watch(): Promise<boolean>;
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
interface IFriggTimeoutCatcher {
|
|
15
|
+
isFinished: boolean;
|
|
16
|
+
work: () => Promise<any>;
|
|
17
|
+
cleanUp: () => Promise<any>;
|
|
18
|
+
waitTime: number;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
watch(): Promise<boolean>;
|
|
21
|
+
doWork(): Promise<void>;
|
|
22
|
+
exitBeforeTimeout(): Promise<void>;
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
type TimeoutCatcherConstructor = {
|
|
26
|
+
work: () => Promise<any>;
|
|
27
|
+
timeout: number;
|
|
28
|
+
cleanUp?: () => Promise<any>;
|
|
29
|
+
cleanUpTime?: number;
|
|
30
|
+
};
|
|
31
31
|
}
|
package/types/logs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
declare module "@friggframework/logs/logger" {
|
|
2
|
+
export function debug(...messages: any[]): void;
|
|
3
|
+
export function initDebugLog(...initMessages: any[]): void;
|
|
4
|
+
export function flushDebugLog(error: any): void;
|
|
5
5
|
}
|