@friggframework/core 2.0.0--canary.703.12b980b.0 → 2.0.0--canary.707.df80bfd.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 +11 -0
- package/CLAUDE.md +28 -0
- package/README.md +105 -0
- package/application/commands/integration-commands.js +20 -10
- package/application/commands/scheduler-commands.js +11 -7
- package/application/commands/user-commands.js +17 -5
- package/application/index.js +6 -2
- package/core/Worker.js +31 -7
- package/core/create-handler.js +9 -0
- package/credential/repositories/credential-repository-documentdb.js +34 -0
- package/credential/repositories/credential-repository-interface.js +15 -0
- package/credential/repositories/credential-repository-mongo.js +23 -0
- package/credential/repositories/credential-repository-postgres.js +28 -0
- package/credential/use-cases/credential-operations-for-user.js +202 -0
- package/credential/use-cases/reauthorize-credential-for-user.js +73 -0
- package/database/config.js +48 -24
- package/database/documentdb-encryption-service.js +9 -22
- package/database/documentdb-utils.js +2 -2
- package/database/encryption/README.md +78 -14
- package/database/encryption/documentdb-encryption-service.md +78 -1
- package/database/encryption/encryption-config.js +219 -0
- package/database/encryption/encryption-schema-registry.js +121 -24
- package/database/encryption/field-encryption-service.js +69 -5
- package/database/encryption/integration-mapping-encryption.js +1 -1
- package/database/encryption/test-support/fake-ciphertext.js +15 -0
- package/database/organization-where.js +18 -0
- package/database/prisma.js +15 -38
- package/database/unique-violation.js +25 -0
- package/database/use-cases/check-encryption-health-use-case.js +43 -52
- package/errors/index.js +0 -4
- package/extensions/bootstrap-runner.js +43 -0
- package/extensions/extension-loader.js +230 -0
- package/extensions/index.js +44 -0
- package/extensions/initialize-app.js +123 -0
- package/extensions/prisma-composer.js +270 -0
- package/extensions/route-mounter.js +103 -0
- package/extensions/schema-composer.js +188 -0
- package/generated/prisma-mongodb/edge.js +33 -42
- package/generated/prisma-mongodb/index-browser.js +30 -39
- package/generated/prisma-mongodb/index.d.ts +3187 -2005
- package/generated/prisma-mongodb/index.js +33 -42
- package/generated/prisma-mongodb/package.json +1 -1
- package/generated/prisma-mongodb/schema.prisma +86 -59
- package/generated/prisma-mongodb/wasm.js +33 -42
- package/generated/prisma-postgresql/edge.js +33 -42
- package/generated/prisma-postgresql/index-browser.js +30 -39
- package/generated/prisma-postgresql/index.d.ts +3380 -2177
- package/generated/prisma-postgresql/index.js +33 -42
- package/generated/prisma-postgresql/package.json +1 -1
- package/generated/prisma-postgresql/schema.prisma +81 -57
- package/generated/prisma-postgresql/wasm.js +33 -42
- package/handlers/WEBHOOKS.md +0 -29
- package/handlers/app-definition-loader.js +128 -19
- package/handlers/app-handler-helpers.js +27 -8
- package/handlers/backend-utils.js +31 -25
- package/handlers/integration-event-dispatcher.js +3 -7
- package/handlers/middleware/admin-auth.js +14 -1
- package/handlers/routers/auth.js +46 -10
- package/handlers/routers/health.js +13 -4
- package/handlers/routers/integration-defined-routers.js +144 -92
- package/handlers/routers/integration-webhook-routers.js +100 -50
- package/handlers/workers/integration-defined-workers.js +5 -2
- package/index.js +66 -16
- package/infrastructure/scheduler/index.js +19 -6
- package/infrastructure/scheduler/netlify-scheduler-adapter.js +216 -0
- package/infrastructure/scheduler/scheduled-job-repository.js +118 -0
- package/infrastructure/scheduler/scheduler-service-factory.js +55 -7
- package/integrations/index.js +1 -14
- package/integrations/integration-base.js +2 -163
- package/integrations/integration-router.js +132 -102
- package/integrations/repositories/integration-mapping-repository-documentdb.js +0 -50
- package/integrations/repositories/integration-mapping-repository-interface.js +0 -15
- package/integrations/repositories/integration-mapping-repository-mongo.js +0 -29
- package/integrations/repositories/integration-mapping-repository-postgres.js +0 -30
- package/integrations/repositories/integration-mapping-repository.js +0 -29
- package/integrations/repositories/integration-not-found.js +14 -0
- package/integrations/repositories/integration-repository-documentdb.js +37 -9
- package/integrations/repositories/integration-repository-interface.js +17 -4
- package/integrations/repositories/integration-repository-mongo.js +64 -96
- package/integrations/repositories/integration-repository-postgres.js +63 -81
- package/integrations/repositories/process-repository-mongo.js +1 -1
- package/integrations/schedule-config.js +80 -0
- package/integrations/tests/doubles/test-integration-repository.js +12 -1
- package/integrations/use-cases/create-integration.js +56 -31
- package/integrations/use-cases/delete-integration-for-user.js +4 -4
- package/integrations/use-cases/dispatch-ongoing-syncs.js +100 -0
- package/integrations/use-cases/get-integration-for-user.js +2 -4
- package/integrations/use-cases/get-integration-instance.js +4 -4
- package/integrations/use-cases/get-integrations-for-user.js +79 -39
- package/integrations/use-cases/get-possible-integrations.js +2 -7
- package/integrations/use-cases/index.js +7 -1
- package/integrations/use-cases/integration-operations-for-user.js +256 -0
- package/integrations/use-cases/resolve-integration-ownership.js +177 -0
- package/integrations/use-cases/update-integration.js +4 -4
- package/integrations/utils/map-integration-dto.js +43 -14
- package/management-api/create-management-api-router.js +49 -0
- package/management-api/error-response.js +116 -0
- package/management-api/management-api-config.js +151 -0
- package/management-api/meta-router.js +76 -0
- package/management-api/openapi/build-openapi.js +144 -0
- package/management-api/openapi/components.js +415 -0
- package/management-api/openapi/v1-operations.js +83 -0
- package/management-api/openapi/v2-operations.js +264 -0
- package/management-api/route-registry.js +411 -0
- package/management-api/test-support/http-client.js +39 -0
- package/management-api/use-cases/get-management-api-meta.js +57 -0
- package/management-api/v1-deprecation.js +120 -0
- package/management-api/v2/create-v2-router.js +85 -0
- package/management-api/v2/dependencies.js +281 -0
- package/management-api/v2/dto.js +143 -0
- package/management-api/v2/handlers/authorization.js +94 -0
- package/management-api/v2/handlers/credentials.js +33 -0
- package/management-api/v2/handlers/entities.js +77 -0
- package/management-api/v2/handlers/integrations.js +128 -0
- package/management-api/v2/handlers/proxy.js +34 -0
- package/management-api/v2/request.js +85 -0
- package/management-api/v2/test-support/fake-dependencies.js +103 -0
- package/modules/domain/authorization-session.js +144 -0
- package/modules/entity-scope.js +15 -0
- package/modules/entity-type-registry.js +311 -0
- package/modules/index.js +14 -0
- package/modules/module-factory.js +12 -0
- package/modules/module.js +53 -2
- package/modules/proxy/proxy-bases.js +169 -0
- package/modules/proxy/proxy-errors.js +31 -0
- package/modules/proxy/proxy-path.js +183 -0
- package/modules/proxy/proxy-policy.js +277 -0
- package/modules/repositories/authorization-session-repository-documentdb.js +112 -0
- package/modules/repositories/authorization-session-repository-factory.js +31 -0
- package/modules/repositories/authorization-session-repository-interface.js +47 -0
- package/modules/repositories/authorization-session-repository-prisma.js +87 -0
- package/modules/repositories/entity-not-found.js +18 -0
- package/modules/repositories/module-repository-documentdb.js +51 -6
- package/modules/repositories/module-repository-interface.js +19 -2
- package/modules/repositories/module-repository-mongo.js +67 -74
- package/modules/repositories/module-repository-postgres.js +66 -74
- package/modules/repositories/module-repository.js +2 -1
- package/modules/requester/proxy-request.js +245 -0
- package/modules/requester/requester.js +35 -5
- package/modules/scope-config.js +192 -0
- package/modules/scope-policy.js +112 -0
- package/modules/scope-resolution.js +288 -0
- package/modules/scope-visibility.js +247 -0
- package/modules/tests/doubles/in-memory-authorization-session-repository.js +45 -0
- package/modules/tests/doubles/ownership-matching.js +18 -0
- package/modules/use-cases/authorize-entity-for-user.js +61 -0
- package/modules/use-cases/create-entity-from-credential.js +113 -0
- package/modules/use-cases/entity-operations-for-user.js +162 -0
- package/modules/use-cases/entity-types.js +139 -0
- package/modules/use-cases/execute-entity-proxy-request.js +331 -0
- package/modules/use-cases/get-authorization-requirements.js +100 -0
- package/modules/use-cases/get-entities-for-user.js +26 -13
- package/modules/use-cases/get-entity-module-for-user.js +113 -0
- package/modules/use-cases/get-entity-options-by-id.js +10 -4
- package/modules/use-cases/get-entity-options-by-type.js +1 -1
- package/modules/use-cases/get-module-instance-from-type.js +1 -1
- package/modules/use-cases/get-module.js +10 -4
- package/modules/use-cases/manage-access.js +21 -0
- package/modules/use-cases/multi-step-authorization.js +329 -0
- package/modules/use-cases/process-authorization-callback.js +53 -19
- package/modules/use-cases/refresh-entity-options.js +10 -4
- package/modules/use-cases/test-module-auth.js +10 -4
- package/package.json +6 -7
- package/prisma-mongodb/schema.prisma +86 -59
- package/prisma-postgresql/migrations/20261003000000_add_authorization_session/migration.sql +28 -0
- package/prisma-postgresql/migrations/20261015000000_add_organization_membership/migration.sql +26 -0
- package/prisma-postgresql/migrations/20261016000000_add_entity_integration_organization/migration.sql +25 -0
- package/prisma-postgresql/migrations/20261017000000_add_scheduled_job/migration.sql +28 -0
- package/prisma-postgresql/schema.prisma +81 -57
- package/providers/index.js +23 -0
- package/providers/resolve-provider.js +93 -0
- package/providers/runtime-detection.js +124 -0
- package/queues/index.js +25 -0
- package/queues/providers/index.js +11 -0
- package/queues/providers/netlify-background-provider.js +150 -0
- package/queues/providers/qstash-queue-provider.js +219 -0
- package/queues/providers/sqs-queue-provider.js +70 -0
- package/queues/queue-client-interface.js +55 -0
- package/queues/queue-message-auth.js +193 -0
- package/queues/queue-provider-factory.js +101 -0
- package/queues/queue-provider.js +65 -0
- package/queues/queuer-util.js +2 -9
- package/queues/sqs-queue-client.js +81 -0
- package/types/index.d.ts +2 -0
- package/types/modules/index.d.ts +214 -0
- package/types/user/index.d.ts +134 -0
- package/user/adopter-jwt-config.js +177 -0
- package/user/adopter-jwt-errors.js +59 -0
- package/user/adopter-token-verifier.js +122 -0
- package/user/app-user-helpers.js +97 -0
- package/user/create-user-authentication.js +64 -0
- package/user/membership.js +51 -0
- package/user/repositories/organization-membership-record.js +19 -0
- package/user/repositories/organization-membership-repository-documentdb.js +106 -0
- package/user/repositories/organization-membership-repository-factory.js +42 -0
- package/user/repositories/organization-membership-repository-interface.js +57 -0
- package/user/repositories/organization-membership-repository-mongo.js +13 -0
- package/user/repositories/organization-membership-repository-postgres.js +29 -0
- package/user/repositories/organization-membership-repository-prisma.js +81 -0
- package/user/repositories/user-repository-documentdb.js +27 -2
- package/user/repositories/user-repository-interface.js +18 -0
- package/user/repositories/user-repository-mongo.js +24 -0
- package/user/repositories/user-repository-postgres.js +18 -0
- package/user/tests/doubles/adopter-jwt-fixtures.js +220 -0
- package/user/use-cases/authenticate-user.js +7 -1
- package/user/use-cases/ensure-organization-membership.js +92 -0
- package/user/use-cases/find-individual-users-by-organization.js +54 -0
- package/user/use-cases/get-user-from-adopter-jwt.js +95 -124
- package/user/use-cases/get-user-from-x-frigg-headers.js +83 -80
- package/user/user.js +64 -1
- package/errors/mapping-already-exists-error.js +0 -14
- package/handlers/workers/integration-triggers.js +0 -25
- package/infrastructure/scheduler/recurrence.js +0 -204
- package/integrations/define/DESIGN.md +0 -122
- package/integrations/define/config.js +0 -98
- package/integrations/define/define-app.js +0 -66
- package/integrations/define/define-extension.js +0 -154
- package/integrations/define/define-integration.js +0 -335
- package/integrations/define/examples/deal-alerts.js +0 -140
- package/integrations/define/extension-binding.js +0 -174
- package/integrations/define/index.js +0 -11
- package/integrations/define/json-schema-lite.js +0 -68
- package/integrations/define/subscriptions.js +0 -186
- package/integrations/define/tests/fixtures/hubspot.js +0 -109
- package/integrations/define/tests/fixtures/slack.js +0 -26
- package/integrations/define/use.js +0 -39
- package/integrations/definitions/README.md +0 -278
- package/integrations/definitions/canonical.js +0 -11
- package/integrations/definitions/capabilities/AUDIT.md +0 -480
- package/integrations/definitions/capabilities/acmeerp.capabilities.json +0 -633
- package/integrations/definitions/capabilities/asana.capabilities.json +0 -279
- package/integrations/definitions/capabilities/calendly.capabilities.json +0 -385
- package/integrations/definitions/capabilities/docusign.capabilities.json +0 -314
- package/integrations/definitions/capabilities/fathom.capabilities.json +0 -238
- package/integrations/definitions/capabilities/github.capabilities.json +0 -585
- package/integrations/definitions/capabilities/hubspot.capabilities.json +0 -822
- package/integrations/definitions/capabilities/jira.capabilities.json +0 -391
- package/integrations/definitions/capabilities/klaviyo.capabilities.json +0 -503
- package/integrations/definitions/capabilities/linear.capabilities.json +0 -378
- package/integrations/definitions/capabilities/netsuite.capabilities.json +0 -535
- package/integrations/definitions/capabilities/notion.capabilities.json +0 -208
- package/integrations/definitions/capabilities/phone.capabilities.json +0 -511
- package/integrations/definitions/capabilities/pipedrive.capabilities.json +0 -430
- package/integrations/definitions/capabilities/quickbooks.capabilities.json +0 -635
- package/integrations/definitions/capabilities/salesforce.capabilities.json +0 -568
- package/integrations/definitions/capabilities/shopify.capabilities.json +0 -1128
- package/integrations/definitions/capabilities/slack.capabilities.json +0 -373
- package/integrations/definitions/capabilities/stripe.capabilities.json +0 -630
- package/integrations/definitions/capabilities/webflow.capabilities.json +0 -196
- package/integrations/definitions/capabilities/zendesk.capabilities.json +0 -422
- package/integrations/definitions/compile.js +0 -80
- package/integrations/definitions/config-form.js +0 -137
- package/integrations/definitions/examples/acme-erp-quickbooks.definition.json +0 -467
- package/integrations/definitions/examples/asana-slack.definition.json +0 -219
- package/integrations/definitions/examples/calendly-salesforce.definition.json +0 -459
- package/integrations/definitions/examples/docusign-salesforce.definition.json +0 -305
- package/integrations/definitions/examples/fathom-hubspot-notion.definition.json +0 -575
- package/integrations/definitions/examples/github-linear.definition.json +0 -322
- package/integrations/definitions/examples/hubspot-slack.definition.json +0 -427
- package/integrations/definitions/examples/klaviyo-hubspot.definition.json +0 -336
- package/integrations/definitions/examples/phone-hubspot.definition.json +0 -633
- package/integrations/definitions/examples/pipedrive-hubspot.definition.json +0 -136
- package/integrations/definitions/examples/pipedrive-phone.definition.json +0 -340
- package/integrations/definitions/examples/records/phone-hubspot.definition-version.json +0 -652
- package/integrations/definitions/examples/records/phone-hubspot.integration.json +0 -86
- package/integrations/definitions/examples/records/phone-hubspot.mappings.json +0 -39
- package/integrations/definitions/examples/records/phone-hubspot.workflow-run.json +0 -62
- package/integrations/definitions/examples/shopify-klaviyo.definition.json +0 -488
- package/integrations/definitions/examples/shopify-netsuite.definition.json +0 -622
- package/integrations/definitions/examples/stripe-quickbooks.definition.json +0 -476
- package/integrations/definitions/examples/webflow-hubspot-slack.definition.json +0 -262
- package/integrations/definitions/examples/zendesk-jira.definition.json +0 -604
- package/integrations/definitions/expressions.js +0 -229
- package/integrations/definitions/index.js +0 -48
- package/integrations/definitions/integration-runtime.js +0 -779
- package/integrations/definitions/interpreter.js +0 -104
- package/integrations/definitions/manifests.js +0 -177
- package/integrations/definitions/renderers/common.js +0 -67
- package/integrations/definitions/renderers/html.js +0 -129
- package/integrations/definitions/renderers/hubspot.js +0 -59
- package/integrations/definitions/renderers/preview.js +0 -154
- package/integrations/definitions/renderers/slack.js +0 -146
- package/integrations/definitions/repositories/definition-version-repository.js +0 -67
- package/integrations/definitions/repositories/workflow-run-repository.js +0 -80
- package/integrations/definitions/router.js +0 -170
- package/integrations/definitions/runtime.js +0 -268
- package/integrations/definitions/schema/capability-manifest.v0.1.schema.json +0 -549
- package/integrations/definitions/schema/installation.v0.1.schema.json +0 -130
- package/integrations/definitions/schema/integration-definition.v0.1.schema.json +0 -909
- package/integrations/definitions/schema/records.md +0 -105
- package/integrations/definitions/schema-check.js +0 -58
- package/integrations/definitions/scripts/check-manifests.js +0 -220
- package/integrations/definitions/scripts/validate.js +0 -66
- package/integrations/definitions/steps.js +0 -123
- package/integrations/definitions/sync-engine.js +0 -297
- package/integrations/definitions/tests/helpers-fake-crm.js +0 -49
- package/integrations/definitions/transforms.js +0 -91
- package/integrations/definitions/use-cases/definition-use-cases.js +0 -245
- package/integrations/definitions/validate.js +0 -436
- package/integrations/definitions/versioning.js +0 -176
- package/integrations/definitions/webhooks.js +0 -119
- package/integrations/integration-types.js +0 -73
- package/integrations/triggers.js +0 -244
- package/integrations/use-cases/run-trigger-tick.js +0 -155
- package/integrations/use-cases/run-trigger.js +0 -77
- package/prisma-postgresql/migrations/20261018000000_add_data_defined_integrations/migration.sql +0 -66
- package/prisma-postgresql/migrations/20261019000000_workflow_run_waits/migration.sql +0 -7
- package/prisma-postgresql/migrations/20261019120000_definition_workspace/migration.sql +0 -5
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The configure form for an installation, generated from its definition: what GET_CONFIG_OPTIONS and
|
|
3
|
-
* REFRESH_CONFIG_OPTIONS return on Frigg's existing, authenticated /api/integrations/:id/config/options routes.
|
|
4
|
-
*
|
|
5
|
-
* The form's data has exactly the shape of Integration.config, so what the management UI PATCHes back is the config:
|
|
6
|
-
* { settings: { … }, syncs: { <id>: { enabled } }, workflows: { <id>: { enabled, settings: { … } } }, ui: { <id>: { enabled } } }
|
|
7
|
-
*
|
|
8
|
-
* Option settings become enums filled by `options(path, values)` (resolveOptions underneath). A list whose inputs are
|
|
9
|
-
* not chosen yet comes back empty with a help line saying what to choose first; REFRESH_CONFIG_OPTIONS, called with
|
|
10
|
-
* the form's current values, fills it.
|
|
11
|
-
*/
|
|
12
|
-
const SETTING_SCHEMA = {
|
|
13
|
-
string: () => ({ type: 'string' }),
|
|
14
|
-
text: () => ({ type: 'string' }),
|
|
15
|
-
number: () => ({ type: 'number' }),
|
|
16
|
-
boolean: () => ({ type: 'boolean' }),
|
|
17
|
-
duration: () => ({ type: 'string', pattern: '^\\d+(m|h|d)$' }),
|
|
18
|
-
enum: (s) => ({ type: 'string', enum: s.enum }),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const dependsOn = (s) => (s && typeof s.options === 'object' ? Object.values(s.options.with || {}).map((v) => String(v).replace(/^\$\.(settings|install)\./, '')) : []);
|
|
22
|
-
|
|
23
|
-
async function settingsSchema(settings, pathPrefix, values, options, integrationSettings) {
|
|
24
|
-
const properties = {}, ui = {}, required = [];
|
|
25
|
-
for (const [key, s] of Object.entries(settings || {})) {
|
|
26
|
-
let schema;
|
|
27
|
-
if (s.type === 'option') {
|
|
28
|
-
const choices = await options(`${pathPrefix}.${key}`, values, integrationSettings);
|
|
29
|
-
schema = choices.length
|
|
30
|
-
? { type: 'string', oneOf: choices.map((c) => ({ const: String(c.value), title: c.label })) }
|
|
31
|
-
: { type: 'string', enum: [] };
|
|
32
|
-
if (!choices.length && dependsOn(s).length) ui[key] = { 'ui:help': `Choose ${dependsOn(s).join(' and ')} first.` };
|
|
33
|
-
} else schema = (SETTING_SCHEMA[s.type] || SETTING_SCHEMA.string)(s);
|
|
34
|
-
properties[key] = { ...schema, title: s.label, ...(s.default !== undefined ? { default: s.default } : {}) };
|
|
35
|
-
if (s.help) ui[key] = { ...(ui[key] || {}), 'ui:help': s.help };
|
|
36
|
-
if (s.required && s.default === undefined) required.push(key);
|
|
37
|
-
}
|
|
38
|
-
return { schema: { type: 'object', properties, ...(required.length ? { required } : {}) }, ui };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The timing field of a schedule the definition marks configurable: an interval when its default is an interval,
|
|
43
|
-
* a cron (with time zone) when its default is a cron. The floor is said in the help text and enforced on save.
|
|
44
|
-
*/
|
|
45
|
-
function scheduleField(recurrence, configurable) {
|
|
46
|
-
if (!configurable || !recurrence) return null;
|
|
47
|
-
const min = configurable.min ? ` No more often than every ${configurable.min}.` : '';
|
|
48
|
-
if (recurrence.every !== undefined) {
|
|
49
|
-
return { schema: { type: 'object', title: 'Schedule', properties: { every: { type: 'string', title: 'Runs every', pattern: '^\\d+\\s*(m|h|d)$', default: recurrence.every } } }, ui: { every: { 'ui:help': `Minutes, hours or days: 15m, 2h, 1d.${min}` } } };
|
|
50
|
-
}
|
|
51
|
-
return { schema: { type: 'object', title: 'Schedule', properties: { cron: { type: 'string', title: 'Cron', default: recurrence.cron }, timezone: { type: 'string', title: 'Time zone', default: recurrence.timezone || 'UTC' } } }, ui: { cron: { 'ui:help': `minute hour day-of-month month day-of-week.${min}` } } };
|
|
52
|
-
}
|
|
53
|
-
const configurableOf = (c) => (c ? (c === true ? {} : c) : false);
|
|
54
|
-
|
|
55
|
-
const toggle = (title, description, enabledByDefault) => ({ type: 'boolean', title, ...(description ? { description } : {}), default: enabledByDefault });
|
|
56
|
-
const isOn = (item, chosen) => (typeof chosen?.enabled === 'boolean' ? chosen.enabled : (item.default || 'on') === 'on');
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @param {object} def
|
|
60
|
-
* @param {object} config the installation's current config (or the form's current values on refresh)
|
|
61
|
-
* @param {(path: string, values: object, integrationSettings: object) => Promise<Array<{label,value}>>} options
|
|
62
|
-
* @returns {Promise<{ jsonSchema: object, uiSchema: object, data: object }>}
|
|
63
|
-
*/
|
|
64
|
-
async function buildConfigForm(def, config = {}, options = async () => []) {
|
|
65
|
-
const jsonSchema = { type: 'object', title: def.display?.label, properties: {} };
|
|
66
|
-
const uiSchema = {};
|
|
67
|
-
const data = { settings: { ...(config.settings || {}) }, syncs: {}, workflows: {}, ui: {} };
|
|
68
|
-
|
|
69
|
-
if (Object.keys(def.settings || {}).length) {
|
|
70
|
-
const s = await settingsSchema(def.settings, 'settings', config.settings || {}, options, config.settings || {});
|
|
71
|
-
jsonSchema.properties.settings = { title: 'Settings', ...s.schema };
|
|
72
|
-
uiSchema.settings = s.ui;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if ((def.syncs || []).length) {
|
|
76
|
-
jsonSchema.properties.syncs = { type: 'object', title: 'Syncs', properties: {} };
|
|
77
|
-
for (const s of def.syncs) {
|
|
78
|
-
jsonSchema.properties.syncs.properties[s.id] = { type: 'object', title: s.label, properties: { enabled: toggle('On', s.description, (s.default || 'on') === 'on') } };
|
|
79
|
-
data.syncs[s.id] = { enabled: isOn(s, config.syncs?.[s.id]) };
|
|
80
|
-
const field = s.ongoing?.mode === 'poll' && scheduleField({ every: s.ongoing.every || '15m' }, configurableOf(s.ongoing.configurable));
|
|
81
|
-
if (field) {
|
|
82
|
-
jsonSchema.properties.syncs.properties[s.id].properties.schedule = field.schema;
|
|
83
|
-
((uiSchema.syncs ||= {})[s.id] ||= {}).schedule = field.ui;
|
|
84
|
-
if (config.syncs?.[s.id]?.schedule) data.syncs[s.id].schedule = { ...config.syncs[s.id].schedule };
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if ((def.workflows || []).length) {
|
|
90
|
-
jsonSchema.properties.workflows = { type: 'object', title: 'Workflows', properties: {} };
|
|
91
|
-
uiSchema.workflows = {};
|
|
92
|
-
for (const w of def.workflows) {
|
|
93
|
-
const chosen = config.workflows?.[w.id] || {};
|
|
94
|
-
const node = { type: 'object', title: w.label, properties: { enabled: toggle('On', w.description, (w.default || 'on') === 'on') } };
|
|
95
|
-
data.workflows[w.id] = { enabled: isOn(w, chosen), settings: { ...(chosen.settings || {}) } };
|
|
96
|
-
if (Object.keys(w.settings || {}).length) {
|
|
97
|
-
// A workflow setting's option inputs may read integration settings, which it sees as $.install.
|
|
98
|
-
const s = await settingsSchema(w.settings, `workflows.${w.id}.settings`, chosen.settings || {}, options, config.settings || {});
|
|
99
|
-
node.properties.settings = { title: 'Settings', ...s.schema };
|
|
100
|
-
uiSchema.workflows[w.id] = { settings: s.ui };
|
|
101
|
-
// Settings only matter while the workflow is on: required only then.
|
|
102
|
-
node.dependencies = { enabled: { oneOf: [{ properties: { enabled: { const: false } } }, { properties: { enabled: { const: true } }, required: ['settings'] }] } };
|
|
103
|
-
}
|
|
104
|
-
const t = w.trigger || {};
|
|
105
|
-
const field = t.type === 'schedule' && scheduleField(t.every !== undefined ? { every: t.every } : { cron: t.cron, timezone: t.timezone }, configurableOf(t.configurable));
|
|
106
|
-
if (field) {
|
|
107
|
-
node.properties.schedule = field.schema;
|
|
108
|
-
(uiSchema.workflows[w.id] ||= {}).schedule = field.ui;
|
|
109
|
-
if (chosen.schedule) data.workflows[w.id].schedule = { ...chosen.schedule };
|
|
110
|
-
}
|
|
111
|
-
jsonSchema.properties.workflows.properties[w.id] = node;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if ((def.ui || []).length) {
|
|
116
|
-
jsonSchema.properties.ui = { type: 'object', title: 'Cards and panels', properties: {} };
|
|
117
|
-
for (const u of def.ui) {
|
|
118
|
-
jsonSchema.properties.ui.properties[u.id] = { type: 'object', title: u.label || u.id, properties: { enabled: toggle('Show', `${u.host} · ${u.placement}`, (u.default || 'on') === 'on') } };
|
|
119
|
-
data.ui[u.id] = { enabled: isOn(u, config.ui?.[u.id]) };
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return { jsonSchema, uiSchema, data };
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** Is anything required still missing? (NEEDS_CONFIG) */
|
|
127
|
-
function missingRequired(def, config = {}) {
|
|
128
|
-
const missing = [];
|
|
129
|
-
for (const [k, s] of Object.entries(def.settings || {})) if (s.required && s.default === undefined && (config.settings?.[k] == null || config.settings[k] === '')) missing.push(`settings.${k}`);
|
|
130
|
-
for (const w of def.workflows || []) {
|
|
131
|
-
if (!isOn(w, config.workflows?.[w.id])) continue;
|
|
132
|
-
for (const [k, s] of Object.entries(w.settings || {})) if (s.required && s.default === undefined && (config.workflows?.[w.id]?.settings?.[k] == null || config.workflows[w.id].settings[k] === '')) missing.push(`workflows.${w.id}.settings.${k}`);
|
|
133
|
-
}
|
|
134
|
-
return missing;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
module.exports = { buildConfigForm, missingRequired };
|
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://friggframework.org/schemas/integration-definition/v0.1.json",
|
|
3
|
-
"schemaVersion": "0.1",
|
|
4
|
-
"id": "acme-erp-quickbooks",
|
|
5
|
-
"version": "1.3.0",
|
|
6
|
-
"display": {
|
|
7
|
-
"label": "Acme ERP \u2194 QuickBooks Online",
|
|
8
|
-
"description": "Finished jobs become QuickBooks invoices with every line item, customers stay matched both ways, and payments recorded in QuickBooks mark the job paid in Acme ERP.",
|
|
9
|
-
"category": "Accounting",
|
|
10
|
-
"tags": [
|
|
11
|
-
"field-service",
|
|
12
|
-
"invoicing",
|
|
13
|
-
"accounting"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"modules": {
|
|
17
|
-
"acmeerp": {
|
|
18
|
-
"module": "acmeerp",
|
|
19
|
-
"version": "^0.9"
|
|
20
|
-
},
|
|
21
|
-
"quickbooks": {
|
|
22
|
-
"module": "quickbooks",
|
|
23
|
-
"version": "^2.0"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"settings": {
|
|
27
|
-
"fallbackItem": {
|
|
28
|
-
"type": "option",
|
|
29
|
-
"options": "quickbooks.item",
|
|
30
|
-
"label": "Product/service for line items with no matching QuickBooks item",
|
|
31
|
-
"required": true
|
|
32
|
-
},
|
|
33
|
-
"terms": {
|
|
34
|
-
"type": "enum",
|
|
35
|
-
"label": "Invoice terms",
|
|
36
|
-
"enum": [
|
|
37
|
-
"Due on receipt",
|
|
38
|
-
"Net 15",
|
|
39
|
-
"Net 30"
|
|
40
|
-
],
|
|
41
|
-
"default": "Due on receipt"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"syncs": [
|
|
45
|
-
{
|
|
46
|
-
"id": "customers",
|
|
47
|
-
"label": "Customers",
|
|
48
|
-
"description": "One customer in both systems. Contact details follow whichever side changed last; QuickBooks owns the billing name.",
|
|
49
|
-
"source": "acmeerp.customer",
|
|
50
|
-
"target": "quickbooks.customer",
|
|
51
|
-
"direction": "two_way",
|
|
52
|
-
"identity": {
|
|
53
|
-
"match": [
|
|
54
|
-
{
|
|
55
|
-
"source": "email",
|
|
56
|
-
"target": "PrimaryEmailAddr.Address",
|
|
57
|
-
"transform": "lowercase",
|
|
58
|
-
"key": "email"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"source": "mobile_number",
|
|
62
|
-
"target": "Mobile.FreeFormNumber",
|
|
63
|
-
"transform": "to_e164_phone",
|
|
64
|
-
"key": "phone"
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
"onAmbiguous": "skip"
|
|
68
|
-
},
|
|
69
|
-
"mapping": [
|
|
70
|
-
{
|
|
71
|
-
"source": "display_name",
|
|
72
|
-
"target": "DisplayName",
|
|
73
|
-
"master": "target"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"source": "first_name",
|
|
77
|
-
"target": "GivenName",
|
|
78
|
-
"master": "newest"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"source": "last_name",
|
|
82
|
-
"target": "FamilyName",
|
|
83
|
-
"master": "newest"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"source": "company_name",
|
|
87
|
-
"target": "CompanyName",
|
|
88
|
-
"master": "newest"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"source": "email",
|
|
92
|
-
"target": "PrimaryEmailAddr.Address",
|
|
93
|
-
"transform": "lowercase",
|
|
94
|
-
"master": "newest"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"source": "mobile_number",
|
|
98
|
-
"target": "Mobile.FreeFormNumber",
|
|
99
|
-
"transform": "to_e164_phone",
|
|
100
|
-
"master": "newest"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"source": "address.street",
|
|
104
|
-
"target": "BillAddr.Line1",
|
|
105
|
-
"master": "source"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"source": "address.city",
|
|
109
|
-
"target": "BillAddr.City",
|
|
110
|
-
"master": "source"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"source": "address.state",
|
|
114
|
-
"target": "BillAddr.CountrySubDivisionCode",
|
|
115
|
-
"master": "source"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"source": "address.zip",
|
|
119
|
-
"target": "BillAddr.PostalCode",
|
|
120
|
-
"master": "source"
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
"backfill": {
|
|
124
|
-
"trigger": "userAction",
|
|
125
|
-
"pageSize": 100
|
|
126
|
-
},
|
|
127
|
-
"ongoing": {
|
|
128
|
-
"mode": "webhook"
|
|
129
|
-
},
|
|
130
|
-
"default": "on"
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
"workflows": [
|
|
134
|
-
{
|
|
135
|
-
"id": "job-invoice",
|
|
136
|
-
"label": "Invoice finished jobs",
|
|
137
|
-
"purpose": "write",
|
|
138
|
-
"default": "on",
|
|
139
|
-
"settings": {
|
|
140
|
-
"emailInvoice": {
|
|
141
|
-
"type": "boolean",
|
|
142
|
-
"label": "Email the invoice from QuickBooks",
|
|
143
|
-
"default": false
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
"trigger": {
|
|
147
|
-
"type": "webhook",
|
|
148
|
-
"module": "acmeerp",
|
|
149
|
-
"topic": "job.finished",
|
|
150
|
-
"filter": "$.record.total_amount > 0 && $.record.external_invoice_id == null"
|
|
151
|
-
},
|
|
152
|
-
"steps": [
|
|
153
|
-
{
|
|
154
|
-
"id": "customer",
|
|
155
|
-
"use": "links.find",
|
|
156
|
-
"with": {
|
|
157
|
-
"sync": "customers",
|
|
158
|
-
"from": "acmeerp",
|
|
159
|
-
"id": "$.record.customer_id"
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"use": "stop",
|
|
164
|
-
"when": "$.steps.customer == null",
|
|
165
|
-
"with": {
|
|
166
|
-
"reason": "Customer is not in QuickBooks yet; the queue will retry after the customer sync"
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"id": "lineItems",
|
|
171
|
-
"use": "acmeerp.job.lineItems",
|
|
172
|
-
"with": {
|
|
173
|
-
"jobId": "$.record.id"
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
"id": "lines",
|
|
178
|
-
"use": "code",
|
|
179
|
-
"with": {
|
|
180
|
-
"ref": "@acme/frigg-steps#quickbooksInvoiceLines@1.0.0",
|
|
181
|
-
"with": {
|
|
182
|
-
"lineItems": "$.steps.lineItems",
|
|
183
|
-
"fallbackItemId": "$.install.fallbackItem",
|
|
184
|
-
"taxAmount": "$.record.tax_amount"
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
"id": "memo",
|
|
190
|
-
"use": "template",
|
|
191
|
-
"with": {
|
|
192
|
-
"id": "invoice-memo"
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
"id": "invoice",
|
|
197
|
-
"use": "quickbooks.invoice.create",
|
|
198
|
-
"with": {
|
|
199
|
-
"invoice": {
|
|
200
|
-
"CustomerRef": {
|
|
201
|
-
"value": "$.steps.customer.quickbooks"
|
|
202
|
-
},
|
|
203
|
-
"DocNumber": "TW-{{record.job_number}}",
|
|
204
|
-
"TxnDate": "$.record.finished_at",
|
|
205
|
-
"SalesTermRef": {
|
|
206
|
-
"name": "$.install.terms"
|
|
207
|
-
},
|
|
208
|
-
"CustomerMemo": {
|
|
209
|
-
"value": "$.steps.memo"
|
|
210
|
-
},
|
|
211
|
-
"PrivateNote": "Acme ERP job {{record.id}}",
|
|
212
|
-
"Line": "$.steps.lines.lines"
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
"use": "acmeerp.job.update",
|
|
218
|
-
"with": {
|
|
219
|
-
"id": "$.record.id",
|
|
220
|
-
"job": {
|
|
221
|
-
"status": "invoiced",
|
|
222
|
-
"external_invoice_id": "$.steps.invoice.Id"
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"use": "quickbooks.invoice.send",
|
|
228
|
-
"when": "$.settings.emailInvoice == true",
|
|
229
|
-
"with": {
|
|
230
|
-
"id": "$.steps.invoice.Id"
|
|
231
|
-
},
|
|
232
|
-
"onError": "continue"
|
|
233
|
-
}
|
|
234
|
-
],
|
|
235
|
-
"retry": {
|
|
236
|
-
"max": 5,
|
|
237
|
-
"backoff": "exponential"
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
"id": "invoice-paid",
|
|
242
|
-
"label": "Mark jobs paid when QuickBooks records a payment",
|
|
243
|
-
"purpose": "write",
|
|
244
|
-
"default": "on",
|
|
245
|
-
"trigger": {
|
|
246
|
-
"type": "webhook",
|
|
247
|
-
"module": "quickbooks",
|
|
248
|
-
"topic": "payment.created"
|
|
249
|
-
},
|
|
250
|
-
"steps": [
|
|
251
|
-
{
|
|
252
|
-
"id": "payment",
|
|
253
|
-
"use": "quickbooks.payment.get",
|
|
254
|
-
"with": {
|
|
255
|
-
"id": "$.record.id"
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
"id": "apply",
|
|
260
|
-
"use": "foreach",
|
|
261
|
-
"with": {
|
|
262
|
-
"over": "$.steps.payment.Line",
|
|
263
|
-
"max": 20
|
|
264
|
-
},
|
|
265
|
-
"do": [
|
|
266
|
-
{
|
|
267
|
-
"id": "jobs",
|
|
268
|
-
"use": "acmeerp.job.search",
|
|
269
|
-
"when": "$.item.LinkedTxn[0].TxnType == 'Invoice'",
|
|
270
|
-
"with": {
|
|
271
|
-
"external_invoice_id": "$.item.LinkedTxn[0].TxnId"
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
"use": "acmeerp.job.markPaid",
|
|
276
|
-
"when": "$.steps.jobs[0] exists",
|
|
277
|
-
"with": {
|
|
278
|
-
"id": "$.steps.jobs[0].id",
|
|
279
|
-
"amount": "{{item.Amount | to_cents}}",
|
|
280
|
-
"paid_at": "$.steps.payment.TxnDate",
|
|
281
|
-
"method": "quickbooks",
|
|
282
|
-
"reference": "QBO payment {{steps.payment.Id}}"
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
]
|
|
286
|
-
}
|
|
287
|
-
]
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"id": "invoice-note",
|
|
291
|
-
"label": "Note the invoice on the job",
|
|
292
|
-
"purpose": "write",
|
|
293
|
-
"default": "off",
|
|
294
|
-
"trigger": {
|
|
295
|
-
"type": "syncRecord",
|
|
296
|
-
"sync": "customers",
|
|
297
|
-
"on": [
|
|
298
|
-
"linked"
|
|
299
|
-
]
|
|
300
|
-
},
|
|
301
|
-
"steps": [
|
|
302
|
-
{
|
|
303
|
-
"id": "open",
|
|
304
|
-
"use": "acmeerp.job.search",
|
|
305
|
-
"with": {
|
|
306
|
-
"customer_id": "$.record.id"
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
"id": "notes",
|
|
311
|
-
"use": "foreach",
|
|
312
|
-
"with": {
|
|
313
|
-
"over": "$.steps.open",
|
|
314
|
-
"max": 25
|
|
315
|
-
},
|
|
316
|
-
"do": [
|
|
317
|
-
{
|
|
318
|
-
"use": "acmeerp.job.addNote",
|
|
319
|
-
"when": "$.item.status == 'finished'",
|
|
320
|
-
"with": {
|
|
321
|
-
"jobId": "$.item.id",
|
|
322
|
-
"body": "Customer is now linked to QuickBooks; finished jobs will be invoiced automatically."
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
]
|
|
328
|
-
}
|
|
329
|
-
],
|
|
330
|
-
"queries": [
|
|
331
|
-
{
|
|
332
|
-
"id": "job-invoice-status",
|
|
333
|
-
"description": "The QuickBooks invoice for this job.",
|
|
334
|
-
"steps": [
|
|
335
|
-
{
|
|
336
|
-
"use": "stop",
|
|
337
|
-
"when": "$.record.external_invoice_id == null",
|
|
338
|
-
"with": {
|
|
339
|
-
"reason": "Not invoiced"
|
|
340
|
-
}
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
"id": "invoice",
|
|
344
|
-
"use": "quickbooks.invoice.get",
|
|
345
|
-
"with": {
|
|
346
|
-
"id": "$.record.external_invoice_id"
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
],
|
|
350
|
-
"returns": {
|
|
351
|
-
"invoice": "$.steps.invoice",
|
|
352
|
-
"realmId": "$.install.accounts.quickbooks.realmId"
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
],
|
|
356
|
-
"ui": [
|
|
357
|
-
{
|
|
358
|
-
"id": "invoice-panel",
|
|
359
|
-
"label": "QuickBooks invoice",
|
|
360
|
-
"host": "acmeerp",
|
|
361
|
-
"placement": "job.sidebar",
|
|
362
|
-
"objects": [
|
|
363
|
-
"job"
|
|
364
|
-
],
|
|
365
|
-
"data": {
|
|
366
|
-
"query": "job-invoice-status"
|
|
367
|
-
},
|
|
368
|
-
"view": {
|
|
369
|
-
"component": "Stack",
|
|
370
|
-
"children": [
|
|
371
|
-
{
|
|
372
|
-
"component": "Heading",
|
|
373
|
-
"props": {
|
|
374
|
-
"text": "QuickBooks"
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
"component": "Empty",
|
|
379
|
-
"when": "!($.data.invoice exists)",
|
|
380
|
-
"props": {
|
|
381
|
-
"text": "Invoiced automatically when the job is finished."
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
"component": "KeyValue",
|
|
386
|
-
"when": "$.data.invoice exists",
|
|
387
|
-
"props": {
|
|
388
|
-
"items": [
|
|
389
|
-
{
|
|
390
|
-
"label": "Invoice",
|
|
391
|
-
"value": "{{data.invoice.DocNumber}}"
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
"label": "Total",
|
|
395
|
-
"value": "${{data.invoice.TotalAmt}}"
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
"label": "Balance",
|
|
399
|
-
"value": "${{data.invoice.Balance}}"
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"label": "Due",
|
|
403
|
-
"value": "{{data.invoice.DueDate | date}}"
|
|
404
|
-
}
|
|
405
|
-
]
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
"component": "Badge",
|
|
410
|
-
"when": "$.data.invoice.Balance == 0",
|
|
411
|
-
"props": {
|
|
412
|
-
"text": "Paid",
|
|
413
|
-
"tone": "success"
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
"component": "Badge",
|
|
418
|
-
"when": "$.data.invoice.Balance > 0",
|
|
419
|
-
"props": {
|
|
420
|
-
"text": "Open",
|
|
421
|
-
"tone": "warning"
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
"component": "Button",
|
|
426
|
-
"when": "$.data.invoice exists",
|
|
427
|
-
"props": {
|
|
428
|
-
"label": "Open in QuickBooks",
|
|
429
|
-
"action": {
|
|
430
|
-
"type": "open_url",
|
|
431
|
-
"url": "https://app.qbo.intuit.com/app/invoice?txnId={{data.invoice.Id}}"
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
]
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
"templates": {
|
|
440
|
-
"invoice-memo": "Thanks for choosing Acme! Job #{{record.job_number}}: {{record.description | truncate: 200}}"
|
|
441
|
-
},
|
|
442
|
-
"lifecycle": {
|
|
443
|
-
"onInstall": [
|
|
444
|
-
{
|
|
445
|
-
"id": "hook",
|
|
446
|
-
"use": "acmeerp.webhook.create",
|
|
447
|
-
"with": {
|
|
448
|
-
"url": "$.install.webhookUrls.acmeerp",
|
|
449
|
-
"events": [
|
|
450
|
-
"job.finished",
|
|
451
|
-
"job.scheduled",
|
|
452
|
-
"customer.created",
|
|
453
|
-
"customer.updated"
|
|
454
|
-
]
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
],
|
|
458
|
-
"onUninstall": [
|
|
459
|
-
{
|
|
460
|
-
"use": "acmeerp.webhook.delete",
|
|
461
|
-
"with": {
|
|
462
|
-
"id": "$.install.runtime.installed.hook.id"
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
]
|
|
466
|
-
}
|
|
467
|
-
}
|