New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

seamapi

Package Overview
Dependencies
Maintainers
2
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seamapi - npm Package Compare versions

Comparing version 6.13.0 to 6.14.3

dist/chunk-CECLNLBS.mjs

2

dist/cli/browser.d.ts
import TypedEmitter from 'typed-emitter';
import { a as SeamClientOptions } from '../client-9d498097';
import { S as SeamClientOptions } from '../client-b5d4abea.js';
import 'axios';

@@ -4,0 +4,0 @@ import 'seamapi-types';

@@ -5,6 +5,35 @@ #!/usr/bin/env node

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __export = (target, all) => {

@@ -23,5 +52,29 @@ for (var name in all)

var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};

@@ -196,6 +249,5 @@ // src/cli/entry.ts

method: "POST",
data: {
...params,
since: (_a = params == null ? void 0 : params.since) != null ? _a : new Date(0).toISOString()
}
data: __spreadProps(__spreadValues({}, params), {
since: (_a = params == null ? void 0 : params.since) != null ? _a : (/* @__PURE__ */ new Date(0)).toISOString()
})
});

@@ -271,17 +323,22 @@ }

}),
create: async (params) => this.makeRequestAndFormat("access_code", {
url: "/access_codes/create",
method: "POST",
data: params
}),
createMultiple: async (params) => this.makeRequestAndFormat(
"access_codes",
{
url: "/access_codes/create_multiple",
create: (params) => __async(this, null, function* () {
return this.makeRequestAndFormat("access_code", {
url: "/access_codes/create",
method: "POST",
data: params
}
),
update: async (params) => {
const action = await this.createActionAttemptAndWait({
});
}),
createMultiple: (params) => __async(this, null, function* () {
return this.makeRequestAndFormat(
"access_codes",
{
url: "/access_codes/create_multiple",
method: "POST",
data: params
}
);
}),
// We can't narrow the return type here like we do with create because we're given partial input
update: (params) => __async(this, null, function* () {
const action = yield this.createActionAttemptAndWait({
url: "/access_codes/update",

@@ -292,3 +349,3 @@ method: "POST",

return action.access_code;
},
}),
delete: (params) => this.createActionAttemptAndWait({

@@ -395,6 +452,8 @@ url: "/access_codes/delete",

this.deviceModels = {
list: ({
acknowledge_intentional_use_of_internal_api = false,
...params
} = {}) => {
list: (_a = {}) => {
var _b = _a, {
acknowledge_intentional_use_of_internal_api = false
} = _b, params = __objRest(_b, [
"acknowledge_intentional_use_of_internal_api"
]);
if (acknowledge_intentional_use_of_internal_api !== true) {

@@ -470,37 +529,43 @@ throw new Error("This is an internal endpoint and should not be used.");

}
async awaitActionAttempt(actionAttempt) {
let fetchedActionAttempt = actionAttempt;
if (fetchedActionAttempt.status === "pending") {
await (0, import_p_retry.default)(
async () => {
fetchedActionAttempt = await this.actionAttempts.get(
fetchedActionAttempt.action_attempt_id
);
if (fetchedActionAttempt.status === "pending") {
throw new Error("Action attempt is still pending");
}
},
{ maxTimeout: 60 * 1e3 }
);
}
if (fetchedActionAttempt.status === "error") {
throw new SeamActionAttemptError(
fetchedActionAttempt.error.type,
fetchedActionAttempt.error.message,
fetchedActionAttempt.action_type
);
}
return fetchedActionAttempt;
awaitActionAttempt(actionAttempt) {
return __async(this, null, function* () {
let fetchedActionAttempt = actionAttempt;
if (fetchedActionAttempt.status === "pending") {
yield (0, import_p_retry.default)(
() => __async(this, null, function* () {
fetchedActionAttempt = yield this.actionAttempts.get(
fetchedActionAttempt.action_attempt_id
);
if (fetchedActionAttempt.status === "pending") {
throw new Error("Action attempt is still pending");
}
}),
// @ts-expect-error UPSTREAM: https://github.com/DefinitelyTyped/DefinitelyTyped/commit/6f77b38130593a06e1988f1d3df162823ae186af#commitcomment-72928468
{ maxTimeout: 60 * 1e3 }
);
}
if (fetchedActionAttempt.status === "error") {
throw new SeamActionAttemptError(
fetchedActionAttempt.error.type,
fetchedActionAttempt.error.message,
fetchedActionAttempt.action_type
);
}
return fetchedActionAttempt;
});
}
async makeRequestAndFormat(innerObjectName, request) {
const response = await this.makeRequest(request);
return response[innerObjectName];
makeRequestAndFormat(innerObjectName, request) {
return __async(this, null, function* () {
const response = yield this.makeRequest(request);
return response[innerObjectName];
});
}
async createActionAttemptAndWait(request) {
const pendingActionAttempt = await this.makeRequestAndFormat("action_attempt", request);
const actionAttempt = await this.awaitActionAttempt(pendingActionAttempt);
return {
...actionAttempt.result,
actionAttempt
};
createActionAttemptAndWait(request) {
return __async(this, null, function* () {
const pendingActionAttempt = yield this.makeRequestAndFormat("action_attempt", request);
const actionAttempt = yield this.awaitActionAttempt(pendingActionAttempt);
return __spreadProps(__spreadValues({}, actionAttempt.result), {
actionAttempt
});
});
}

@@ -510,3 +575,3 @@ };

// package.json
var version = "6.13.0";
var version = "6.14.3";

@@ -522,5 +587,5 @@ // src/seam-connect/client.ts

if (typeof apiKeyOrOptions === "string") {
return { ...seamClientDefaults, apiKey: apiKeyOrOptions };
return __spreadProps(__spreadValues({}, seamClientDefaults), { apiKey: apiKeyOrOptions });
} else {
return { ...seamClientDefaults, ...apiKeyOrOptions };
return __spreadValues(__spreadValues({}, seamClientDefaults), apiKeyOrOptions);
}

@@ -537,15 +602,10 @@ };

});
const headers = {
...axiosOptions == null ? void 0 : axiosOptions.headers,
...authHeaders,
...!workspaceId ? {} : { "Seam-Workspace": workspaceId }
};
const headers = __spreadValues(__spreadValues(__spreadValues({}, axiosOptions == null ? void 0 : axiosOptions.headers), authHeaders), !workspaceId ? {} : { "Seam-Workspace": workspaceId });
if (typeof window === "undefined") {
headers["User-Agent"] = `Javascript SDK v${version}, Node.js mode, (https://github.com/seamapi/javascript)`;
}
this.client = import_axios.default.create({
...axiosOptions,
this.client = import_axios.default.create(__spreadProps(__spreadValues({}, axiosOptions), {
baseURL: endpoint,
headers
});
}));
(0, import_axios_retry.default)(this.client, {

@@ -556,52 +616,53 @@ retries: 2,

}
async makeRequest(request) {
return makeRequest(this.client, request);
makeRequest(request) {
return __async(this, null, function* () {
return makeRequest(this.client, request);
});
}
static async getClientSessionToken(options) {
const { apiKey, endpoint, axiosOptions } = getSeamClientOptionsWithDefaults(options);
if (!options.userIdentifierKey) {
throw new Error("userIdentifierKey is required");
}
if (isEmail(options.userIdentifierKey)) {
console.warn(`Using an email for the userIdentifierKey!
static getClientSessionToken(options) {
return __async(this, null, function* () {
const { apiKey, endpoint, axiosOptions } = getSeamClientOptionsWithDefaults(options);
if (!options.userIdentifierKey) {
throw new Error("userIdentifierKey is required");
}
if (isEmail(options.userIdentifierKey)) {
console.warn(`Using an email for the userIdentifierKey!
This is insecure because an email is common knowledge or easily guessed.
Use something with sufficient entropy know only to the owner of the client session (like a server-generated UUID).`);
}
const getKeyHeaders = () => {
const { publishableKey } = options;
if (publishableKey) {
if (!publishableKey.startsWith("seam_pk")) {
throw new Error("Invalid publishableKey");
}
return { "seam-publishable-key": publishableKey };
}
if (apiKey) {
if (!(apiKey == null ? void 0 : apiKey.startsWith("seam_"))) {
throw new Error("Invalid apiKey");
const getKeyHeaders = () => {
const { publishableKey } = options;
if (publishableKey) {
if (!publishableKey.startsWith("seam_pk")) {
throw new Error("Invalid publishableKey");
}
return { "seam-publishable-key": publishableKey };
}
return { "seam-api-key": apiKey };
}
throw new Error("Must provide a publishableKey or apiKey");
};
const headers = {
...getKeyHeaders(),
...axiosOptions == null ? void 0 : axiosOptions.headers
};
const client = import_axios.default.create({
...axiosOptions,
baseURL: endpoint,
headers
if (apiKey) {
if (!(apiKey == null ? void 0 : apiKey.startsWith("seam_"))) {
throw new Error("Invalid apiKey");
}
return { "seam-api-key": apiKey };
}
throw new Error("Must provide a publishableKey or apiKey");
};
const headers = __spreadValues(__spreadValues({}, getKeyHeaders()), axiosOptions == null ? void 0 : axiosOptions.headers);
const client = import_axios.default.create(__spreadProps(__spreadValues({}, axiosOptions), {
baseURL: endpoint,
headers
}));
return makeRequest(client, {
method: "PUT",
url: "/client_sessions/create",
data: { user_identifier_key: options.userIdentifierKey }
});
});
return makeRequest(client, {
method: "PUT",
url: "/client_sessions/create",
data: { user_identifier_key: options.userIdentifierKey }
});
}
};
var isValueUsedForBearerAuthentication = (value) => value.startsWith("seam_at") || value.startsWith("ey");
var makeRequest = async (client, request) => {
var isValueUsedForBearerAuthentication = (value) => value.startsWith("seam_at") || /** Exclude JWT tokens as well */
value.startsWith("ey");
var makeRequest = (client, request) => __async(void 0, null, function* () {
var _a;
try {
const response = await client.request(request);
const response = yield client.request(request);
return response.data;

@@ -623,3 +684,3 @@ } catch (error) {

}
};
});
var getAuthHeaders = ({

@@ -696,7 +757,7 @@ clientSessionToken,

// src/cli/lib/execute-command.ts
var executeCommand = async (methodName, args, executeArgs) => {
var executeCommand = (methodName, args, executeArgs) => __async(void 0, null, function* () {
let spinner = void 0;
const displaySpinner = typeof window === "undefined" && !(executeArgs.quiet || executeArgs.json);
if (displaySpinner) {
const ora = await Promise.resolve().then(() => __toESM(require("ora")));
const ora = yield import("ora");
spinner = ora.default(

@@ -712,3 +773,3 @@ methodName.split(".").map((v) => (0, import_change_case.paramCase)(v)).join(".")

try {
const result = await method(...args);
const result = yield method(...args);
spinner == null ? void 0 : spinner.succeed();

@@ -734,3 +795,3 @@ if (executeArgs.json) {

}
};
});
var execute_command_default = executeCommand;

@@ -754,4 +815,4 @@

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"accessCodes.list",

@@ -765,3 +826,3 @@ [

);
}
})
).command(

@@ -790,4 +851,4 @@ "get <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"accessCodes.get",

@@ -803,3 +864,3 @@ [

);
}
})
).command(

@@ -830,5 +891,5 @@ "create",

},
async (argv) => {
(argv) => __async(void 0, null, function* () {
if (argv.startsAt && argv.endsAt) {
await execute_command_default(
yield execute_command_default(
"accessCodes.create",

@@ -847,3 +908,3 @@ [

} else {
await execute_command_default(
yield execute_command_default(
"accessCodes.create",

@@ -855,2 +916,3 @@ [

code: argv.code
// see https://github.com/microsoft/TypeScript/issues/32164
}

@@ -861,3 +923,3 @@ ],

}
}
})
).command(

@@ -873,4 +935,4 @@ "delete <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"accessCodes.delete",

@@ -884,3 +946,3 @@ [

);
}
})
);

@@ -913,5 +975,5 @@ },

},
async (argv) => {
await execute_command_default("actionAttempts.get", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("actionAttempts.get", [argv.id], argv);
})
);

@@ -946,4 +1008,4 @@ },

name: "initiate_two_factor_pane",
getInput: async ({ options }) => {
const { id } = await (0, import_prompts.default)(
getInput: (_0) => __async(void 0, [_0], function* ({ options }) {
const { id } = yield (0, import_prompts.default)(
{

@@ -965,3 +1027,3 @@ type: "select",

return { id };
}
})
};

@@ -974,6 +1036,6 @@ var initiate_two_factor_pane_default = initiateTwoFactorPane;

name: "login_pane",
getInput: async (props) => {
getInput: (props) => __async(void 0, null, function* () {
let userIdentifier;
if (props.accepted_user_identifiers.length > 1) {
userIdentifier = (await (0, import_prompts2.default)(
userIdentifier = (yield (0, import_prompts2.default)(
{

@@ -999,3 +1061,3 @@ name: "userIdentifier",

}
const response = await (0, import_prompts2.default)(
const response = yield (0, import_prompts2.default)(
[

@@ -1020,3 +1082,3 @@ {

return response;
}
})
};

@@ -1042,6 +1104,6 @@ var login_pane_default = loginPane;

name: "redirect_pane",
getInput: async (props) => {
await (0, import_open.default)(props.redirect_url);
getInput: (props) => __async(void 0, null, function* () {
yield (0, import_open.default)(props.redirect_url);
throw new ContinueOutsideCLIError("You must continue in the browser");
}
})
};

@@ -1054,4 +1116,4 @@ var redirect_pane_default = redirectPane;

name: "search_and_select_pane",
getInput: async ({ title, options }) => {
const { selection } = await (0, import_prompts3.default)(
getInput: (_0) => __async(void 0, [_0], function* ({ title, options }) {
const { selection } = yield (0, import_prompts3.default)(
{

@@ -1073,3 +1135,3 @@ name: "selection",

return { value: selection };
}
})
};

@@ -1082,4 +1144,4 @@ var search_and_select_pane_default = searchAndSelectPane;

name: "two_factor_pane",
getInput: async ({ code_length }) => {
const { code } = await (0, import_prompts4.default)(
getInput: (_0) => __async(void 0, [_0], function* ({ code_length }) {
const { code } = yield (0, import_prompts4.default)(
{

@@ -1103,3 +1165,3 @@ type: "text",

return { code };
}
})
};

@@ -1118,3 +1180,3 @@ var two_factor_pane_default = twoFactorPane;

// src/cli/lib/interactive-login/complete-interactive-login.ts
var completeInteractiveLogin = async (connectWebviewId, args) => {
var completeInteractiveLogin = (connectWebviewId, args) => __async(void 0, null, function* () {
const { client } = get_client_from_args_default(args);

@@ -1124,3 +1186,3 @@ const displaySpinner = typeof window === "undefined" && !args.quiet;

if (displaySpinner) {
const ora = await Promise.resolve().then(() => __toESM(require("ora")));
const ora = yield import("ora");
spinner = ora.default("Logging in...");

@@ -1133,3 +1195,3 @@ }

spinner == null ? void 0 : spinner.start("Loading...");
const { data } = await client.post(
const { data } = yield client.post(
"/internal/connect_webviews/login/next",

@@ -1157,3 +1219,3 @@ {

try {
submit_args = await handler.getInput(currentPane.render_props);
submit_args = yield handler.getInput(currentPane.render_props);
} catch (error) {

@@ -1178,3 +1240,3 @@ if (error instanceof ContinueOutsideCLIError) {

spinner == null ? void 0 : spinner.succeed("\u{1F389} login successful!");
};
});
var complete_interactive_login_default = completeInteractiveLogin;

@@ -1193,5 +1255,5 @@

},
async (yargs3) => {
await execute_command_default("connectWebviews.list", [], yargs3);
}
(yargs3) => __async(void 0, null, function* () {
yield execute_command_default("connectWebviews.list", [], yargs3);
})
).command(

@@ -1207,5 +1269,5 @@ "get <id>",

},
async (argv) => {
await execute_command_default("connectWebviews.get", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("connectWebviews.get", [argv.id], argv);
})
).command(

@@ -1221,5 +1283,5 @@ "login <id>",

},
async (argv) => {
await complete_interactive_login_default(argv.id, argv);
}
(argv) => __async(void 0, null, function* () {
yield complete_interactive_login_default(argv.id, argv);
})
).command(

@@ -1247,4 +1309,4 @@ "create",

},
async (argv) => {
const { connect_webview_id } = await execute_command_default(
(argv) => __async(void 0, null, function* () {
const { connect_webview_id } = yield execute_command_default(
"connectWebviews.create",

@@ -1259,5 +1321,5 @@ [

if (argv.login) {
await complete_interactive_login_default(connect_webview_id, argv);
yield complete_interactive_login_default(connect_webview_id, argv);
}
}
})
).command(

@@ -1273,4 +1335,4 @@ "delete <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"connectWebviews.delete",

@@ -1284,3 +1346,3 @@ [

);
}
})
);

@@ -1308,5 +1370,5 @@ },

},
async (argv) => {
await execute_command_default("connectedAccounts.list", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("connectedAccounts.list", [], argv);
})
).command(

@@ -1330,4 +1392,4 @@ "get",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"connectedAccounts.get",

@@ -1342,3 +1404,3 @@ [

);
}
})
).command(

@@ -1362,4 +1424,4 @@ "delete",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"connectedAccounts.delete",

@@ -1374,3 +1436,3 @@ [

);
}
})
);

@@ -1409,4 +1471,4 @@ },

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"devices.get",

@@ -1416,3 +1478,3 @@ [argv.name ? { name: argv.name } : { device_id: argv.id }],

);
}
})
).command(

@@ -1428,4 +1490,4 @@ "list",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"devices.list",

@@ -1435,3 +1497,3 @@ [{ connected_account_id: argv.connectedAccountId }],

);
}
})
).command(

@@ -1458,4 +1520,4 @@ "update <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"devices.update",

@@ -1472,3 +1534,3 @@ [

);
}
})
).command(

@@ -1484,5 +1546,5 @@ "delete",

},
async (argv) => {
await execute_command_default("devices.delete", [{ device_id: argv.id }], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("devices.delete", [{ device_id: argv.id }], argv);
})
).command(

@@ -1497,4 +1559,4 @@ "list_device_providers",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"devices.listDeviceProviders",

@@ -1504,3 +1566,3 @@ [{ provider_category: argv.providerCategory }],

);
}
})
);

@@ -1533,5 +1595,5 @@ },

},
async (argv) => {
await execute_command_default("locks.get", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("locks.get", [argv.id], argv);
})
).command(

@@ -1547,5 +1609,5 @@ "list",

},
async (argv) => {
await execute_command_default("locks.list", [argv.connectedAccountId], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("locks.list", [argv.connectedAccountId], argv);
})
).command(

@@ -1561,5 +1623,5 @@ "lock-door <id>",

},
async (argv) => {
await execute_command_default("locks.lockDoor", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("locks.lockDoor", [argv.id], argv);
})
).command(

@@ -1575,5 +1637,5 @@ "unlock-door <id>",

},
async (argv) => {
await execute_command_default("locks.unlockDoor", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("locks.unlockDoor", [argv.id], argv);
})
);

@@ -1600,5 +1662,5 @@ },

(yargs3) => yargs3,
async (argv) => {
await execute_command_default("workspaces.get", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("workspaces.get", [], argv);
})
).command(

@@ -1608,5 +1670,5 @@ "list",

(yargs3) => yargs3,
async (argv) => {
await execute_command_default("workspaces.list", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("workspaces.list", [], argv);
})
).command(

@@ -1616,5 +1678,5 @@ "reset-sandbox",

(yargs3) => yargs3,
async (argv) => {
await execute_command_default("workspaces.resetSandbox", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("workspaces.resetSandbox", [], argv);
})
);

@@ -1641,5 +1703,5 @@ },

(yargs3) => yargs3,
async (argv) => {
await execute_command_default("webhooks.list", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("webhooks.list", [], argv);
})
).command(

@@ -1655,5 +1717,5 @@ "get <id>",

},
async (argv) => {
await execute_command_default("webhooks.get", [{ webhook_id: argv.id }], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("webhooks.get", [{ webhook_id: argv.id }], argv);
})
).command(

@@ -1669,5 +1731,5 @@ "create <url>",

},
async (argv) => {
await execute_command_default("webhooks.create", [{ url: argv.url }], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("webhooks.create", [{ url: argv.url }], argv);
})
).command(

@@ -1683,4 +1745,4 @@ "delete <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"webhooks.delete",

@@ -1690,3 +1752,3 @@ [{ webhook_id: argv.id }],

);
}
})
);

@@ -1719,4 +1781,4 @@ },

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"noiseThresholds.list",

@@ -1730,3 +1792,3 @@ [

);
}
})
).command(

@@ -1764,4 +1826,4 @@ "create",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"noiseThresholds.create",

@@ -1780,3 +1842,3 @@ [

);
}
})
).command(

@@ -1818,4 +1880,4 @@ "update",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"noiseThresholds.update",

@@ -1835,3 +1897,3 @@ [

);
}
})
).command(

@@ -1851,4 +1913,4 @@ "delete",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"noiseThresholds.delete",

@@ -1863,3 +1925,3 @@ [

);
}
})
);

@@ -1866,0 +1928,0 @@ },

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __export = (target, all) => {

@@ -21,2 +50,6 @@ for (var name in all)

var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,

@@ -26,2 +59,22 @@ mod

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};

@@ -199,6 +252,5 @@ // src/cli/index.ts

method: "POST",
data: {
...params,
since: (_a = params == null ? void 0 : params.since) != null ? _a : new Date(0).toISOString()
}
data: __spreadProps(__spreadValues({}, params), {
since: (_a = params == null ? void 0 : params.since) != null ? _a : (/* @__PURE__ */ new Date(0)).toISOString()
})
});

@@ -274,17 +326,22 @@ }

}),
create: async (params) => this.makeRequestAndFormat("access_code", {
url: "/access_codes/create",
method: "POST",
data: params
}),
createMultiple: async (params) => this.makeRequestAndFormat(
"access_codes",
{
url: "/access_codes/create_multiple",
create: (params) => __async(this, null, function* () {
return this.makeRequestAndFormat("access_code", {
url: "/access_codes/create",
method: "POST",
data: params
}
),
update: async (params) => {
const action = await this.createActionAttemptAndWait({
});
}),
createMultiple: (params) => __async(this, null, function* () {
return this.makeRequestAndFormat(
"access_codes",
{
url: "/access_codes/create_multiple",
method: "POST",
data: params
}
);
}),
// We can't narrow the return type here like we do with create because we're given partial input
update: (params) => __async(this, null, function* () {
const action = yield this.createActionAttemptAndWait({
url: "/access_codes/update",

@@ -295,3 +352,3 @@ method: "POST",

return action.access_code;
},
}),
delete: (params) => this.createActionAttemptAndWait({

@@ -398,6 +455,8 @@ url: "/access_codes/delete",

this.deviceModels = {
list: ({
acknowledge_intentional_use_of_internal_api = false,
...params
} = {}) => {
list: (_a = {}) => {
var _b = _a, {
acknowledge_intentional_use_of_internal_api = false
} = _b, params = __objRest(_b, [
"acknowledge_intentional_use_of_internal_api"
]);
if (acknowledge_intentional_use_of_internal_api !== true) {

@@ -473,37 +532,43 @@ throw new Error("This is an internal endpoint and should not be used.");

}
async awaitActionAttempt(actionAttempt) {
let fetchedActionAttempt = actionAttempt;
if (fetchedActionAttempt.status === "pending") {
await (0, import_p_retry.default)(
async () => {
fetchedActionAttempt = await this.actionAttempts.get(
fetchedActionAttempt.action_attempt_id
);
if (fetchedActionAttempt.status === "pending") {
throw new Error("Action attempt is still pending");
}
},
{ maxTimeout: 60 * 1e3 }
);
}
if (fetchedActionAttempt.status === "error") {
throw new SeamActionAttemptError(
fetchedActionAttempt.error.type,
fetchedActionAttempt.error.message,
fetchedActionAttempt.action_type
);
}
return fetchedActionAttempt;
awaitActionAttempt(actionAttempt) {
return __async(this, null, function* () {
let fetchedActionAttempt = actionAttempt;
if (fetchedActionAttempt.status === "pending") {
yield (0, import_p_retry.default)(
() => __async(this, null, function* () {
fetchedActionAttempt = yield this.actionAttempts.get(
fetchedActionAttempt.action_attempt_id
);
if (fetchedActionAttempt.status === "pending") {
throw new Error("Action attempt is still pending");
}
}),
// @ts-expect-error UPSTREAM: https://github.com/DefinitelyTyped/DefinitelyTyped/commit/6f77b38130593a06e1988f1d3df162823ae186af#commitcomment-72928468
{ maxTimeout: 60 * 1e3 }
);
}
if (fetchedActionAttempt.status === "error") {
throw new SeamActionAttemptError(
fetchedActionAttempt.error.type,
fetchedActionAttempt.error.message,
fetchedActionAttempt.action_type
);
}
return fetchedActionAttempt;
});
}
async makeRequestAndFormat(innerObjectName, request) {
const response = await this.makeRequest(request);
return response[innerObjectName];
makeRequestAndFormat(innerObjectName, request) {
return __async(this, null, function* () {
const response = yield this.makeRequest(request);
return response[innerObjectName];
});
}
async createActionAttemptAndWait(request) {
const pendingActionAttempt = await this.makeRequestAndFormat("action_attempt", request);
const actionAttempt = await this.awaitActionAttempt(pendingActionAttempt);
return {
...actionAttempt.result,
actionAttempt
};
createActionAttemptAndWait(request) {
return __async(this, null, function* () {
const pendingActionAttempt = yield this.makeRequestAndFormat("action_attempt", request);
const actionAttempt = yield this.awaitActionAttempt(pendingActionAttempt);
return __spreadProps(__spreadValues({}, actionAttempt.result), {
actionAttempt
});
});
}

@@ -513,3 +578,3 @@ };

// package.json
var version = "6.13.0";
var version = "6.14.3";

@@ -525,5 +590,5 @@ // src/seam-connect/client.ts

if (typeof apiKeyOrOptions === "string") {
return { ...seamClientDefaults, apiKey: apiKeyOrOptions };
return __spreadProps(__spreadValues({}, seamClientDefaults), { apiKey: apiKeyOrOptions });
} else {
return { ...seamClientDefaults, ...apiKeyOrOptions };
return __spreadValues(__spreadValues({}, seamClientDefaults), apiKeyOrOptions);
}

@@ -540,15 +605,10 @@ };

});
const headers = {
...axiosOptions == null ? void 0 : axiosOptions.headers,
...authHeaders,
...!workspaceId ? {} : { "Seam-Workspace": workspaceId }
};
const headers = __spreadValues(__spreadValues(__spreadValues({}, axiosOptions == null ? void 0 : axiosOptions.headers), authHeaders), !workspaceId ? {} : { "Seam-Workspace": workspaceId });
if (typeof window === "undefined") {
headers["User-Agent"] = `Javascript SDK v${version}, Node.js mode, (https://github.com/seamapi/javascript)`;
}
this.client = import_axios.default.create({
...axiosOptions,
this.client = import_axios.default.create(__spreadProps(__spreadValues({}, axiosOptions), {
baseURL: endpoint,
headers
});
}));
(0, import_axios_retry.default)(this.client, {

@@ -559,52 +619,53 @@ retries: 2,

}
async makeRequest(request) {
return makeRequest(this.client, request);
makeRequest(request) {
return __async(this, null, function* () {
return makeRequest(this.client, request);
});
}
static async getClientSessionToken(options) {
const { apiKey, endpoint, axiosOptions } = getSeamClientOptionsWithDefaults(options);
if (!options.userIdentifierKey) {
throw new Error("userIdentifierKey is required");
}
if (isEmail(options.userIdentifierKey)) {
console.warn(`Using an email for the userIdentifierKey!
static getClientSessionToken(options) {
return __async(this, null, function* () {
const { apiKey, endpoint, axiosOptions } = getSeamClientOptionsWithDefaults(options);
if (!options.userIdentifierKey) {
throw new Error("userIdentifierKey is required");
}
if (isEmail(options.userIdentifierKey)) {
console.warn(`Using an email for the userIdentifierKey!
This is insecure because an email is common knowledge or easily guessed.
Use something with sufficient entropy know only to the owner of the client session (like a server-generated UUID).`);
}
const getKeyHeaders = () => {
const { publishableKey } = options;
if (publishableKey) {
if (!publishableKey.startsWith("seam_pk")) {
throw new Error("Invalid publishableKey");
}
return { "seam-publishable-key": publishableKey };
}
if (apiKey) {
if (!(apiKey == null ? void 0 : apiKey.startsWith("seam_"))) {
throw new Error("Invalid apiKey");
const getKeyHeaders = () => {
const { publishableKey } = options;
if (publishableKey) {
if (!publishableKey.startsWith("seam_pk")) {
throw new Error("Invalid publishableKey");
}
return { "seam-publishable-key": publishableKey };
}
return { "seam-api-key": apiKey };
}
throw new Error("Must provide a publishableKey or apiKey");
};
const headers = {
...getKeyHeaders(),
...axiosOptions == null ? void 0 : axiosOptions.headers
};
const client = import_axios.default.create({
...axiosOptions,
baseURL: endpoint,
headers
if (apiKey) {
if (!(apiKey == null ? void 0 : apiKey.startsWith("seam_"))) {
throw new Error("Invalid apiKey");
}
return { "seam-api-key": apiKey };
}
throw new Error("Must provide a publishableKey or apiKey");
};
const headers = __spreadValues(__spreadValues({}, getKeyHeaders()), axiosOptions == null ? void 0 : axiosOptions.headers);
const client = import_axios.default.create(__spreadProps(__spreadValues({}, axiosOptions), {
baseURL: endpoint,
headers
}));
return makeRequest(client, {
method: "PUT",
url: "/client_sessions/create",
data: { user_identifier_key: options.userIdentifierKey }
});
});
return makeRequest(client, {
method: "PUT",
url: "/client_sessions/create",
data: { user_identifier_key: options.userIdentifierKey }
});
}
};
var isValueUsedForBearerAuthentication = (value) => value.startsWith("seam_at") || value.startsWith("ey");
var makeRequest = async (client, request) => {
var isValueUsedForBearerAuthentication = (value) => value.startsWith("seam_at") || /** Exclude JWT tokens as well */
value.startsWith("ey");
var makeRequest = (client, request) => __async(void 0, null, function* () {
var _a;
try {
const response = await client.request(request);
const response = yield client.request(request);
return response.data;

@@ -626,3 +687,3 @@ } catch (error) {

}
};
});
var getAuthHeaders = ({

@@ -699,7 +760,7 @@ clientSessionToken,

// src/cli/lib/execute-command.ts
var executeCommand = async (methodName, args, executeArgs) => {
var executeCommand = (methodName, args, executeArgs) => __async(void 0, null, function* () {
let spinner = void 0;
const displaySpinner = typeof window === "undefined" && !(executeArgs.quiet || executeArgs.json);
if (displaySpinner) {
const ora = await Promise.resolve().then(() => __toESM(require("ora")));
const ora = yield import("ora");
spinner = ora.default(

@@ -715,3 +776,3 @@ methodName.split(".").map((v) => (0, import_change_case.paramCase)(v)).join(".")

try {
const result = await method(...args);
const result = yield method(...args);
spinner == null ? void 0 : spinner.succeed();

@@ -737,3 +798,3 @@ if (executeArgs.json) {

}
};
});
var execute_command_default = executeCommand;

@@ -757,4 +818,4 @@

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"accessCodes.list",

@@ -768,3 +829,3 @@ [

);
}
})
).command(

@@ -793,4 +854,4 @@ "get <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"accessCodes.get",

@@ -806,3 +867,3 @@ [

);
}
})
).command(

@@ -833,5 +894,5 @@ "create",

},
async (argv) => {
(argv) => __async(void 0, null, function* () {
if (argv.startsAt && argv.endsAt) {
await execute_command_default(
yield execute_command_default(
"accessCodes.create",

@@ -850,3 +911,3 @@ [

} else {
await execute_command_default(
yield execute_command_default(
"accessCodes.create",

@@ -858,2 +919,3 @@ [

code: argv.code
// see https://github.com/microsoft/TypeScript/issues/32164
}

@@ -864,3 +926,3 @@ ],

}
}
})
).command(

@@ -876,4 +938,4 @@ "delete <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"accessCodes.delete",

@@ -887,3 +949,3 @@ [

);
}
})
);

@@ -916,5 +978,5 @@ },

},
async (argv) => {
await execute_command_default("actionAttempts.get", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("actionAttempts.get", [argv.id], argv);
})
);

@@ -949,4 +1011,4 @@ },

name: "initiate_two_factor_pane",
getInput: async ({ options }) => {
const { id } = await (0, import_prompts.default)(
getInput: (_0) => __async(void 0, [_0], function* ({ options }) {
const { id } = yield (0, import_prompts.default)(
{

@@ -968,3 +1030,3 @@ type: "select",

return { id };
}
})
};

@@ -977,6 +1039,6 @@ var initiate_two_factor_pane_default = initiateTwoFactorPane;

name: "login_pane",
getInput: async (props) => {
getInput: (props) => __async(void 0, null, function* () {
let userIdentifier;
if (props.accepted_user_identifiers.length > 1) {
userIdentifier = (await (0, import_prompts2.default)(
userIdentifier = (yield (0, import_prompts2.default)(
{

@@ -1002,3 +1064,3 @@ name: "userIdentifier",

}
const response = await (0, import_prompts2.default)(
const response = yield (0, import_prompts2.default)(
[

@@ -1023,3 +1085,3 @@ {

return response;
}
})
};

@@ -1045,6 +1107,6 @@ var login_pane_default = loginPane;

name: "redirect_pane",
getInput: async (props) => {
await (0, import_open.default)(props.redirect_url);
getInput: (props) => __async(void 0, null, function* () {
yield (0, import_open.default)(props.redirect_url);
throw new ContinueOutsideCLIError("You must continue in the browser");
}
})
};

@@ -1057,4 +1119,4 @@ var redirect_pane_default = redirectPane;

name: "search_and_select_pane",
getInput: async ({ title, options }) => {
const { selection } = await (0, import_prompts3.default)(
getInput: (_0) => __async(void 0, [_0], function* ({ title, options }) {
const { selection } = yield (0, import_prompts3.default)(
{

@@ -1076,3 +1138,3 @@ name: "selection",

return { value: selection };
}
})
};

@@ -1085,4 +1147,4 @@ var search_and_select_pane_default = searchAndSelectPane;

name: "two_factor_pane",
getInput: async ({ code_length }) => {
const { code } = await (0, import_prompts4.default)(
getInput: (_0) => __async(void 0, [_0], function* ({ code_length }) {
const { code } = yield (0, import_prompts4.default)(
{

@@ -1106,3 +1168,3 @@ type: "text",

return { code };
}
})
};

@@ -1121,3 +1183,3 @@ var two_factor_pane_default = twoFactorPane;

// src/cli/lib/interactive-login/complete-interactive-login.ts
var completeInteractiveLogin = async (connectWebviewId, args) => {
var completeInteractiveLogin = (connectWebviewId, args) => __async(void 0, null, function* () {
const { client } = get_client_from_args_default(args);

@@ -1127,3 +1189,3 @@ const displaySpinner = typeof window === "undefined" && !args.quiet;

if (displaySpinner) {
const ora = await Promise.resolve().then(() => __toESM(require("ora")));
const ora = yield import("ora");
spinner = ora.default("Logging in...");

@@ -1136,3 +1198,3 @@ }

spinner == null ? void 0 : spinner.start("Loading...");
const { data } = await client.post(
const { data } = yield client.post(
"/internal/connect_webviews/login/next",

@@ -1160,3 +1222,3 @@ {

try {
submit_args = await handler.getInput(currentPane.render_props);
submit_args = yield handler.getInput(currentPane.render_props);
} catch (error) {

@@ -1181,3 +1243,3 @@ if (error instanceof ContinueOutsideCLIError) {

spinner == null ? void 0 : spinner.succeed("\u{1F389} login successful!");
};
});
var complete_interactive_login_default = completeInteractiveLogin;

@@ -1196,5 +1258,5 @@

},
async (yargs2) => {
await execute_command_default("connectWebviews.list", [], yargs2);
}
(yargs2) => __async(void 0, null, function* () {
yield execute_command_default("connectWebviews.list", [], yargs2);
})
).command(

@@ -1210,5 +1272,5 @@ "get <id>",

},
async (argv) => {
await execute_command_default("connectWebviews.get", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("connectWebviews.get", [argv.id], argv);
})
).command(

@@ -1224,5 +1286,5 @@ "login <id>",

},
async (argv) => {
await complete_interactive_login_default(argv.id, argv);
}
(argv) => __async(void 0, null, function* () {
yield complete_interactive_login_default(argv.id, argv);
})
).command(

@@ -1250,4 +1312,4 @@ "create",

},
async (argv) => {
const { connect_webview_id } = await execute_command_default(
(argv) => __async(void 0, null, function* () {
const { connect_webview_id } = yield execute_command_default(
"connectWebviews.create",

@@ -1262,5 +1324,5 @@ [

if (argv.login) {
await complete_interactive_login_default(connect_webview_id, argv);
yield complete_interactive_login_default(connect_webview_id, argv);
}
}
})
).command(

@@ -1276,4 +1338,4 @@ "delete <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"connectWebviews.delete",

@@ -1287,3 +1349,3 @@ [

);
}
})
);

@@ -1311,5 +1373,5 @@ },

},
async (argv) => {
await execute_command_default("connectedAccounts.list", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("connectedAccounts.list", [], argv);
})
).command(

@@ -1333,4 +1395,4 @@ "get",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"connectedAccounts.get",

@@ -1345,3 +1407,3 @@ [

);
}
})
).command(

@@ -1365,4 +1427,4 @@ "delete",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"connectedAccounts.delete",

@@ -1377,3 +1439,3 @@ [

);
}
})
);

@@ -1412,4 +1474,4 @@ },

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"devices.get",

@@ -1419,3 +1481,3 @@ [argv.name ? { name: argv.name } : { device_id: argv.id }],

);
}
})
).command(

@@ -1431,4 +1493,4 @@ "list",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"devices.list",

@@ -1438,3 +1500,3 @@ [{ connected_account_id: argv.connectedAccountId }],

);
}
})
).command(

@@ -1461,4 +1523,4 @@ "update <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"devices.update",

@@ -1475,3 +1537,3 @@ [

);
}
})
).command(

@@ -1487,5 +1549,5 @@ "delete",

},
async (argv) => {
await execute_command_default("devices.delete", [{ device_id: argv.id }], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("devices.delete", [{ device_id: argv.id }], argv);
})
).command(

@@ -1500,4 +1562,4 @@ "list_device_providers",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"devices.listDeviceProviders",

@@ -1507,3 +1569,3 @@ [{ provider_category: argv.providerCategory }],

);
}
})
);

@@ -1536,5 +1598,5 @@ },

},
async (argv) => {
await execute_command_default("locks.get", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("locks.get", [argv.id], argv);
})
).command(

@@ -1550,5 +1612,5 @@ "list",

},
async (argv) => {
await execute_command_default("locks.list", [argv.connectedAccountId], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("locks.list", [argv.connectedAccountId], argv);
})
).command(

@@ -1564,5 +1626,5 @@ "lock-door <id>",

},
async (argv) => {
await execute_command_default("locks.lockDoor", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("locks.lockDoor", [argv.id], argv);
})
).command(

@@ -1578,5 +1640,5 @@ "unlock-door <id>",

},
async (argv) => {
await execute_command_default("locks.unlockDoor", [argv.id], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("locks.unlockDoor", [argv.id], argv);
})
);

@@ -1603,5 +1665,5 @@ },

(yargs2) => yargs2,
async (argv) => {
await execute_command_default("workspaces.get", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("workspaces.get", [], argv);
})
).command(

@@ -1611,5 +1673,5 @@ "list",

(yargs2) => yargs2,
async (argv) => {
await execute_command_default("workspaces.list", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("workspaces.list", [], argv);
})
).command(

@@ -1619,5 +1681,5 @@ "reset-sandbox",

(yargs2) => yargs2,
async (argv) => {
await execute_command_default("workspaces.resetSandbox", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("workspaces.resetSandbox", [], argv);
})
);

@@ -1644,5 +1706,5 @@ },

(yargs2) => yargs2,
async (argv) => {
await execute_command_default("webhooks.list", [], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("webhooks.list", [], argv);
})
).command(

@@ -1658,5 +1720,5 @@ "get <id>",

},
async (argv) => {
await execute_command_default("webhooks.get", [{ webhook_id: argv.id }], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("webhooks.get", [{ webhook_id: argv.id }], argv);
})
).command(

@@ -1672,5 +1734,5 @@ "create <url>",

},
async (argv) => {
await execute_command_default("webhooks.create", [{ url: argv.url }], argv);
}
(argv) => __async(void 0, null, function* () {
yield execute_command_default("webhooks.create", [{ url: argv.url }], argv);
})
).command(

@@ -1686,4 +1748,4 @@ "delete <id>",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"webhooks.delete",

@@ -1693,3 +1755,3 @@ [{ webhook_id: argv.id }],

);
}
})
);

@@ -1722,4 +1784,4 @@ },

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"noiseThresholds.list",

@@ -1733,3 +1795,3 @@ [

);
}
})
).command(

@@ -1767,4 +1829,4 @@ "create",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"noiseThresholds.create",

@@ -1783,3 +1845,3 @@ [

);
}
})
).command(

@@ -1821,4 +1883,4 @@ "update",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"noiseThresholds.update",

@@ -1838,3 +1900,3 @@ [

);
}
})
).command(

@@ -1854,4 +1916,4 @@ "delete",

},
async (argv) => {
await execute_command_default(
(argv) => __async(void 0, null, function* () {
yield execute_command_default(
"noiseThresholds.delete",

@@ -1866,3 +1928,3 @@ [

);
}
})
);

@@ -1869,0 +1931,0 @@ },

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __export = (target, all) => {

@@ -21,2 +50,6 @@ for (var name in all)

var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,

@@ -26,2 +59,22 @@ mod

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};

@@ -191,6 +244,5 @@ // src/index.ts

method: "POST",
data: {
...params,
since: (_a = params == null ? void 0 : params.since) != null ? _a : new Date(0).toISOString()
}
data: __spreadProps(__spreadValues({}, params), {
since: (_a = params == null ? void 0 : params.since) != null ? _a : (/* @__PURE__ */ new Date(0)).toISOString()
})
});

@@ -266,17 +318,22 @@ }

}),
create: async (params) => this.makeRequestAndFormat("access_code", {
url: "/access_codes/create",
method: "POST",
data: params
}),
createMultiple: async (params) => this.makeRequestAndFormat(
"access_codes",
{
url: "/access_codes/create_multiple",
create: (params) => __async(this, null, function* () {
return this.makeRequestAndFormat("access_code", {
url: "/access_codes/create",
method: "POST",
data: params
}
),
update: async (params) => {
const action = await this.createActionAttemptAndWait({
});
}),
createMultiple: (params) => __async(this, null, function* () {
return this.makeRequestAndFormat(
"access_codes",
{
url: "/access_codes/create_multiple",
method: "POST",
data: params
}
);
}),
// We can't narrow the return type here like we do with create because we're given partial input
update: (params) => __async(this, null, function* () {
const action = yield this.createActionAttemptAndWait({
url: "/access_codes/update",

@@ -287,3 +344,3 @@ method: "POST",

return action.access_code;
},
}),
delete: (params) => this.createActionAttemptAndWait({

@@ -390,6 +447,8 @@ url: "/access_codes/delete",

this.deviceModels = {
list: ({
acknowledge_intentional_use_of_internal_api = false,
...params
} = {}) => {
list: (_a = {}) => {
var _b = _a, {
acknowledge_intentional_use_of_internal_api = false
} = _b, params = __objRest(_b, [
"acknowledge_intentional_use_of_internal_api"
]);
if (acknowledge_intentional_use_of_internal_api !== true) {

@@ -465,37 +524,43 @@ throw new Error("This is an internal endpoint and should not be used.");

}
async awaitActionAttempt(actionAttempt) {
let fetchedActionAttempt = actionAttempt;
if (fetchedActionAttempt.status === "pending") {
await (0, import_p_retry.default)(
async () => {
fetchedActionAttempt = await this.actionAttempts.get(
fetchedActionAttempt.action_attempt_id
);
if (fetchedActionAttempt.status === "pending") {
throw new Error("Action attempt is still pending");
}
},
{ maxTimeout: 60 * 1e3 }
);
}
if (fetchedActionAttempt.status === "error") {
throw new SeamActionAttemptError(
fetchedActionAttempt.error.type,
fetchedActionAttempt.error.message,
fetchedActionAttempt.action_type
);
}
return fetchedActionAttempt;
awaitActionAttempt(actionAttempt) {
return __async(this, null, function* () {
let fetchedActionAttempt = actionAttempt;
if (fetchedActionAttempt.status === "pending") {
yield (0, import_p_retry.default)(
() => __async(this, null, function* () {
fetchedActionAttempt = yield this.actionAttempts.get(
fetchedActionAttempt.action_attempt_id
);
if (fetchedActionAttempt.status === "pending") {
throw new Error("Action attempt is still pending");
}
}),
// @ts-expect-error UPSTREAM: https://github.com/DefinitelyTyped/DefinitelyTyped/commit/6f77b38130593a06e1988f1d3df162823ae186af#commitcomment-72928468
{ maxTimeout: 60 * 1e3 }
);
}
if (fetchedActionAttempt.status === "error") {
throw new SeamActionAttemptError(
fetchedActionAttempt.error.type,
fetchedActionAttempt.error.message,
fetchedActionAttempt.action_type
);
}
return fetchedActionAttempt;
});
}
async makeRequestAndFormat(innerObjectName, request) {
const response = await this.makeRequest(request);
return response[innerObjectName];
makeRequestAndFormat(innerObjectName, request) {
return __async(this, null, function* () {
const response = yield this.makeRequest(request);
return response[innerObjectName];
});
}
async createActionAttemptAndWait(request) {
const pendingActionAttempt = await this.makeRequestAndFormat("action_attempt", request);
const actionAttempt = await this.awaitActionAttempt(pendingActionAttempt);
return {
...actionAttempt.result,
actionAttempt
};
createActionAttemptAndWait(request) {
return __async(this, null, function* () {
const pendingActionAttempt = yield this.makeRequestAndFormat("action_attempt", request);
const actionAttempt = yield this.awaitActionAttempt(pendingActionAttempt);
return __spreadProps(__spreadValues({}, actionAttempt.result), {
actionAttempt
});
});
}

@@ -505,3 +570,3 @@ };

// package.json
var version = "6.13.0";
var version = "6.14.3";

@@ -517,5 +582,5 @@ // src/seam-connect/client.ts

if (typeof apiKeyOrOptions === "string") {
return { ...seamClientDefaults, apiKey: apiKeyOrOptions };
return __spreadProps(__spreadValues({}, seamClientDefaults), { apiKey: apiKeyOrOptions });
} else {
return { ...seamClientDefaults, ...apiKeyOrOptions };
return __spreadValues(__spreadValues({}, seamClientDefaults), apiKeyOrOptions);
}

@@ -532,15 +597,10 @@ };

});
const headers = {
...axiosOptions == null ? void 0 : axiosOptions.headers,
...authHeaders,
...!workspaceId ? {} : { "Seam-Workspace": workspaceId }
};
const headers = __spreadValues(__spreadValues(__spreadValues({}, axiosOptions == null ? void 0 : axiosOptions.headers), authHeaders), !workspaceId ? {} : { "Seam-Workspace": workspaceId });
if (typeof window === "undefined") {
headers["User-Agent"] = `Javascript SDK v${version}, Node.js mode, (https://github.com/seamapi/javascript)`;
}
this.client = import_axios.default.create({
...axiosOptions,
this.client = import_axios.default.create(__spreadProps(__spreadValues({}, axiosOptions), {
baseURL: endpoint,
headers
});
}));
(0, import_axios_retry.default)(this.client, {

@@ -551,52 +611,53 @@ retries: 2,

}
async makeRequest(request) {
return makeRequest(this.client, request);
makeRequest(request) {
return __async(this, null, function* () {
return makeRequest(this.client, request);
});
}
static async getClientSessionToken(options) {
const { apiKey, endpoint, axiosOptions } = getSeamClientOptionsWithDefaults(options);
if (!options.userIdentifierKey) {
throw new Error("userIdentifierKey is required");
}
if (isEmail(options.userIdentifierKey)) {
console.warn(`Using an email for the userIdentifierKey!
static getClientSessionToken(options) {
return __async(this, null, function* () {
const { apiKey, endpoint, axiosOptions } = getSeamClientOptionsWithDefaults(options);
if (!options.userIdentifierKey) {
throw new Error("userIdentifierKey is required");
}
if (isEmail(options.userIdentifierKey)) {
console.warn(`Using an email for the userIdentifierKey!
This is insecure because an email is common knowledge or easily guessed.
Use something with sufficient entropy know only to the owner of the client session (like a server-generated UUID).`);
}
const getKeyHeaders = () => {
const { publishableKey } = options;
if (publishableKey) {
if (!publishableKey.startsWith("seam_pk")) {
throw new Error("Invalid publishableKey");
}
return { "seam-publishable-key": publishableKey };
}
if (apiKey) {
if (!(apiKey == null ? void 0 : apiKey.startsWith("seam_"))) {
throw new Error("Invalid apiKey");
const getKeyHeaders = () => {
const { publishableKey } = options;
if (publishableKey) {
if (!publishableKey.startsWith("seam_pk")) {
throw new Error("Invalid publishableKey");
}
return { "seam-publishable-key": publishableKey };
}
return { "seam-api-key": apiKey };
}
throw new Error("Must provide a publishableKey or apiKey");
};
const headers = {
...getKeyHeaders(),
...axiosOptions == null ? void 0 : axiosOptions.headers
};
const client = import_axios.default.create({
...axiosOptions,
baseURL: endpoint,
headers
if (apiKey) {
if (!(apiKey == null ? void 0 : apiKey.startsWith("seam_"))) {
throw new Error("Invalid apiKey");
}
return { "seam-api-key": apiKey };
}
throw new Error("Must provide a publishableKey or apiKey");
};
const headers = __spreadValues(__spreadValues({}, getKeyHeaders()), axiosOptions == null ? void 0 : axiosOptions.headers);
const client = import_axios.default.create(__spreadProps(__spreadValues({}, axiosOptions), {
baseURL: endpoint,
headers
}));
return makeRequest(client, {
method: "PUT",
url: "/client_sessions/create",
data: { user_identifier_key: options.userIdentifierKey }
});
});
return makeRequest(client, {
method: "PUT",
url: "/client_sessions/create",
data: { user_identifier_key: options.userIdentifierKey }
});
}
};
var isValueUsedForBearerAuthentication = (value) => value.startsWith("seam_at") || value.startsWith("ey");
var makeRequest = async (client, request) => {
var isValueUsedForBearerAuthentication = (value) => value.startsWith("seam_at") || /** Exclude JWT tokens as well */
value.startsWith("ey");
var makeRequest = (client, request) => __async(void 0, null, function* () {
var _a;
try {
const response = await client.request(request);
const response = yield client.request(request);
return response.data;

@@ -618,3 +679,3 @@ } catch (error) {

}
};
});
var getAuthHeaders = ({

@@ -656,5 +717,15 @@ clientSessionToken,

var SeamWebhook = class {
/**
* Create a new instance of SeamWebhook.
* @param secret your webhook secret from the dashboard
*/
constructor(secret) {
this.wh = new import_svix.Webhook(secret);
}
/**
* Verify a payload received from a webhook and return the typed event.
* @param payload must be a string (should not be the parsed JSON object)
* @param headers request headers (used to verify against the secret)
* @returns event
*/
verify(payload, headers) {

@@ -725,5 +796,5 @@ return this.wh.verify(payload, headers);

if (typeof apiKeyOrOptions === "string") {
return { ...seamClientDefaults, apiKey: apiKeyOrOptions };
return __spreadProps(__spreadValues({}, seamClientDefaults), { apiKey: apiKeyOrOptions });
} else {
return { ...seamClientDefaults, ...apiKeyOrOptions };
return __spreadValues(__spreadValues({}, seamClientDefaults), apiKeyOrOptions);
}

@@ -736,10 +807,10 @@ };

};
this._postGrab = (url, innerObject) => async (data) => {
const res = await this.post(url, data);
this._postGrab = (url, innerObject) => (data) => __async(this, null, function* () {
const res = yield this.post(url, data);
return res[innerObject];
};
this._getGrab = (url, innerObject) => async (data) => {
const res = await this.post(url, data);
});
this._getGrab = (url, innerObject) => (data) => __async(this, null, function* () {
const res = yield this.post(url, data);
return res[innerObject];
};
});
this._curriedGet = (url) => (data) => {

@@ -790,2 +861,3 @@ return this.post(url, data);

)
// update: this._curriedPost("/access_passes/update"),
};

@@ -820,2 +892,5 @@ this.buildings = {

update: this._curriedPost("/device_groups/update")
// woops need to add
// add_device: this._curriedPost("/device_groups/add_device"),
// remove_device: this._curriedPost("/device_groups/remove_device"),
};

@@ -883,22 +958,21 @@ this.devices = {

}
this.axios = import_axios2.default.create({
...axiosOptions,
this.axios = import_axios2.default.create(__spreadProps(__spreadValues({}, axiosOptions), {
baseURL: endpoint,
headers: {
...axiosOptions == null ? void 0 : axiosOptions.headers,
headers: __spreadValues(__spreadProps(__spreadValues({}, axiosOptions == null ? void 0 : axiosOptions.headers), {
Authorization: `Bearer ${apiKey}`,
["User-Agent"]: `Javascript SDK v${version} (https://github.com/seamapi/javascript)`,
...!organizationId ? {} : { "Seam-Organization-Id": organizationId }
}
["User-Agent"]: `Javascript SDK v${version} (https://github.com/seamapi/javascript)`
}), !organizationId ? {} : { "Seam-Organization-Id": organizationId })
}));
}
makeRequest(request) {
return __async(this, null, function* () {
const res = yield this.axios.request(request);
return res.data;
});
}
async makeRequest(request) {
const res = await this.axios.request(request);
return res.data;
}
get(url, config) {
return this.makeRequest({ url, method: "GET", ...config });
return this.makeRequest(__spreadValues({ url, method: "GET" }, config));
}
post(url, data, config) {
return this.makeRequest({ url, method: "POST", data, ...config });
return this.makeRequest(__spreadValues({ url, method: "POST", data }, config));
}

@@ -905,0 +979,0 @@ };

@@ -10,3 +10,3 @@ {

],
"version": "6.13.0",
"version": "6.14.3",
"license": "MIT",

@@ -56,6 +56,6 @@ "sideEffects": false,

"@ava/get-port": "^2.0.0",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/commit-analyzer": "^10.0.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^9.0.2",
"@semantic-release/release-notes-generator": "^10.0.3",
"@semantic-release/npm": "^10.0.4",
"@semantic-release/release-notes-generator": "^11.0.3",
"@swc/core": "1.2.133",

@@ -89,6 +89,6 @@ "@types/lodash": "^4.14.179",

"prettier": "2.5.1",
"semantic-release": "^20.1.0",
"semantic-release": "^21.0.5",
"testcontainers": "^9.1.1",
"ts-json-schema-generator": "0.98.0",
"tsup": "5.11.11",
"tsup": "^7.1.0",
"type-fest": "2.11.1",

@@ -117,2 +117,3 @@ "typedoc": "0.22.12",

"pack:cli": "pkg -c package.json dist/cli/entry.js",
"typecheck": "tsc --noEmit",
"format": "prettier --write .",

@@ -119,0 +120,0 @@ "format:check": "prettier --check .",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc