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

@orpc/client

Package Overview
Dependencies
Maintainers
0
Versions
243
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orpc/client - npm Package Compare versions

Comparing version 0.0.0-next-20241123135451 to 0.0.0-next-20241123144325

142

dist/index.js

@@ -0,6 +1,140 @@

// ../contract/src/procedure.ts
var ContractProcedure = class {
constructor(zz$cp) {
this.zz$cp = zz$cp;
}
};
var DecoratedContractProcedure = class _DecoratedContractProcedure extends ContractProcedure {
static decorate(cp) {
if (cp instanceof _DecoratedContractProcedure)
return cp;
return new _DecoratedContractProcedure(cp.zz$cp);
}
route(opts) {
return new _DecoratedContractProcedure({
...this.zz$cp,
...opts,
method: opts.method,
path: opts.path
});
}
prefix(prefix) {
if (!this.zz$cp.path)
return this;
return new _DecoratedContractProcedure({
...this.zz$cp,
path: `${prefix}${this.zz$cp.path}`
});
}
addTags(...tags) {
if (!tags.length)
return this;
return new _DecoratedContractProcedure({
...this.zz$cp,
tags: [...this.zz$cp.tags ?? [], ...tags]
});
}
input(schema, example) {
return new _DecoratedContractProcedure({
...this.zz$cp,
InputSchema: schema,
inputExample: example
});
}
output(schema, example) {
return new _DecoratedContractProcedure({
...this.zz$cp,
OutputSchema: schema,
outputExample: example
});
}
};
function isContractProcedure(item) {
if (item instanceof ContractProcedure)
return true;
return (typeof item === "object" || typeof item === "function") && item !== null && "zz$cp" in item && typeof item.zz$cp === "object" && item.zz$cp !== null && "InputSchema" in item.zz$cp && "OutputSchema" in item.zz$cp;
}
// ../contract/src/router-builder.ts
var ContractRouterBuilder = class _ContractRouterBuilder {
constructor(zz$crb) {
this.zz$crb = zz$crb;
}
prefix(prefix) {
return new _ContractRouterBuilder({
...this.zz$crb,
prefix: `${this.zz$crb.prefix ?? ""}${prefix}`
});
}
tags(...tags) {
if (!tags.length)
return this;
return new _ContractRouterBuilder({
...this.zz$crb,
tags: [...this.zz$crb.tags ?? [], ...tags]
});
}
router(router) {
const handled = {};
for (const key in router) {
const item = router[key];
if (isContractProcedure(item)) {
const decorated = DecoratedContractProcedure.decorate(item).addTags(
...this.zz$crb.tags ?? []
);
handled[key] = this.zz$crb.prefix ? decorated.prefix(this.zz$crb.prefix) : decorated;
} else {
handled[key] = this.router(item);
}
}
return handled;
}
};
// ../contract/src/builder.ts
var ContractBuilder = class {
prefix(prefix) {
return new ContractRouterBuilder({
prefix
});
}
tags(...tags) {
return new ContractRouterBuilder({
tags
});
}
route(opts) {
return new DecoratedContractProcedure({
InputSchema: void 0,
OutputSchema: void 0,
...opts
});
}
input(schema, example) {
return new DecoratedContractProcedure({
InputSchema: schema,
inputExample: example,
OutputSchema: void 0
});
}
output(schema, example) {
return new DecoratedContractProcedure({
InputSchema: void 0,
OutputSchema: schema,
outputExample: example
});
}
router(router) {
return router;
}
};
// ../contract/src/constants.ts
var ORPC_HEADER = "x-orpc-transformer";
var ORPC_HEADER_VALUE = "t";
// ../contract/src/index.ts
var oc = new ContractBuilder();
// src/procedure.ts
import {
ORPC_HEADER,
ORPC_HEADER_VALUE
} from "@orpc/contract";
import { trim } from "@orpc/shared";

@@ -7,0 +141,0 @@ import { ORPCError } from "@orpc/shared/error";

10

package.json
{
"name": "@orpc/client",
"type": "module",
"version": "0.0.0-next-20241123135451",
"version": "0.0.0-next-20241123144325",
"author": {

@@ -37,6 +37,2 @@ "name": "unnoq",

],
"peerDependencies": {
"@orpc/contract": "0.0.0-next-20241123135451",
"@orpc/server": "0.0.0-next-20241123135451"
},
"dependencies": {

@@ -47,3 +43,5 @@ "@orpc/shared": "0.0.5",

"devDependencies": {
"zod": "^3.23.8"
"zod": "^3.23.8",
"@orpc/contract": "0.0.0-next-20241123144325",
"@orpc/server": "0.0.0-next-20241123144325"
},

@@ -50,0 +48,0 @@ "scripts": {

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