@superdurable/connector-ashby 0.1.0 → 0.2.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/dex-connector.json +1933 -2
- package/dist/chunk-ARSIHHSF.js +1417 -0
- package/dist/connection-BHsC6yC5.d.ts +988 -0
- package/dist/index.d.ts +1759 -5
- package/dist/index.js +2207 -19
- package/dist/mock.d.ts +627 -5
- package/dist/mock.js +1556 -4
- package/package.json +3 -3
- package/dist/chunk-6O5ADW6S.js +0 -107
- package/dist/connection-DrUeqnOI.d.ts +0 -75
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-ashby",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Ashby connector for Dex TypeScript applications",
|
|
6
6
|
"repository": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
38
|
"lint": "eslint src test examples",
|
|
39
|
-
"test": "vitest run --exclude test/integration/**",
|
|
39
|
+
"test": "vitest run --exclude 'test/integration/**'",
|
|
40
40
|
"test:integration": "vitest run test/integration/*.integration.test.ts",
|
|
41
41
|
"example:worker": "tsx examples/candidate-inspection/worker.ts",
|
|
42
42
|
"example:start": "tsx examples/candidate-inspection/start.ts",
|
|
43
43
|
"check": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@superdurable/connectors-sdk": "0.
|
|
46
|
+
"@superdurable/connectors-sdk": "0.13.0",
|
|
47
47
|
"@superdurable/dex": ">=1.28.0",
|
|
48
48
|
"zod": "^4.1.0"
|
|
49
49
|
},
|
package/dist/chunk-6O5ADW6S.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// src/generated/models.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
-
var ConfigSchema = z.object({
|
|
5
|
-
"baseUrl": z.string().optional(),
|
|
6
|
-
"timeoutMs": z.number().int().optional(),
|
|
7
|
-
"maxResponseBytes": z.number().int().optional()
|
|
8
|
-
});
|
|
9
|
-
function decodeCredentials(value) {
|
|
10
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
11
|
-
const fields = value;
|
|
12
|
-
const allowed = /* @__PURE__ */ new Set(["api_key"]);
|
|
13
|
-
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
14
|
-
if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new TypeError("credential api_key has an invalid type");
|
|
15
|
-
const credentials = {};
|
|
16
|
-
if (!fields["api_key"]) throw new TypeError("credential api_key is required");
|
|
17
|
-
credentials.apiKey = new SecretString(fields["api_key"] ?? "");
|
|
18
|
-
return credentials;
|
|
19
|
-
}
|
|
20
|
-
var GetCandidateInputSchema = z.strictObject({
|
|
21
|
-
"candidateId": z.string()
|
|
22
|
-
});
|
|
23
|
-
var CandidateProfileSchema = z.strictObject({
|
|
24
|
-
"id": z.string(),
|
|
25
|
-
"name": z.string(),
|
|
26
|
-
"createdAt": z.string(),
|
|
27
|
-
"updatedAt": z.string()
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// src/generated/definitions.ts
|
|
31
|
-
var ConnectorID = "ashby";
|
|
32
|
-
var ProviderID = "ashby";
|
|
33
|
-
var GetCandidateBranch = {
|
|
34
|
-
Found: "found",
|
|
35
|
-
NotFound: "notFound",
|
|
36
|
-
ProviderRejected: "providerRejected",
|
|
37
|
-
InvalidResponse: "invalidResponse",
|
|
38
|
-
Defect: "defect"
|
|
39
|
-
};
|
|
40
|
-
var GetCandidateBranchFound = GetCandidateBranch.Found;
|
|
41
|
-
var GetCandidateBranchNotFound = GetCandidateBranch.NotFound;
|
|
42
|
-
var GetCandidateBranchProviderRejected = GetCandidateBranch.ProviderRejected;
|
|
43
|
-
var GetCandidateBranchInvalidResponse = GetCandidateBranch.InvalidResponse;
|
|
44
|
-
var GetCandidateBranchDefect = GetCandidateBranch.Defect;
|
|
45
|
-
var GetCandidateDefinition = {
|
|
46
|
-
operation: { connectorId: ConnectorID, operationId: "getCandidate" },
|
|
47
|
-
branches: [
|
|
48
|
-
{ id: "found", description: "Ashby returned the candidate." },
|
|
49
|
-
{ id: "notFound", description: "Ashby did not expose the candidate.", optional: true },
|
|
50
|
-
{ id: "providerRejected", description: "Ashby conclusively rejected the lookup.", optional: true },
|
|
51
|
-
{ id: "invalidResponse", description: "Ashby returned malformed or oversized JSON.", optional: true },
|
|
52
|
-
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
53
|
-
],
|
|
54
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
55
|
-
};
|
|
56
|
-
var GetCandidateMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
57
|
-
|
|
58
|
-
// src/generated/connection.ts
|
|
59
|
-
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
60
|
-
var Connection = class {
|
|
61
|
-
/** Stable provider and connection name. */
|
|
62
|
-
reference;
|
|
63
|
-
/** Bound provider operations. */
|
|
64
|
-
operations;
|
|
65
|
-
/** Validate a reference and bind operations. */
|
|
66
|
-
constructor(reference, operations) {
|
|
67
|
-
this.reference = ConnectionRefSchema.parse(reference);
|
|
68
|
-
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
69
|
-
if (!operations) throw new TypeError("connector operations are required");
|
|
70
|
-
this.operations = operations;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
function newConnection(client, reference) {
|
|
74
|
-
if (!client) throw new TypeError("connector client is required");
|
|
75
|
-
return new Connection(reference, client);
|
|
76
|
-
}
|
|
77
|
-
function newConnectionWithOperations(operations, reference) {
|
|
78
|
-
return new Connection(reference, operations);
|
|
79
|
-
}
|
|
80
|
-
function newProjectConnection(project, connectionName, createClient) {
|
|
81
|
-
if (!project) throw new TypeError("loaded project is required");
|
|
82
|
-
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
83
|
-
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
84
|
-
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
85
|
-
return newConnection(createClient(project, connectionName), reference);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export {
|
|
89
|
-
ConfigSchema,
|
|
90
|
-
decodeCredentials,
|
|
91
|
-
GetCandidateInputSchema,
|
|
92
|
-
CandidateProfileSchema,
|
|
93
|
-
ConnectorID,
|
|
94
|
-
ProviderID,
|
|
95
|
-
GetCandidateBranch,
|
|
96
|
-
GetCandidateBranchFound,
|
|
97
|
-
GetCandidateBranchNotFound,
|
|
98
|
-
GetCandidateBranchProviderRejected,
|
|
99
|
-
GetCandidateBranchInvalidResponse,
|
|
100
|
-
GetCandidateBranchDefect,
|
|
101
|
-
GetCandidateDefinition,
|
|
102
|
-
GetCandidateMetadata,
|
|
103
|
-
Connection,
|
|
104
|
-
newConnection,
|
|
105
|
-
newConnectionWithOperations,
|
|
106
|
-
newProjectConnection
|
|
107
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { SecretString, CredentialProvider, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
-
interface Config {
|
|
6
|
-
/** Ashby API root as an absolute HTTPS URL. Blank uses the displayed endpoint; override only for a trusted local test gateway. */
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
/** Maximum duration of one API request as a positive Go duration such as 15s. Blank uses the displayed default; increase for slow candidate reads. Runtime value in milliseconds. */
|
|
9
|
-
timeoutMs?: number;
|
|
10
|
-
/** Maximum complete candidate response in bytes as a positive integer. Blank uses the displayed default; increase for candidates with large metadata. */
|
|
11
|
-
maxResponseBytes?: number;
|
|
12
|
-
}
|
|
13
|
-
/** Runtime schema for manifest configuration. */
|
|
14
|
-
declare const ConfigSchema: z.ZodObject<{
|
|
15
|
-
baseUrl: z.ZodOptional<z.ZodString>;
|
|
16
|
-
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
/** Private connector credentials resolved by the host. */
|
|
20
|
-
interface Credentials {
|
|
21
|
-
/** Secret Ashby API key from Admin > API Keys. Grant Candidates read permission; copy the complete opaque value once. Blank prevents calls. Dex uses it as the Basic username with an empty password. */
|
|
22
|
-
apiKey: SecretString;
|
|
23
|
-
}
|
|
24
|
-
/** Decode private credential fields for the connector. */
|
|
25
|
-
declare function decodeCredentials(value: unknown): Credentials;
|
|
26
|
-
/** Host-owned source of private connector credentials. */
|
|
27
|
-
type CredentialSource = CredentialProvider<Credentials>;
|
|
28
|
-
/** GetCandidateInput selects a candidate by its non-secret Ashby ID. */
|
|
29
|
-
interface GetCandidateInput {
|
|
30
|
-
/** CandidateID is the ID shown in Ashby Candidates or returned by the API. */
|
|
31
|
-
"candidateId": string;
|
|
32
|
-
}
|
|
33
|
-
/** CandidateProfile excludes email, phone, files, and custom fields. */
|
|
34
|
-
interface CandidateProfile {
|
|
35
|
-
/** ID is the Ashby candidate UUID. */
|
|
36
|
-
"id": string;
|
|
37
|
-
/** Name is the candidate display name. */
|
|
38
|
-
"name": string;
|
|
39
|
-
/** CreatedAt is Ashby's creation timestamp. */
|
|
40
|
-
"createdAt": string;
|
|
41
|
-
/** UpdatedAt is Ashby's update timestamp. */
|
|
42
|
-
"updatedAt": string;
|
|
43
|
-
}
|
|
44
|
-
/** Runtime validator for GetCandidateInput. */
|
|
45
|
-
declare const GetCandidateInputSchema: z.ZodObject<{
|
|
46
|
-
candidateId: z.ZodString;
|
|
47
|
-
}, z.core.$strict>;
|
|
48
|
-
/** Runtime validator for CandidateProfile. */
|
|
49
|
-
declare const CandidateProfileSchema: z.ZodObject<{
|
|
50
|
-
id: z.ZodString;
|
|
51
|
-
name: z.ZodString;
|
|
52
|
-
createdAt: z.ZodString;
|
|
53
|
-
updatedAt: z.ZodString;
|
|
54
|
-
}, z.core.$strict>;
|
|
55
|
-
|
|
56
|
-
/** Typed operations supplied by a client or mock. */
|
|
57
|
-
interface Operations {
|
|
58
|
-
/** Invoke getCandidate through this connection. */
|
|
59
|
-
getCandidate(): Query<GetCandidateInput, CandidateProfile>;
|
|
60
|
-
}
|
|
61
|
-
/** Named connector connection kept outside Flow state. */
|
|
62
|
-
declare class Connection<BoundOperations = Operations> {
|
|
63
|
-
/** Stable provider and connection name. */
|
|
64
|
-
readonly reference: ConnectionRef;
|
|
65
|
-
/** Bound provider operations. */
|
|
66
|
-
readonly operations: BoundOperations;
|
|
67
|
-
/** Validate a reference and bind operations. */
|
|
68
|
-
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
69
|
-
}
|
|
70
|
-
/** Bind a client to a named connection. */
|
|
71
|
-
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
72
|
-
/** Bind scripted operations to a named connection. */
|
|
73
|
-
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
74
|
-
|
|
75
|
-
export { type CandidateProfile as C, type GetCandidateInput as G, type Operations as O, Connection as a, type Config as b, type Credentials as c, CandidateProfileSchema as d, ConfigSchema as e, type CredentialSource as f, GetCandidateInputSchema as g, decodeCredentials as h, newConnectionWithOperations as i, newConnection as n };
|