@nmtjs/contract 0.6.5 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/constants.js CHANGED
@@ -1 +1 @@
1
- export const Kind = Symbol.for('neemata:kind');
1
+ export const Kind = Symbol.for("neemata:kind");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants.ts"],"sourcesContent":["export const Kind = Symbol.for('neemata:kind')\n"],"names":["Kind","Symbol","for"],"mappings":"AAAA,OAAO,MAAMA,OAAOC,OAAOC,GAAG,CAAC,gBAAe"}
1
+ {"mappings":"AAAA,OAAO,MAAM,OAAO,OAAO,IAAI,eAAe","names":[],"sources":["src/constants.ts"],"sourcesContent":["export const Kind = Symbol.for('neemata:kind')\n"],"version":3}
package/dist/index.js CHANGED
@@ -9,13 +9,13 @@ export * from "./schemas/event.js";
9
9
  export * from "./schemas/namespace.js";
10
10
  export * from "./schemas/procedure.js";
11
11
  export * from "./schemas/subscription.js";
12
- export var contract;
13
- (function(contract) {
14
- contract.procedure = ProcedureContract;
15
- contract.event = EventContract;
16
- contract.subscription = SubscriptionContract;
17
- contract.namespace = NamespaceContract;
18
- contract.api = APIContract;
19
- contract.blob = BlobType;
12
+ export let contract;
13
+ (function(_contract) {
14
+ const procedure = _contract.procedure = ProcedureContract;
15
+ const event = _contract.event = EventContract;
16
+ const subscription = _contract.subscription = SubscriptionContract;
17
+ const namespace = _contract.namespace = NamespaceContract;
18
+ const api = _contract.api = APIContract;
19
+ const blob = _contract.blob = BlobType;
20
20
  })(contract || (contract = {}));
21
21
  export { contract as c };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { APIContract } from './schemas/api.ts'\nimport { EventContract } from './schemas/event.ts'\nimport { NamespaceContract } from './schemas/namespace.ts'\nimport { ProcedureContract } from './schemas/procedure.ts'\nimport { SubscriptionContract } from './schemas/subscription.ts'\nimport { BlobType } from './types/blob.ts'\n\nexport * from './schemas/api.ts'\nexport * from './schemas/event.ts'\nexport * from './schemas/namespace.ts'\nexport * from './schemas/procedure.ts'\nexport * from './schemas/subscription.ts'\n\nexport namespace contract {\n export const procedure = ProcedureContract\n export const event = EventContract\n export const subscription = SubscriptionContract\n export const namespace = NamespaceContract\n export const api = APIContract\n export const blob = BlobType\n}\n\nexport { contract as c }\n"],"names":["APIContract","EventContract","NamespaceContract","ProcedureContract","SubscriptionContract","BlobType","contract","procedure","event","subscription","namespace","api","blob","c"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mBAAkB;AAC9C,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,QAAQ,QAAQ,kBAAiB;AAE1C,cAAc,mBAAkB;AAChC,cAAc,qBAAoB;AAClC,cAAc,yBAAwB;AACtC,cAAc,yBAAwB;AACtC,cAAc,4BAA2B;;UAExBC;aACFC,YAAYJ;aACZK,QAAQP;aACRQ,eAAeL;aACfM,YAAYR;aACZS,MAAMX;aACNY,OAAOP;AACtB,GAPiBC,aAAAA;AASjB,SAASA,YAAYO,CAAC,GAAE"}
1
+ {"mappings":"AAAA,SAAS,mBAAmB,kBAAkB;AAC9C,SAAS,qBAAqB,oBAAoB;AAClD,SAAS,yBAAyB,wBAAwB;AAC1D,SAAS,yBAAyB,wBAAwB;AAC1D,SAAS,4BAA4B,2BAA2B;AAChE,SAAS,gBAAgB,iBAAiB;AAE1C,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;;AAEP;CACE,MAAM,kCAAY;CAClB,MAAM,0BAAQ;CACd,MAAM,wCAAe;CACrB,MAAM,kCAAY;CAClB,MAAM,sBAAM;CACZ,MAAM,wBAAO;;AAGtB,SAAS,YAAY","names":[],"sources":["src/index.ts"],"sourcesContent":["import { APIContract } from './schemas/api.ts'\nimport { EventContract } from './schemas/event.ts'\nimport { NamespaceContract } from './schemas/namespace.ts'\nimport { ProcedureContract } from './schemas/procedure.ts'\nimport { SubscriptionContract } from './schemas/subscription.ts'\nimport { BlobType } from './types/blob.ts'\n\nexport * from './schemas/api.ts'\nexport * from './schemas/event.ts'\nexport * from './schemas/namespace.ts'\nexport * from './schemas/procedure.ts'\nexport * from './schemas/subscription.ts'\n\nexport namespace contract {\n export const procedure = ProcedureContract\n export const event = EventContract\n export const subscription = SubscriptionContract\n export const namespace = NamespaceContract\n export const api = APIContract\n export const blob = BlobType\n}\n\nexport { contract as c }\n"],"version":3}
@@ -1,60 +1,60 @@
1
1
  import { Kind } from "../constants.js";
2
2
  import { createSchema } from "../utils.js";
3
- export const APIKind = 'NeemataAPI';
4
- export const APIContract = (options)=>{
5
- const { namespaces = {}, timeout = 1000, schemaOptions = {} } = options || {};
6
- const _namespaces = {};
7
- for(const namespaceKey in namespaces){
8
- const namespace = namespaces[namespaceKey];
9
- const _procedures = {};
10
- for(const procedureKey in namespace.procedures){
11
- const procedure = namespace.procedures[procedureKey];
12
- _procedures[procedureKey] = Object.assign({}, procedure, {
13
- name: procedureKey,
14
- namespace: namespaceKey
15
- });
16
- }
17
- const _subscriptions = {};
18
- for(const subscriptionKey in namespace.subscriptions){
19
- const subscription = namespace.subscriptions[subscriptionKey];
20
- const _events = {};
21
- for(const eventKey in subscription.events){
22
- const event = subscription.events[eventKey];
23
- _events[eventKey] = Object.assign({}, event, {
24
- name: eventKey,
25
- namespace: namespaceKey,
26
- subscription: subscriptionKey
27
- });
28
- }
29
- _subscriptions[subscriptionKey] = Object.assign({}, subscription, {
30
- name: subscriptionKey,
31
- namespace: namespaceKey,
32
- events: _events
33
- });
34
- }
35
- const _events = {};
36
- for(const eventKey in namespace.events){
37
- const event = namespace.events[eventKey];
38
- _events[eventKey] = Object.assign({}, event, {
39
- name: eventKey,
40
- namespace: namespaceKey
41
- });
42
- }
43
- _namespaces[namespaceKey] = Object.assign({}, namespace, {
44
- name: namespaceKey,
45
- procedures: _procedures,
46
- subscriptions: _subscriptions,
47
- events: _events
48
- });
49
- }
50
- return createSchema({
51
- ...schemaOptions,
52
- [Kind]: APIKind,
53
- type: 'neemata:api',
54
- namespaces: _namespaces,
55
- timeout
56
- });
3
+ export const APIKind = "NeemataAPI";
4
+ export const APIContract = (options) => {
5
+ const { namespaces = {}, timeout = 1e3, schemaOptions = {} } = options || {};
6
+ const _namespaces = {};
7
+ for (const namespaceKey in namespaces) {
8
+ const namespace = namespaces[namespaceKey];
9
+ const _procedures = {};
10
+ for (const procedureKey in namespace.procedures) {
11
+ const procedure = namespace.procedures[procedureKey];
12
+ _procedures[procedureKey] = Object.assign({}, procedure, {
13
+ name: procedureKey,
14
+ namespace: namespaceKey
15
+ });
16
+ }
17
+ const _subscriptions = {};
18
+ for (const subscriptionKey in namespace.subscriptions) {
19
+ const subscription = namespace.subscriptions[subscriptionKey];
20
+ const _events = {};
21
+ for (const eventKey in subscription.events) {
22
+ const event = subscription.events[eventKey];
23
+ _events[eventKey] = Object.assign({}, event, {
24
+ name: eventKey,
25
+ namespace: namespaceKey,
26
+ subscription: subscriptionKey
27
+ });
28
+ }
29
+ _subscriptions[subscriptionKey] = Object.assign({}, subscription, {
30
+ name: subscriptionKey,
31
+ namespace: namespaceKey,
32
+ events: _events
33
+ });
34
+ }
35
+ const _events = {};
36
+ for (const eventKey in namespace.events) {
37
+ const event = namespace.events[eventKey];
38
+ _events[eventKey] = Object.assign({}, event, {
39
+ name: eventKey,
40
+ namespace: namespaceKey
41
+ });
42
+ }
43
+ _namespaces[namespaceKey] = Object.assign({}, namespace, {
44
+ name: namespaceKey,
45
+ procedures: _procedures,
46
+ subscriptions: _subscriptions,
47
+ events: _events
48
+ });
49
+ }
50
+ return createSchema({
51
+ ...schemaOptions,
52
+ [Kind]: APIKind,
53
+ type: "neemata:api",
54
+ namespaces: _namespaces,
55
+ timeout
56
+ });
57
57
  };
58
58
  export function IsAPIContract(value) {
59
- return Kind in value && value[Kind] === APIKind;
59
+ return Kind in value && value[Kind] === APIKind;
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"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"],"names":["Kind","createSchema","APIKind","APIContract","options","namespaces","timeout","schemaOptions","_namespaces","namespaceKey","namespace","_procedures","procedureKey","procedures","procedure","Object","assign","name","_subscriptions","subscriptionKey","subscriptions","subscription","_events","eventKey","events","event","type","IsAPIContract","value"],"mappings":"AAAA,SAASA,IAAI,QAAQ,kBAAiB;AACtC,SAAqCC,YAAY,QAAQ,cAAa;AAGtE,OAAO,MAAMC,UAAU,aAAY;AAoBnC,OAAO,MAAMC,cAAc,CAEzBC;IAKA,MAAM,EAAEC,aAAa,CAAC,CAAC,EAAEC,UAAU,IAAI,EAAEC,gBAAgB,CAAC,CAAC,EAAE,GAAGH,WAAW,CAAC;IAE5E,MAAMI,cAAc,CAAC;IAErB,IAAK,MAAMC,gBAAgBJ,WAAY;QACrC,MAAMK,YAAYL,UAAU,CAACI,aAAa;QAC1C,MAAME,cAAc,CAAC;QACrB,IAAK,MAAMC,gBAAgBF,UAAUG,UAAU,CAAE;YAC/C,MAAMC,YAAYJ,UAAUG,UAAU,CAACD,aAAa;YACpDD,WAAW,CAACC,aAAa,GAAGG,OAAOC,MAAM,CAAC,CAAC,GAAGF,WAAW;gBACvDG,MAAML;gBACNF,WAAWD;YACb;QACF;QAEA,MAAMS,iBAAiB,CAAC;QACxB,IAAK,MAAMC,mBAAmBT,UAAUU,aAAa,CAAE;YACrD,MAAMC,eAAeX,UAAUU,aAAa,CAACD,gBAAgB;YAC7D,MAAMG,UAAU,CAAC;YACjB,IAAK,MAAMC,YAAYF,aAAaG,MAAM,CAAE;gBAC1C,MAAMC,QAAQJ,aAAaG,MAAM,CAACD,SAAS;gBAC3CD,OAAO,CAACC,SAAS,GAAGR,OAAOC,MAAM,CAAC,CAAC,GAAGS,OAAO;oBAC3CR,MAAMM;oBACNb,WAAWD;oBACXY,cAAcF;gBAChB;YACF;YACAD,cAAc,CAACC,gBAAgB,GAAGJ,OAAOC,MAAM,CAAC,CAAC,GAAGK,cAAc;gBAChEJ,MAAME;gBACNT,WAAWD;gBACXe,QAAQF;YACV;QACF;QAEA,MAAMA,UAAU,CAAC;QACjB,IAAK,MAAMC,YAAYb,UAAUc,MAAM,CAAE;YACvC,MAAMC,QAAQf,UAAUc,MAAM,CAACD,SAAS;YACxCD,OAAO,CAACC,SAAS,GAAGR,OAAOC,MAAM,CAAC,CAAC,GAAGS,OAAO;gBAC3CR,MAAMM;gBACNb,WAAWD;YACb;QACF;QAEAD,WAAW,CAACC,aAAa,GAAGM,OAAOC,MAAM,CAAC,CAAC,GAAGN,WAAW;YACvDO,MAAMR;YACNI,YAAYF;YACZS,eAAeF;YACfM,QAAQF;QACV;IACF;IAEA,OAAOrB,aAAuC;QAC5C,GAAGM,aAAa;QAChB,CAACP,KAAK,EAAEE;QACRwB,MAAM;QACNrB,YAAYG;QACZF;IACF;AACF,EAAC;AAED,OAAO,SAASqB,cAAcC,KAAU;IACtC,OAAO5B,QAAQ4B,SAASA,KAAK,CAAC5B,KAAK,KAAKE;AAC1C"}
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}
@@ -1,19 +1,19 @@
1
- import { t } from '@nmtjs/type';
1
+ import { t } from "@nmtjs/type";
2
2
  import { Kind } from "../constants.js";
3
3
  import { createSchema } from "../utils.js";
4
- export const EventKind = 'NeemataEvent';
5
- export const EventContract = (options)=>{
6
- const { payload = t.never(), schemaOptions = {}, name } = options ?? {};
7
- return createSchema({
8
- ...schemaOptions,
9
- [Kind]: EventKind,
10
- type: 'neemata:event',
11
- payload,
12
- name: name,
13
- subscription: undefined,
14
- namespace: undefined
15
- });
4
+ export const EventKind = "NeemataEvent";
5
+ export const EventContract = (options) => {
6
+ const { payload = t.never(), schemaOptions = {}, name } = options ?? {};
7
+ return createSchema({
8
+ ...schemaOptions,
9
+ [Kind]: EventKind,
10
+ type: "neemata:event",
11
+ payload,
12
+ name,
13
+ subscription: undefined,
14
+ namespace: undefined
15
+ });
16
16
  };
17
17
  export function IsEventContract(value) {
18
- return Kind in value && value[Kind] === EventKind;
18
+ return Kind in value && value[Kind] === EventKind;
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/event.ts"],"sourcesContent":["import { type BaseType, type NeverType, t } from '@nmtjs/type'\nimport { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\n\nexport const EventKind = 'NeemataEvent'\n\nexport type TAnyEventContract = TEventContract<\n BaseType,\n string | undefined,\n string | undefined,\n string | undefined\n>\n\nexport interface TEventContract<\n Payload extends BaseType = NeverType,\n Name extends string | undefined = undefined,\n Subscription extends string | undefined = undefined,\n Namespace extends string | undefined = undefined,\n> {\n [Kind]: typeof EventKind\n type: 'neemata:event'\n name: Name\n subscription: Subscription\n namespace: Namespace\n payload: Payload\n}\n\nexport const EventContract = <\n Payload extends BaseType,\n Name extends string | undefined = undefined,\n>(options?: {\n payload?: Payload\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}) => {\n const {\n payload = t.never() as unknown as Payload,\n schemaOptions = {},\n name,\n } = options ?? {}\n return createSchema<TEventContract<Payload, Name>>({\n ...schemaOptions,\n [Kind]: EventKind,\n type: 'neemata:event',\n payload,\n name: name as Name,\n subscription: undefined,\n namespace: undefined,\n })\n}\n\nexport function IsEventContract(value: any): value is TAnyEventContract {\n return Kind in value && value[Kind] === EventKind\n}\n"],"names":["t","Kind","createSchema","EventKind","EventContract","options","payload","never","schemaOptions","name","type","subscription","undefined","namespace","IsEventContract","value"],"mappings":"AAAA,SAAwCA,CAAC,QAAQ,cAAa;AAC9D,SAASC,IAAI,QAAQ,kBAAiB;AACtC,SAAqCC,YAAY,QAAQ,cAAa;AAEtE,OAAO,MAAMC,YAAY,eAAc;AAuBvC,OAAO,MAAMC,gBAAgB,CAG3BC;IAKA,MAAM,EACJC,UAAUN,EAAEO,KAAK,EAAwB,EACzCC,gBAAgB,CAAC,CAAC,EAClBC,IAAI,EACL,GAAGJ,WAAW,CAAC;IAChB,OAAOH,aAA4C;QACjD,GAAGM,aAAa;QAChB,CAACP,KAAK,EAAEE;QACRO,MAAM;QACNJ;QACAG,MAAMA;QACNE,cAAcC;QACdC,WAAWD;IACb;AACF,EAAC;AAED,OAAO,SAASE,gBAAgBC,KAAU;IACxC,OAAOd,QAAQc,SAASA,KAAK,CAACd,KAAK,KAAKE;AAC1C"}
1
+ {"mappings":"AAAA,SAAwC,SAAS,aAAa;AAC9D,SAAS,YAAY,iBAAiB;AACtC,SAAqC,oBAAoB,aAAa;AAEtE,OAAO,MAAM,YAAY;AAuBzB,OAAO,MAAM,gBAAgB,CAG3BA,YAII;CACJ,MAAM,EACJ,UAAU,EAAE,OAAO,EACnB,gBAAgB,CAAE,GAClB,MACD,GAAG,WAAW,CAAE;AACjB,QAAO,aAA4C;EACjD,GAAG;GACF,OAAO;EACR,MAAM;EACN;EACM;EACN,cAAc;EACd,WAAW;CACZ,EAAC;AACH;AAED,OAAO,SAAS,gBAAgBC,OAAwC;AACtE,QAAO,QAAQ,SAAS,MAAM,UAAU;AACzC","names":["options?: {\n payload?: Payload\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}","value: any"],"sources":["src/schemas/event.ts"],"sourcesContent":["import { type BaseType, type NeverType, t } from '@nmtjs/type'\nimport { Kind } from '../constants.ts'\nimport { type ContractSchemaOptions, createSchema } from '../utils.ts'\n\nexport const EventKind = 'NeemataEvent'\n\nexport type TAnyEventContract = TEventContract<\n BaseType,\n string | undefined,\n string | undefined,\n string | undefined\n>\n\nexport interface TEventContract<\n Payload extends BaseType = NeverType,\n Name extends string | undefined = undefined,\n Subscription extends string | undefined = undefined,\n Namespace extends string | undefined = undefined,\n> {\n [Kind]: typeof EventKind\n type: 'neemata:event'\n name: Name\n subscription: Subscription\n namespace: Namespace\n payload: Payload\n}\n\nexport const EventContract = <\n Payload extends BaseType,\n Name extends string | undefined = undefined,\n>(options?: {\n payload?: Payload\n schemaOptions?: ContractSchemaOptions\n name?: Name\n}) => {\n const {\n payload = t.never() as unknown as Payload,\n schemaOptions = {},\n name,\n } = options ?? {}\n return createSchema<TEventContract<Payload, Name>>({\n ...schemaOptions,\n [Kind]: EventKind,\n type: 'neemata:event',\n payload,\n name: name as Name,\n subscription: undefined,\n namespace: undefined,\n })\n}\n\nexport function IsEventContract(value: any): value is TAnyEventContract {\n return Kind in value && value[Kind] === EventKind\n}\n"],"version":3}
@@ -1,53 +1,53 @@
1
1
  import { Kind } from "../constants.js";
2
2
  import { createSchema } from "../utils.js";
3
- export const NamespaceKind = 'NeemataNamespace';
4
- export const NamespaceContract = (options)=>{
5
- const { procedures = {}, subscriptions = {}, events = {}, name, timeout, schemaOptions = {} } = options ?? {};
6
- const _events = {};
7
- for(const eventKey in events){
8
- const event = events[eventKey];
9
- _events[eventKey] = Object.assign({}, event, {
10
- name: eventKey,
11
- namespace: options?.name
12
- });
13
- }
14
- const _procedures = {};
15
- for(const procedureKey in procedures){
16
- const procedure = procedures[procedureKey];
17
- _procedures[procedureKey] = Object.assign({}, procedure, {
18
- name: procedureKey,
19
- namespace: options?.name
20
- });
21
- }
22
- const _subscriptions = {};
23
- for(const subscriptionKey in subscriptions){
24
- const subscription = subscriptions[subscriptionKey];
25
- const _events = {};
26
- for(const eventKey in subscription.events){
27
- const event = subscription.events[eventKey];
28
- _events[eventKey] = Object.assign({}, event, {
29
- name: eventKey,
30
- subscription: subscriptionKey,
31
- namespace: options?.name
32
- });
33
- }
34
- _subscriptions[subscriptionKey] = Object.assign({}, subscription, {
35
- name: subscriptionKey,
36
- namespace: options?.name,
37
- events: _events
38
- });
39
- }
40
- return createSchema({
41
- ...schemaOptions,
42
- [Kind]: NamespaceKind,
43
- type: 'neemata:namespace',
44
- name: name,
45
- procedures: _procedures,
46
- subscriptions: _subscriptions,
47
- events: _events,
48
- timeout
49
- });
3
+ export const NamespaceKind = "NeemataNamespace";
4
+ export const NamespaceContract = (options) => {
5
+ const { procedures = {}, subscriptions = {}, events = {}, name, timeout, schemaOptions = {} } = options ?? {};
6
+ const _events = {};
7
+ for (const eventKey in events) {
8
+ const event = events[eventKey];
9
+ _events[eventKey] = Object.assign({}, event, {
10
+ name: eventKey,
11
+ namespace: options?.name
12
+ });
13
+ }
14
+ const _procedures = {};
15
+ for (const procedureKey in procedures) {
16
+ const procedure = procedures[procedureKey];
17
+ _procedures[procedureKey] = Object.assign({}, procedure, {
18
+ name: procedureKey,
19
+ namespace: options?.name
20
+ });
21
+ }
22
+ const _subscriptions = {};
23
+ for (const subscriptionKey in subscriptions) {
24
+ const subscription = subscriptions[subscriptionKey];
25
+ const _events = {};
26
+ for (const eventKey in subscription.events) {
27
+ const event = subscription.events[eventKey];
28
+ _events[eventKey] = Object.assign({}, event, {
29
+ name: eventKey,
30
+ subscription: subscriptionKey,
31
+ namespace: options?.name
32
+ });
33
+ }
34
+ _subscriptions[subscriptionKey] = Object.assign({}, subscription, {
35
+ name: subscriptionKey,
36
+ namespace: options?.name,
37
+ events: _events
38
+ });
39
+ }
40
+ return createSchema({
41
+ ...schemaOptions,
42
+ [Kind]: NamespaceKind,
43
+ type: "neemata:namespace",
44
+ name,
45
+ procedures: _procedures,
46
+ subscriptions: _subscriptions,
47
+ events: _events,
48
+ timeout
49
+ });
50
50
  };
51
51
  export function IsNamespaceContract(value) {
52
- return Kind in value && value[Kind] === NamespaceKind;
52
+ return Kind in value && value[Kind] === NamespaceKind;
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"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"],"names":["Kind","createSchema","NamespaceKind","NamespaceContract","options","procedures","subscriptions","events","name","timeout","schemaOptions","_events","eventKey","event","Object","assign","namespace","_procedures","procedureKey","procedure","_subscriptions","subscriptionKey","subscription","type","IsNamespaceContract","value"],"mappings":"AAAA,SAASA,IAAI,QAAQ,kBAAiB;AACtC,SAAqCC,YAAY,QAAQ,cAAa;AAQtE,OAAO,MAAMC,gBAAgB,mBAAkB;AA+D/C,OAAO,MAAMC,oBAAoB,CAK/BC;IAQA,MAAM,EACJC,aAAa,CAAC,CAAe,EAC7BC,gBAAgB,CAAC,CAAkB,EACnCC,SAAS,CAAC,CAAW,EACrBC,IAAI,EACJC,OAAO,EACPC,gBAAgB,CAAC,CAA0B,EAC5C,GAAGN,WAAW,CAAC;IAChB,MAAMO,UAAU,CAAC;IAEjB,IAAK,MAAMC,YAAYL,OAAQ;QAC7B,MAAMM,QAAQN,MAAM,CAACK,SAAS;QAC9BD,OAAO,CAACC,SAAS,GAAGE,OAAOC,MAAM,CAAC,CAAC,GAAGF,OAAO;YAC3CL,MAAMI;YACNI,WAAWZ,SAASI;QACtB;IACF;IAEA,MAAMS,cAAc,CAAC;IACrB,IAAK,MAAMC,gBAAgBb,WAAY;QACrC,MAAMc,YAAiBd,UAAU,CAACa,aAAa;QAC/CD,WAAW,CAACC,aAAa,GAAGJ,OAAOC,MAAM,CAAC,CAAC,GAAGI,WAAW;YACvDX,MAAMU;YACNF,WAAWZ,SAASI;QACtB;IACF;IAEA,MAAMY,iBAAiB,CAAC;IACxB,IAAK,MAAMC,mBAAmBf,cAAe;QAC3C,MAAMgB,eAAoBhB,aAAa,CAACe,gBAAgB;QACxD,MAAMV,UAAU,CAAC;QAEjB,IAAK,MAAMC,YAAYU,aAAaf,MAAM,CAAE;YAC1C,MAAMM,QAAQS,aAAaf,MAAM,CAACK,SAAS;YAC3CD,OAAO,CAACC,SAAS,GAAGE,OAAOC,MAAM,CAAC,CAAC,GAAGF,OAAO;gBAC3CL,MAAMI;gBACNU,cAAcD;gBACdL,WAAWZ,SAASI;YACtB;QACF;QAEAY,cAAc,CAACC,gBAAgB,GAAGP,OAAOC,MAAM,CAAC,CAAC,GAAGO,cAAc;YAChEd,MAAMa;YACNL,WAAWZ,SAASI;YACpBD,QAAQI;QACV;IACF;IAEA,OAAOV,aAEL;QACA,GAAGS,aAAa;QAChB,CAACV,KAAK,EAAEE;QACRqB,MAAM;QACNf,MAAMA;QACNH,YAAYY;QACZX,eAAec;QACfb,QAAQI;QACRF;IACF;AACF,EAAC;AAED,OAAO,SAASe,oBACdC,KAAU;IAEV,OAAOzB,QAAQyB,SAASA,KAAK,CAACzB,KAAK,KAAKE;AAC1C"}
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}
@@ -1,21 +1,21 @@
1
- import { t } from '@nmtjs/type';
1
+ import { t } from "@nmtjs/type";
2
2
  import { Kind } from "../constants.js";
3
3
  import { createSchema } from "../utils.js";
4
- export const ProcedureKind = 'NeemataProcedure';
5
- export const ProcedureContract = (options)=>{
6
- const { input = t.never(), output = t.never(), stream = t.never(), timeout, schemaOptions = {}, name } = options;
7
- return createSchema({
8
- ...schemaOptions,
9
- [Kind]: ProcedureKind,
10
- type: 'neemata:procedure',
11
- input,
12
- output,
13
- stream,
14
- timeout,
15
- name: name,
16
- namespace: undefined
17
- });
4
+ export const ProcedureKind = "NeemataProcedure";
5
+ export const ProcedureContract = (options) => {
6
+ const { input = t.never(), output = t.never(), stream = t.never(), timeout, schemaOptions = {}, name } = options;
7
+ return createSchema({
8
+ ...schemaOptions,
9
+ [Kind]: ProcedureKind,
10
+ type: "neemata:procedure",
11
+ input,
12
+ output,
13
+ stream,
14
+ timeout,
15
+ name,
16
+ namespace: undefined
17
+ });
18
18
  };
19
19
  export function IsProcedureContract(contract) {
20
- return Kind in contract && contract[Kind] === ProcedureKind;
20
+ return Kind in contract && contract[Kind] === ProcedureKind;
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/procedure.ts"],"sourcesContent":["import { type BaseType, type NeverType, 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 = NeverType,\n Output extends BaseType = NeverType,\n Stream extends BaseType = 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 = NeverType,\n Output extends BaseType = NeverType,\n Stream extends BaseType = 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"],"names":["t","Kind","createSchema","ProcedureKind","ProcedureContract","options","input","never","output","stream","timeout","schemaOptions","name","type","namespace","undefined","IsProcedureContract","contract"],"mappings":"AAAA,SAAwCA,CAAC,QAAQ,cAAa;AAC9D,SAASC,IAAI,QAAQ,kBAAiB;AACtC,SAAqCC,YAAY,QAAQ,cAAa;AA0BtE,OAAO,MAAMC,gBAAgB,mBAAkB;AA2B/C,OAAO,MAAMC,oBAAoB,CAK/BC;IAQA,MAAM,EACJC,QAAQN,EAAEO,KAAK,EAAsB,EACrCC,SAASR,EAAEO,KAAK,EAAuB,EACvCE,SAAST,EAAEO,KAAK,EAAuB,EACvCG,OAAO,EACPC,gBAAgB,CAAC,CAAC,EAClBC,IAAI,EACL,GAAGP;IACJ,OAAOH,aAA8D;QACnE,GAAGS,aAAa;QAChB,CAACV,KAAK,EAAEE;QACRU,MAAM;QACNP;QACAE;QACAC;QACAC;QACAE,MAAMA;QACNE,WAAWC;IACb;AACF,EAAC;AAED,OAAO,SAASC,oBACdC,QAAa;IAEb,OAAOhB,QAAQgB,YAAYA,QAAQ,CAAChB,KAAK,KAAKE;AAChD"}
1
+ {"mappings":"AAAA,SAAwC,SAAS,aAAa;AAC9D,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, type NeverType, 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 = NeverType,\n Output extends BaseType = NeverType,\n Stream extends BaseType = 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 = NeverType,\n Output extends BaseType = NeverType,\n Stream extends BaseType = 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}
@@ -1,31 +1,27 @@
1
- import { t } from '@nmtjs/type';
1
+ import { t } from "@nmtjs/type";
2
2
  import { Kind } from "../constants.js";
3
3
  import { createSchema } from "../utils.js";
4
- export const SubscriptionKind = 'NeemataSubscription';
5
- export const SubscriptionContract = (options)=>{
6
- const { input = t.never(), output = t.never(), events = {}, timeout, schemaOptions = {}, name } = options ?? {};
7
- const _events = {};
8
- for(const key in events){
9
- const event = events[key];
10
- _events[key] = Object.assign({}, event, {
11
- subscription: name
12
- });
13
- }
14
- return {
15
- $withOptions: ()=>createSchema({
16
- ...schemaOptions,
17
- [Kind]: SubscriptionKind,
18
- type: 'neemata:subscription',
19
- input,
20
- output,
21
- events: _events,
22
- timeout,
23
- name: name,
24
- namespace: undefined,
25
- options: undefined
26
- })
27
- };
4
+ export const SubscriptionKind = "NeemataSubscription";
5
+ export const SubscriptionContract = (options) => {
6
+ const { input = t.never(), output = t.never(), events = {}, timeout, schemaOptions = {}, name } = options ?? {};
7
+ const _events = {};
8
+ for (const key in events) {
9
+ const event = events[key];
10
+ _events[key] = Object.assign({}, event, { subscription: name });
11
+ }
12
+ return { $withOptions: () => createSchema({
13
+ ...schemaOptions,
14
+ [Kind]: SubscriptionKind,
15
+ type: "neemata:subscription",
16
+ input,
17
+ output,
18
+ events: _events,
19
+ timeout,
20
+ name,
21
+ namespace: undefined,
22
+ options: undefined
23
+ }) };
28
24
  };
29
25
  export function IsSubscriptionContract(contract) {
30
- return Kind in contract && contract[Kind] === SubscriptionKind;
26
+ return Kind in contract && contract[Kind] === SubscriptionKind;
31
27
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/subscription.ts"],"sourcesContent":["import { type BaseType, type NeverType, 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 = NeverType,\n Output extends BaseType = 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 = NeverType,\n Output extends BaseType = 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"],"names":["t","Kind","createSchema","SubscriptionKind","SubscriptionContract","options","input","never","output","events","timeout","schemaOptions","name","_events","key","event","Object","assign","subscription","$withOptions","type","namespace","undefined","IsSubscriptionContract","contract"],"mappings":"AAAA,SAAwCA,CAAC,QAAQ,cAAa;AAC9D,SAASC,IAAI,QAAQ,kBAAiB;AACtC,SAAqCC,YAAY,QAAQ,cAAa;AAItE,OAAO,MAAMC,mBAAmB,sBAAqB;AAyCrD,OAAO,MAAMC,uBAAuB,CAKlCC;IAQA,MAAM,EACJC,QAAQN,EAAEO,KAAK,EAAsB,EACrCC,SAASR,EAAEO,KAAK,EAAuB,EACvCE,SAAS,CAAC,CAAW,EACrBC,OAAO,EACPC,gBAAgB,CAAC,CAAC,EAClBC,IAAI,EACL,GAAGP,WAAW,CAAC;IAEhB,MAAMQ,UAAU,CAAC;IACjB,IAAK,MAAMC,OAAOL,OAAQ;QACxB,MAAMM,QAAQN,MAAM,CAACK,IAAI;QACzBD,OAAO,CAACC,IAAI,GAAGE,OAAOC,MAAM,CAAC,CAAC,GAAGF,OAAO;YAAEG,cAAcN;QAAK;IAC/D;IACA,OAAO;QACLO,cAAc,IACZjB,aACE;gBACE,GAAGS,aAAa;gBAChB,CAACV,KAAK,EAAEE;gBACRiB,MAAM;gBACNd;gBACAE;gBACAC,QAAQI;gBACRH;gBACAE,MAAMA;gBACNS,WAAWC;gBACXjB,SAASiB;YACX;IAEN;AACF,EAAC;AAED,OAAO,SAASC,uBACdC,QAAa;IAEb,OAAOvB,QAAQuB,YAAYA,QAAQ,CAACvB,KAAK,KAAKE;AAChD"}
1
+ {"mappings":"AAAA,SAAwC,SAAS,aAAa;AAC9D,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, type NeverType, 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 = NeverType,\n Output extends BaseType = 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 = NeverType,\n Output extends BaseType = 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}
@@ -1,13 +1,12 @@
1
- import { t } from '@nmtjs/type';
2
- export const BlobKind = 'ProtocolBlob';
3
- export const BlobType = (options = {})=>t.custom((value)=>{
4
- if ('metadata' in value) {
5
- if (options.maxSize) {
6
- const size = value.metadata.size;
7
- if (size === -1 || size > options.maxSize) {
8
- throw new Error('Blob size unknown or exceeds maximum allowed size');
9
- }
10
- }
11
- }
12
- return value;
13
- }, (value)=>value);
1
+ import { t } from "@nmtjs/type";
2
+ export const BlobType = (options = {}) => t.custom((value) => {
3
+ if ("metadata" in value) {
4
+ if (options.maxSize) {
5
+ const size = value.metadata.size;
6
+ if (size === -1 || size > options.maxSize) {
7
+ throw new Error("Blob size unknown or exceeds maximum allowed size");
8
+ }
9
+ }
10
+ }
11
+ return value;
12
+ }, (value) => value);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/types/blob.ts"],"sourcesContent":["import type { ProtocolBlobInterface } from '@nmtjs/protocol/common'\nimport { t } from '@nmtjs/type'\n\nexport const BlobKind = 'ProtocolBlob'\n\nexport interface BlobOptions {\n maxSize?: number\n contentType?: string\n}\n\nexport const BlobType = (options: BlobOptions = {}) =>\n t.custom<ProtocolBlobInterface>(\n (value) => {\n // TODO: this should be registered separately for server and client\n // ref: https://github.com/sinclairzx81/typebox/issues/977\n if ('metadata' in value) {\n if (options.maxSize) {\n const size = (value as ProtocolBlobInterface).metadata.size\n if (size === -1 || size > options.maxSize) {\n throw new Error('Blob size unknown or exceeds maximum allowed size')\n }\n }\n }\n return value\n },\n (value) => value,\n )\n"],"names":["t","BlobKind","BlobType","options","custom","value","maxSize","size","metadata","Error"],"mappings":"AACA,SAASA,CAAC,QAAQ,cAAa;AAE/B,OAAO,MAAMC,WAAW,eAAc;AAOtC,OAAO,MAAMC,WAAW,CAACC,UAAuB,CAAC,CAAC,GAChDH,EAAEI,MAAM,CACN,CAACC;QAGC,IAAI,cAAcA,OAAO;YACvB,IAAIF,QAAQG,OAAO,EAAE;gBACnB,MAAMC,OAAO,AAACF,MAAgCG,QAAQ,CAACD,IAAI;gBAC3D,IAAIA,SAAS,CAAC,KAAKA,OAAOJ,QAAQG,OAAO,EAAE;oBACzC,MAAM,IAAIG,MAAM;gBAClB;YACF;QACF;QACA,OAAOJ;IACT,GACA,CAACA,QAAUA,OACZ"}
1
+ {"mappings":"AACA,SAAS,SAAS,aAAa;AAO/B,OAAO,MAAM,WAAW,CAACA,UAAuB,CAAE,MAChD,EAAE,OACA,CAAC,UAAU;AAGT,KAAI,cAAc,OAAO;AACvB,MAAI,QAAQ,SAAS;GACnB,MAAM,OAAQ,MAAgC,SAAS;AACvD,OAAI,UAAU,KAAK,OAAO,QAAQ,SAAS;AACzC,UAAM,IAAI,MAAM;GACjB;EACF;CACF;AACD,QAAO;AACR,GACD,CAAC,UAAU,MACZ","names":["options: BlobOptions"],"sources":["src/types/blob.ts"],"sourcesContent":["import type { ProtocolBlobInterface } from '@nmtjs/protocol/common'\nimport { t } from '@nmtjs/type'\n\nexport interface BlobOptions {\n maxSize?: number\n contentType?: string\n}\n\nexport const BlobType = (options: BlobOptions = {}) =>\n t.custom<ProtocolBlobInterface>(\n (value) => {\n // TODO: this should be registered separately for server and client\n // ref: https://github.com/sinclairzx81/typebox/issues/977\n if ('metadata' in value) {\n if (options.maxSize) {\n const size = (value as ProtocolBlobInterface).metadata.size\n if (size === -1 || size > options.maxSize) {\n throw new Error('Blob size unknown or exceeds maximum allowed size')\n }\n }\n }\n return value\n },\n (value) => value,\n )\n"],"version":3}
package/dist/utils.js CHANGED
@@ -1,11 +1,8 @@
1
- export const applyNames = (params, opts)=>{
2
- return Object.fromEntries(Object.entries(params).map(([k, v])=>[
3
- k,
4
- {
5
- ...v,
6
- name: k,
7
- ...opts
8
- }
9
- ]));
1
+ export const applyNames = (params, opts) => {
2
+ return Object.fromEntries(Object.entries(params).map(([k, v]) => [k, {
3
+ ...v,
4
+ name: k,
5
+ ...opts
6
+ }]));
10
7
  };
11
- export const createSchema = (schema)=>schema;
8
+ export const createSchema = (schema) => schema;
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils.ts"],"sourcesContent":["export type ContractSchemaOptions = {\n title?: string\n description?: string\n}\n\nexport const applyNames = <T extends Record<string, { serviceName?: string }>>(\n params: T,\n opts: { serviceName?: string; subscriptionName?: string },\n) => {\n return Object.fromEntries(\n Object.entries(params).map(([k, v]) => [k, { ...v, name: k, ...opts }]),\n )\n}\n\nexport const createSchema = <T>(schema: T) => schema as T\n"],"names":["applyNames","params","opts","Object","fromEntries","entries","map","k","v","name","createSchema","schema"],"mappings":"AAKA,OAAO,MAAMA,aAAa,CACxBC,QACAC;IAEA,OAAOC,OAAOC,WAAW,CACvBD,OAAOE,OAAO,CAACJ,QAAQK,GAAG,CAAC,CAAC,CAACC,GAAGC,EAAE,GAAK;YAACD;YAAG;gBAAE,GAAGC,CAAC;gBAAEC,MAAMF;gBAAG,GAAGL,IAAI;YAAC;SAAE;AAE1E,EAAC;AAED,OAAO,MAAMQ,eAAe,CAAIC,SAAcA,OAAW"}
1
+ {"mappings":"AAKA,OAAO,MAAM,aAAa,CACxBA,QACAC,SACG;AACH,QAAO,OAAO,YACZ,OAAO,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG;EAAE,GAAG;EAAG,MAAM;EAAG,GAAG;CAAM,CAAC,EAAC,CACxE;AACF;AAED,OAAO,MAAM,eAAe,CAAIC,WAAc","names":["params: T","opts: { serviceName?: string; subscriptionName?: string }","schema: T"],"sources":["src/utils.ts"],"sourcesContent":["export type ContractSchemaOptions = {\n title?: string\n description?: string\n}\n\nexport const applyNames = <T extends Record<string, { serviceName?: string }>>(\n params: T,\n opts: { serviceName?: string; subscriptionName?: string },\n) => {\n return Object.fromEntries(\n Object.entries(params).map(([k, v]) => [k, { ...v, name: k, ...opts }]),\n )\n}\n\nexport const createSchema = <T>(schema: T) => schema as T\n"],"version":3}
package/package.json CHANGED
@@ -3,14 +3,13 @@
3
3
  "type": "module",
4
4
  "exports": {
5
5
  ".": {
6
- "bun": "./src/index.ts",
7
- "default": "./dist/index.js",
6
+ "import": "./dist/index.js",
8
7
  "types": "./src/index.ts"
9
8
  }
10
9
  },
11
10
  "dependencies": {
12
- "@nmtjs/type": "0.6.5",
13
- "@nmtjs/protocol": "0.6.5"
11
+ "@nmtjs/protocol": "0.7.0",
12
+ "@nmtjs/type": "0.7.0"
14
13
  },
15
14
  "files": [
16
15
  "src",
@@ -18,9 +17,9 @@
18
17
  "LICENSE.md",
19
18
  "README.md"
20
19
  ],
21
- "version": "0.6.5",
20
+ "version": "0.7.0",
22
21
  "scripts": {
23
- "build": "neemata-build -p neutral --root=./src './**/*.ts'",
22
+ "build": "neemata-build --root=./src './**/*.ts'",
24
23
  "type-check": "tsc --noEmit"
25
24
  }
26
25
  }
package/src/types/blob.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import type { ProtocolBlobInterface } from '@nmtjs/protocol/common'
2
2
  import { t } from '@nmtjs/type'
3
3
 
4
- export const BlobKind = 'ProtocolBlob'
5
-
6
4
  export interface BlobOptions {
7
5
  maxSize?: number
8
6
  contentType?: string