@dork-labs/connector-providers 0.0.0-stage → 0.98.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/LICENSE +21 -0
- package/README.md +83 -2
- package/dist/composio/authentication-config-policy.d.ts +11 -0
- package/dist/composio/authentication-config-policy.d.ts.map +1 -0
- package/dist/composio/authentication-config-policy.js +103 -0
- package/dist/composio/authentication-config-policy.js.map +1 -0
- package/dist/composio/authentication-configuration.d.ts +57 -0
- package/dist/composio/authentication-configuration.d.ts.map +1 -0
- package/dist/composio/authentication-configuration.js +299 -0
- package/dist/composio/authentication-configuration.js.map +1 -0
- package/dist/composio/authentication-contract.d.ts +66 -0
- package/dist/composio/authentication-contract.d.ts.map +1 -0
- package/dist/composio/authentication-contract.js +78 -0
- package/dist/composio/authentication-contract.js.map +1 -0
- package/dist/composio/event-client.d.ts +116 -0
- package/dist/composio/event-client.d.ts.map +1 -0
- package/dist/composio/event-client.js +234 -0
- package/dist/composio/event-client.js.map +1 -0
- package/dist/composio/hosted-client-factory.d.ts +25 -0
- package/dist/composio/hosted-client-factory.d.ts.map +1 -0
- package/dist/composio/hosted-client-factory.js +35 -0
- package/dist/composio/hosted-client-factory.js.map +1 -0
- package/dist/composio/index.d.ts +9 -0
- package/dist/composio/index.d.ts.map +1 -0
- package/dist/composio/index.js +9 -0
- package/dist/composio/index.js.map +1 -0
- package/dist/composio/managed-account-client.d.ts +105 -0
- package/dist/composio/managed-account-client.d.ts.map +1 -0
- package/dist/composio/managed-account-client.js +362 -0
- package/dist/composio/managed-account-client.js.map +1 -0
- package/dist/composio/sdk-client.d.ts +103 -0
- package/dist/composio/sdk-client.d.ts.map +1 -0
- package/dist/composio/sdk-client.js +470 -0
- package/dist/composio/sdk-client.js.map +1 -0
- package/dist/composio/webhook-verifier.d.ts +46 -0
- package/dist/composio/webhook-verifier.d.ts.map +1 -0
- package/dist/composio/webhook-verifier.js +74 -0
- package/dist/composio/webhook-verifier.js.map +1 -0
- package/dist/connector-arguments.d.ts +49 -0
- package/dist/connector-arguments.d.ts.map +1 -0
- package/dist/connector-arguments.js +161 -0
- package/dist/connector-arguments.js.map +1 -0
- package/dist/connector-authentication-setup.d.ts +33 -0
- package/dist/connector-authentication-setup.d.ts.map +1 -0
- package/dist/connector-authentication-setup.js +38 -0
- package/dist/connector-authentication-setup.js.map +1 -0
- package/dist/connector-event-schemas.d.ts +475 -0
- package/dist/connector-event-schemas.d.ts.map +1 -0
- package/dist/connector-event-schemas.js +241 -0
- package/dist/connector-event-schemas.js.map +1 -0
- package/dist/connector-events.d.ts +105 -0
- package/dist/connector-events.d.ts.map +1 -0
- package/dist/connector-events.js +2 -0
- package/dist/connector-events.js.map +1 -0
- package/dist/connector-managed-discovery-schemas.d.ts +347 -0
- package/dist/connector-managed-discovery-schemas.d.ts.map +1 -0
- package/dist/connector-managed-discovery-schemas.js +213 -0
- package/dist/connector-managed-discovery-schemas.js.map +1 -0
- package/dist/connector-managed-schemas.d.ts +338 -0
- package/dist/connector-managed-schemas.d.ts.map +1 -0
- package/dist/connector-managed-schemas.js +251 -0
- package/dist/connector-managed-schemas.js.map +1 -0
- package/dist/connector-managed-usage-schemas.d.ts +187 -0
- package/dist/connector-managed-usage-schemas.d.ts.map +1 -0
- package/dist/connector-managed-usage-schemas.js +89 -0
- package/dist/connector-managed-usage-schemas.js.map +1 -0
- package/dist/connector-provider.d.ts +424 -0
- package/dist/connector-provider.d.ts.map +1 -0
- package/dist/connector-provider.js +244 -0
- package/dist/connector-provider.js.map +1 -0
- package/dist/connector-schemas.d.ts +5195 -0
- package/dist/connector-schemas.d.ts.map +1 -0
- package/dist/connector-schemas.js +1487 -0
- package/dist/connector-schemas.js.map +1 -0
- package/dist/event-content.d.ts +28 -0
- package/dist/event-content.d.ts.map +1 -0
- package/dist/event-content.js +90 -0
- package/dist/event-content.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/stable-stringify.d.ts +34 -0
- package/dist/stable-stringify.d.ts.map +1 -0
- package/dist/stable-stringify.js +56 -0
- package/dist/stable-stringify.js.map +1 -0
- package/package.json +102 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 144 Studio, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dork-labs/connector-providers
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The connector contract DorkOS speaks, plus the adapter that talks to Composio.
|
|
4
|
+
|
|
5
|
+
DorkOS lets an agent act in your other apps (Gmail, Slack, Notion and more) through a
|
|
6
|
+
connection you approve. This package holds the parts of that which more than one program needs:
|
|
7
|
+
the DorkOS app uses it on your computer, and DorkOS Cloud uses the same code for hosted
|
|
8
|
+
connections. Publishing it means both sides read one definition instead of two copies that drift.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @dork-labs/connector-providers zod
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Entry points
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// The Composio adapter: catalog reads, managed accounts, events and webhook checks.
|
|
18
|
+
// This entry point and the root one load the Composio SDK.
|
|
19
|
+
import {
|
|
20
|
+
ComposioSdkClient,
|
|
21
|
+
ComposioWebhookVerifier,
|
|
22
|
+
} from '@dork-labs/connector-providers/composio';
|
|
23
|
+
|
|
24
|
+
// Zod schemas and types for connections, operations, events and the provider port.
|
|
25
|
+
// Zod only, so a browser can use them.
|
|
26
|
+
import { ConnectionIdSchema } from '@dork-labs/connector-providers/connector-schemas';
|
|
27
|
+
import { ConnectorEventDefinitionSchema } from '@dork-labs/connector-providers/connector-event-schemas';
|
|
28
|
+
import type { ConnectorProvider } from '@dork-labs/connector-providers/connector-provider';
|
|
29
|
+
import type { ConnectorEventCapability } from '@dork-labs/connector-providers/connector-events';
|
|
30
|
+
import { ConnectorAuthenticationSetupSchema } from '@dork-labs/connector-providers/connector-authentication-setup';
|
|
31
|
+
|
|
32
|
+
// Key-sorted JSON, the form DorkOS hashes connector material over.
|
|
33
|
+
import { stableStringify } from '@dork-labs/connector-providers/stable-stringify';
|
|
34
|
+
|
|
35
|
+
// Check an agent's arguments against an operation's JSON Schema, without filling defaults.
|
|
36
|
+
import { checkConnectorArguments } from '@dork-labs/connector-providers/connector-arguments';
|
|
37
|
+
|
|
38
|
+
// The wire schemas between a linked DorkOS app and DorkOS Cloud for hosted connections.
|
|
39
|
+
import { ManagedConnectorExecutionRequestSchema } from '@dork-labs/connector-providers/connector-managed-schemas';
|
|
40
|
+
import { ManagedConnectorCatalogPageSchema } from '@dork-labs/connector-providers/connector-managed-discovery-schemas';
|
|
41
|
+
import { ManagedConnectorUsageResponseSchema } from '@dork-labs/connector-providers/connector-managed-usage-schemas';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The root entry (`@dork-labs/connector-providers`) re-exports the Composio adapter and the event
|
|
45
|
+
payload protector. Prefer the narrow subpaths when you only need the schemas: they never load the
|
|
46
|
+
Composio SDK.
|
|
47
|
+
|
|
48
|
+
## Versions
|
|
49
|
+
|
|
50
|
+
This package carries the same version as each DorkOS release and is published with it, together
|
|
51
|
+
with `@dork-labs/cloud-api`. The two always share a version number.
|
|
52
|
+
|
|
53
|
+
While the version starts with `0.`, a caret range such as `^0.97.0` holds you on one release.
|
|
54
|
+
Pin an exact version and bump it when you take a new DorkOS release.
|
|
55
|
+
|
|
56
|
+
## Dependencies
|
|
57
|
+
|
|
58
|
+
- `zod` is a **peer dependency** (`^4.6.2`), so your app and this package share one copy and
|
|
59
|
+
their schemas recognise each other.
|
|
60
|
+
- `@composio/core` is a regular dependency at an **exact** version. The adapter is written
|
|
61
|
+
against that version's exact shapes.
|
|
62
|
+
- This is a Node.js package. If you use TypeScript, install `@types/node` too: the Composio
|
|
63
|
+
SDK's own type files refer to Node's built-in modules.
|
|
64
|
+
- `@dork-labs/cloud-api` is a regular dependency at the **same exact version** as this package.
|
|
65
|
+
The hosted-connection schemas use its connection grant shape. npm installs it for you.
|
|
66
|
+
- Nothing else. No other package from the DorkOS monorepo is a dependency.
|
|
67
|
+
`src/__tests__/packaging.test.ts` checks this from the manifest, the imports and the lockfile.
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm --filter @dork-labs/connector-providers build # ESM + .d.ts into dist/
|
|
73
|
+
pnpm --filter @dork-labs/connector-providers typecheck
|
|
74
|
+
pnpm --filter @dork-labs/connector-providers lint
|
|
75
|
+
pnpm vitest run packages/connector-providers # from the repo root
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Inside the monorepo, `@dorkos/shared` re-exports the schema modules under its old subpaths
|
|
79
|
+
(`@dorkos/shared/connector-schemas` and the rest), so app code keeps one import. The modules
|
|
80
|
+
themselves live here; edit them here.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Supported upstream policy facts; credential values and unknown keys are never retained. */
|
|
2
|
+
export interface ComposioAuthenticationConfigPolicy {
|
|
3
|
+
type: 'default' | 'custom';
|
|
4
|
+
scopes: string[];
|
|
5
|
+
userScopes: string[];
|
|
6
|
+
credentialsEmpty: boolean;
|
|
7
|
+
routerEnabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Return only a verified empty/default policy shape; absent means unsuitable for automatic reuse. */
|
|
10
|
+
export declare function projectComposioAuthenticationConfigPolicy(raw: unknown): ComposioAuthenticationConfigPolicy | undefined;
|
|
11
|
+
//# sourceMappingURL=authentication-config-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-config-policy.d.ts","sourceRoot":"","sources":["../../src/composio/authentication-config-policy.ts"],"names":[],"mappings":"AAGA,8FAA8F;AAC9F,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;CACxB;AAwED,sGAAsG;AACtG,wBAAgB,yCAAyC,CACvD,GAAG,EAAE,OAAO,GACX,kCAAkC,GAAG,SAAS,CAmChD"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** Nonsecret projection of mutable automatic-authentication configuration policy. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const scopeValue = z.union([z.string().max(16_384), z.array(z.string().max(512)).max(512)]);
|
|
4
|
+
const credentials = z
|
|
5
|
+
.object({ scopes: scopeValue.optional(), user_scopes: scopeValue.optional() })
|
|
6
|
+
.strict();
|
|
7
|
+
const managedCredentials = credentials.extend({
|
|
8
|
+
client_id: z.string().max(16_384).optional(),
|
|
9
|
+
client_secret: z.string().max(16_384).optional(),
|
|
10
|
+
oauth_redirect_uri: z
|
|
11
|
+
.enum([
|
|
12
|
+
'https://backend.composio.dev/api/v1/auth-apps/add',
|
|
13
|
+
'https://backend.composio.dev/api/v3/toolkits/auth/callback',
|
|
14
|
+
])
|
|
15
|
+
.optional(),
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Composio's managed Slack app also stores Slack's legacy `verification_token`.
|
|
19
|
+
* Like `client_secret` it is the provider app's own material, so it is checked
|
|
20
|
+
* for shape and never retained. Accepted for the `slack` toolkit only: on any
|
|
21
|
+
* other toolkit an unexpected credential key still means the policy is unknown.
|
|
22
|
+
*/
|
|
23
|
+
const managedSlackCredentials = managedCredentials.extend({
|
|
24
|
+
verification_token: z.string().max(16_384).optional(),
|
|
25
|
+
});
|
|
26
|
+
const toolAccess = z
|
|
27
|
+
.object({
|
|
28
|
+
tools_available_for_execution: z.array(z.string()).max(0).optional(),
|
|
29
|
+
tools_for_connected_account_creation: z.array(z.string()).max(0).optional(),
|
|
30
|
+
})
|
|
31
|
+
.strict();
|
|
32
|
+
const policy = z.object({
|
|
33
|
+
type: z.enum(['default', 'custom']),
|
|
34
|
+
credentials: credentials.optional(),
|
|
35
|
+
shared_credentials: z.object({}).strict().optional(),
|
|
36
|
+
proxy_config: z.null().optional(),
|
|
37
|
+
restrict_to_following_tools: z.array(z.string()).max(0).optional(),
|
|
38
|
+
tool_access_config: toolAccess,
|
|
39
|
+
is_enabled_for_tool_router: z.boolean(),
|
|
40
|
+
is_connection_revoke_supported: z.boolean().optional(),
|
|
41
|
+
});
|
|
42
|
+
const knownKeys = new Set([
|
|
43
|
+
'id',
|
|
44
|
+
'name',
|
|
45
|
+
'no_of_connections',
|
|
46
|
+
'status',
|
|
47
|
+
'tool_access_config',
|
|
48
|
+
'toolkit',
|
|
49
|
+
'type',
|
|
50
|
+
'uuid',
|
|
51
|
+
'auth_scheme',
|
|
52
|
+
'created_at',
|
|
53
|
+
'created_by',
|
|
54
|
+
'credentials',
|
|
55
|
+
'expected_input_fields',
|
|
56
|
+
'is_composio_managed',
|
|
57
|
+
'is_connection_revoke_supported',
|
|
58
|
+
'is_enabled_for_tool_router',
|
|
59
|
+
'last_updated_at',
|
|
60
|
+
'proxy_config',
|
|
61
|
+
'restrict_to_following_tools',
|
|
62
|
+
'shared_credentials',
|
|
63
|
+
]);
|
|
64
|
+
function scopes(value) {
|
|
65
|
+
return [
|
|
66
|
+
...new Set((Array.isArray(value) ? value : (value?.split(/[\s,]+/) ?? []))
|
|
67
|
+
.map((item) => item.trim())
|
|
68
|
+
.filter(Boolean)),
|
|
69
|
+
].sort();
|
|
70
|
+
}
|
|
71
|
+
/** Return only a verified empty/default policy shape; absent means unsuitable for automatic reuse. */
|
|
72
|
+
export function projectComposioAuthenticationConfigPolicy(raw) {
|
|
73
|
+
if (!raw ||
|
|
74
|
+
typeof raw !== 'object' ||
|
|
75
|
+
Array.isArray(raw) ||
|
|
76
|
+
Object.keys(raw).some((key) => !knownKeys.has(key)))
|
|
77
|
+
return undefined;
|
|
78
|
+
// Managed OAuth app credentials belong to Composio, not the connected account.
|
|
79
|
+
// Validate only the documented envelope; never retain its client credentials.
|
|
80
|
+
const envelope = raw;
|
|
81
|
+
const managed = envelope.type === 'default' &&
|
|
82
|
+
envelope.is_composio_managed === true &&
|
|
83
|
+
envelope.auth_scheme === 'OAUTH2';
|
|
84
|
+
const slack = managed &&
|
|
85
|
+
typeof envelope.toolkit === 'object' &&
|
|
86
|
+
envelope.toolkit !== null &&
|
|
87
|
+
envelope.toolkit.slug === 'slack';
|
|
88
|
+
const parsed = (managed
|
|
89
|
+
? policy.extend({
|
|
90
|
+
credentials: (slack ? managedSlackCredentials : managedCredentials).optional(),
|
|
91
|
+
})
|
|
92
|
+
: policy).safeParse(raw);
|
|
93
|
+
if (!parsed.success)
|
|
94
|
+
return undefined;
|
|
95
|
+
return {
|
|
96
|
+
type: parsed.data.type,
|
|
97
|
+
scopes: scopes(parsed.data.credentials?.scopes),
|
|
98
|
+
userScopes: scopes(parsed.data.credentials?.user_scopes),
|
|
99
|
+
credentialsEmpty: Object.keys(parsed.data.credentials ?? {}).length === 0,
|
|
100
|
+
routerEnabled: parsed.data.is_enabled_for_tool_router,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=authentication-config-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-config-policy.js","sourceRoot":"","sources":["../../src/composio/authentication-config-policy.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5F,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;KAC7E,MAAM,EAAE,CAAC;AACZ,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,CAAC;IAC5C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IAC5C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,MA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,QAAQ,CAAC;IACpC,MAAM,KAAK,GACT,OAAO;QACP,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;QACpC,QAAQ,CAAC,OAAO,KAAK,IAAI;QACxB,QAAQ,CAAC,OAAmC,CAAC,IAAI,KAAK,OAAO,CAAC;IACjE,MAAM,MAAM,GAAG,CACb,OAAO;QACL,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;YACZ,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;SAC/E,CAAC;QACJ,CAAC,CAAC,MAAM,CACX,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACjB,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IACtC,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;QACtB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;QAC/C,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;QACxD,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;QACzE,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,0BAA0B;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type ComposioAuthenticationConfigPolicy } from './authentication-config-policy.js';
|
|
2
|
+
import { type ComposioAuthenticationDescriptor } from './authentication-contract.js';
|
|
3
|
+
/** Normalized method metadata; contains no provider credentials or defaults. */
|
|
4
|
+
export interface ComposioAuthenticationMethod {
|
|
5
|
+
scheme: string;
|
|
6
|
+
needsDeveloperConfiguration: boolean;
|
|
7
|
+
descriptor?: ComposioAuthenticationDescriptor;
|
|
8
|
+
}
|
|
9
|
+
/** Exact selected-toolkit metadata; never an authority-bearing public DTO. */
|
|
10
|
+
export interface ComposioToolkitAuthentication {
|
|
11
|
+
toolkit: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
managedOAuth2: boolean;
|
|
14
|
+
managedScopes: string[];
|
|
15
|
+
managedUserScopes: string[];
|
|
16
|
+
methods: ComposioAuthenticationMethod[];
|
|
17
|
+
}
|
|
18
|
+
/** Safe configuration identity; vendor credentials and shared secrets are discarded. */
|
|
19
|
+
export interface ComposioAuthenticationConfiguration {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
toolkit: string;
|
|
23
|
+
scheme: string;
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
managed: boolean;
|
|
26
|
+
policy?: ComposioAuthenticationConfigPolicy;
|
|
27
|
+
}
|
|
28
|
+
declare const metadataIssueLocations: readonly ["auth_config_creation_required", "auth_config_creation_optional", "connected_account_initiation_required", "connected_account_initiation_optional"];
|
|
29
|
+
type MetadataIssueLocation = (typeof metadataIssueLocations)[number];
|
|
30
|
+
declare const metadataMethodKinds: readonly ["oauth2", "supported_account_fields", "other"];
|
|
31
|
+
type MetadataMethodKind = (typeof metadataMethodKinds)[number];
|
|
32
|
+
/** Closed capability refusal with no provider response or credential values. */
|
|
33
|
+
export declare class ComposioAuthenticationSetupError extends Error {
|
|
34
|
+
/** Stable server-only reason safe for structured diagnostics. */
|
|
35
|
+
readonly reason: 'disabled' | 'configured_mismatch' | 'unsupported_method' | 'unsupported_metadata';
|
|
36
|
+
/** Count of strict metadata issue objects, never provider keys or values. */
|
|
37
|
+
readonly metadataIssueCount?: number;
|
|
38
|
+
/** Fixed schema regions containing strict metadata issues. */
|
|
39
|
+
readonly metadataIssueLocations?: readonly MetadataIssueLocation[];
|
|
40
|
+
/** Closed authentication-method classes containing strict metadata issues. */
|
|
41
|
+
readonly metadataMethodKinds?: readonly MetadataMethodKind[];
|
|
42
|
+
constructor(reason: ComposioAuthenticationSetupError['reason'], metadata?: {
|
|
43
|
+
issueCount: number;
|
|
44
|
+
issueLocations: readonly string[];
|
|
45
|
+
methodKinds: readonly string[];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** Normalize only declared fields; unsupported types stay unavailable rather than becoming OAuth. */
|
|
49
|
+
export declare function normalizeComposioToolkitAuthentication(raw: unknown): ComposioToolkitAuthentication;
|
|
50
|
+
/** Drop every provider envelope field except exact configuration identity and status. */
|
|
51
|
+
export declare function normalizeComposioAuthenticationConfiguration(raw: unknown): ComposioAuthenticationConfiguration;
|
|
52
|
+
/** Prefer an explicit configuration, then managed OAuth, then declared account-field methods. */
|
|
53
|
+
export declare function selectComposioAuthentication(toolkit: ComposioToolkitAuthentication, configured?: ComposioAuthenticationConfiguration): ComposioAuthenticationDescriptor;
|
|
54
|
+
/** Check mutable automatic policy without applying that restriction to an explicit custom mapping. */
|
|
55
|
+
export declare function matchesComposioAutomaticAuthenticationPolicy(config: ComposioAuthenticationConfiguration, toolkit: ComposioToolkitAuthentication, descriptor: ComposioAuthenticationDescriptor): boolean;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=authentication-configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-configuration.d.ts","sourceRoot":"","sources":["../../src/composio/authentication-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,8BAA8B,CAAC;AAEtC,gFAAgF;AAChF,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B,EAAE,OAAO,CAAC;IACrC,UAAU,CAAC,EAAE,gCAAgC,CAAC;CAC/C;AAED,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,O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BAAgB,sCAAsC,CACpD,GAAG,EAAE,OAAO,GACX,6BAA6B,CA6E/B;AAED,yFAAyF;AACzF,wBAAgB,4CAA4C,CAC1D,GAAG,EAAE,OAAO,GACX,mCAAmC,CAsBrC;AAED,iGAAiG;AACjG,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,6BAA6B,EACtC,UAAU,CAAC,EAAE,mCAAmC,GAC/C,gCAAgC,CAkClC;AAED,sGAAsG;AACtG,wBAAgB,4CAA4C,CAC1D,MAAM,EAAE,mCAAmC,EAC3C,OAAO,EAAE,6BAA6B,EACtC,UAAU,EAAE,gCAAgC,GAC3C,OAAO,CAST"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/** Closed provider metadata used to select one hosted authentication method. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { projectComposioAuthenticationConfigPolicy, } from './authentication-config-policy.js';
|
|
4
|
+
import { ComposioAuthenticationDescriptorSchema, } from './authentication-contract.js';
|
|
5
|
+
const metadataIssueLocations = [
|
|
6
|
+
'auth_config_creation_required',
|
|
7
|
+
'auth_config_creation_optional',
|
|
8
|
+
'connected_account_initiation_required',
|
|
9
|
+
'connected_account_initiation_optional',
|
|
10
|
+
];
|
|
11
|
+
const metadataMethodKinds = ['oauth2', 'supported_account_fields', 'other'];
|
|
12
|
+
function isMetadataIssueLocation(value) {
|
|
13
|
+
return metadataIssueLocations.includes(value);
|
|
14
|
+
}
|
|
15
|
+
function isMetadataMethodKind(value) {
|
|
16
|
+
return metadataMethodKinds.includes(value);
|
|
17
|
+
}
|
|
18
|
+
/** Closed capability refusal with no provider response or credential values. */
|
|
19
|
+
export class ComposioAuthenticationSetupError extends Error {
|
|
20
|
+
/** Stable server-only reason safe for structured diagnostics. */
|
|
21
|
+
reason;
|
|
22
|
+
/** Count of strict metadata issue objects, never provider keys or values. */
|
|
23
|
+
metadataIssueCount;
|
|
24
|
+
/** Fixed schema regions containing strict metadata issues. */
|
|
25
|
+
metadataIssueLocations;
|
|
26
|
+
/** Closed authentication-method classes containing strict metadata issues. */
|
|
27
|
+
metadataMethodKinds;
|
|
28
|
+
constructor(reason, metadata) {
|
|
29
|
+
super(reason === 'unsupported_metadata'
|
|
30
|
+
? 'This service declares account-field constraints DorkOS does not support yet.'
|
|
31
|
+
: reason === 'disabled'
|
|
32
|
+
? 'This service is currently unavailable.'
|
|
33
|
+
: reason === 'configured_mismatch'
|
|
34
|
+
? 'The configured account setup does not match this service.'
|
|
35
|
+
: 'This service needs advanced account setup or uses account fields DorkOS does not support yet.');
|
|
36
|
+
this.name = 'ComposioAuthenticationSetupError';
|
|
37
|
+
this.reason = reason;
|
|
38
|
+
if (reason === 'unsupported_metadata' &&
|
|
39
|
+
metadata &&
|
|
40
|
+
Number.isSafeInteger(metadata.issueCount) &&
|
|
41
|
+
metadata.issueCount > 0) {
|
|
42
|
+
this.metadataIssueCount = metadata.issueCount;
|
|
43
|
+
this.metadataIssueLocations = Object.freeze([...new Set(metadata.issueLocations.filter(isMetadataIssueLocation))].sort());
|
|
44
|
+
this.metadataMethodKinds = Object.freeze([...new Set(metadata.methodKinds.filter(isMetadataMethodKind))].sort());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const text = z.string().min(1).max(512);
|
|
49
|
+
const rawField = z
|
|
50
|
+
.object({
|
|
51
|
+
name: text,
|
|
52
|
+
displayName: z.string().max(512),
|
|
53
|
+
description: z.string().max(2048),
|
|
54
|
+
required: z.boolean(),
|
|
55
|
+
type: text,
|
|
56
|
+
is_secret: z.boolean().optional(),
|
|
57
|
+
user_visible: z.boolean().optional(),
|
|
58
|
+
default: z.string().nullable().optional(),
|
|
59
|
+
legacy_template_name: z.string().optional(),
|
|
60
|
+
})
|
|
61
|
+
.strict();
|
|
62
|
+
const providerOwnedOAuthAppSetupField = rawField.strip();
|
|
63
|
+
const fieldGroup = z.object({
|
|
64
|
+
required: z.array(rawField).max(64),
|
|
65
|
+
optional: z.array(rawField).max(64),
|
|
66
|
+
});
|
|
67
|
+
function stripProviderOwnedOAuthAppSetupConstraints(raw) {
|
|
68
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
69
|
+
return raw;
|
|
70
|
+
const method = raw;
|
|
71
|
+
if (method.mode !== 'OAUTH2' || !method.fields || typeof method.fields !== 'object')
|
|
72
|
+
return raw;
|
|
73
|
+
const fields = method.fields;
|
|
74
|
+
const creation = fields.auth_config_creation;
|
|
75
|
+
if (!creation || typeof creation !== 'object' || Array.isArray(creation))
|
|
76
|
+
return raw;
|
|
77
|
+
const groups = creation;
|
|
78
|
+
if (!Array.isArray(groups.required) || !Array.isArray(groups.optional))
|
|
79
|
+
return raw;
|
|
80
|
+
const strip = (field) => {
|
|
81
|
+
const parsed = providerOwnedOAuthAppSetupField.safeParse(field);
|
|
82
|
+
return parsed.success ? parsed.data : field;
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
...method,
|
|
86
|
+
fields: {
|
|
87
|
+
...fields,
|
|
88
|
+
auth_config_creation: {
|
|
89
|
+
...groups,
|
|
90
|
+
required: groups.required.map(strip),
|
|
91
|
+
optional: groups.optional.map(strip),
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const authenticationMethod = z.preprocess(stripProviderOwnedOAuthAppSetupConstraints, z.object({
|
|
97
|
+
mode: text,
|
|
98
|
+
fields: z.object({
|
|
99
|
+
auth_config_creation: fieldGroup,
|
|
100
|
+
connected_account_initiation: fieldGroup,
|
|
101
|
+
}),
|
|
102
|
+
}));
|
|
103
|
+
const metadata = z.object({
|
|
104
|
+
slug: z.string().min(1).max(200),
|
|
105
|
+
enabled: z.boolean(),
|
|
106
|
+
composio_managed_auth_schemes: z.array(text).max(64).optional(),
|
|
107
|
+
composio_managed_auth: z
|
|
108
|
+
.array(z.object({
|
|
109
|
+
mode: text,
|
|
110
|
+
scopes: z.object({ available: z.array(text).max(512) }),
|
|
111
|
+
user_scopes: z.object({ available: z.array(text).max(512) }).optional(),
|
|
112
|
+
}))
|
|
113
|
+
.max(64)
|
|
114
|
+
.optional(),
|
|
115
|
+
auth_config_details: z.array(authenticationMethod).max(64).optional(),
|
|
116
|
+
});
|
|
117
|
+
function invalid() {
|
|
118
|
+
throw new Error('Composio returned invalid authentication metadata.');
|
|
119
|
+
}
|
|
120
|
+
function strictMetadataIssueLocation(path) {
|
|
121
|
+
if (path.length !== 6 ||
|
|
122
|
+
path[0] !== 'auth_config_details' ||
|
|
123
|
+
typeof path[1] !== 'number' ||
|
|
124
|
+
path[2] !== 'fields' ||
|
|
125
|
+
!['auth_config_creation', 'connected_account_initiation'].includes(String(path[3])) ||
|
|
126
|
+
!['required', 'optional'].includes(String(path[4])) ||
|
|
127
|
+
typeof path[5] !== 'number') {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const location = `${String(path[3])}_${String(path[4])}`;
|
|
131
|
+
return isMetadataIssueLocation(location) ? location : undefined;
|
|
132
|
+
}
|
|
133
|
+
function strictMetadataMethodKind(raw, path) {
|
|
134
|
+
if (path[0] !== 'auth_config_details' ||
|
|
135
|
+
typeof path[1] !== 'number' ||
|
|
136
|
+
!raw ||
|
|
137
|
+
typeof raw !== 'object') {
|
|
138
|
+
return 'other';
|
|
139
|
+
}
|
|
140
|
+
const details = raw.auth_config_details;
|
|
141
|
+
const method = Array.isArray(details) ? details[path[1]] : undefined;
|
|
142
|
+
const mode = method && typeof method === 'object' ? method.mode : undefined;
|
|
143
|
+
if (mode === 'OAUTH2')
|
|
144
|
+
return 'oauth2';
|
|
145
|
+
if (['API_KEY', 'BEARER_TOKEN', 'BASIC', 'NO_AUTH'].includes(String(mode)))
|
|
146
|
+
return 'supported_account_fields';
|
|
147
|
+
return 'other';
|
|
148
|
+
}
|
|
149
|
+
/** Normalize only declared fields; unsupported types stay unavailable rather than becoming OAuth. */
|
|
150
|
+
export function normalizeComposioToolkitAuthentication(raw) {
|
|
151
|
+
const parsed = metadata.safeParse(raw);
|
|
152
|
+
if (!parsed.success) {
|
|
153
|
+
const strictIssues = parsed.error.issues.filter((issue) => issue.code === 'unrecognized_keys');
|
|
154
|
+
if (strictIssues.length > 0)
|
|
155
|
+
throw new ComposioAuthenticationSetupError('unsupported_metadata', {
|
|
156
|
+
issueCount: strictIssues.length,
|
|
157
|
+
issueLocations: strictIssues.flatMap((issue) => {
|
|
158
|
+
const location = strictMetadataIssueLocation(issue.path);
|
|
159
|
+
return location ? [location] : [];
|
|
160
|
+
}),
|
|
161
|
+
methodKinds: strictIssues.map((issue) => strictMetadataMethodKind(raw, issue.path)),
|
|
162
|
+
});
|
|
163
|
+
return invalid();
|
|
164
|
+
}
|
|
165
|
+
const value = parsed.data;
|
|
166
|
+
const managed = value.composio_managed_auth?.filter((item) => item.mode === 'OAUTH2') ?? [];
|
|
167
|
+
if (managed.length > 1)
|
|
168
|
+
return invalid();
|
|
169
|
+
const details = value.auth_config_details ?? [];
|
|
170
|
+
if (new Set(details.map((item) => item.mode)).size !== details.length)
|
|
171
|
+
return invalid();
|
|
172
|
+
return {
|
|
173
|
+
toolkit: value.slug,
|
|
174
|
+
enabled: value.enabled,
|
|
175
|
+
managedOAuth2: managed.length === 1 || value.composio_managed_auth_schemes?.includes('OAUTH2') === true,
|
|
176
|
+
managedScopes: managed[0]?.scopes.available ?? [],
|
|
177
|
+
managedUserScopes: managed[0]?.user_scopes?.available ?? [],
|
|
178
|
+
methods: details.map((method) => {
|
|
179
|
+
const initiation = method.fields.connected_account_initiation;
|
|
180
|
+
const fields = [
|
|
181
|
+
...initiation.required.map((field) => ({ ...field, required: true })),
|
|
182
|
+
...initiation.optional,
|
|
183
|
+
];
|
|
184
|
+
// Connect Link collects OAuth context itself; it does not enter our credential POST.
|
|
185
|
+
const normalized = ComposioAuthenticationDescriptorSchema.safeParse({
|
|
186
|
+
toolkit: value.slug,
|
|
187
|
+
scheme: method.mode,
|
|
188
|
+
kind: method.mode === 'OAUTH2' ? 'oauth' : method.mode === 'NO_AUTH' ? 'none' : 'fields',
|
|
189
|
+
source: 'account-fields',
|
|
190
|
+
fields: method.mode === 'OAUTH2'
|
|
191
|
+
? []
|
|
192
|
+
: fields.map((field) => ({
|
|
193
|
+
name: field.name,
|
|
194
|
+
label: field.displayName || field.name,
|
|
195
|
+
description: field.description,
|
|
196
|
+
type: field.type,
|
|
197
|
+
required: field.required,
|
|
198
|
+
secret: field.is_secret === true || field.type === 'password',
|
|
199
|
+
})),
|
|
200
|
+
});
|
|
201
|
+
const requiredWireField = method.mode === 'BEARER_TOKEN' ? 'token' : method.mode === 'BASIC' ? 'username' : undefined;
|
|
202
|
+
const requiredField = normalized.success && requiredWireField
|
|
203
|
+
? normalized.data.fields.find((field) => field.name === requiredWireField && ['string', 'password'].includes(field.type))
|
|
204
|
+
: undefined;
|
|
205
|
+
const wireSupported = !requiredWireField || Boolean(requiredField);
|
|
206
|
+
// Connect Link owns OAuth context. Our credential forms cannot honor hidden
|
|
207
|
+
// account fields, so keep that method unavailable instead of exposing or
|
|
208
|
+
// silently dropping them. Other valid methods remain selectable.
|
|
209
|
+
const visibilitySupported = method.mode === 'OAUTH2' || fields.every((field) => field.user_visible !== false);
|
|
210
|
+
// The pinned create union requires these fields even if toolkit metadata calls them optional.
|
|
211
|
+
if (requiredField)
|
|
212
|
+
requiredField.required = true;
|
|
213
|
+
return {
|
|
214
|
+
scheme: method.mode,
|
|
215
|
+
needsDeveloperConfiguration: method.fields.auth_config_creation.required.length > 0,
|
|
216
|
+
...(normalized.success && wireSupported && visibilitySupported
|
|
217
|
+
? { descriptor: normalized.data }
|
|
218
|
+
: {}),
|
|
219
|
+
};
|
|
220
|
+
}),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/** Drop every provider envelope field except exact configuration identity and status. */
|
|
224
|
+
export function normalizeComposioAuthenticationConfiguration(raw) {
|
|
225
|
+
const parsed = z
|
|
226
|
+
.object({
|
|
227
|
+
id: text,
|
|
228
|
+
name: text,
|
|
229
|
+
toolkit: z.object({ slug: z.string().min(1).max(200) }),
|
|
230
|
+
auth_scheme: text,
|
|
231
|
+
status: z.enum(['ENABLED', 'DISABLED']),
|
|
232
|
+
is_composio_managed: z.boolean().optional(),
|
|
233
|
+
})
|
|
234
|
+
.safeParse(raw);
|
|
235
|
+
if (!parsed.success)
|
|
236
|
+
return invalid();
|
|
237
|
+
const policy = projectComposioAuthenticationConfigPolicy(raw);
|
|
238
|
+
return {
|
|
239
|
+
...(policy ? { policy } : {}),
|
|
240
|
+
id: parsed.data.id,
|
|
241
|
+
name: parsed.data.name,
|
|
242
|
+
toolkit: parsed.data.toolkit.slug,
|
|
243
|
+
scheme: parsed.data.auth_scheme,
|
|
244
|
+
enabled: parsed.data.status === 'ENABLED',
|
|
245
|
+
managed: parsed.data.is_composio_managed === true,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/** Prefer an explicit configuration, then managed OAuth, then declared account-field methods. */
|
|
249
|
+
export function selectComposioAuthentication(toolkit, configured) {
|
|
250
|
+
if (!toolkit.enabled)
|
|
251
|
+
throw new ComposioAuthenticationSetupError('disabled');
|
|
252
|
+
if (configured) {
|
|
253
|
+
if (!configured.enabled || configured.toolkit !== toolkit.toolkit)
|
|
254
|
+
throw new ComposioAuthenticationSetupError('configured_mismatch');
|
|
255
|
+
// An exact enabled OAuth2 configuration already supplies developer setup; Connect Link
|
|
256
|
+
// collects its context even when optional toolkit field metadata is absent.
|
|
257
|
+
if (configured.scheme === 'OAUTH2') {
|
|
258
|
+
return {
|
|
259
|
+
toolkit: toolkit.toolkit,
|
|
260
|
+
scheme: 'OAUTH2',
|
|
261
|
+
kind: 'oauth',
|
|
262
|
+
source: 'configured',
|
|
263
|
+
fields: [],
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
const method = toolkit.methods.find((item) => item.scheme === configured.scheme);
|
|
267
|
+
if (!method?.descriptor)
|
|
268
|
+
throw new ComposioAuthenticationSetupError('unsupported_method');
|
|
269
|
+
return { ...method.descriptor, source: 'configured' };
|
|
270
|
+
}
|
|
271
|
+
if (toolkit.managedOAuth2) {
|
|
272
|
+
return {
|
|
273
|
+
toolkit: toolkit.toolkit,
|
|
274
|
+
scheme: 'OAUTH2',
|
|
275
|
+
kind: 'oauth',
|
|
276
|
+
source: 'managed',
|
|
277
|
+
fields: [],
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
for (const scheme of ['API_KEY', 'BEARER_TOKEN', 'BASIC', 'NO_AUTH']) {
|
|
281
|
+
const method = toolkit.methods.find((item) => item.scheme === scheme);
|
|
282
|
+
if (method?.descriptor && !method.needsDeveloperConfiguration)
|
|
283
|
+
return method.descriptor;
|
|
284
|
+
}
|
|
285
|
+
throw new ComposioAuthenticationSetupError('unsupported_method');
|
|
286
|
+
}
|
|
287
|
+
/** Check mutable automatic policy without applying that restriction to an explicit custom mapping. */
|
|
288
|
+
export function matchesComposioAutomaticAuthenticationPolicy(config, toolkit, descriptor) {
|
|
289
|
+
const policy = config.policy;
|
|
290
|
+
if (!policy || policy.routerEnabled || descriptor.source === 'configured')
|
|
291
|
+
return false;
|
|
292
|
+
return descriptor.source === 'managed'
|
|
293
|
+
? config.managed &&
|
|
294
|
+
policy.type === 'default' &&
|
|
295
|
+
policy.scopes.every((scope) => toolkit.managedScopes.includes(scope)) &&
|
|
296
|
+
policy.userScopes.every((scope) => toolkit.managedUserScopes.includes(scope))
|
|
297
|
+
: !config.managed && policy.type === 'custom' && policy.credentialsEmpty;
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=authentication-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-configuration.js","sourceRoot":"","sources":["../../src/composio/authentication-configuration.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,yCAAyC,GAE1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,sCAAsC,GAEvC,MAAM,8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