@superdurable/connector-braze 0.0.0-stage → 0.1.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 +4 -2
- package/dex-connector.json +65 -0
- package/dist/chunk-VGRZKZ7B.js +108 -0
- package/dist/connection-CJqjLDg0.d.ts +78 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +226 -0
- package/dist/mock.d.ts +37 -0
- package/dist/mock.js +78 -0
- package/package.json +59 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Super Durable
|
|
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,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Braze TypeScript connector
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package implements `getUserProfile` for Dex TypeScript Flows. It requests only external ID, Braze ID, given name, family name, and email from `POST /users/export/ids`; the Go-recorded conformance scenarios verify requests, branches, retries, and outputs.
|
|
4
|
+
|
|
5
|
+
In Braze Dashboard > Settings > APIs and Identifiers > API Keys, create a REST API key with `users.export.ids` permission. Enter its secret value in Dex Web `rest_api_key`, and set `baseUrl` to the account's REST Endpoint from that page. See the [connector README](../README.md) and [runnable example](examples/profile-inspection/README.md). Real Braze authorization remains unverified.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "braze",
|
|
3
|
+
"releaseTag": "connectors/braze/go/v0.1.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-braze",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newGetUserProfileStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "getUserProfile",
|
|
14
|
+
"inputType": "GetUserProfileInput",
|
|
15
|
+
"description": "Read one user's external ID, Braze ID, name, and email if present.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "found",
|
|
25
|
+
"field": "found",
|
|
26
|
+
"optional": false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "notFound",
|
|
30
|
+
"field": "notFound",
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "providerRejected",
|
|
35
|
+
"field": "providerRejected",
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "invalidResponse",
|
|
40
|
+
"field": "invalidResponse",
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "defect",
|
|
45
|
+
"field": "defect",
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"inputSchema": {
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"description": "GetUserProfileInput selects a Braze user by the application's external ID.",
|
|
52
|
+
"properties": {
|
|
53
|
+
"externalId": {
|
|
54
|
+
"description": "ExternalID is a non-secret stable application user ID.",
|
|
55
|
+
"type": "string"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": [
|
|
59
|
+
"externalId"
|
|
60
|
+
],
|
|
61
|
+
"type": "object"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
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(),
|
|
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(["rest_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["rest_api_key"] != null && !(typeof fields["rest_api_key"] === "string")) throw new TypeError("credential rest_api_key has an invalid type");
|
|
15
|
+
const credentials = {};
|
|
16
|
+
if (!fields["rest_api_key"]) throw new TypeError("credential rest_api_key is required");
|
|
17
|
+
credentials.restApiKey = new SecretString(fields["rest_api_key"] ?? "");
|
|
18
|
+
return credentials;
|
|
19
|
+
}
|
|
20
|
+
var GetUserProfileInputSchema = z.strictObject({
|
|
21
|
+
"externalId": z.string()
|
|
22
|
+
});
|
|
23
|
+
var UserProfileSchema = z.strictObject({
|
|
24
|
+
"externalId": z.string(),
|
|
25
|
+
"brazeId": z.string().optional(),
|
|
26
|
+
"firstName": z.string().optional(),
|
|
27
|
+
"lastName": z.string().optional(),
|
|
28
|
+
"email": z.string().optional()
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// src/generated/definitions.ts
|
|
32
|
+
var ConnectorID = "braze";
|
|
33
|
+
var ProviderID = "braze";
|
|
34
|
+
var GetUserProfileBranch = {
|
|
35
|
+
Found: "found",
|
|
36
|
+
NotFound: "notFound",
|
|
37
|
+
ProviderRejected: "providerRejected",
|
|
38
|
+
InvalidResponse: "invalidResponse",
|
|
39
|
+
Defect: "defect"
|
|
40
|
+
};
|
|
41
|
+
var GetUserProfileBranchFound = GetUserProfileBranch.Found;
|
|
42
|
+
var GetUserProfileBranchNotFound = GetUserProfileBranch.NotFound;
|
|
43
|
+
var GetUserProfileBranchProviderRejected = GetUserProfileBranch.ProviderRejected;
|
|
44
|
+
var GetUserProfileBranchInvalidResponse = GetUserProfileBranch.InvalidResponse;
|
|
45
|
+
var GetUserProfileBranchDefect = GetUserProfileBranch.Defect;
|
|
46
|
+
var GetUserProfileDefinition = {
|
|
47
|
+
operation: { connectorId: ConnectorID, operationId: "getUserProfile" },
|
|
48
|
+
branches: [
|
|
49
|
+
{ id: "found", description: "Braze returned the user profile." },
|
|
50
|
+
{ id: "notFound", description: "Braze returned no user for the external ID.", optional: true },
|
|
51
|
+
{ id: "providerRejected", description: "Braze conclusively rejected the request.", optional: true },
|
|
52
|
+
{ id: "invalidResponse", description: "Braze returned malformed or oversized JSON.", optional: true },
|
|
53
|
+
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
54
|
+
],
|
|
55
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
56
|
+
};
|
|
57
|
+
var GetUserProfileMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
58
|
+
|
|
59
|
+
// src/generated/connection.ts
|
|
60
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
61
|
+
var Connection = class {
|
|
62
|
+
/** Stable provider and connection name. */
|
|
63
|
+
reference;
|
|
64
|
+
/** Bound provider operations. */
|
|
65
|
+
operations;
|
|
66
|
+
/** Validate a reference and bind operations. */
|
|
67
|
+
constructor(reference, operations) {
|
|
68
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
69
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
70
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
71
|
+
this.operations = operations;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
function newConnection(client, reference) {
|
|
75
|
+
if (!client) throw new TypeError("connector client is required");
|
|
76
|
+
return new Connection(reference, client);
|
|
77
|
+
}
|
|
78
|
+
function newConnectionWithOperations(operations, reference) {
|
|
79
|
+
return new Connection(reference, operations);
|
|
80
|
+
}
|
|
81
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
82
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
83
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
84
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
85
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
86
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
ConfigSchema,
|
|
91
|
+
decodeCredentials,
|
|
92
|
+
GetUserProfileInputSchema,
|
|
93
|
+
UserProfileSchema,
|
|
94
|
+
ConnectorID,
|
|
95
|
+
ProviderID,
|
|
96
|
+
GetUserProfileBranch,
|
|
97
|
+
GetUserProfileBranchFound,
|
|
98
|
+
GetUserProfileBranchNotFound,
|
|
99
|
+
GetUserProfileBranchProviderRejected,
|
|
100
|
+
GetUserProfileBranchInvalidResponse,
|
|
101
|
+
GetUserProfileBranchDefect,
|
|
102
|
+
GetUserProfileDefinition,
|
|
103
|
+
GetUserProfileMetadata,
|
|
104
|
+
Connection,
|
|
105
|
+
newConnection,
|
|
106
|
+
newConnectionWithOperations,
|
|
107
|
+
newProjectConnection
|
|
108
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
/** Your account's HTTPS REST endpoint from Braze Dashboard > Settings > APIs and Identifiers > API Keys > REST Endpoint, such as https://rest.iad-01.braze.com. This non-secret endpoint is required; blank prevents calls. */
|
|
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 profile exports. Runtime value in milliseconds. */
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
/** Maximum complete response in bytes as a positive integer. Blank uses the displayed default; increase for known larger selected profiles. */
|
|
11
|
+
maxResponseBytes?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Runtime schema for manifest configuration. */
|
|
14
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
15
|
+
baseUrl: 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 REST API key from Braze Dashboard > Settings > APIs and Identifiers > API Keys. Create or select a key with users.export.ids permission, copy its value into this secret field; blank prevents calls. Dex sends it only as a Bearer token. */
|
|
22
|
+
restApiKey: 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
|
+
/** GetUserProfileInput selects a Braze user by the application's external ID. */
|
|
29
|
+
interface GetUserProfileInput {
|
|
30
|
+
/** ExternalID is a non-secret stable application user ID. */
|
|
31
|
+
"externalId": string;
|
|
32
|
+
}
|
|
33
|
+
/** UserProfile contains only the selected profile fields, excluding custom attributes. */
|
|
34
|
+
interface UserProfile {
|
|
35
|
+
/** ExternalID is the application-supplied user ID. */
|
|
36
|
+
"externalId": string;
|
|
37
|
+
/** BrazeID is Braze's internal user ID. */
|
|
38
|
+
"brazeId"?: string | undefined;
|
|
39
|
+
/** FirstName is the optional given name. */
|
|
40
|
+
"firstName"?: string | undefined;
|
|
41
|
+
/** LastName is the optional family name. */
|
|
42
|
+
"lastName"?: string | undefined;
|
|
43
|
+
/** Email is the optional email address. */
|
|
44
|
+
"email"?: string | undefined;
|
|
45
|
+
}
|
|
46
|
+
/** Runtime validator for GetUserProfileInput. */
|
|
47
|
+
declare const GetUserProfileInputSchema: z.ZodObject<{
|
|
48
|
+
externalId: z.ZodString;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
/** Runtime validator for UserProfile. */
|
|
51
|
+
declare const UserProfileSchema: z.ZodObject<{
|
|
52
|
+
externalId: z.ZodString;
|
|
53
|
+
brazeId: z.ZodOptional<z.ZodString>;
|
|
54
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
55
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
56
|
+
email: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strict>;
|
|
58
|
+
|
|
59
|
+
/** Typed operations supplied by a client or mock. */
|
|
60
|
+
interface Operations {
|
|
61
|
+
/** Invoke getUserProfile through this connection. */
|
|
62
|
+
getUserProfile(): Query<GetUserProfileInput, UserProfile>;
|
|
63
|
+
}
|
|
64
|
+
/** Named connector connection kept outside Flow state. */
|
|
65
|
+
declare class Connection<BoundOperations = Operations> {
|
|
66
|
+
/** Stable provider and connection name. */
|
|
67
|
+
readonly reference: ConnectionRef;
|
|
68
|
+
/** Bound provider operations. */
|
|
69
|
+
readonly operations: BoundOperations;
|
|
70
|
+
/** Validate a reference and bind operations. */
|
|
71
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
72
|
+
}
|
|
73
|
+
/** Bind a client to a named connection. */
|
|
74
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
75
|
+
/** Bind scripted operations to a named connection. */
|
|
76
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
77
|
+
|
|
78
|
+
export { Connection as C, type GetUserProfileInput as G, type Operations as O, type UserProfile as U, type Config as a, type Credentials as b, ConfigSchema as c, type CredentialSource as d, GetUserProfileInputSchema as e, UserProfileSchema as f, decodeCredentials as g, newConnectionWithOperations as h, newConnection as n };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { G as GetUserProfileInput, U as UserProfile, C as Connection, O as Operations, a as Config, b as Credentials } from './connection-CJqjLDg0.js';
|
|
2
|
+
export { c as ConfigSchema, d as CredentialSource, e as GetUserProfileInputSchema, f as UserProfileSchema, g as decodeCredentials, n as newConnection, h as newConnectionWithOperations } from './connection-CJqjLDg0.js';
|
|
3
|
+
import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, CredentialProvider, Call, QueryAttempt } from '@superdurable/connectors-sdk';
|
|
4
|
+
import { StepTarget } from '@superdurable/dex';
|
|
5
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
6
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
7
|
+
import 'zod';
|
|
8
|
+
|
|
9
|
+
/** Stable connector identity. */
|
|
10
|
+
declare const ConnectorID = "braze";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "braze";
|
|
13
|
+
/** Branch IDs for getUserProfile. */
|
|
14
|
+
declare const GetUserProfileBranch: {
|
|
15
|
+
readonly Found: "found";
|
|
16
|
+
readonly NotFound: "notFound";
|
|
17
|
+
readonly ProviderRejected: "providerRejected";
|
|
18
|
+
readonly InvalidResponse: "invalidResponse";
|
|
19
|
+
readonly Defect: "defect";
|
|
20
|
+
};
|
|
21
|
+
/** Braze returned the user profile. */
|
|
22
|
+
declare const GetUserProfileBranchFound: "found";
|
|
23
|
+
/** Braze returned no user for the external ID. */
|
|
24
|
+
declare const GetUserProfileBranchNotFound: "notFound";
|
|
25
|
+
/** Braze conclusively rejected the request. */
|
|
26
|
+
declare const GetUserProfileBranchProviderRejected: "providerRejected";
|
|
27
|
+
/** Braze returned malformed or oversized JSON. */
|
|
28
|
+
declare const GetUserProfileBranchInvalidResponse: "invalidResponse";
|
|
29
|
+
/** Local input or connection credentials are invalid. */
|
|
30
|
+
declare const GetUserProfileBranchDefect: "defect";
|
|
31
|
+
/** Manifest definition for getUserProfile. */
|
|
32
|
+
declare const GetUserProfileDefinition: QueryDefinition;
|
|
33
|
+
/** Manifest metadata for getUserProfile. */
|
|
34
|
+
declare const GetUserProfileMetadata: {
|
|
35
|
+
readonly kind: "query";
|
|
36
|
+
readonly idempotency: "none";
|
|
37
|
+
readonly authorization: "required";
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Configuration for the getUserProfile connector Step. */
|
|
41
|
+
interface GetUserProfileStepConfig<StepInput, OperationInput = GetUserProfileInput, OperationOutput = UserProfile> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
42
|
+
/** Named connection supplying this operation. */
|
|
43
|
+
connection: Connection<{
|
|
44
|
+
getUserProfile(): Query<OperationInput, OperationOutput>;
|
|
45
|
+
}>;
|
|
46
|
+
/** Name matching the bound connection. */
|
|
47
|
+
connectionName: string;
|
|
48
|
+
/** Braze returned the user profile. */
|
|
49
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
50
|
+
/** Braze returned no user for the external ID. */
|
|
51
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
52
|
+
/** Braze conclusively rejected the request. */
|
|
53
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
54
|
+
/** Braze returned malformed or oversized JSON. */
|
|
55
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
56
|
+
/** Local input or connection credentials are invalid. */
|
|
57
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
58
|
+
}
|
|
59
|
+
/** Build the getUserProfile Step from a named connection. */
|
|
60
|
+
declare function newGetUserProfileStep<StepInput, OperationInput = GetUserProfileInput, OperationOutput = UserProfile>(configuration: GetUserProfileStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
61
|
+
|
|
62
|
+
/** Open one named Braze connection from Dex project configuration. */
|
|
63
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
64
|
+
|
|
65
|
+
/** Injectable provider sender for tests and local applications. */
|
|
66
|
+
interface BrazeClientOptions {
|
|
67
|
+
/** Provider sender; omitted uses the SDK transport. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
68
|
+
}
|
|
69
|
+
interface Exchange {
|
|
70
|
+
status: number;
|
|
71
|
+
body: Uint8Array;
|
|
72
|
+
retryAfterMs: number;
|
|
73
|
+
error?: 'credential' | 'request' | 'tooLarge';
|
|
74
|
+
}
|
|
75
|
+
/** Authenticated Braze REST client for selected user profile exports. */
|
|
76
|
+
declare class BrazeClient {
|
|
77
|
+
private readonly credentials;
|
|
78
|
+
private readonly baseURL;
|
|
79
|
+
private readonly timeoutMs;
|
|
80
|
+
private readonly maxResponseBytes;
|
|
81
|
+
private readonly send;
|
|
82
|
+
/** Validate account endpoint and request limits without contacting Braze. */
|
|
83
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: BrazeClientOptions);
|
|
84
|
+
/** Bind the getUserProfile Query. */ getUserProfile(): GetUserProfileOperation;
|
|
85
|
+
/** Resolve the key and send one bounded profile export request. */
|
|
86
|
+
post(call: Call, externalID: string): Promise<Exchange>;
|
|
87
|
+
}
|
|
88
|
+
/** Read one Braze user's selected identity and contact fields. */
|
|
89
|
+
declare class GetUserProfileOperation implements Query<GetUserProfileInput, UserProfile> {
|
|
90
|
+
private readonly client;
|
|
91
|
+
/** Bind the provider client. */ constructor(client: BrazeClient);
|
|
92
|
+
/** Return the generated Query contract. */ definition(): QueryDefinition;
|
|
93
|
+
/** Classify provider outcomes consistently with the Go implementation. */
|
|
94
|
+
invoke(call: Call, input: GetUserProfileInput): Promise<QueryAttempt<UserProfile>>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { BrazeClient, type BrazeClientOptions, Config, Connection, ConnectorID, Credentials, GetUserProfileBranch, GetUserProfileBranchDefect, GetUserProfileBranchFound, GetUserProfileBranchInvalidResponse, GetUserProfileBranchNotFound, GetUserProfileBranchProviderRejected, GetUserProfileDefinition, GetUserProfileInput, GetUserProfileMetadata, GetUserProfileOperation, type GetUserProfileStepConfig, ProviderID, UserProfile, newGetUserProfileStep, newProjectConnection };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigSchema,
|
|
3
|
+
Connection,
|
|
4
|
+
ConnectorID,
|
|
5
|
+
GetUserProfileBranch,
|
|
6
|
+
GetUserProfileBranchDefect,
|
|
7
|
+
GetUserProfileBranchFound,
|
|
8
|
+
GetUserProfileBranchInvalidResponse,
|
|
9
|
+
GetUserProfileBranchNotFound,
|
|
10
|
+
GetUserProfileBranchProviderRejected,
|
|
11
|
+
GetUserProfileDefinition,
|
|
12
|
+
GetUserProfileInputSchema,
|
|
13
|
+
GetUserProfileMetadata,
|
|
14
|
+
ProviderID,
|
|
15
|
+
UserProfileSchema,
|
|
16
|
+
decodeCredentials,
|
|
17
|
+
newConnection,
|
|
18
|
+
newConnectionWithOperations,
|
|
19
|
+
newProjectConnection
|
|
20
|
+
} from "./chunk-VGRZKZ7B.js";
|
|
21
|
+
|
|
22
|
+
// src/generated/steps.ts
|
|
23
|
+
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
24
|
+
function newGetUserProfileStep(configuration) {
|
|
25
|
+
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
26
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
27
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getUserProfile(), connection: connection.reference, branches: [
|
|
28
|
+
goToBranch("found", found),
|
|
29
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
30
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
31
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
32
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/project.ts
|
|
37
|
+
import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
|
|
38
|
+
import { z } from "zod";
|
|
39
|
+
|
|
40
|
+
// src/client.ts
|
|
41
|
+
import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
42
|
+
import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
|
|
43
|
+
var fieldsToExport = ["external_id", "braze_id", "first_name", "last_name", "email"];
|
|
44
|
+
var emptyProfile = () => ({ externalId: "" });
|
|
45
|
+
var BrazeClient = class {
|
|
46
|
+
/** Validate account endpoint and request limits without contacting Braze. */
|
|
47
|
+
constructor(config, credentials, options = {}) {
|
|
48
|
+
this.credentials = credentials;
|
|
49
|
+
if (!config || !credentials) throw new TypeError("Braze configuration and credentials are required");
|
|
50
|
+
this.baseURL = validateBaseURL(config.baseUrl);
|
|
51
|
+
this.timeoutMs = config.timeoutMs || 15e3;
|
|
52
|
+
this.maxResponseBytes = config.maxResponseBytes || 1048576;
|
|
53
|
+
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0)
|
|
54
|
+
throw new TypeError("Braze request limits must be positive integers");
|
|
55
|
+
this.send = options.send ?? sendProviderRequest;
|
|
56
|
+
}
|
|
57
|
+
credentials;
|
|
58
|
+
baseURL;
|
|
59
|
+
timeoutMs;
|
|
60
|
+
maxResponseBytes;
|
|
61
|
+
send;
|
|
62
|
+
/** Bind the getUserProfile Query. */
|
|
63
|
+
getUserProfile() {
|
|
64
|
+
return new GetUserProfileOperation(this);
|
|
65
|
+
}
|
|
66
|
+
/** Resolve the key and send one bounded profile export request. */
|
|
67
|
+
async post(call, externalID) {
|
|
68
|
+
let token;
|
|
69
|
+
try {
|
|
70
|
+
const credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
71
|
+
token = credentials.restApiKey instanceof SecretString ? credentials.restApiKey.reveal() : "";
|
|
72
|
+
} catch {
|
|
73
|
+
return emptyExchange("credential");
|
|
74
|
+
}
|
|
75
|
+
if (!token || !isHeaderSafeCredential(token)) return emptyExchange("credential");
|
|
76
|
+
const request = {
|
|
77
|
+
url: `${this.baseURL}/users/export/ids`,
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: { Accept: "application/json", "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
80
|
+
body: new TextEncoder().encode(JSON.stringify({ external_ids: [externalID], fields_to_export: fieldsToExport })),
|
|
81
|
+
maxResponseBytes: this.maxResponseBytes,
|
|
82
|
+
timeoutMs: this.timeoutMs,
|
|
83
|
+
addressPolicy: this.baseURL.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP",
|
|
84
|
+
signal: call.context.cancellationSignal
|
|
85
|
+
};
|
|
86
|
+
let response;
|
|
87
|
+
let isTooLarge = false;
|
|
88
|
+
try {
|
|
89
|
+
response = await this.send(request);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (error instanceof BodyTooLargeError && error.status !== void 0) {
|
|
92
|
+
response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
|
|
93
|
+
isTooLarge = true;
|
|
94
|
+
} else return emptyExchange("request");
|
|
95
|
+
}
|
|
96
|
+
const retryAfterMs = parseRetryAfter(header(response.headers, "retry-after"));
|
|
97
|
+
if (isTooLarge || response.body.length > this.maxResponseBytes)
|
|
98
|
+
return { status: response.status, body: new Uint8Array(), retryAfterMs, error: "tooLarge" };
|
|
99
|
+
return { status: response.status, body: response.body, retryAfterMs };
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var GetUserProfileOperation = class {
|
|
103
|
+
/** Bind the provider client. */
|
|
104
|
+
constructor(client) {
|
|
105
|
+
this.client = client;
|
|
106
|
+
}
|
|
107
|
+
client;
|
|
108
|
+
/** Return the generated Query contract. */
|
|
109
|
+
definition() {
|
|
110
|
+
return GetUserProfileDefinition;
|
|
111
|
+
}
|
|
112
|
+
/** Classify provider outcomes consistently with the Go implementation. */
|
|
113
|
+
async invoke(call, input) {
|
|
114
|
+
if (!input || typeof input.externalId !== "string" || !input.externalId.trim() || /[\uD800-\uDFFF]/u.test(input.externalId) || Buffer.byteLength(input.externalId, "utf8") > 987)
|
|
115
|
+
return terminal("defect", "VALIDATION", "external ID must be a nonempty UTF-8 value of at most 987 bytes");
|
|
116
|
+
const exchange = await this.client.post(call, input.externalId);
|
|
117
|
+
if (exchange.error === "credential") return terminal("defect", "AUTHENTICATION", "Braze credentials are unavailable or invalid");
|
|
118
|
+
if (exchange.error === "request") return retry("TRANSPORT", "Braze profile request failed");
|
|
119
|
+
if (exchange.status === 429) return retry("RATE_LIMIT", "Braze rate limited the request", exchange.retryAfterMs);
|
|
120
|
+
if (exchange.status === 408 || exchange.status >= 500) return retry("AVAILABILITY", "Braze is temporarily unavailable", exchange.retryAfterMs);
|
|
121
|
+
if (exchange.status !== 200 && exchange.status !== 201) return terminal("providerRejected", "PROVIDER_REJECTION", `Braze rejected HTTP ${exchange.status}`);
|
|
122
|
+
if (exchange.error === "tooLarge") return terminal("invalidResponse", "RESPONSE_TOO_LARGE", "Braze response exceeded the configured limit");
|
|
123
|
+
const profile = decodeProfile(exchange.body, input.externalId);
|
|
124
|
+
if (profile === void 0) return terminal("invalidResponse", "PROTOCOL", "Braze returned an invalid profile response");
|
|
125
|
+
if (profile === null) return terminal("notFound", "NOT_FOUND", "Braze did not find the user");
|
|
126
|
+
return newQueryBranch("found", profile);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
function emptyExchange(error) {
|
|
130
|
+
return { status: 0, body: new Uint8Array(), retryAfterMs: 0, error };
|
|
131
|
+
}
|
|
132
|
+
function failure(kind, message) {
|
|
133
|
+
return { provider: "braze", operation: "getUserProfile", kind, message };
|
|
134
|
+
}
|
|
135
|
+
function terminal(branch, kind, message) {
|
|
136
|
+
return newQueryBranch(branch, emptyProfile(), {}, failure(kind, message));
|
|
137
|
+
}
|
|
138
|
+
function retry(kind, message, delay = 0) {
|
|
139
|
+
return newQueryRetry(failure(kind, message), delay);
|
|
140
|
+
}
|
|
141
|
+
function header(headers, name) {
|
|
142
|
+
const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
143
|
+
return Array.isArray(entry) ? entry[0] ?? "" : entry ?? "";
|
|
144
|
+
}
|
|
145
|
+
function isObject(value) {
|
|
146
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
147
|
+
}
|
|
148
|
+
function decodeProfile(body, externalID) {
|
|
149
|
+
let raw;
|
|
150
|
+
try {
|
|
151
|
+
raw = JSON.parse(Buffer.from(body).toString("utf8"));
|
|
152
|
+
} catch {
|
|
153
|
+
return void 0;
|
|
154
|
+
}
|
|
155
|
+
if (!isObject(raw) || raw.message !== "success" || !Array.isArray(raw.users) || raw.users.length > 1) return void 0;
|
|
156
|
+
if (raw.users.length === 0) return null;
|
|
157
|
+
const user = raw.users[0];
|
|
158
|
+
if (!isObject(user) || user.external_id !== externalID) return void 0;
|
|
159
|
+
for (const field of ["braze_id", "first_name", "last_name", "email"])
|
|
160
|
+
if (user[field] !== void 0 && user[field] !== null && typeof user[field] !== "string") return void 0;
|
|
161
|
+
const result = { externalId: externalID };
|
|
162
|
+
if (user.braze_id) result.brazeId = user.braze_id;
|
|
163
|
+
if (user.first_name) result.firstName = user.first_name;
|
|
164
|
+
if (user.last_name) result.lastName = user.last_name;
|
|
165
|
+
if (user.email) result.email = user.email;
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/project.ts
|
|
170
|
+
function newProjectConnection2(project, connectionName) {
|
|
171
|
+
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
172
|
+
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "braze" && entry.connectionName === name);
|
|
173
|
+
if (!selected) throw new TypeError("Braze project connection is not configured");
|
|
174
|
+
const fields = z.strictObject({ baseUrl: z.string(), timeout: z.union([z.string(), z.number().int()]).optional(), maxResponseBytes: z.number().int().optional() }).parse(selected.configuration);
|
|
175
|
+
const timeoutMs = typeof fields.timeout === "number" ? Math.ceil(fields.timeout / 1e6) : fields.timeout ? parseDurationMilliseconds(fields.timeout) : void 0;
|
|
176
|
+
const config = {
|
|
177
|
+
baseUrl: fields.baseUrl,
|
|
178
|
+
...timeoutMs !== void 0 ? { timeoutMs } : {},
|
|
179
|
+
...fields.maxResponseBytes !== void 0 ? { maxResponseBytes: fields.maxResponseBytes } : {}
|
|
180
|
+
};
|
|
181
|
+
const credentials = {
|
|
182
|
+
async resolve(_call, signal) {
|
|
183
|
+
const privateFields = await loadedProject.resolveCredential("braze", name, signal);
|
|
184
|
+
if (typeof privateFields.rest_api_key !== "string") throw new TypeError("Braze credentials are unavailable");
|
|
185
|
+
return { restApiKey: new SecretString2(privateFields.rest_api_key) };
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
return new BrazeClient(config, credentials);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function parseDurationMilliseconds(value) {
|
|
192
|
+
let remaining = value;
|
|
193
|
+
let milliseconds = 0;
|
|
194
|
+
const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
|
|
195
|
+
while (remaining) {
|
|
196
|
+
const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
|
|
197
|
+
if (!part) throw new TypeError("Braze timeout must be a positive Go duration");
|
|
198
|
+
milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
|
|
199
|
+
remaining = remaining.slice(part[0].length);
|
|
200
|
+
}
|
|
201
|
+
if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("Braze timeout must resolve to positive whole milliseconds");
|
|
202
|
+
return milliseconds;
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
BrazeClient,
|
|
206
|
+
ConfigSchema,
|
|
207
|
+
Connection,
|
|
208
|
+
ConnectorID,
|
|
209
|
+
GetUserProfileBranch,
|
|
210
|
+
GetUserProfileBranchDefect,
|
|
211
|
+
GetUserProfileBranchFound,
|
|
212
|
+
GetUserProfileBranchInvalidResponse,
|
|
213
|
+
GetUserProfileBranchNotFound,
|
|
214
|
+
GetUserProfileBranchProviderRejected,
|
|
215
|
+
GetUserProfileDefinition,
|
|
216
|
+
GetUserProfileInputSchema,
|
|
217
|
+
GetUserProfileMetadata,
|
|
218
|
+
GetUserProfileOperation,
|
|
219
|
+
ProviderID,
|
|
220
|
+
UserProfileSchema,
|
|
221
|
+
decodeCredentials,
|
|
222
|
+
newConnection,
|
|
223
|
+
newConnectionWithOperations,
|
|
224
|
+
newGetUserProfileStep,
|
|
225
|
+
newProjectConnection2 as newProjectConnection
|
|
226
|
+
};
|
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
|
+
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
+
import { O as Operations, C as Connection, G as GetUserProfileInput, U as UserProfile } from './connection-CJqjLDg0.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for GetUserProfileInput in scripted cases. */
|
|
7
|
+
declare const emptyGetUserProfileInput: GetUserProfileInput;
|
|
8
|
+
/** Go zero value for UserProfile in scripted cases. */
|
|
9
|
+
declare const emptyUserProfile: UserProfile;
|
|
10
|
+
/** Script the found branch. */
|
|
11
|
+
declare function getUserProfileFound(value: UserProfile, failure?: Failure): Case<UserProfile>;
|
|
12
|
+
/** Script the notFound branch. */
|
|
13
|
+
declare function getUserProfileNotFound(value: UserProfile, failure?: Failure): Case<UserProfile>;
|
|
14
|
+
/** Script the providerRejected branch. */
|
|
15
|
+
declare function getUserProfileProviderRejected(value: UserProfile, failure?: Failure): Case<UserProfile>;
|
|
16
|
+
/** Script the invalidResponse branch. */
|
|
17
|
+
declare function getUserProfileInvalidResponse(value: UserProfile, failure?: Failure): Case<UserProfile>;
|
|
18
|
+
/** Script the defect branch. */
|
|
19
|
+
declare function getUserProfileDefect(value: UserProfile, failure?: Failure): Case<UserProfile>;
|
|
20
|
+
/** Script a safe retry of getUserProfile. */
|
|
21
|
+
declare function getUserProfileRetry(failure: Failure, retryAfterMs?: number): Case<UserProfile>;
|
|
22
|
+
/** Manifest scenario foundDefault for getUserProfile. */
|
|
23
|
+
declare function getUserProfileFoundDefault(): Case<UserProfile>;
|
|
24
|
+
/** Default getUserProfile scenario. */
|
|
25
|
+
declare function getUserProfileDefault(): Case<UserProfile>;
|
|
26
|
+
/** Manifest scenario userMissing for getUserProfile. */
|
|
27
|
+
declare function getUserProfileUserMissing(): Case<UserProfile>;
|
|
28
|
+
/** Scripted operations and manifest defaults for this connector. */
|
|
29
|
+
declare class GeneratedMock implements Operations {
|
|
30
|
+
#private;
|
|
31
|
+
constructor(connectionName: string);
|
|
32
|
+
connection(): Connection;
|
|
33
|
+
getUserProfile(): MockQuery<GetUserProfileInput, UserProfile>;
|
|
34
|
+
assertNoFailures(): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { GeneratedMock, GeneratedMock as Mock, emptyGetUserProfileInput, emptyUserProfile, getUserProfileDefault, getUserProfileDefect, getUserProfileFound, getUserProfileFoundDefault, getUserProfileInvalidResponse, getUserProfileNotFound, getUserProfileProviderRejected, getUserProfileRetry, getUserProfileUserMissing };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectorID,
|
|
3
|
+
GetUserProfileDefinition,
|
|
4
|
+
GetUserProfileInputSchema,
|
|
5
|
+
ProviderID,
|
|
6
|
+
UserProfileSchema,
|
|
7
|
+
newConnectionWithOperations
|
|
8
|
+
} from "./chunk-VGRZKZ7B.js";
|
|
9
|
+
|
|
10
|
+
// src/generated/mock.ts
|
|
11
|
+
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
12
|
+
var emptyGetUserProfileInput = GetUserProfileInputSchema.parse({
|
|
13
|
+
"externalId": ""
|
|
14
|
+
});
|
|
15
|
+
var emptyUserProfile = UserProfileSchema.parse({
|
|
16
|
+
"externalId": ""
|
|
17
|
+
});
|
|
18
|
+
function getUserProfileFound(value, failure) {
|
|
19
|
+
return branchCase("found", value, failure);
|
|
20
|
+
}
|
|
21
|
+
function getUserProfileNotFound(value, failure) {
|
|
22
|
+
return branchCase("notFound", value, failure);
|
|
23
|
+
}
|
|
24
|
+
function getUserProfileProviderRejected(value, failure) {
|
|
25
|
+
return branchCase("providerRejected", value, failure);
|
|
26
|
+
}
|
|
27
|
+
function getUserProfileInvalidResponse(value, failure) {
|
|
28
|
+
return branchCase("invalidResponse", value, failure);
|
|
29
|
+
}
|
|
30
|
+
function getUserProfileDefect(value, failure) {
|
|
31
|
+
return branchCase("defect", value, failure);
|
|
32
|
+
}
|
|
33
|
+
function getUserProfileRetry(failure, retryAfterMs = 0) {
|
|
34
|
+
return retryCase(failure, retryAfterMs);
|
|
35
|
+
}
|
|
36
|
+
function getUserProfileFoundDefault() {
|
|
37
|
+
const value = UserProfileSchema.parse({ "brazeId": "sample-braze-1", "email": "reader@example.com", "externalId": "sample-user-1", "firstName": "Avery", "lastName": "Reader" });
|
|
38
|
+
return branchCase("found", value);
|
|
39
|
+
}
|
|
40
|
+
function getUserProfileDefault() {
|
|
41
|
+
return getUserProfileFoundDefault();
|
|
42
|
+
}
|
|
43
|
+
function getUserProfileUserMissing() {
|
|
44
|
+
const value = emptyUserProfile;
|
|
45
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "getUserProfile", message: "Braze did not find the user." });
|
|
46
|
+
}
|
|
47
|
+
var GeneratedMock = class {
|
|
48
|
+
#getUserProfile;
|
|
49
|
+
#connection;
|
|
50
|
+
constructor(connectionName) {
|
|
51
|
+
this.#getUserProfile = newQuery(GetUserProfileDefinition).default(getUserProfileDefault());
|
|
52
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
53
|
+
}
|
|
54
|
+
connection() {
|
|
55
|
+
return this.#connection;
|
|
56
|
+
}
|
|
57
|
+
getUserProfile() {
|
|
58
|
+
return this.#getUserProfile;
|
|
59
|
+
}
|
|
60
|
+
assertNoFailures() {
|
|
61
|
+
this.#getUserProfile.assertNoFailures();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
GeneratedMock,
|
|
66
|
+
GeneratedMock as Mock,
|
|
67
|
+
emptyGetUserProfileInput,
|
|
68
|
+
emptyUserProfile,
|
|
69
|
+
getUserProfileDefault,
|
|
70
|
+
getUserProfileDefect,
|
|
71
|
+
getUserProfileFound,
|
|
72
|
+
getUserProfileFoundDefault,
|
|
73
|
+
getUserProfileInvalidResponse,
|
|
74
|
+
getUserProfileNotFound,
|
|
75
|
+
getUserProfileProviderRejected,
|
|
76
|
+
getUserProfileRetry,
|
|
77
|
+
getUserProfileUserMissing
|
|
78
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-braze",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Braze connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/braze/typescript"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
14
|
+
},
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./mock": {
|
|
23
|
+
"types": "./dist/mock.d.ts",
|
|
24
|
+
"import": "./dist/mock.js"
|
|
25
|
+
},
|
|
26
|
+
"./dex-connector.json": "./dex-connector.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"dex-connector.json"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prepack": "npm run build",
|
|
36
|
+
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"lint": "eslint src test examples",
|
|
39
|
+
"test": "vitest run --exclude test/integration/**",
|
|
40
|
+
"test:integration": "vitest run test/integration/*.integration.test.ts",
|
|
41
|
+
"example:worker": "tsx examples/profile-inspection/worker.ts",
|
|
42
|
+
"example:start": "tsx examples/profile-inspection/start.ts",
|
|
43
|
+
"check": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@superdurable/connectors-sdk": "0.1.1",
|
|
47
|
+
"@superdurable/dex": ">=1.28.0",
|
|
48
|
+
"zod": "^4.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@eslint/js": "^9.0.0",
|
|
52
|
+
"@types/node": "^22.0.0",
|
|
53
|
+
"eslint": "^9.0.0",
|
|
54
|
+
"tsup": "^8.0.0",
|
|
55
|
+
"tsx": "^4.23.15",
|
|
56
|
+
"typescript": "^5.9.0",
|
|
57
|
+
"typescript-eslint": "^8.0.0",
|
|
58
|
+
"vitest": "^3.0.0",
|
|
59
|
+
"yaml": "^2.9.1"
|
|
60
|
+
}
|
|
61
|
+
}
|