partnerships 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/README.md +8 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/package.json +1 -0
package/README.md
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export interface Options{name?:string;[key:string]:any}
|
|
2
|
+
export declare class Component{constructor(options?:Options);register(key:string,value:any,metadata?:Record<string,any>):this;get(key:string):any;has(key:string):boolean;list():any[];remove(key:string):boolean;readonly size:number;toJSON():object}
|
|
3
|
+
export declare function create(options?:Options):Component;
|
|
4
|
+
export default create;
|
package/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
class Component{constructor(o={}){this.name=o.name||"component";this._reg=new Map();this._hooks=[]}register(k,v,m={}){this._reg.set(k,{value:v,metadata:m,createdAt:new Date().toISOString()});return this}get(k){const e=this._reg.get(k);if(!e)throw new Error(`"${k}" not found`);return e.value}has(k){return this._reg.has(k)}list(){return Array.from(this._reg.entries()).map(([k,v])=>({key:k,...v}))}remove(k){return this._reg.delete(k)}use(fn){this._hooks.push(fn);return this}async process(i){let r=i;for(const h of this._hooks){r=await h(r,this)||r}return r}get size(){return this._reg.size}toJSON(){return{name:this.name,entries:this.list()}}}
|
|
3
|
+
function create(o){return new Component(o)}
|
|
4
|
+
module.exports={Component,create,default:create};
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"partnerships","version":"0.1.0","description":"Partnerships - Open infrastructure for AI agents","main":"index.js","types":"index.d.ts","keywords":["ai","agent","partnerships","platform"],"author":"Backo, Inc.","license":"MIT","homepage":"https://backo.ai","engines":{"node":">=16.0.0"}}
|