@nmtjs/contract 0.11.4 → 0.11.6

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.
@@ -1 +1 @@
1
- {"mappings":"AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AAGtE,OAAO,MAAM,UAAU;AAoBvB,OAAO,MAAM,cAAc,CAEzBA,YAII;CACJ,MAAM,EAAE,aAAa,CAAE,GAAE,UAAU,KAAM,gBAAgB,CAAE,GAAE,GAAG,WAAW,CAAE;CAE7E,MAAM,cAAc,CAAE;AAEtB,MAAK,MAAM,gBAAgB,YAAY;EACrC,MAAM,YAAY,WAAW;EAC7B,MAAM,cAAc,CAAE;AACtB,OAAK,MAAM,gBAAgB,UAAU,YAAY;GAC/C,MAAM,YAAY,UAAU,WAAW;AACvC,eAAY,gBAAgB,OAAO,OAAO,CAAE,GAAE,WAAW;IACvD,MAAM;IACN,WAAW;GACZ,EAAC;EACH;EAED,MAAM,iBAAiB,CAAE;AACzB,OAAK,MAAM,mBAAmB,UAAU,eAAe;GACrD,MAAM,eAAe,UAAU,cAAc;GAC7C,MAAM,UAAU,CAAE;AAClB,QAAK,MAAM,YAAY,aAAa,QAAQ;IAC1C,MAAM,QAAQ,aAAa,OAAO;AAClC,YAAQ,YAAY,OAAO,OAAO,CAAE,GAAE,OAAO;KAC3C,MAAM;KACN,WAAW;KACX,cAAc;IACf,EAAC;GACH;AACD,kBAAe,mBAAmB,OAAO,OAAO,CAAE,GAAE,cAAc;IAChE,MAAM;IACN,WAAW;IACX,QAAQ;GACT,EAAC;EACH;EAED,MAAM,UAAU,CAAE;AAClB,OAAK,MAAM,YAAY,UAAU,QAAQ;GACvC,MAAM,QAAQ,UAAU,OAAO;AAC/B,WAAQ,YAAY,OAAO,OAAO,CAAE,GAAE,OAAO;IAC3C,MAAM;IACN,WAAW;GACZ,EAAC;EACH;AAED,cAAY,gBAAgB,OAAO,OAAO,CAAE,GAAE,WAAW;GACvD,MAAM;GACN,YAAY;GACZ,eAAe;GACf,QAAQ;EACT,EAAC;CACH;AAED,QAAO,aAAuC;EAC5C,GAAG;GACF,OAAO;EACR,MAAM;EACN,YAAY;EACZ;CACD,EAAC;AACH;AAED,OAAO,SAAS,cAAcC,OAAsC;AAClE,QAAO,QAAQ,SAAS,MAAM,UAAU;AACzC","names":["options?: {\n namespaces?: Namespaces\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n}","value: any"],"sources":["../../src/schemas/api.ts"],"sourcesContent":["import { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\nimport type { TAnyNamespaceContract, TNamespaceContract } from './namespace.ts'\n\nexport const APIKind = 'NeemataAPI'\n\nexport type TAnyAPIContract = TAPIContract<Record<string, any>>\n\nexport interface TAPIContract<Namespaces extends Record<string, unknown> = {}> {\n [Kind]: typeof APIKind\n type: 'neemata:api'\n namespaces: {\n [K in keyof Namespaces]: Namespaces[K] extends TAnyNamespaceContract\n ? TNamespaceContract<\n Namespaces[K]['procedures'],\n Namespaces[K]['subscriptions'],\n Namespaces[K]['events'],\n Extract<K, string>\n >\n : never\n }\n timeout?: number\n}\n\nexport const APIContract = <\n Namespaces extends Record<string, unknown> = {},\n>(options?: {\n namespaces?: Namespaces\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n}) => {\n const { namespaces = {}, timeout = 1000, schemaOptions = {} } = options || {}\n\n const _namespaces = {} as any\n\n for (const namespaceKey in namespaces) {\n const namespace = namespaces[namespaceKey]\n const _procedures = {} as any\n for (const procedureKey in namespace.procedures) {\n const procedure = namespace.procedures[procedureKey]\n _procedures[procedureKey] = Object.assign({}, procedure, {\n name: procedureKey,\n namespace: namespaceKey,\n })\n }\n\n const _subscriptions = {} as any\n for (const subscriptionKey in namespace.subscriptions) {\n const subscription = namespace.subscriptions[subscriptionKey]\n const _events = {} as any\n for (const eventKey in subscription.events) {\n const event = subscription.events[eventKey]\n _events[eventKey] = Object.assign({}, event, {\n name: eventKey,\n namespace: namespaceKey,\n subscription: subscriptionKey,\n })\n }\n _subscriptions[subscriptionKey] = Object.assign({}, subscription, {\n name: subscriptionKey,\n namespace: namespaceKey,\n events: _events,\n })\n }\n\n const _events = {} as any\n for (const eventKey in namespace.events) {\n const event = namespace.events[eventKey]\n _events[eventKey] = Object.assign({}, event, {\n name: eventKey,\n namespace: namespaceKey,\n })\n }\n\n _namespaces[namespaceKey] = Object.assign({}, namespace, {\n name: namespaceKey,\n procedures: _procedures,\n subscriptions: _subscriptions,\n events: _events,\n })\n }\n\n return createSchema<TAPIContract<Namespaces>>({\n ...schemaOptions,\n [Kind]: APIKind,\n type: 'neemata:api',\n namespaces: _namespaces,\n timeout,\n })\n}\n\nexport function IsAPIContract(value: any): value is TAnyAPIContract {\n return Kind in value && value[Kind] === APIKind\n}\n"],"version":3,"file":"api.js"}
1
+ {"mappings":"AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AAGtE,OAAO,MAAM,UAAU;AAoBvB,OAAO,MAAM,cAAc,CAEzBA,YAII;CACJ,MAAM,EAAE,aAAa,CAAE,GAAE,UAAU,KAAM,gBAAgB,CAAE,GAAE,GAAG,WAAW,CAAE;CAE7E,MAAM,cAAc,CAAE;AAEtB,MAAK,MAAM,gBAAgB,YAAY;EACrC,MAAM,YAAY,WAAW;EAC7B,MAAM,cAAc,CAAE;AACtB,OAAK,MAAM,gBAAgB,UAAU,YAAY;GAC/C,MAAM,YAAY,UAAU,WAAW;AACvC,eAAY,gBAAgB,OAAO,OAAO,CAAE,GAAE,WAAW;IACvD,MAAM;IACN,WAAW;GACZ,EAAC;EACH;EAED,MAAM,iBAAiB,CAAE;AACzB,OAAK,MAAM,mBAAmB,UAAU,eAAe;GACrD,MAAM,eAAe,UAAU,cAAc;GAC7C,MAAM,UAAU,CAAE;AAClB,QAAK,MAAM,YAAY,aAAa,QAAQ;IAC1C,MAAM,QAAQ,aAAa,OAAO;AAClC,YAAQ,YAAY,OAAO,OAAO,CAAE,GAAE,OAAO;KAC3C,MAAM;KACN,WAAW;KACX,cAAc;IACf,EAAC;GACH;AACD,kBAAe,mBAAmB,OAAO,OAAO,CAAE,GAAE,cAAc;IAChE,MAAM;IACN,WAAW;IACX,QAAQ;GACT,EAAC;EACH;EAED,MAAM,UAAU,CAAE;AAClB,OAAK,MAAM,YAAY,UAAU,QAAQ;GACvC,MAAM,QAAQ,UAAU,OAAO;AAC/B,WAAQ,YAAY,OAAO,OAAO,CAAE,GAAE,OAAO;IAC3C,MAAM;IACN,WAAW;GACZ,EAAC;EACH;AAED,cAAY,gBAAgB,OAAO,OAAO,CAAE,GAAE,WAAW;GACvD,MAAM;GACN,YAAY;GACZ,eAAe;GACf,QAAQ;EACT,EAAC;CACH;AAED,QAAO,aAAuC;EAC5C,GAAG;GACF,OAAO;EACR,MAAM;EACN,YAAY;EACZ;CACD,EAAC;AACH;AAED,OAAO,SAAS,cAAcC,OAAsC;AAClE,QAAO,QAAQ,SAAS,MAAM,UAAU;AACzC","names":["options?: {\n namespaces?: Namespaces\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n}","value: any"],"sources":["../../src/schemas/api.ts"],"sourcesContent":["import { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\nimport type { TAnyNamespaceContract, TNamespaceContract } from './namespace.ts'\n\nexport const APIKind = 'NeemataAPI'\n\nexport type TAnyAPIContract = TAPIContract<Record<string, any>>\n\nexport interface TAPIContract<Namespaces extends Record<string, unknown> = {}> {\n [Kind]: typeof APIKind\n type: 'neemata:api'\n namespaces: {\n [K in keyof Namespaces]: Namespaces[K] extends TAnyNamespaceContract\n ? TNamespaceContract<\n Namespaces[K]['procedures'],\n // Namespaces[K]['subscriptions'],\n Namespaces[K]['events'],\n Extract<K, string>\n >\n : never\n }\n timeout?: number\n}\n\nexport const APIContract = <\n Namespaces extends Record<string, unknown> = {},\n>(options?: {\n namespaces?: Namespaces\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n}) => {\n const { namespaces = {}, timeout = 1000, schemaOptions = {} } = options || {}\n\n const _namespaces = {} as any\n\n for (const namespaceKey in namespaces) {\n const namespace = namespaces[namespaceKey]\n const _procedures = {} as any\n for (const procedureKey in namespace.procedures) {\n const procedure = namespace.procedures[procedureKey]\n _procedures[procedureKey] = Object.assign({}, procedure, {\n name: procedureKey,\n namespace: namespaceKey,\n })\n }\n\n const _subscriptions = {} as any\n for (const subscriptionKey in namespace.subscriptions) {\n const subscription = namespace.subscriptions[subscriptionKey]\n const _events = {} as any\n for (const eventKey in subscription.events) {\n const event = subscription.events[eventKey]\n _events[eventKey] = Object.assign({}, event, {\n name: eventKey,\n namespace: namespaceKey,\n subscription: subscriptionKey,\n })\n }\n _subscriptions[subscriptionKey] = Object.assign({}, subscription, {\n name: subscriptionKey,\n namespace: namespaceKey,\n events: _events,\n })\n }\n\n const _events = {} as any\n for (const eventKey in namespace.events) {\n const event = namespace.events[eventKey]\n _events[eventKey] = Object.assign({}, event, {\n name: eventKey,\n namespace: namespaceKey,\n })\n }\n\n _namespaces[namespaceKey] = Object.assign({}, namespace, {\n name: namespaceKey,\n procedures: _procedures,\n subscriptions: _subscriptions,\n events: _events,\n })\n }\n\n return createSchema<TAPIContract<Namespaces>>({\n ...schemaOptions,\n [Kind]: APIKind,\n type: 'neemata:api',\n namespaces: _namespaces,\n timeout,\n })\n}\n\nexport function IsAPIContract(value: any): value is TAnyAPIContract {\n return Kind in value && value[Kind] === APIKind\n}\n"],"version":3,"file":"api.js"}
@@ -43,7 +43,7 @@ export const NamespaceContract = (options) => {
43
43
  type: "neemata:namespace",
44
44
  name,
45
45
  procedures: _procedures,
46
- subscriptions: _subscriptions,
46
+ subscriptions: {},
47
47
  events: _events,
48
48
  timeout
49
49
  });
@@ -1 +1 @@
1
- {"mappings":"AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AAQtE,OAAO,MAAM,gBAAgB;AA+D7B,OAAO,MAAM,oBAAoB,CAK/BA,YAOI;CACJ,MAAM,EACJ,aAAa,CAAE,GACf,gBAAgB,CAAE,GAClB,SAAS,CAAE,GACX,MACA,SACA,gBAAgB,CAAE,GACnB,GAAG,WAAW,CAAE;CACjB,MAAM,UAAU,CAAE;AAElB,MAAK,MAAM,YAAY,QAAQ;EAC7B,MAAM,QAAQ,OAAO;AACrB,UAAQ,YAAY,OAAO,OAAO,CAAE,GAAE,OAAO;GAC3C,MAAM;GACN,WAAW,SAAS;EACrB,EAAC;CACH;CAED,MAAM,cAAc,CAAE;AACtB,MAAK,MAAM,gBAAgB,YAAY;EACrC,MAAMC,YAAiB,WAAW;AAClC,cAAY,gBAAgB,OAAO,OAAO,CAAE,GAAE,WAAW;GACvD,MAAM;GACN,WAAW,SAAS;EACrB,EAAC;CACH;CAED,MAAM,iBAAiB,CAAE;AACzB,MAAK,MAAM,mBAAmB,eAAe;EAC3C,MAAMC,eAAoB,cAAc;EACxC,MAAM,UAAU,CAAE;AAElB,OAAK,MAAM,YAAY,aAAa,QAAQ;GAC1C,MAAM,QAAQ,aAAa,OAAO;AAClC,WAAQ,YAAY,OAAO,OAAO,CAAE,GAAE,OAAO;IAC3C,MAAM;IACN,cAAc;IACd,WAAW,SAAS;GACrB,EAAC;EACH;AAED,iBAAe,mBAAmB,OAAO,OAAO,CAAE,GAAE,cAAc;GAChE,MAAM;GACN,WAAW,SAAS;GACpB,QAAQ;EACT,EAAC;CACH;AAED,QAAO,aAEL;EACA,GAAG;GACF,OAAO;EACR,MAAM;EACA;EACN,YAAY;EACZ,eAAe;EACf,QAAQ;EACR;CACD,EAAC;AACH;AAED,OAAO,SAAS,oBACdC,OACgC;AAChC,QAAO,QAAQ,SAAS,MAAM,UAAU;AACzC","names":["options?: {\n procedures?: Procedures\n subscriptions?: Subscriptions\n events?: Events\n name?: Name\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n}","procedure: any","subscription: any","value: any"],"sources":["../../src/schemas/namespace.ts"],"sourcesContent":["import { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\nimport type { TAnyEventContract, TEventContract } from './event.ts'\nimport type { TAnyProcedureContract, TProcedureContract } from './procedure.ts'\nimport type {\n TAnySubscriptionContract,\n TSubscriptionContract,\n} from './subscription.ts'\n\nexport const NamespaceKind = 'NeemataNamespace'\n\nexport type TAnyNamespaceContract = TNamespaceContract<\n Record<string, any>,\n Record<string, any>,\n Record<string, any>,\n string | undefined\n>\n\nexport interface TNamespaceContract<\n Procedures extends Record<string, unknown> = {},\n Subscriptions extends Record<string, unknown> = {},\n Events extends Record<string, unknown> = {},\n Name extends string | undefined = undefined,\n> {\n [Kind]: typeof NamespaceKind\n type: 'neemata:namespace'\n name: Name\n procedures: {\n [K in keyof Procedures]: Procedures[K] extends TAnyProcedureContract\n ? TProcedureContract<\n Procedures[K]['input'],\n Procedures[K]['output'],\n Procedures[K]['stream'],\n Extract<K, string>,\n Name\n >\n : never\n }\n subscriptions: {\n [K in keyof Subscriptions]: Subscriptions[K] extends TAnySubscriptionContract\n ? TSubscriptionContract<\n Subscriptions[K]['input'],\n Subscriptions[K]['output'],\n Subscriptions[K]['options'],\n {\n [E in keyof Subscriptions[K]['events']]: Subscriptions[K]['events'][E] extends TAnyEventContract\n ? TEventContract<\n Subscriptions[K]['events'][E]['payload'],\n Extract<E, string>,\n Extract<K, string>,\n Name\n >\n : never\n },\n Extract<K, string>,\n Name\n >\n : never\n }\n events: {\n [K in keyof Events]: Events[K] extends TAnyEventContract\n ? TEventContract<\n Events[K]['payload'],\n Extract<K, string>,\n undefined,\n Name\n >\n : never\n }\n timeout?: number\n}\n\nexport const NamespaceContract = <\n Procedures extends Record<string, unknown> = {},\n Subscriptions extends Record<string, unknown> = {},\n Events extends Record<string, unknown> = {},\n Name extends string | undefined = undefined,\n>(options?: {\n procedures?: Procedures\n subscriptions?: Subscriptions\n events?: Events\n name?: Name\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n}) => {\n const {\n procedures = {} as Procedures,\n subscriptions = {} as Subscriptions,\n events = {} as Events,\n name,\n timeout,\n schemaOptions = {} as ContractSchemaOptions,\n } = options ?? {}\n const _events = {} as any\n\n for (const eventKey in events) {\n const event = events[eventKey]\n _events[eventKey] = Object.assign({}, event, {\n name: eventKey,\n namespace: options?.name,\n })\n }\n\n const _procedures = {} as any\n for (const procedureKey in procedures) {\n const procedure: any = procedures[procedureKey]\n _procedures[procedureKey] = Object.assign({}, procedure, {\n name: procedureKey,\n namespace: options?.name,\n })\n }\n\n const _subscriptions = {} as any\n for (const subscriptionKey in subscriptions) {\n const subscription: any = subscriptions[subscriptionKey]\n const _events = {} as any\n\n for (const eventKey in subscription.events) {\n const event = subscription.events[eventKey]\n _events[eventKey] = Object.assign({}, event, {\n name: eventKey,\n subscription: subscriptionKey,\n namespace: options?.name,\n })\n }\n\n _subscriptions[subscriptionKey] = Object.assign({}, subscription, {\n name: subscriptionKey,\n namespace: options?.name,\n events: _events,\n })\n }\n\n return createSchema<\n TNamespaceContract<Procedures, Subscriptions, Events, Name>\n >({\n ...schemaOptions,\n [Kind]: NamespaceKind,\n type: 'neemata:namespace',\n name: name as Name,\n procedures: _procedures,\n subscriptions: _subscriptions,\n events: _events,\n timeout,\n })\n}\n\nexport function IsNamespaceContract(\n value: any,\n): value is TAnyNamespaceContract {\n return Kind in value && value[Kind] === NamespaceKind\n}\n"],"version":3,"file":"namespace.js"}
1
+ {"mappings":"AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AAQtE,OAAO,MAAM,gBAAgB;AA+D7B,OAAO,MAAM,oBAAoB,CAK/BA,YAOI;CACJ,MAAM,EACJ,aAAa,CAAE,GACf,gBAAgB,CAAE,GAClB,SAAS,CAAE,GACX,MACA,SACA,gBAAgB,CAAE,GACnB,GAAG,WAAW,CAAE;CACjB,MAAM,UAAU,CAAE;AAElB,MAAK,MAAM,YAAY,QAAQ;EAC7B,MAAM,QAAQ,OAAO;AACrB,UAAQ,YAAY,OAAO,OAAO,CAAE,GAAE,OAAO;GAC3C,MAAM;GACN,WAAW,SAAS;EACrB,EAAC;CACH;CAED,MAAM,cAAc,CAAE;AACtB,MAAK,MAAM,gBAAgB,YAAY;EACrC,MAAMC,YAAiB,WAAW;AAClC,cAAY,gBAAgB,OAAO,OAAO,CAAE,GAAE,WAAW;GACvD,MAAM;GACN,WAAW,SAAS;EACrB,EAAC;CACH;CAED,MAAM,iBAAiB,CAAE;AACzB,MAAK,MAAM,mBAAmB,eAAe;EAC3C,MAAMC,eAAoB,cAAc;EACxC,MAAM,UAAU,CAAE;AAElB,OAAK,MAAM,YAAY,aAAa,QAAQ;GAC1C,MAAM,QAAQ,aAAa,OAAO;AAClC,WAAQ,YAAY,OAAO,OAAO,CAAE,GAAE,OAAO;IAC3C,MAAM;IACN,cAAc;IACd,WAAW,SAAS;GACrB,EAAC;EACH;AAED,iBAAe,mBAAmB,OAAO,OAAO,CAAE,GAAE,cAAc;GAChE,MAAM;GACN,WAAW,SAAS;GACpB,QAAQ;EACT,EAAC;CACH;AAED,QAAO,aAOL;EACA,GAAG;GACF,OAAO;EACR,MAAM;EACA;EACN,YAAY;EAEZ,eAAe,CAAE;EACjB,QAAQ;EACR;CACD,EAAC;AACH;AAED,OAAO,SAAS,oBACdC,OACgC;AAChC,QAAO,QAAQ,SAAS,MAAM,UAAU;AACzC","names":["options?: {\n procedures?: Procedures\n subscriptions?: Subscriptions\n events?: Events\n name?: Name\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n}","procedure: any","subscription: any","value: any"],"sources":["../../src/schemas/namespace.ts"],"sourcesContent":["import { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\nimport type { TAnyEventContract, TEventContract } from './event.ts'\nimport type { TAnyProcedureContract, TProcedureContract } from './procedure.ts'\n// import type {\n// TAnySubscriptionContract,\n// TSubscriptionContract,\n// } from './subscription.ts'\n\nexport const NamespaceKind = 'NeemataNamespace'\n\nexport type TAnyNamespaceContract = TNamespaceContract<\n Record<string, any>,\n // Record<string, any>,\n Record<string, any>,\n string | undefined\n>\n\nexport interface TNamespaceContract<\n Procedures extends Record<string, unknown> = {},\n // Subscriptions extends Record<string, unknown> = {},\n Events extends Record<string, unknown> = {},\n Name extends string | undefined = undefined,\n> {\n [Kind]: typeof NamespaceKind\n type: 'neemata:namespace'\n name: Name\n procedures: {\n [K in keyof Procedures]: Procedures[K] extends TAnyProcedureContract\n ? TProcedureContract<\n Procedures[K]['input'],\n Procedures[K]['output'],\n Procedures[K]['stream'],\n Extract<K, string>,\n Name\n >\n : never\n }\n subscriptions: {\n // [K in keyof Subscriptions]: Subscriptions[K] extends TAnySubscriptionContract\n // ? TSubscriptionContract<\n // Subscriptions[K]['input'],\n // Subscriptions[K]['output'],\n // Subscriptions[K]['options'],\n // {\n // [E in keyof Subscriptions[K]['events']]: Subscriptions[K]['events'][E] extends TAnyEventContract\n // ? TEventContract<\n // Subscriptions[K]['events'][E]['payload'],\n // Extract<E, string>,\n // Extract<K, string>,\n // Name\n // >\n // : never\n // },\n // Extract<K, string>,\n // Name\n // >\n // : never\n }\n events: {\n [K in keyof Events]: Events[K] extends TAnyEventContract\n ? TEventContract<\n Events[K]['payload'],\n Extract<K, string>,\n undefined,\n Name\n >\n : never\n }\n timeout?: number\n}\n\nexport const NamespaceContract = <\n Procedures extends Record<string, unknown> = {},\n Subscriptions extends Record<string, unknown> = {},\n Events extends Record<string, unknown> = {},\n Name extends string | undefined = undefined,\n>(options?: {\n procedures?: Procedures\n subscriptions?: Subscriptions\n events?: Events\n name?: Name\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n}) => {\n const {\n procedures = {} as Procedures,\n subscriptions = {} as Subscriptions,\n events = {} as Events,\n name,\n timeout,\n schemaOptions = {} as ContractSchemaOptions,\n } = options ?? {}\n const _events = {} as any\n\n for (const eventKey in events) {\n const event = events[eventKey]\n _events[eventKey] = Object.assign({}, event, {\n name: eventKey,\n namespace: options?.name,\n })\n }\n\n const _procedures = {} as any\n for (const procedureKey in procedures) {\n const procedure: any = procedures[procedureKey]\n _procedures[procedureKey] = Object.assign({}, procedure, {\n name: procedureKey,\n namespace: options?.name,\n })\n }\n\n const _subscriptions = {} as any\n for (const subscriptionKey in subscriptions) {\n const subscription: any = subscriptions[subscriptionKey]\n const _events = {} as any\n\n for (const eventKey in subscription.events) {\n const event = subscription.events[eventKey]\n _events[eventKey] = Object.assign({}, event, {\n name: eventKey,\n subscription: subscriptionKey,\n namespace: options?.name,\n })\n }\n\n _subscriptions[subscriptionKey] = Object.assign({}, subscription, {\n name: subscriptionKey,\n namespace: options?.name,\n events: _events,\n })\n }\n\n return createSchema<\n TNamespaceContract<\n Procedures,\n // Subscriptions,\n Events,\n Name\n >\n >({\n ...schemaOptions,\n [Kind]: NamespaceKind,\n type: 'neemata:namespace',\n name: name as Name,\n procedures: _procedures,\n // subscriptions: _subscriptions,\n subscriptions: {},\n events: _events,\n timeout,\n })\n}\n\nexport function IsNamespaceContract(\n value: any,\n): value is TAnyNamespaceContract {\n return Kind in value && value[Kind] === NamespaceKind\n}\n"],"version":3,"file":"namespace.js"}
@@ -1 +1 @@
1
- {"mappings":"AAAA,SAAwB,SAAS,aAAa;AAC9C,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AA0BtE,OAAO,MAAM,gBAAgB;AA2B7B,OAAO,MAAM,oBAAoB,CAK/BA,YAOI;CACJ,MAAM,EACJ,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,OAAO,EAClB,SACA,gBAAgB,CAAE,GAClB,MACD,GAAG;AACJ,QAAO,aAA8D;EACnE,GAAG;GACF,OAAO;EACR,MAAM;EACN;EACA;EACA;EACA;EACM;EACN,WAAW;CACZ,EAAC;AACH;AAED,OAAO,SAAS,oBACdC,UACmC;AACnC,QAAO,QAAQ,YAAY,SAAS,UAAU;AAC/C","names":["options: {\n input?: Input\n output?: Output\n stream?: Stream\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}","contract: any"],"sources":["../../src/schemas/procedure.ts"],"sourcesContent":["import { type BaseType, t } from '@nmtjs/type'\nimport { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\n\nexport type TAnyBaseProcedureContract = TBaseProcedureContract<\n string,\n BaseType,\n BaseType,\n string | undefined,\n string | undefined\n>\n\nexport interface TBaseProcedureContract<\n Type extends string,\n Input extends BaseType,\n Output extends BaseType,\n Name extends string | undefined = undefined,\n Namespace extends string | undefined = undefined,\n> {\n [Kind]: string\n type: Type\n name: Name\n namespace: Namespace\n input: Input\n output: Output\n timeout?: number\n}\n\nexport const ProcedureKind = 'NeemataProcedure'\n\nexport type TAnyProcedureContract = TProcedureContract<\n BaseType,\n BaseType,\n BaseType,\n string | undefined,\n string | undefined\n>\n\nexport interface TProcedureContract<\n Input extends BaseType = t.NeverType,\n Output extends BaseType = t.NeverType,\n Stream extends BaseType = t.NeverType,\n Name extends string | undefined = undefined,\n Namespace extends string | undefined = undefined,\n> extends TBaseProcedureContract<\n 'neemata:procedure',\n Input,\n Output,\n Name,\n Namespace\n > {\n [Kind]: typeof ProcedureKind\n stream: Stream\n}\n\nexport const ProcedureContract = <\n Input extends BaseType = t.NeverType,\n Output extends BaseType = t.NeverType,\n Stream extends BaseType = t.NeverType,\n Name extends string | undefined = undefined,\n>(options: {\n input?: Input\n output?: Output\n stream?: Stream\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}) => {\n const {\n input = t.never() as unknown as Input,\n output = t.never() as unknown as Output,\n stream = t.never() as unknown as Stream,\n timeout,\n schemaOptions = {},\n name,\n } = options\n return createSchema<TProcedureContract<Input, Output, Stream, Name>>({\n ...schemaOptions,\n [Kind]: ProcedureKind,\n type: 'neemata:procedure',\n input,\n output,\n stream,\n timeout,\n name: name as Name,\n namespace: undefined,\n })\n}\n\nexport function IsProcedureContract(\n contract: any,\n): contract is TAnyProcedureContract {\n return Kind in contract && contract[Kind] === ProcedureKind\n}\n"],"version":3,"file":"procedure.js"}
1
+ {"mappings":"AAAA,SAAwB,SAAS,aAAa;AAC9C,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AAUtE,OAAO,MAAM,gBAAgB;AAmB7B,OAAO,MAAM,oBAAoB,CAK/BA,YAOI;CACJ,MAAM,EACJ,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,OAAO,EAClB,SACA,gBAAgB,CAAE,GAClB,MACD,GAAG;AACJ,QAAO,aAA8D;EACnE,GAAG;GACF,OAAO;EACR,MAAM;EACN;EACA;EACA;EACA;EACM;EACN,WAAW;CACZ,EAAC;AACH;AAED,OAAO,SAAS,oBACdC,UACmC;AACnC,QAAO,QAAQ,YAAY,SAAS,UAAU;AAC/C","names":["options: {\n input?: Input\n output?: Output\n stream?: Stream\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}","contract: any"],"sources":["../../src/schemas/procedure.ts"],"sourcesContent":["import { type BaseType, t } from '@nmtjs/type'\nimport { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\n\nexport type TAnyProcedureContract = TProcedureContract<\n BaseType,\n BaseType,\n BaseType,\n string | undefined,\n string | undefined\n>\n\nexport const ProcedureKind = 'NeemataProcedure'\n\nexport interface TProcedureContract<\n Input extends BaseType = t.NeverType,\n Output extends BaseType = t.NeverType,\n Stream extends BaseType = t.NeverType,\n Name extends string | undefined = undefined,\n Namespace extends string | undefined = undefined,\n> {\n [Kind]: typeof ProcedureKind\n type: 'neemata:procedure'\n name: Name\n namespace: Namespace\n input: Input\n output: Output\n timeout?: number\n stream: Stream\n}\n\nexport const ProcedureContract = <\n Input extends BaseType = t.NeverType,\n Output extends BaseType = t.NeverType,\n Stream extends BaseType = t.NeverType,\n Name extends string | undefined = undefined,\n>(options: {\n input?: Input\n output?: Output\n stream?: Stream\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}) => {\n const {\n input = t.never() as unknown as Input,\n output = t.never() as unknown as Output,\n stream = t.never() as unknown as Stream,\n timeout,\n schemaOptions = {},\n name,\n } = options\n return createSchema<TProcedureContract<Input, Output, Stream, Name>>({\n ...schemaOptions,\n [Kind]: ProcedureKind,\n type: 'neemata:procedure',\n input,\n output,\n stream,\n timeout,\n name: name as Name,\n namespace: undefined,\n })\n}\n\nexport function IsProcedureContract(\n contract: any,\n): contract is TAnyProcedureContract {\n return Kind in contract && contract[Kind] === ProcedureKind\n}\n"],"version":3,"file":"procedure.js"}
@@ -1,9 +1,8 @@
1
- import { t } from "@nmtjs/type";
2
1
  import { Kind } from "../constants.js";
3
2
  import { createSchema } from "../utils.js";
4
3
  export const SubscriptionKind = "NeemataSubscription";
5
4
  export const SubscriptionContract = (options) => {
6
- const { input = t.never(), output = t.never(), events = {}, timeout, schemaOptions = {}, name } = options ?? {};
5
+ const { events = {}, schemaOptions = {}, name } = options ?? {};
7
6
  const _events = {};
8
7
  for (const key in events) {
9
8
  const event = events[key];
@@ -13,10 +12,7 @@ export const SubscriptionContract = (options) => {
13
12
  ...schemaOptions,
14
13
  [Kind]: SubscriptionKind,
15
14
  type: "neemata:subscription",
16
- input,
17
- output,
18
15
  events: _events,
19
- timeout,
20
16
  name,
21
17
  namespace: undefined,
22
18
  options: undefined
@@ -1 +1 @@
1
- {"mappings":"AAAA,SAAwB,SAAS,aAAa;AAC9C,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AAItE,OAAO,MAAM,mBAAmB;AAyChC,OAAO,MAAM,uBAAuB,CAKlCA,YAOI;CACJ,MAAM,EACJ,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,OAAO,EAClB,SAAS,CAAE,GACX,SACA,gBAAgB,CAAE,GAClB,MACD,GAAG,WAAW,CAAE;CAEjB,MAAM,UAAU,CAAE;AAClB,MAAK,MAAM,OAAO,QAAQ;EACxB,MAAM,QAAQ,OAAO;AACrB,UAAQ,OAAO,OAAO,OAAO,CAAE,GAAE,OAAO,EAAE,cAAc,KAAM,EAAC;CAChE;AACD,QAAO,EACL,cAAc,MACZ,aACE;EACE,GAAG;GACF,OAAO;EACR,MAAM;EACN;EACA;EACA,QAAQ;EACR;EACM;EACN,WAAW;EACX,SAAS;CACV,EACF,CACJ;AACF;AAED,OAAO,SAAS,uBACdC,UACsC;AACtC,QAAO,QAAQ,YAAY,SAAS,UAAU;AAC/C","names":["options?: {\n input?: Input\n output?: Output\n events?: Events\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}","contract: any"],"sources":["../../src/schemas/subscription.ts"],"sourcesContent":["import { type BaseType, t } from '@nmtjs/type'\nimport { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\nimport type { TAnyEventContract, TEventContract } from './event.ts'\nimport type { TBaseProcedureContract } from './procedure.ts'\n\nexport const SubscriptionKind = 'NeemataSubscription'\n\nexport type SubcriptionOptions = Record<string, string | number | boolean>\n\nexport type TAnySubscriptionContract = TSubscriptionContract<\n BaseType,\n BaseType,\n SubcriptionOptions,\n Record<string, unknown>,\n string | undefined,\n string | undefined\n>\n\nexport interface TSubscriptionContract<\n Input extends BaseType = t.NeverType,\n Output extends BaseType = t.NeverType,\n Options extends SubcriptionOptions = {},\n Events extends Record<string, unknown> = {},\n Name extends string | undefined = undefined,\n Namespace extends string | undefined = undefined,\n> extends TBaseProcedureContract<\n 'neemata:subscription',\n Input,\n Output,\n Name,\n Namespace\n > {\n [Kind]: typeof SubscriptionKind\n options: Options\n events: {\n [K in keyof Events]: Events[K] extends TAnyEventContract\n ? TEventContract<\n Events[K]['payload'],\n Extract<K, string>,\n Name,\n Namespace\n >\n : never\n }\n}\n\nexport const SubscriptionContract = <\n Input extends BaseType = t.NeverType,\n Output extends BaseType = t.NeverType,\n Events extends Record<string, unknown> = {},\n Name extends string | undefined = undefined,\n>(options?: {\n input?: Input\n output?: Output\n events?: Events\n timeout?: number\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}) => {\n const {\n input = t.never() as unknown as Input,\n output = t.never() as unknown as Output,\n events = {} as Events,\n timeout,\n schemaOptions = {},\n name,\n } = options ?? {}\n\n const _events = {} as any\n for (const key in events) {\n const event = events[key]\n _events[key] = Object.assign({}, event, { subscription: name })\n }\n return {\n $withOptions: <Options extends SubcriptionOptions>() =>\n createSchema<TSubscriptionContract<Input, Output, Options, Events, Name>>(\n {\n ...schemaOptions,\n [Kind]: SubscriptionKind,\n type: 'neemata:subscription',\n input,\n output,\n events: _events,\n timeout,\n name: name as Name,\n namespace: undefined,\n options: undefined as unknown as Options,\n },\n ),\n }\n}\n\nexport function IsSubscriptionContract(\n contract: any,\n): contract is TAnySubscriptionContract {\n return Kind in contract && contract[Kind] === SubscriptionKind\n}\n"],"version":3,"file":"subscription.js"}
1
+ {"mappings":"AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AAGtE,OAAO,MAAM,mBAAmB;AAkChC,OAAO,MAAM,uBAAuB,CAGlCA,YAII;CACJ,MAAM,EAAE,SAAS,CAAE,GAAY,gBAAgB,CAAE,GAAE,MAAM,GAAG,WAAW,CAAE;CAEzE,MAAM,UAAU,CAAE;AAClB,MAAK,MAAM,OAAO,QAAQ;EACxB,MAAM,QAAQ,OAAO;AACrB,UAAQ,OAAO,OAAO,OAAO,CAAE,GAAE,OAAO,EAAE,cAAc,KAAM,EAAC;CAChE;AACD,QAAO,EACL,cAAc,MACZ,aAA2D;EACzD,GAAG;GACF,OAAO;EACR,MAAM;EACN,QAAQ;EACF;EACN,WAAW;EACX,SAAS;CACV,EAAC,CACL;AACF;AAED,OAAO,SAAS,uBACdC,UACsC;AACtC,QAAO,QAAQ,YAAY,SAAS,UAAU;AAC/C","names":["options?: {\n events?: Events\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}","contract: any"],"sources":["../../src/schemas/subscription.ts"],"sourcesContent":["import { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\nimport type { TAnyEventContract, TEventContract } from './event.ts'\n\nexport const SubscriptionKind = 'NeemataSubscription'\n\nexport type SubcriptionOptions = Record<string, string | number | boolean>\n\nexport type TAnySubscriptionContract = TSubscriptionContract<\n SubcriptionOptions,\n Record<string, unknown>,\n string | undefined,\n string | undefined\n>\n\nexport interface TSubscriptionContract<\n Options extends SubcriptionOptions = {},\n Events extends Record<string, unknown> = {},\n Name extends string | undefined = undefined,\n Namespace extends string | undefined = undefined,\n> {\n [Kind]: typeof SubscriptionKind\n type: 'neemata:subscription'\n name: Name\n namespace: Namespace\n options: Options\n events: {\n [K in keyof Events]: Events[K] extends TAnyEventContract\n ? TEventContract<\n Events[K]['payload'],\n Extract<K, string>,\n Name,\n Namespace\n >\n : never\n }\n}\n\nexport const SubscriptionContract = <\n Events extends Record<string, unknown> = {},\n Name extends string | undefined = undefined,\n>(options?: {\n events?: Events\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}) => {\n const { events = {} as Events, schemaOptions = {}, name } = options ?? {}\n\n const _events = {} as any\n for (const key in events) {\n const event = events[key]\n _events[key] = Object.assign({}, event, { subscription: name })\n }\n return {\n $withOptions: <Options extends SubcriptionOptions>() =>\n createSchema<TSubscriptionContract<Options, Events, Name>>({\n ...schemaOptions,\n [Kind]: SubscriptionKind,\n type: 'neemata:subscription',\n events: _events,\n name: name as Name,\n namespace: undefined,\n options: undefined as unknown as Options,\n }),\n }\n}\n\nexport function IsSubscriptionContract(\n contract: any,\n): contract is TAnySubscriptionContract {\n return Kind in contract && contract[Kind] === SubscriptionKind\n}\n"],"version":3,"file":"subscription.js"}
package/package.json CHANGED
@@ -8,8 +8,8 @@
8
8
  }
9
9
  },
10
10
  "dependencies": {
11
- "@nmtjs/protocol": "0.11.4",
12
- "@nmtjs/type": "0.11.4"
11
+ "@nmtjs/protocol": "0.11.6",
12
+ "@nmtjs/type": "0.11.6"
13
13
  },
14
14
  "files": [
15
15
  "src",
@@ -17,7 +17,7 @@
17
17
  "LICENSE.md",
18
18
  "README.md"
19
19
  ],
20
- "version": "0.11.4",
20
+ "version": "0.11.6",
21
21
  "scripts": {
22
22
  "build": "neemata-build --root=./src './**/*.ts'",
23
23
  "type-check": "tsc --noEmit"
@@ -13,7 +13,7 @@ export interface TAPIContract<Namespaces extends Record<string, unknown> = {}> {
13
13
  [K in keyof Namespaces]: Namespaces[K] extends TAnyNamespaceContract
14
14
  ? TNamespaceContract<
15
15
  Namespaces[K]['procedures'],
16
- Namespaces[K]['subscriptions'],
16
+ // Namespaces[K]['subscriptions'],
17
17
  Namespaces[K]['events'],
18
18
  Extract<K, string>
19
19
  >
@@ -2,23 +2,23 @@ import { Kind } from '../constants.ts'
2
2
  import { type ContractSchemaOptions, createSchema } from '../utils.ts'
3
3
  import type { TAnyEventContract, TEventContract } from './event.ts'
4
4
  import type { TAnyProcedureContract, TProcedureContract } from './procedure.ts'
5
- import type {
6
- TAnySubscriptionContract,
7
- TSubscriptionContract,
8
- } from './subscription.ts'
5
+ // import type {
6
+ // TAnySubscriptionContract,
7
+ // TSubscriptionContract,
8
+ // } from './subscription.ts'
9
9
 
10
10
  export const NamespaceKind = 'NeemataNamespace'
11
11
 
12
12
  export type TAnyNamespaceContract = TNamespaceContract<
13
13
  Record<string, any>,
14
- Record<string, any>,
14
+ // Record<string, any>,
15
15
  Record<string, any>,
16
16
  string | undefined
17
17
  >
18
18
 
19
19
  export interface TNamespaceContract<
20
20
  Procedures extends Record<string, unknown> = {},
21
- Subscriptions extends Record<string, unknown> = {},
21
+ // Subscriptions extends Record<string, unknown> = {},
22
22
  Events extends Record<string, unknown> = {},
23
23
  Name extends string | undefined = undefined,
24
24
  > {
@@ -37,25 +37,25 @@ export interface TNamespaceContract<
37
37
  : never
38
38
  }
39
39
  subscriptions: {
40
- [K in keyof Subscriptions]: Subscriptions[K] extends TAnySubscriptionContract
41
- ? TSubscriptionContract<
42
- Subscriptions[K]['input'],
43
- Subscriptions[K]['output'],
44
- Subscriptions[K]['options'],
45
- {
46
- [E in keyof Subscriptions[K]['events']]: Subscriptions[K]['events'][E] extends TAnyEventContract
47
- ? TEventContract<
48
- Subscriptions[K]['events'][E]['payload'],
49
- Extract<E, string>,
50
- Extract<K, string>,
51
- Name
52
- >
53
- : never
54
- },
55
- Extract<K, string>,
56
- Name
57
- >
58
- : never
40
+ // [K in keyof Subscriptions]: Subscriptions[K] extends TAnySubscriptionContract
41
+ // ? TSubscriptionContract<
42
+ // Subscriptions[K]['input'],
43
+ // Subscriptions[K]['output'],
44
+ // Subscriptions[K]['options'],
45
+ // {
46
+ // [E in keyof Subscriptions[K]['events']]: Subscriptions[K]['events'][E] extends TAnyEventContract
47
+ // ? TEventContract<
48
+ // Subscriptions[K]['events'][E]['payload'],
49
+ // Extract<E, string>,
50
+ // Extract<K, string>,
51
+ // Name
52
+ // >
53
+ // : never
54
+ // },
55
+ // Extract<K, string>,
56
+ // Name
57
+ // >
58
+ // : never
59
59
  }
60
60
  events: {
61
61
  [K in keyof Events]: Events[K] extends TAnyEventContract
@@ -132,14 +132,20 @@ export const NamespaceContract = <
132
132
  }
133
133
 
134
134
  return createSchema<
135
- TNamespaceContract<Procedures, Subscriptions, Events, Name>
135
+ TNamespaceContract<
136
+ Procedures,
137
+ // Subscriptions,
138
+ Events,
139
+ Name
140
+ >
136
141
  >({
137
142
  ...schemaOptions,
138
143
  [Kind]: NamespaceKind,
139
144
  type: 'neemata:namespace',
140
145
  name: name as Name,
141
146
  procedures: _procedures,
142
- subscriptions: _subscriptions,
147
+ // subscriptions: _subscriptions,
148
+ subscriptions: {},
143
149
  events: _events,
144
150
  timeout,
145
151
  })
@@ -2,32 +2,6 @@ import { type BaseType, t } from '@nmtjs/type'
2
2
  import { Kind } from '../constants.ts'
3
3
  import { type ContractSchemaOptions, createSchema } from '../utils.ts'
4
4
 
5
- export type TAnyBaseProcedureContract = TBaseProcedureContract<
6
- string,
7
- BaseType,
8
- BaseType,
9
- string | undefined,
10
- string | undefined
11
- >
12
-
13
- export interface TBaseProcedureContract<
14
- Type extends string,
15
- Input extends BaseType,
16
- Output extends BaseType,
17
- Name extends string | undefined = undefined,
18
- Namespace extends string | undefined = undefined,
19
- > {
20
- [Kind]: string
21
- type: Type
22
- name: Name
23
- namespace: Namespace
24
- input: Input
25
- output: Output
26
- timeout?: number
27
- }
28
-
29
- export const ProcedureKind = 'NeemataProcedure'
30
-
31
5
  export type TAnyProcedureContract = TProcedureContract<
32
6
  BaseType,
33
7
  BaseType,
@@ -36,20 +10,22 @@ export type TAnyProcedureContract = TProcedureContract<
36
10
  string | undefined
37
11
  >
38
12
 
13
+ export const ProcedureKind = 'NeemataProcedure'
14
+
39
15
  export interface TProcedureContract<
40
16
  Input extends BaseType = t.NeverType,
41
17
  Output extends BaseType = t.NeverType,
42
18
  Stream extends BaseType = t.NeverType,
43
19
  Name extends string | undefined = undefined,
44
20
  Namespace extends string | undefined = undefined,
45
- > extends TBaseProcedureContract<
46
- 'neemata:procedure',
47
- Input,
48
- Output,
49
- Name,
50
- Namespace
51
- > {
21
+ > {
52
22
  [Kind]: typeof ProcedureKind
23
+ type: 'neemata:procedure'
24
+ name: Name
25
+ namespace: Namespace
26
+ input: Input
27
+ output: Output
28
+ timeout?: number
53
29
  stream: Stream
54
30
  }
55
31
 
@@ -1,16 +1,12 @@
1
- import { type BaseType, t } from '@nmtjs/type'
2
1
  import { Kind } from '../constants.ts'
3
2
  import { type ContractSchemaOptions, createSchema } from '../utils.ts'
4
3
  import type { TAnyEventContract, TEventContract } from './event.ts'
5
- import type { TBaseProcedureContract } from './procedure.ts'
6
4
 
7
5
  export const SubscriptionKind = 'NeemataSubscription'
8
6
 
9
7
  export type SubcriptionOptions = Record<string, string | number | boolean>
10
8
 
11
9
  export type TAnySubscriptionContract = TSubscriptionContract<
12
- BaseType,
13
- BaseType,
14
10
  SubcriptionOptions,
15
11
  Record<string, unknown>,
16
12
  string | undefined,
@@ -18,20 +14,15 @@ export type TAnySubscriptionContract = TSubscriptionContract<
18
14
  >
19
15
 
20
16
  export interface TSubscriptionContract<
21
- Input extends BaseType = t.NeverType,
22
- Output extends BaseType = t.NeverType,
23
17
  Options extends SubcriptionOptions = {},
24
18
  Events extends Record<string, unknown> = {},
25
19
  Name extends string | undefined = undefined,
26
20
  Namespace extends string | undefined = undefined,
27
- > extends TBaseProcedureContract<
28
- 'neemata:subscription',
29
- Input,
30
- Output,
31
- Name,
32
- Namespace
33
- > {
21
+ > {
34
22
  [Kind]: typeof SubscriptionKind
23
+ type: 'neemata:subscription'
24
+ name: Name
25
+ namespace: Namespace
35
26
  options: Options
36
27
  events: {
37
28
  [K in keyof Events]: Events[K] extends TAnyEventContract
@@ -46,26 +37,14 @@ export interface TSubscriptionContract<
46
37
  }
47
38
 
48
39
  export const SubscriptionContract = <
49
- Input extends BaseType = t.NeverType,
50
- Output extends BaseType = t.NeverType,
51
40
  Events extends Record<string, unknown> = {},
52
41
  Name extends string | undefined = undefined,
53
42
  >(options?: {
54
- input?: Input
55
- output?: Output
56
43
  events?: Events
57
- timeout?: number
58
44
  schemaOptions?: ContractSchemaOptions
59
45
  name?: Name
60
46
  }) => {
61
- const {
62
- input = t.never() as unknown as Input,
63
- output = t.never() as unknown as Output,
64
- events = {} as Events,
65
- timeout,
66
- schemaOptions = {},
67
- name,
68
- } = options ?? {}
47
+ const { events = {} as Events, schemaOptions = {}, name } = options ?? {}
69
48
 
70
49
  const _events = {} as any
71
50
  for (const key in events) {
@@ -74,20 +53,15 @@ export const SubscriptionContract = <
74
53
  }
75
54
  return {
76
55
  $withOptions: <Options extends SubcriptionOptions>() =>
77
- createSchema<TSubscriptionContract<Input, Output, Options, Events, Name>>(
78
- {
79
- ...schemaOptions,
80
- [Kind]: SubscriptionKind,
81
- type: 'neemata:subscription',
82
- input,
83
- output,
84
- events: _events,
85
- timeout,
86
- name: name as Name,
87
- namespace: undefined,
88
- options: undefined as unknown as Options,
89
- },
90
- ),
56
+ createSchema<TSubscriptionContract<Options, Events, Name>>({
57
+ ...schemaOptions,
58
+ [Kind]: SubscriptionKind,
59
+ type: 'neemata:subscription',
60
+ events: _events,
61
+ name: name as Name,
62
+ namespace: undefined,
63
+ options: undefined as unknown as Options,
64
+ }),
91
65
  }
92
66
  }
93
67