@seamapi/http 1.17.0 → 1.18.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/dist/connect.cjs +119 -1
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +112 -211
- package/lib/seam/connect/auth.js +6 -1
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/resolve-action-attempt.d.ts +108 -280
- package/lib/seam/connect/routes/acs-encoders-simulate.d.ts +33 -0
- package/lib/seam/connect/routes/acs-encoders-simulate.js +112 -0
- package/lib/seam/connect/routes/acs-encoders-simulate.js.map +1 -0
- package/lib/seam/connect/routes/acs-encoders.d.ts +2 -0
- package/lib/seam/connect/routes/acs-encoders.js +4 -0
- package/lib/seam/connect/routes/acs-encoders.js.map +1 -1
- package/lib/seam/connect/routes/index.d.ts +1 -0
- package/lib/seam/connect/routes/index.js +1 -0
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +6 -4
- package/src/lib/seam/connect/auth.ts +5 -2
- package/src/lib/seam/connect/routes/acs-encoders-simulate.ts +248 -0
- package/src/lib/seam/connect/routes/acs-encoders.ts +5 -0
- package/src/lib/seam/connect/routes/index.ts +1 -0
- package/src/lib/version.ts +1 -1
package/dist/connect.cjs
CHANGED
|
@@ -449,7 +449,10 @@ var warnOnInsecureuserIdentifierKey = (userIdentifierKey) => {
|
|
|
449
449
|
);
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
|
-
var isEmail = (value) =>
|
|
452
|
+
var isEmail = (value) => {
|
|
453
|
+
if (value.includes("!")) return false;
|
|
454
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
455
|
+
};
|
|
453
456
|
|
|
454
457
|
// src/lib/seam/connect/seam-http-error.ts
|
|
455
458
|
var SeamHttpApiError = class extends Error {
|
|
@@ -2463,6 +2466,117 @@ var SeamHttpAcs = class _SeamHttpAcs {
|
|
|
2463
2466
|
}
|
|
2464
2467
|
};
|
|
2465
2468
|
|
|
2469
|
+
// src/lib/seam/connect/routes/acs-encoders-simulate.ts
|
|
2470
|
+
var SeamHttpAcsEncodersSimulate = class _SeamHttpAcsEncodersSimulate {
|
|
2471
|
+
constructor(apiKeyOrOptions = {}) {
|
|
2472
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
2473
|
+
this.client = "client" in options ? options.client : createClient(options);
|
|
2474
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
2475
|
+
}
|
|
2476
|
+
static fromClient(client, options = {}) {
|
|
2477
|
+
const constructorOptions = { ...options, client };
|
|
2478
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
2479
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
2480
|
+
}
|
|
2481
|
+
return new _SeamHttpAcsEncodersSimulate(constructorOptions);
|
|
2482
|
+
}
|
|
2483
|
+
static fromApiKey(apiKey, options = {}) {
|
|
2484
|
+
const constructorOptions = { ...options, apiKey };
|
|
2485
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
2486
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
2487
|
+
}
|
|
2488
|
+
return new _SeamHttpAcsEncodersSimulate(constructorOptions);
|
|
2489
|
+
}
|
|
2490
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
2491
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
2492
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
2493
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
2494
|
+
}
|
|
2495
|
+
return new _SeamHttpAcsEncodersSimulate(constructorOptions);
|
|
2496
|
+
}
|
|
2497
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
2498
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
2499
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
2500
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
2501
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2502
|
+
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
2503
|
+
);
|
|
2504
|
+
}
|
|
2505
|
+
const client = createClient(clientOptions);
|
|
2506
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
2507
|
+
const { token } = await clientSessions.getOrCreate({
|
|
2508
|
+
user_identifier_key: userIdentifierKey
|
|
2509
|
+
});
|
|
2510
|
+
return _SeamHttpAcsEncodersSimulate.fromClientSessionToken(token, options);
|
|
2511
|
+
}
|
|
2512
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2513
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2514
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2515
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2516
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2517
|
+
);
|
|
2518
|
+
}
|
|
2519
|
+
return new _SeamHttpAcsEncodersSimulate(constructorOptions);
|
|
2520
|
+
}
|
|
2521
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2522
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2523
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2524
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2525
|
+
"Missing personalAccessToken or workspaceId"
|
|
2526
|
+
);
|
|
2527
|
+
}
|
|
2528
|
+
return new _SeamHttpAcsEncodersSimulate(constructorOptions);
|
|
2529
|
+
}
|
|
2530
|
+
async updateClientSessionToken(clientSessionToken) {
|
|
2531
|
+
const { headers } = this.client.defaults;
|
|
2532
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
2533
|
+
clientSessionToken
|
|
2534
|
+
});
|
|
2535
|
+
for (const key of Object.keys(authHeaders)) {
|
|
2536
|
+
if (headers[key] == null) {
|
|
2537
|
+
throw new Error(
|
|
2538
|
+
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
2539
|
+
);
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
2543
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
2544
|
+
await clientSessions.get();
|
|
2545
|
+
}
|
|
2546
|
+
nextCredentialEncodeWillFail(body) {
|
|
2547
|
+
return new SeamHttpRequest(this, {
|
|
2548
|
+
path: "/acs/encoders/simulate/next_credential_encode_will_fail",
|
|
2549
|
+
method: "post",
|
|
2550
|
+
body,
|
|
2551
|
+
responseKey: void 0
|
|
2552
|
+
});
|
|
2553
|
+
}
|
|
2554
|
+
nextCredentialEncodeWillSucceed(body) {
|
|
2555
|
+
return new SeamHttpRequest(this, {
|
|
2556
|
+
path: "/acs/encoders/simulate/next_credential_encode_will_succeed",
|
|
2557
|
+
method: "post",
|
|
2558
|
+
body,
|
|
2559
|
+
responseKey: void 0
|
|
2560
|
+
});
|
|
2561
|
+
}
|
|
2562
|
+
nextCredentialScanWillFail(body) {
|
|
2563
|
+
return new SeamHttpRequest(this, {
|
|
2564
|
+
path: "/acs/encoders/simulate/next_credential_scan_will_fail",
|
|
2565
|
+
method: "post",
|
|
2566
|
+
body,
|
|
2567
|
+
responseKey: void 0
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
nextCredentialScanWillSucceed(body) {
|
|
2571
|
+
return new SeamHttpRequest(this, {
|
|
2572
|
+
path: "/acs/encoders/simulate/next_credential_scan_will_succeed",
|
|
2573
|
+
method: "post",
|
|
2574
|
+
body,
|
|
2575
|
+
responseKey: void 0
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
};
|
|
2579
|
+
|
|
2466
2580
|
// src/lib/seam/connect/routes/acs-encoders.ts
|
|
2467
2581
|
var SeamHttpAcsEncoders = class _SeamHttpAcsEncoders {
|
|
2468
2582
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -2540,6 +2654,9 @@ var SeamHttpAcsEncoders = class _SeamHttpAcsEncoders {
|
|
|
2540
2654
|
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
2541
2655
|
await clientSessions.get();
|
|
2542
2656
|
}
|
|
2657
|
+
get simulate() {
|
|
2658
|
+
return SeamHttpAcsEncodersSimulate.fromClient(this.client, this.defaults);
|
|
2659
|
+
}
|
|
2543
2660
|
encodeCredential(body, options = {}) {
|
|
2544
2661
|
return new SeamHttpRequest(this, {
|
|
2545
2662
|
path: "/acs/encoders/encode_credential",
|
|
@@ -5042,6 +5159,7 @@ exports.SeamHttpAcsCredentialProvisioningAutomations = SeamHttpAcsCredentialProv
|
|
|
5042
5159
|
exports.SeamHttpAcsCredentials = SeamHttpAcsCredentials;
|
|
5043
5160
|
exports.SeamHttpAcsCredentialsUnmanaged = SeamHttpAcsCredentialsUnmanaged;
|
|
5044
5161
|
exports.SeamHttpAcsEncoders = SeamHttpAcsEncoders;
|
|
5162
|
+
exports.SeamHttpAcsEncodersSimulate = SeamHttpAcsEncodersSimulate;
|
|
5045
5163
|
exports.SeamHttpAcsEntrances = SeamHttpAcsEntrances;
|
|
5046
5164
|
exports.SeamHttpAcsSystems = SeamHttpAcsSystems;
|
|
5047
5165
|
exports.SeamHttpAcsUsers = SeamHttpAcsUsers;
|