@xyo-network/payload-model 2.99.2 → 2.99.4
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/browser/Error.d.cts +3 -0
- package/dist/browser/Error.d.cts.map +1 -1
- package/dist/browser/Error.d.mts +3 -0
- package/dist/browser/Error.d.mts.map +1 -1
- package/dist/browser/Error.d.ts +3 -0
- package/dist/browser/Error.d.ts.map +1 -1
- package/dist/browser/Schema.d.cts +2 -2
- package/dist/browser/Schema.d.mts +2 -2
- package/dist/browser/Schema.d.ts +2 -2
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/isPayload.d.cts +4 -4
- package/dist/browser/isPayload.d.mts +4 -4
- package/dist/browser/isPayload.d.ts +4 -4
- package/dist/neutral/Error.d.cts +22 -0
- package/dist/neutral/Error.d.cts.map +1 -0
- package/dist/neutral/Error.d.mts +22 -0
- package/dist/neutral/Error.d.mts.map +1 -0
- package/dist/neutral/Error.d.ts +22 -0
- package/dist/neutral/Error.d.ts.map +1 -0
- package/dist/neutral/Meta.d.cts +10 -0
- package/dist/neutral/Meta.d.cts.map +1 -0
- package/dist/neutral/Meta.d.mts +10 -0
- package/dist/neutral/Meta.d.mts.map +1 -0
- package/dist/neutral/Meta.d.ts +10 -0
- package/dist/neutral/Meta.d.ts.map +1 -0
- package/dist/neutral/Payload.d.cts +33 -0
- package/dist/neutral/Payload.d.cts.map +1 -0
- package/dist/neutral/Payload.d.mts +33 -0
- package/dist/neutral/Payload.d.mts.map +1 -0
- package/dist/neutral/Payload.d.ts +33 -0
- package/dist/neutral/Payload.d.ts.map +1 -0
- package/dist/neutral/PayloadFindFilter.d.cts +8 -0
- package/dist/neutral/PayloadFindFilter.d.cts.map +1 -0
- package/dist/neutral/PayloadFindFilter.d.mts +8 -0
- package/dist/neutral/PayloadFindFilter.d.mts.map +1 -0
- package/dist/neutral/PayloadFindFilter.d.ts +8 -0
- package/dist/neutral/PayloadFindFilter.d.ts.map +1 -0
- package/dist/neutral/PayloadSet/PayloadSetPayload.d.cts +8 -0
- package/dist/neutral/PayloadSet/PayloadSetPayload.d.cts.map +1 -0
- package/dist/neutral/PayloadSet/PayloadSetPayload.d.mts +8 -0
- package/dist/neutral/PayloadSet/PayloadSetPayload.d.mts.map +1 -0
- package/dist/neutral/PayloadSet/PayloadSetPayload.d.ts +8 -0
- package/dist/neutral/PayloadSet/PayloadSetPayload.d.ts.map +1 -0
- package/dist/neutral/PayloadSet/PayloadSetSchema.d.cts +3 -0
- package/dist/neutral/PayloadSet/PayloadSetSchema.d.cts.map +1 -0
- package/dist/neutral/PayloadSet/PayloadSetSchema.d.mts +3 -0
- package/dist/neutral/PayloadSet/PayloadSetSchema.d.mts.map +1 -0
- package/dist/neutral/PayloadSet/PayloadSetSchema.d.ts +3 -0
- package/dist/neutral/PayloadSet/PayloadSetSchema.d.ts.map +1 -0
- package/dist/neutral/PayloadSet/index.d.cts +3 -0
- package/dist/neutral/PayloadSet/index.d.cts.map +1 -0
- package/dist/neutral/PayloadSet/index.d.mts +3 -0
- package/dist/neutral/PayloadSet/index.d.mts.map +1 -0
- package/dist/neutral/PayloadSet/index.d.ts +3 -0
- package/dist/neutral/PayloadSet/index.d.ts.map +1 -0
- package/dist/neutral/PayloadValidationFunction.d.cts +6 -0
- package/dist/neutral/PayloadValidationFunction.d.cts.map +1 -0
- package/dist/neutral/PayloadValidationFunction.d.mts +6 -0
- package/dist/neutral/PayloadValidationFunction.d.mts.map +1 -0
- package/dist/neutral/PayloadValidationFunction.d.ts +6 -0
- package/dist/neutral/PayloadValidationFunction.d.ts.map +1 -0
- package/dist/neutral/PayloadValueExpression.d.cts +38 -0
- package/dist/neutral/PayloadValueExpression.d.cts.map +1 -0
- package/dist/neutral/PayloadValueExpression.d.mts +38 -0
- package/dist/neutral/PayloadValueExpression.d.mts.map +1 -0
- package/dist/neutral/PayloadValueExpression.d.ts +38 -0
- package/dist/neutral/PayloadValueExpression.d.ts.map +1 -0
- package/dist/neutral/Query.d.cts +16 -0
- package/dist/neutral/Query.d.cts.map +1 -0
- package/dist/neutral/Query.d.mts +16 -0
- package/dist/neutral/Query.d.mts.map +1 -0
- package/dist/neutral/Query.d.ts +16 -0
- package/dist/neutral/Query.d.ts.map +1 -0
- package/dist/neutral/Schema.d.cts +18 -0
- package/dist/neutral/Schema.d.cts.map +1 -0
- package/dist/neutral/Schema.d.mts +18 -0
- package/dist/neutral/Schema.d.mts.map +1 -0
- package/dist/neutral/Schema.d.ts +18 -0
- package/dist/neutral/Schema.d.ts.map +1 -0
- package/dist/neutral/Timestamp.d.cts +8 -0
- package/dist/neutral/Timestamp.d.cts.map +1 -0
- package/dist/neutral/Timestamp.d.mts +8 -0
- package/dist/neutral/Timestamp.d.mts.map +1 -0
- package/dist/neutral/Timestamp.d.ts +8 -0
- package/dist/neutral/Timestamp.d.ts.map +1 -0
- package/dist/neutral/index.cjs +108 -0
- package/dist/neutral/index.cjs.map +1 -0
- package/dist/neutral/index.d.cts +13 -0
- package/dist/neutral/index.d.cts.map +1 -0
- package/dist/neutral/index.d.mts +13 -0
- package/dist/neutral/index.d.mts.map +1 -0
- package/dist/neutral/index.d.ts +13 -0
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.js +87 -0
- package/dist/neutral/index.js.map +1 -0
- package/dist/neutral/isPayload.d.cts +23 -0
- package/dist/neutral/isPayload.d.cts.map +1 -0
- package/dist/neutral/isPayload.d.mts +23 -0
- package/dist/neutral/isPayload.d.mts.map +1 -0
- package/dist/neutral/isPayload.d.ts +23 -0
- package/dist/neutral/isPayload.d.ts.map +1 -0
- package/dist/neutral/isPayloadOfSchemaType.d.cts +15 -0
- package/dist/neutral/isPayloadOfSchemaType.d.cts.map +1 -0
- package/dist/neutral/isPayloadOfSchemaType.d.mts +15 -0
- package/dist/neutral/isPayloadOfSchemaType.d.mts.map +1 -0
- package/dist/neutral/isPayloadOfSchemaType.d.ts +15 -0
- package/dist/neutral/isPayloadOfSchemaType.d.ts.map +1 -0
- package/dist/neutral/isPayloadWithHash.d.cts +18 -0
- package/dist/neutral/isPayloadWithHash.d.cts.map +1 -0
- package/dist/neutral/isPayloadWithHash.d.mts +18 -0
- package/dist/neutral/isPayloadWithHash.d.mts.map +1 -0
- package/dist/neutral/isPayloadWithHash.d.ts +18 -0
- package/dist/neutral/isPayloadWithHash.d.ts.map +1 -0
- package/dist/node/Error.d.cts +3 -0
- package/dist/node/Error.d.cts.map +1 -1
- package/dist/node/Error.d.mts +3 -0
- package/dist/node/Error.d.mts.map +1 -1
- package/dist/node/Error.d.ts +3 -0
- package/dist/node/Error.d.ts.map +1 -1
- package/dist/node/Schema.d.cts +2 -2
- package/dist/node/Schema.d.mts +2 -2
- package/dist/node/Schema.d.ts +2 -2
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/isPayload.d.cts +4 -4
- package/dist/node/isPayload.d.mts +4 -4
- package/dist/node/isPayload.d.ts +4 -4
- package/package.json +5 -5
- package/src/Error.ts +2 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/isPayload.ts
|
|
5
|
+
import { AsObjectFactory, isObject } from "@xylabs/object";
|
|
6
|
+
var isAnyPayload = /* @__PURE__ */ __name((value) => {
|
|
7
|
+
if (isObject(value)) {
|
|
8
|
+
return typeof value.schema === "string";
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}, "isAnyPayload");
|
|
12
|
+
var asAnyPayload = AsObjectFactory.create(isAnyPayload);
|
|
13
|
+
var isPayload = /* @__PURE__ */ __name((schema) => (value) => {
|
|
14
|
+
if (isAnyPayload(value)) {
|
|
15
|
+
return schema.includes(value.schema);
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}, "isPayload");
|
|
19
|
+
var asPayload = /* @__PURE__ */ __name((schema) => AsObjectFactory.create((value) => isPayload(schema)(value)), "asPayload");
|
|
20
|
+
|
|
21
|
+
// src/isPayloadOfSchemaType.ts
|
|
22
|
+
var isPayloadOfSchemaType = /* @__PURE__ */ __name((schema) => {
|
|
23
|
+
return (x) => isAnyPayload(x) && x?.schema === schema;
|
|
24
|
+
}, "isPayloadOfSchemaType");
|
|
25
|
+
var isPayloadOfSchemaTypeWithMeta = /* @__PURE__ */ __name((schema) => {
|
|
26
|
+
return (x) => isPayloadOfSchemaType(schema)(x) && x.$hash !== void 0;
|
|
27
|
+
}, "isPayloadOfSchemaTypeWithMeta");
|
|
28
|
+
var isPayloadOfSchemaTypeWithSources = /* @__PURE__ */ __name((schema) => {
|
|
29
|
+
return (x) => isPayloadOfSchemaType(schema)(x) && x.sources !== void 0 && Array.isArray(x.sources);
|
|
30
|
+
}, "isPayloadOfSchemaTypeWithSources");
|
|
31
|
+
var notPayloadOfSchemaType = /* @__PURE__ */ __name((schema) => {
|
|
32
|
+
return (x) => !isAnyPayload(x) || x?.schema !== schema;
|
|
33
|
+
}, "notPayloadOfSchemaType");
|
|
34
|
+
|
|
35
|
+
// src/Error.ts
|
|
36
|
+
var ModuleErrorSchema = "network.xyo.error.module";
|
|
37
|
+
var isModuleError = isPayloadOfSchemaType(ModuleErrorSchema);
|
|
38
|
+
|
|
39
|
+
// src/isPayloadWithHash.ts
|
|
40
|
+
var isWithHash = /* @__PURE__ */ __name((value) => {
|
|
41
|
+
return typeof value?.$hash === "string";
|
|
42
|
+
}, "isWithHash");
|
|
43
|
+
var isPayloadWithHash = /* @__PURE__ */ __name((value) => {
|
|
44
|
+
return isAnyPayload(value) && isWithHash(value);
|
|
45
|
+
}, "isPayloadWithHash");
|
|
46
|
+
|
|
47
|
+
// src/Meta.ts
|
|
48
|
+
var unMeta = /* @__PURE__ */ __name((payload) => {
|
|
49
|
+
if (payload) {
|
|
50
|
+
const { $meta, $hash, ...result } = payload;
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
}, "unMeta");
|
|
54
|
+
|
|
55
|
+
// src/PayloadSet/PayloadSetSchema.ts
|
|
56
|
+
var PayloadSetSchema = "network.xyo.payload.set";
|
|
57
|
+
|
|
58
|
+
// src/Schema.ts
|
|
59
|
+
import { AsTypeFactory } from "@xylabs/object";
|
|
60
|
+
var PayloadSchema = "network.xyo.payload";
|
|
61
|
+
var isSchema = /* @__PURE__ */ __name((value) => {
|
|
62
|
+
if (typeof value === "string") {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}, "isSchema");
|
|
67
|
+
var asSchema = AsTypeFactory.create(isSchema);
|
|
68
|
+
export {
|
|
69
|
+
ModuleErrorSchema,
|
|
70
|
+
PayloadSchema,
|
|
71
|
+
PayloadSetSchema,
|
|
72
|
+
asAnyPayload,
|
|
73
|
+
asPayload,
|
|
74
|
+
asSchema,
|
|
75
|
+
isAnyPayload,
|
|
76
|
+
isModuleError,
|
|
77
|
+
isPayload,
|
|
78
|
+
isPayloadOfSchemaType,
|
|
79
|
+
isPayloadOfSchemaTypeWithMeta,
|
|
80
|
+
isPayloadOfSchemaTypeWithSources,
|
|
81
|
+
isPayloadWithHash,
|
|
82
|
+
isSchema,
|
|
83
|
+
isWithHash,
|
|
84
|
+
notPayloadOfSchemaType,
|
|
85
|
+
unMeta
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/isPayloadWithHash.ts","../../src/Meta.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts"],"sourcesContent":["import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport { Payload } from './Payload'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload =\n <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload, WithSources } from './Payload'\n\nexport const isPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithMeta = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithMeta<T> => isPayloadOfSchemaType<WithMeta<T>>(schema)(x) && x.$hash !== undefined\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.sources !== undefined && Array.isArray(x.sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n//test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\nconst testWithMeta: WithMeta<Test> = { $hash: '1234abcd', $meta: { timestamp: Date.now() }, field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\nconst testMetaPayloads: WithMeta<Payload>[] = [testWithMeta]\n\nconst testType: Test = testWithMeta\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMeta: Payload[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMetaWithMeta: PayloadWithMeta[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n\nconst isTestFromMetaTypedWithMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestWithMeta: WithMeta<Test>[] = testPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\nconst isTestWithMetaFromMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\n*/\n","import { Hash } from '@xylabs/hex'\nimport { JsonValue } from '@xylabs/object'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType'\nimport { Payload } from './Payload'\n\nexport type ModuleErrorSchema = 'network.xyo.error.module'\nexport const ModuleErrorSchema: ModuleErrorSchema = 'network.xyo.error.module'\n\nexport type ModuleError = Payload<{\n details?: JsonValue\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n sources?: Hash[]\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload } from './Payload'\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isWithHash = <T extends Payload>(value: T): value is WithMeta<T> => {\n return typeof (value as WithMeta<T>)?.$hash === 'string'\n}\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isPayloadWithHash = <T extends Payload>(value: unknown): value is WithMeta<T> => {\n return isAnyPayload(value) && isWithHash(value)\n}\n","import { EmptyObject, JsonObject } from '@xylabs/object'\n\nimport { Payload, PayloadMetaFields } from './Payload'\nimport { Schema, WithSchema } from './Schema'\n\nexport type WithMeta<T extends Payload = Payload, M extends JsonObject | void = void> = PayloadMetaFields<M> & T\nexport type WithOptionalMeta<T extends Payload = Payload, M extends JsonObject | void = void> = Partial<WithMeta<T, M>> &\n Omit<WithMeta<T, M>, '$hash'>\n\nexport type PayloadWithMeta<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithMeta<Payload<T, S>>\n\nexport const unMeta = <T extends WithMeta<Payload>>(payload?: T): T | undefined => {\n if (payload) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { $meta, $hash, ...result } = payload\n return result as T\n }\n}\n","export type PayloadSetSchema = 'network.xyo.payload.set'\nexport const PayloadSetSchema: PayloadSetSchema = 'network.xyo.payload.set'\n","import { AsTypeFactory, EmptyObject } from '@xylabs/object'\n\n/** Schema type in Javascript is a string */\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload'\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n if (typeof value === 'string') {\n return true\n }\n return false\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n"],"mappings":";;;;AAAA,SAASA,iBAAiBC,gBAAgB;AAInC,IAAMC,eAAe,wBAACC,UAAAA;AAC3B,MAAIC,SAASD,KAAAA,GAAQ;AACnB,WAAO,OAAOA,MAAME,WAAW;EACjC;AACA,SAAO;AACT,GAL4B;AAOrB,IAAMC,eAAeC,gBAAgBC,OAAON,YAAAA;AAE5C,IAAMO,YACX,wBAAoBJ,WACpB,CAACF,UAAAA;AACC,MAAID,aAAaC,KAAAA,GAAQ;AACvB,WAAOE,OAAOK,SAASP,MAAME,MAAM;EACrC;AACA,SAAO;AACT,GANA;AAQK,IAAMM,YAAY,wBAAoBN,WAAqBE,gBAAgBC,OAAO,CAACL,UAA+BM,UAAUJ,MAAAA,EAAQF,KAAAA,CAAAA,GAAlH;;;AClBlB,IAAMS,wBAAwB,wBAAoBC,WAAAA;AACvD,SAAO,CAACC,MAA+BC,aAAaD,CAAAA,KAAMA,GAAGD,WAAWA;AAC1E,GAFqC;AAI9B,IAAMG,gCAAgC,wBAAoBH,WAAAA;AAC/D,SAAO,CAACC,MAAyCF,sBAAmCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEG,UAAUC;AAChH,GAF6C;AAItC,IAAMC,mCAAmC,wBAAoBN,WAAAA;AAClE,SAAO,CAACC,MACNF,sBAAsCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEM,YAAYF,UAAaG,MAAMC,QAAQR,EAAEM,OAAO;AAC1G,GAHgD;AAKzC,IAAMG,yBAAyB,wBAAoBV,WAAAA;AACxD,SAAO,CAACC,MAA+B,CAACC,aAAaD,CAAAA,KAAMA,GAAGD,WAAWA;AAC3E,GAFsC;;;ACV/B,IAAMW,oBAAuC;AAW7C,IAAMC,gBAAgBC,sBAAmCF,iBAAAA;;;ACTzD,IAAMG,aAAa,wBAAoBC,UAAAA;AAC5C,SAAO,OAAQA,OAAuBC,UAAU;AAClD,GAF0B;AASnB,IAAMC,oBAAoB,wBAAoBF,UAAAA;AACnD,SAAOG,aAAaH,KAAAA,KAAUD,WAAWC,KAAAA;AAC3C,GAFiC;;;ACP1B,IAAMI,SAAS,wBAA8BC,YAAAA;AAClD,MAAIA,SAAS;AAEX,UAAM,EAAEC,OAAOC,OAAO,GAAGC,OAAAA,IAAWH;AACpC,WAAOG;EACT;AACF,GANsB;;;ACVf,IAAMC,mBAAqC;;;ACDlD,SAASC,qBAAkC;AAKpC,IAAMC,gBAAgB;AAGtB,IAAMC,WAAW,wBAACC,UAAAA;AACvB,MAAI,OAAOA,UAAU,UAAU;AAC7B,WAAO;EACT;AACA,SAAO;AACT,GALwB;AAOjB,IAAMC,WAAWC,cAAcC,OAAeJ,QAAAA;","names":["AsObjectFactory","isObject","isAnyPayload","value","isObject","schema","asAnyPayload","AsObjectFactory","create","isPayload","includes","asPayload","isPayloadOfSchemaType","schema","x","isAnyPayload","isPayloadOfSchemaTypeWithMeta","$hash","undefined","isPayloadOfSchemaTypeWithSources","sources","Array","isArray","notPayloadOfSchemaType","ModuleErrorSchema","isModuleError","isPayloadOfSchemaType","isWithHash","value","$hash","isPayloadWithHash","isAnyPayload","unMeta","payload","$meta","$hash","result","PayloadSetSchema","AsTypeFactory","PayloadSchema","isSchema","value","asSchema","AsTypeFactory","create"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const isAnyPayload: (value: unknown) => value is {
|
|
2
|
+
schema: string;
|
|
3
|
+
} & import("./Payload").PayloadFields;
|
|
4
|
+
export declare const asAnyPayload: {
|
|
5
|
+
<TType extends {
|
|
6
|
+
schema: string;
|
|
7
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
8
|
+
<TType_1 extends {
|
|
9
|
+
schema: string;
|
|
10
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<{
|
|
11
|
+
schema: string;
|
|
12
|
+
} & import("./Payload").PayloadFields>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
13
|
+
};
|
|
14
|
+
export declare const isPayload: <T extends {
|
|
15
|
+
schema: string;
|
|
16
|
+
} & import("./Payload").PayloadFields>(schema: string[]) => (value: unknown) => value is T;
|
|
17
|
+
export declare const asPayload: <T extends {
|
|
18
|
+
schema: string;
|
|
19
|
+
} & import("./Payload").PayloadFields>(schema: string[]) => {
|
|
20
|
+
<TType extends T>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
21
|
+
<TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=isPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayload.d.ts","sourceRoot":"","sources":["../../src/isPayload.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,UAAW,OAAO;;qCAK1C,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;CAAuC,CAAA;AAEhE,eAAO,MAAM,SAAS;;+CACQ,MAAM,EAAE,aAC5B,OAAO,eAKd,CAAA;AAEH,eAAO,MAAM,SAAS;;+CAA+B,MAAM,EAAE;;;CAAqF,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const isAnyPayload: (value: unknown) => value is {
|
|
2
|
+
schema: string;
|
|
3
|
+
} & import("./Payload").PayloadFields;
|
|
4
|
+
export declare const asAnyPayload: {
|
|
5
|
+
<TType extends {
|
|
6
|
+
schema: string;
|
|
7
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
8
|
+
<TType_1 extends {
|
|
9
|
+
schema: string;
|
|
10
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<{
|
|
11
|
+
schema: string;
|
|
12
|
+
} & import("./Payload").PayloadFields>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
13
|
+
};
|
|
14
|
+
export declare const isPayload: <T extends {
|
|
15
|
+
schema: string;
|
|
16
|
+
} & import("./Payload").PayloadFields>(schema: string[]) => (value: unknown) => value is T;
|
|
17
|
+
export declare const asPayload: <T extends {
|
|
18
|
+
schema: string;
|
|
19
|
+
} & import("./Payload").PayloadFields>(schema: string[]) => {
|
|
20
|
+
<TType extends T>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
21
|
+
<TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=isPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayload.d.ts","sourceRoot":"","sources":["../../src/isPayload.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,UAAW,OAAO;;qCAK1C,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;CAAuC,CAAA;AAEhE,eAAO,MAAM,SAAS;;+CACQ,MAAM,EAAE,aAC5B,OAAO,eAKd,CAAA;AAEH,eAAO,MAAM,SAAS;;+CAA+B,MAAM,EAAE;;;CAAqF,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const isAnyPayload: (value: unknown) => value is {
|
|
2
|
+
schema: string;
|
|
3
|
+
} & import("./Payload").PayloadFields;
|
|
4
|
+
export declare const asAnyPayload: {
|
|
5
|
+
<TType extends {
|
|
6
|
+
schema: string;
|
|
7
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
8
|
+
<TType_1 extends {
|
|
9
|
+
schema: string;
|
|
10
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<{
|
|
11
|
+
schema: string;
|
|
12
|
+
} & import("./Payload").PayloadFields>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
13
|
+
};
|
|
14
|
+
export declare const isPayload: <T extends {
|
|
15
|
+
schema: string;
|
|
16
|
+
} & import("./Payload").PayloadFields>(schema: string[]) => (value: unknown) => value is T;
|
|
17
|
+
export declare const asPayload: <T extends {
|
|
18
|
+
schema: string;
|
|
19
|
+
} & import("./Payload").PayloadFields>(schema: string[]) => {
|
|
20
|
+
<TType extends T>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
21
|
+
<TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=isPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayload.d.ts","sourceRoot":"","sources":["../../src/isPayload.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,UAAW,OAAO;;qCAK1C,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;CAAuC,CAAA;AAEhE,eAAO,MAAM,SAAS;;+CACQ,MAAM,EAAE,aAC5B,OAAO,eAKd,CAAA;AAEH,eAAO,MAAM,SAAS;;+CAA+B,MAAM,EAAE;;;CAAqF,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WithMeta } from './Meta';
|
|
2
|
+
import { WithSources } from './Payload';
|
|
3
|
+
export declare const isPayloadOfSchemaType: <T extends {
|
|
4
|
+
schema: string;
|
|
5
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is T;
|
|
6
|
+
export declare const isPayloadOfSchemaTypeWithMeta: <T extends {
|
|
7
|
+
schema: string;
|
|
8
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is WithMeta<T>;
|
|
9
|
+
export declare const isPayloadOfSchemaTypeWithSources: <T extends {
|
|
10
|
+
schema: string;
|
|
11
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is WithSources<T>;
|
|
12
|
+
export declare const notPayloadOfSchemaType: <T extends {
|
|
13
|
+
schema: string;
|
|
14
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is T;
|
|
15
|
+
//# sourceMappingURL=isPayloadOfSchemaType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayloadOfSchemaType.d.ts","sourceRoot":"","sources":["../../src/isPayloadOfSchemaType.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,EAAW,WAAW,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,qBAAqB;;+CAA+B,MAAM,UACzD,OAAO,GAAG,IAAI,WAC3B,CAAA;AAED,eAAO,MAAM,6BAA6B;;+CAA+B,MAAM,UACjE,OAAO,GAAG,IAAI,qBAC3B,CAAA;AAED,eAAO,MAAM,gCAAgC;;+CAA+B,MAAM,UACpE,OAAO,GAAG,IAAI,wBAE3B,CAAA;AAED,eAAO,MAAM,sBAAsB;;+CAA+B,MAAM,UAC1D,OAAO,GAAG,IAAI,WAC3B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WithMeta } from './Meta';
|
|
2
|
+
import { WithSources } from './Payload';
|
|
3
|
+
export declare const isPayloadOfSchemaType: <T extends {
|
|
4
|
+
schema: string;
|
|
5
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is T;
|
|
6
|
+
export declare const isPayloadOfSchemaTypeWithMeta: <T extends {
|
|
7
|
+
schema: string;
|
|
8
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is WithMeta<T>;
|
|
9
|
+
export declare const isPayloadOfSchemaTypeWithSources: <T extends {
|
|
10
|
+
schema: string;
|
|
11
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is WithSources<T>;
|
|
12
|
+
export declare const notPayloadOfSchemaType: <T extends {
|
|
13
|
+
schema: string;
|
|
14
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is T;
|
|
15
|
+
//# sourceMappingURL=isPayloadOfSchemaType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayloadOfSchemaType.d.ts","sourceRoot":"","sources":["../../src/isPayloadOfSchemaType.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,EAAW,WAAW,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,qBAAqB;;+CAA+B,MAAM,UACzD,OAAO,GAAG,IAAI,WAC3B,CAAA;AAED,eAAO,MAAM,6BAA6B;;+CAA+B,MAAM,UACjE,OAAO,GAAG,IAAI,qBAC3B,CAAA;AAED,eAAO,MAAM,gCAAgC;;+CAA+B,MAAM,UACpE,OAAO,GAAG,IAAI,wBAE3B,CAAA;AAED,eAAO,MAAM,sBAAsB;;+CAA+B,MAAM,UAC1D,OAAO,GAAG,IAAI,WAC3B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WithMeta } from './Meta';
|
|
2
|
+
import { WithSources } from './Payload';
|
|
3
|
+
export declare const isPayloadOfSchemaType: <T extends {
|
|
4
|
+
schema: string;
|
|
5
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is T;
|
|
6
|
+
export declare const isPayloadOfSchemaTypeWithMeta: <T extends {
|
|
7
|
+
schema: string;
|
|
8
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is WithMeta<T>;
|
|
9
|
+
export declare const isPayloadOfSchemaTypeWithSources: <T extends {
|
|
10
|
+
schema: string;
|
|
11
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is WithSources<T>;
|
|
12
|
+
export declare const notPayloadOfSchemaType: <T extends {
|
|
13
|
+
schema: string;
|
|
14
|
+
} & import("./Payload").PayloadFields>(schema: string) => (x?: unknown | null) => x is T;
|
|
15
|
+
//# sourceMappingURL=isPayloadOfSchemaType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayloadOfSchemaType.d.ts","sourceRoot":"","sources":["../../src/isPayloadOfSchemaType.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,EAAW,WAAW,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,qBAAqB;;+CAA+B,MAAM,UACzD,OAAO,GAAG,IAAI,WAC3B,CAAA;AAED,eAAO,MAAM,6BAA6B;;+CAA+B,MAAM,UACjE,OAAO,GAAG,IAAI,qBAC3B,CAAA;AAED,eAAO,MAAM,gCAAgC;;+CAA+B,MAAM,UACpE,OAAO,GAAG,IAAI,wBAE3B,CAAA;AAED,eAAO,MAAM,sBAAsB;;+CAA+B,MAAM,UAC1D,OAAO,GAAG,IAAI,WAC3B,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WithMeta } from './Meta';
|
|
2
|
+
/**
|
|
3
|
+
* Return true if the value is a payload with the required meta fields
|
|
4
|
+
* @param value The value to check
|
|
5
|
+
* @returns True if the value is a payload with the required meta fields
|
|
6
|
+
*/
|
|
7
|
+
export declare const isWithHash: <T extends {
|
|
8
|
+
schema: string;
|
|
9
|
+
} & import("./Payload").PayloadFields>(value: T) => value is WithMeta<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Return true if the value is a payload with the required meta fields
|
|
12
|
+
* @param value The value to check
|
|
13
|
+
* @returns True if the value is a payload with the required meta fields
|
|
14
|
+
*/
|
|
15
|
+
export declare const isPayloadWithHash: <T extends {
|
|
16
|
+
schema: string;
|
|
17
|
+
} & import("./Payload").PayloadFields>(value: unknown) => value is WithMeta<T>;
|
|
18
|
+
//# sourceMappingURL=isPayloadWithHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayloadWithHash.d.ts","sourceRoot":"","sources":["../../src/isPayloadWithHash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGjC;;;;GAIG;AACH,eAAO,MAAM,UAAU;;8CAA8B,CAAC,yBAErD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;8CAA8B,OAAO,yBAElE,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WithMeta } from './Meta';
|
|
2
|
+
/**
|
|
3
|
+
* Return true if the value is a payload with the required meta fields
|
|
4
|
+
* @param value The value to check
|
|
5
|
+
* @returns True if the value is a payload with the required meta fields
|
|
6
|
+
*/
|
|
7
|
+
export declare const isWithHash: <T extends {
|
|
8
|
+
schema: string;
|
|
9
|
+
} & import("./Payload").PayloadFields>(value: T) => value is WithMeta<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Return true if the value is a payload with the required meta fields
|
|
12
|
+
* @param value The value to check
|
|
13
|
+
* @returns True if the value is a payload with the required meta fields
|
|
14
|
+
*/
|
|
15
|
+
export declare const isPayloadWithHash: <T extends {
|
|
16
|
+
schema: string;
|
|
17
|
+
} & import("./Payload").PayloadFields>(value: unknown) => value is WithMeta<T>;
|
|
18
|
+
//# sourceMappingURL=isPayloadWithHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayloadWithHash.d.ts","sourceRoot":"","sources":["../../src/isPayloadWithHash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGjC;;;;GAIG;AACH,eAAO,MAAM,UAAU;;8CAA8B,CAAC,yBAErD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;8CAA8B,OAAO,yBAElE,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WithMeta } from './Meta';
|
|
2
|
+
/**
|
|
3
|
+
* Return true if the value is a payload with the required meta fields
|
|
4
|
+
* @param value The value to check
|
|
5
|
+
* @returns True if the value is a payload with the required meta fields
|
|
6
|
+
*/
|
|
7
|
+
export declare const isWithHash: <T extends {
|
|
8
|
+
schema: string;
|
|
9
|
+
} & import("./Payload").PayloadFields>(value: T) => value is WithMeta<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Return true if the value is a payload with the required meta fields
|
|
12
|
+
* @param value The value to check
|
|
13
|
+
* @returns True if the value is a payload with the required meta fields
|
|
14
|
+
*/
|
|
15
|
+
export declare const isPayloadWithHash: <T extends {
|
|
16
|
+
schema: string;
|
|
17
|
+
} & import("./Payload").PayloadFields>(value: unknown) => value is WithMeta<T>;
|
|
18
|
+
//# sourceMappingURL=isPayloadWithHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayloadWithHash.d.ts","sourceRoot":"","sources":["../../src/isPayloadWithHash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGjC;;;;GAIG;AACH,eAAO,MAAM,UAAU;;8CAA8B,CAAC,yBAErD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;8CAA8B,OAAO,yBAElE,CAAA"}
|
package/dist/node/Error.d.cts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Hash } from '@xylabs/hex';
|
|
2
|
+
import { JsonValue } from '@xylabs/object';
|
|
2
3
|
import { Payload } from './Payload';
|
|
3
4
|
export type ModuleErrorSchema = 'network.xyo.error.module';
|
|
4
5
|
export declare const ModuleErrorSchema: ModuleErrorSchema;
|
|
5
6
|
export type ModuleError = Payload<{
|
|
7
|
+
details?: JsonValue;
|
|
6
8
|
message?: string;
|
|
7
9
|
name?: string;
|
|
8
10
|
query?: Hash;
|
|
@@ -10,6 +12,7 @@ export type ModuleError = Payload<{
|
|
|
10
12
|
sources?: Hash[];
|
|
11
13
|
}>;
|
|
12
14
|
export declare const isModuleError: (x?: unknown) => x is import("./Schema").SchemaFields & import("./Payload").PayloadFields & {
|
|
15
|
+
details?: JsonValue | undefined;
|
|
13
16
|
message?: string | undefined;
|
|
14
17
|
name?: string | undefined;
|
|
15
18
|
query?: Lowercase<string> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,MAAM,iBAAiB,GAAG,0BAA0B,CAAA;AAC1D,eAAO,MAAM,iBAAiB,EAAE,iBAA8C,CAAA;AAE9E,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,MAAM,EAAE,iBAAiB,CAAA;IACzB,OAAO,CAAC,EAAE,IAAI,EAAE,CAAA;CACjB,CAAC,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;YAJhB,iBAAiB;;CAIuD,CAAA"}
|
package/dist/node/Error.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Hash } from '@xylabs/hex';
|
|
2
|
+
import { JsonValue } from '@xylabs/object';
|
|
2
3
|
import { Payload } from './Payload';
|
|
3
4
|
export type ModuleErrorSchema = 'network.xyo.error.module';
|
|
4
5
|
export declare const ModuleErrorSchema: ModuleErrorSchema;
|
|
5
6
|
export type ModuleError = Payload<{
|
|
7
|
+
details?: JsonValue;
|
|
6
8
|
message?: string;
|
|
7
9
|
name?: string;
|
|
8
10
|
query?: Hash;
|
|
@@ -10,6 +12,7 @@ export type ModuleError = Payload<{
|
|
|
10
12
|
sources?: Hash[];
|
|
11
13
|
}>;
|
|
12
14
|
export declare const isModuleError: (x?: unknown) => x is import("./Schema").SchemaFields & import("./Payload").PayloadFields & {
|
|
15
|
+
details?: JsonValue | undefined;
|
|
13
16
|
message?: string | undefined;
|
|
14
17
|
name?: string | undefined;
|
|
15
18
|
query?: Lowercase<string> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,MAAM,iBAAiB,GAAG,0BAA0B,CAAA;AAC1D,eAAO,MAAM,iBAAiB,EAAE,iBAA8C,CAAA;AAE9E,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,MAAM,EAAE,iBAAiB,CAAA;IACzB,OAAO,CAAC,EAAE,IAAI,EAAE,CAAA;CACjB,CAAC,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;YAJhB,iBAAiB;;CAIuD,CAAA"}
|
package/dist/node/Error.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Hash } from '@xylabs/hex';
|
|
2
|
+
import { JsonValue } from '@xylabs/object';
|
|
2
3
|
import { Payload } from './Payload';
|
|
3
4
|
export type ModuleErrorSchema = 'network.xyo.error.module';
|
|
4
5
|
export declare const ModuleErrorSchema: ModuleErrorSchema;
|
|
5
6
|
export type ModuleError = Payload<{
|
|
7
|
+
details?: JsonValue;
|
|
6
8
|
message?: string;
|
|
7
9
|
name?: string;
|
|
8
10
|
query?: Hash;
|
|
@@ -10,6 +12,7 @@ export type ModuleError = Payload<{
|
|
|
10
12
|
sources?: Hash[];
|
|
11
13
|
}>;
|
|
12
14
|
export declare const isModuleError: (x?: unknown) => x is import("./Schema").SchemaFields & import("./Payload").PayloadFields & {
|
|
15
|
+
details?: JsonValue | undefined;
|
|
13
16
|
message?: string | undefined;
|
|
14
17
|
name?: string | undefined;
|
|
15
18
|
query?: Lowercase<string> | undefined;
|
package/dist/node/Error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,MAAM,iBAAiB,GAAG,0BAA0B,CAAA;AAC1D,eAAO,MAAM,iBAAiB,EAAE,iBAA8C,CAAA;AAE9E,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,MAAM,EAAE,iBAAiB,CAAA;IACzB,OAAO,CAAC,EAAE,IAAI,EAAE,CAAA;CACjB,CAAC,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;YAJhB,iBAAiB;;CAIuD,CAAA"}
|
package/dist/node/Schema.d.cts
CHANGED
|
@@ -5,8 +5,8 @@ export declare const PayloadSchema = "network.xyo.payload";
|
|
|
5
5
|
export type PayloadSchema = typeof PayloadSchema;
|
|
6
6
|
export declare const isSchema: (value: unknown) => value is string;
|
|
7
7
|
export declare const asSchema: {
|
|
8
|
-
<TType extends string>(value: import("@xylabs/promise").AnyNonPromise
|
|
9
|
-
<TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise
|
|
8
|
+
<TType extends string>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
9
|
+
<TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
10
10
|
};
|
|
11
11
|
/** Schema fields for a Payload */
|
|
12
12
|
export interface SchemaFields extends EmptyObject {
|
package/dist/node/Schema.d.mts
CHANGED
|
@@ -5,8 +5,8 @@ export declare const PayloadSchema = "network.xyo.payload";
|
|
|
5
5
|
export type PayloadSchema = typeof PayloadSchema;
|
|
6
6
|
export declare const isSchema: (value: unknown) => value is string;
|
|
7
7
|
export declare const asSchema: {
|
|
8
|
-
<TType extends string>(value: import("@xylabs/promise").AnyNonPromise
|
|
9
|
-
<TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise
|
|
8
|
+
<TType extends string>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
9
|
+
<TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
10
10
|
};
|
|
11
11
|
/** Schema fields for a Payload */
|
|
12
12
|
export interface SchemaFields extends EmptyObject {
|
package/dist/node/Schema.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export declare const PayloadSchema = "network.xyo.payload";
|
|
|
5
5
|
export type PayloadSchema = typeof PayloadSchema;
|
|
6
6
|
export declare const isSchema: (value: unknown) => value is string;
|
|
7
7
|
export declare const asSchema: {
|
|
8
|
-
<TType extends string>(value: import("@xylabs/promise").AnyNonPromise
|
|
9
|
-
<TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise
|
|
8
|
+
<TType extends string>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
9
|
+
<TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
10
10
|
};
|
|
11
11
|
/** Schema fields for a Payload */
|
|
12
12
|
export interface SchemaFields extends EmptyObject {
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/isPayloadWithHash.ts","../../src/Meta.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts"],"sourcesContent":["export * from './Error'\nexport * from './isPayload'\nexport * from './isPayloadOfSchemaType'\nexport * from './isPayloadWithHash'\nexport * from './Meta'\nexport * from './Payload'\nexport * from './PayloadFindFilter'\nexport * from './PayloadSet'\nexport * from './PayloadValidationFunction'\nexport * from './PayloadValueExpression'\nexport * from './Query'\nexport * from './Schema'\n","import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport { Payload } from './Payload'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload =\n <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload, WithSources } from './Payload'\n\nexport const isPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithMeta = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithMeta<T> => isPayloadOfSchemaType<WithMeta<T>>(schema)(x) && x.$hash !== undefined\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.sources !== undefined && Array.isArray(x.sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n//test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\nconst testWithMeta: WithMeta<Test> = { $hash: '1234abcd', $meta: { timestamp: Date.now() }, field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\nconst testMetaPayloads: WithMeta<Payload>[] = [testWithMeta]\n\nconst testType: Test = testWithMeta\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMeta: Payload[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMetaWithMeta: PayloadWithMeta[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n\nconst isTestFromMetaTypedWithMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestWithMeta: WithMeta<Test>[] = testPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\nconst isTestWithMetaFromMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\n*/\n","import { Hash } from '@xylabs/hex'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType'\nimport { Payload } from './Payload'\n\nexport type ModuleErrorSchema = 'network.xyo.error.module'\nexport const ModuleErrorSchema: ModuleErrorSchema = 'network.xyo.error.module'\n\nexport type ModuleError = Payload<{\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n sources?: Hash[]\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload } from './Payload'\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isWithHash = <T extends Payload>(value: T): value is WithMeta<T> => {\n return typeof (value as WithMeta<T>)?.$hash === 'string'\n}\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isPayloadWithHash = <T extends Payload>(value: unknown): value is WithMeta<T> => {\n return isAnyPayload(value) && isWithHash(value)\n}\n","import { EmptyObject, JsonObject } from '@xylabs/object'\n\nimport { Payload, PayloadMetaFields } from './Payload'\nimport { Schema, WithSchema } from './Schema'\n\nexport type WithMeta<T extends Payload = Payload, M extends JsonObject | void = void> = PayloadMetaFields<M> & T\nexport type WithOptionalMeta<T extends Payload = Payload, M extends JsonObject | void = void> = Partial<WithMeta<T, M>> &\n Omit<WithMeta<T, M>, '$hash'>\n\nexport type PayloadWithMeta<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithMeta<Payload<T, S>>\n\nexport const unMeta = <T extends WithMeta<Payload>>(payload?: T): T | undefined => {\n if (payload) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { $meta, $hash, ...result } = payload\n return result as T\n }\n}\n","export type PayloadSetSchema = 'network.xyo.payload.set'\nexport const PayloadSetSchema: PayloadSetSchema = 'network.xyo.payload.set'\n","import { AsTypeFactory, EmptyObject } from '@xylabs/object'\n\n/** Schema type in Javascript is a string */\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload'\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n if (typeof value === 'string') {\n return true\n }\n return false\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACAA,oBAA0C;AAInC,IAAMA,eAAe,wBAACC,UAAAA;AAC3B,UAAIC,wBAASD,KAAAA,GAAQ;AACnB,WAAO,OAAOA,MAAME,WAAW;EACjC;AACA,SAAO;AACT,GAL4B;AAOrB,IAAMC,eAAeC,8BAAgBC,OAAON,YAAAA;AAE5C,IAAMO,YACX,wBAAoBJ,WACpB,CAACF,UAAAA;AACC,MAAID,aAAaC,KAAAA,GAAQ;AACvB,WAAOE,OAAOK,SAASP,MAAME,MAAM;EACrC;AACA,SAAO;AACT,GANA;AAQK,IAAMM,YAAY,wBAAoBN,WAAqBE,8BAAgBC,OAAO,CAACL,UAA+BM,UAAUJ,MAAAA,EAAQF,KAAAA,CAAAA,GAAlH;;;AClBlB,IAAMS,wBAAwB,wBAAoBC,WAAAA;AACvD,SAAO,CAACC,MAA+BC,aAAaD,CAAAA,MAAMA,uBAAGD,YAAWA;AAC1E,GAFqC;AAI9B,IAAMG,gCAAgC,wBAAoBH,WAAAA;AAC/D,SAAO,CAACC,MAAyCF,sBAAmCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEG,UAAUC;AAChH,GAF6C;AAItC,IAAMC,mCAAmC,wBAAoBN,WAAAA;AAClE,SAAO,CAACC,MACNF,sBAAsCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEM,YAAYF,UAAaG,MAAMC,QAAQR,EAAEM,OAAO;AAC1G,GAHgD;AAKzC,IAAMG,yBAAyB,wBAAoBV,WAAAA;AACxD,SAAO,CAACC,MAA+B,CAACC,aAAaD,CAAAA,MAAMA,uBAAGD,YAAWA;AAC3E,GAFsC;;;
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/isPayloadWithHash.ts","../../src/Meta.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts"],"sourcesContent":["export * from './Error'\nexport * from './isPayload'\nexport * from './isPayloadOfSchemaType'\nexport * from './isPayloadWithHash'\nexport * from './Meta'\nexport * from './Payload'\nexport * from './PayloadFindFilter'\nexport * from './PayloadSet'\nexport * from './PayloadValidationFunction'\nexport * from './PayloadValueExpression'\nexport * from './Query'\nexport * from './Schema'\n","import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport { Payload } from './Payload'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload =\n <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload, WithSources } from './Payload'\n\nexport const isPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithMeta = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithMeta<T> => isPayloadOfSchemaType<WithMeta<T>>(schema)(x) && x.$hash !== undefined\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.sources !== undefined && Array.isArray(x.sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n//test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\nconst testWithMeta: WithMeta<Test> = { $hash: '1234abcd', $meta: { timestamp: Date.now() }, field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\nconst testMetaPayloads: WithMeta<Payload>[] = [testWithMeta]\n\nconst testType: Test = testWithMeta\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMeta: Payload[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMetaWithMeta: PayloadWithMeta[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n\nconst isTestFromMetaTypedWithMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestWithMeta: WithMeta<Test>[] = testPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\nconst isTestWithMetaFromMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\n*/\n","import { Hash } from '@xylabs/hex'\nimport { JsonValue } from '@xylabs/object'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType'\nimport { Payload } from './Payload'\n\nexport type ModuleErrorSchema = 'network.xyo.error.module'\nexport const ModuleErrorSchema: ModuleErrorSchema = 'network.xyo.error.module'\n\nexport type ModuleError = Payload<{\n details?: JsonValue\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n sources?: Hash[]\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload } from './Payload'\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isWithHash = <T extends Payload>(value: T): value is WithMeta<T> => {\n return typeof (value as WithMeta<T>)?.$hash === 'string'\n}\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isPayloadWithHash = <T extends Payload>(value: unknown): value is WithMeta<T> => {\n return isAnyPayload(value) && isWithHash(value)\n}\n","import { EmptyObject, JsonObject } from '@xylabs/object'\n\nimport { Payload, PayloadMetaFields } from './Payload'\nimport { Schema, WithSchema } from './Schema'\n\nexport type WithMeta<T extends Payload = Payload, M extends JsonObject | void = void> = PayloadMetaFields<M> & T\nexport type WithOptionalMeta<T extends Payload = Payload, M extends JsonObject | void = void> = Partial<WithMeta<T, M>> &\n Omit<WithMeta<T, M>, '$hash'>\n\nexport type PayloadWithMeta<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithMeta<Payload<T, S>>\n\nexport const unMeta = <T extends WithMeta<Payload>>(payload?: T): T | undefined => {\n if (payload) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { $meta, $hash, ...result } = payload\n return result as T\n }\n}\n","export type PayloadSetSchema = 'network.xyo.payload.set'\nexport const PayloadSetSchema: PayloadSetSchema = 'network.xyo.payload.set'\n","import { AsTypeFactory, EmptyObject } from '@xylabs/object'\n\n/** Schema type in Javascript is a string */\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload'\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n if (typeof value === 'string') {\n return true\n }\n return false\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACAA,oBAA0C;AAInC,IAAMA,eAAe,wBAACC,UAAAA;AAC3B,UAAIC,wBAASD,KAAAA,GAAQ;AACnB,WAAO,OAAOA,MAAME,WAAW;EACjC;AACA,SAAO;AACT,GAL4B;AAOrB,IAAMC,eAAeC,8BAAgBC,OAAON,YAAAA;AAE5C,IAAMO,YACX,wBAAoBJ,WACpB,CAACF,UAAAA;AACC,MAAID,aAAaC,KAAAA,GAAQ;AACvB,WAAOE,OAAOK,SAASP,MAAME,MAAM;EACrC;AACA,SAAO;AACT,GANA;AAQK,IAAMM,YAAY,wBAAoBN,WAAqBE,8BAAgBC,OAAO,CAACL,UAA+BM,UAAUJ,MAAAA,EAAQF,KAAAA,CAAAA,GAAlH;;;AClBlB,IAAMS,wBAAwB,wBAAoBC,WAAAA;AACvD,SAAO,CAACC,MAA+BC,aAAaD,CAAAA,MAAMA,uBAAGD,YAAWA;AAC1E,GAFqC;AAI9B,IAAMG,gCAAgC,wBAAoBH,WAAAA;AAC/D,SAAO,CAACC,MAAyCF,sBAAmCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEG,UAAUC;AAChH,GAF6C;AAItC,IAAMC,mCAAmC,wBAAoBN,WAAAA;AAClE,SAAO,CAACC,MACNF,sBAAsCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEM,YAAYF,UAAaG,MAAMC,QAAQR,EAAEM,OAAO;AAC1G,GAHgD;AAKzC,IAAMG,yBAAyB,wBAAoBV,WAAAA;AACxD,SAAO,CAACC,MAA+B,CAACC,aAAaD,CAAAA,MAAMA,uBAAGD,YAAWA;AAC3E,GAFsC;;;ACV/B,IAAMW,oBAAuC;AAW7C,IAAMC,gBAAgBC,sBAAmCF,iBAAAA;;;ACTzD,IAAMG,aAAa,wBAAoBC,UAAAA;AAC5C,SAAO,QAAQA,+BAAuBC,WAAU;AAClD,GAF0B;AASnB,IAAMC,oBAAoB,wBAAoBF,UAAAA;AACnD,SAAOG,aAAaH,KAAAA,KAAUD,WAAWC,KAAAA;AAC3C,GAFiC;;;ACP1B,IAAMI,SAAS,wBAA8BC,YAAAA;AAClD,MAAIA,SAAS;AAEX,UAAM,EAAEC,OAAOC,OAAO,GAAGC,OAAAA,IAAWH;AACpC,WAAOG;EACT;AACF,GANsB;;;ACVf,IAAMC,mBAAqC;;;ACDlD,IAAAC,iBAA2C;AAKpC,IAAMC,gBAAgB;AAGtB,IAAMC,WAAW,wBAACC,UAAAA;AACvB,MAAI,OAAOA,UAAU,UAAU;AAC7B,WAAO;EACT;AACA,SAAO;AACT,GALwB;AAOjB,IAAMC,WAAWC,6BAAcC,OAAeJ,QAAAA;","names":["isAnyPayload","value","isObject","schema","asAnyPayload","AsObjectFactory","create","isPayload","includes","asPayload","isPayloadOfSchemaType","schema","x","isAnyPayload","isPayloadOfSchemaTypeWithMeta","$hash","undefined","isPayloadOfSchemaTypeWithSources","sources","Array","isArray","notPayloadOfSchemaType","ModuleErrorSchema","isModuleError","isPayloadOfSchemaType","isWithHash","value","$hash","isPayloadWithHash","isAnyPayload","unMeta","payload","$meta","$hash","result","PayloadSetSchema","import_object","PayloadSchema","isSchema","value","asSchema","AsTypeFactory","create"]}
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/isPayloadWithHash.ts","../../src/Meta.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts"],"sourcesContent":["import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport { Payload } from './Payload'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload =\n <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload, WithSources } from './Payload'\n\nexport const isPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithMeta = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithMeta<T> => isPayloadOfSchemaType<WithMeta<T>>(schema)(x) && x.$hash !== undefined\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.sources !== undefined && Array.isArray(x.sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n//test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\nconst testWithMeta: WithMeta<Test> = { $hash: '1234abcd', $meta: { timestamp: Date.now() }, field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\nconst testMetaPayloads: WithMeta<Payload>[] = [testWithMeta]\n\nconst testType: Test = testWithMeta\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMeta: Payload[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMetaWithMeta: PayloadWithMeta[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n\nconst isTestFromMetaTypedWithMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestWithMeta: WithMeta<Test>[] = testPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\nconst isTestWithMetaFromMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\n*/\n","import { Hash } from '@xylabs/hex'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType'\nimport { Payload } from './Payload'\n\nexport type ModuleErrorSchema = 'network.xyo.error.module'\nexport const ModuleErrorSchema: ModuleErrorSchema = 'network.xyo.error.module'\n\nexport type ModuleError = Payload<{\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n sources?: Hash[]\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload } from './Payload'\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isWithHash = <T extends Payload>(value: T): value is WithMeta<T> => {\n return typeof (value as WithMeta<T>)?.$hash === 'string'\n}\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isPayloadWithHash = <T extends Payload>(value: unknown): value is WithMeta<T> => {\n return isAnyPayload(value) && isWithHash(value)\n}\n","import { EmptyObject, JsonObject } from '@xylabs/object'\n\nimport { Payload, PayloadMetaFields } from './Payload'\nimport { Schema, WithSchema } from './Schema'\n\nexport type WithMeta<T extends Payload = Payload, M extends JsonObject | void = void> = PayloadMetaFields<M> & T\nexport type WithOptionalMeta<T extends Payload = Payload, M extends JsonObject | void = void> = Partial<WithMeta<T, M>> &\n Omit<WithMeta<T, M>, '$hash'>\n\nexport type PayloadWithMeta<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithMeta<Payload<T, S>>\n\nexport const unMeta = <T extends WithMeta<Payload>>(payload?: T): T | undefined => {\n if (payload) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { $meta, $hash, ...result } = payload\n return result as T\n }\n}\n","export type PayloadSetSchema = 'network.xyo.payload.set'\nexport const PayloadSetSchema: PayloadSetSchema = 'network.xyo.payload.set'\n","import { AsTypeFactory, EmptyObject } from '@xylabs/object'\n\n/** Schema type in Javascript is a string */\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload'\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n if (typeof value === 'string') {\n return true\n }\n return false\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n"],"mappings":";;;;AAAA,SAASA,iBAAiBC,gBAAgB;AAInC,IAAMC,eAAe,wBAACC,UAAAA;AAC3B,MAAIC,SAASD,KAAAA,GAAQ;AACnB,WAAO,OAAOA,MAAME,WAAW;EACjC;AACA,SAAO;AACT,GAL4B;AAOrB,IAAMC,eAAeC,gBAAgBC,OAAON,YAAAA;AAE5C,IAAMO,YACX,wBAAoBJ,WACpB,CAACF,UAAAA;AACC,MAAID,aAAaC,KAAAA,GAAQ;AACvB,WAAOE,OAAOK,SAASP,MAAME,MAAM;EACrC;AACA,SAAO;AACT,GANA;AAQK,IAAMM,YAAY,wBAAoBN,WAAqBE,gBAAgBC,OAAO,CAACL,UAA+BM,UAAUJ,MAAAA,EAAQF,KAAAA,CAAAA,GAAlH;;;AClBlB,IAAMS,wBAAwB,wBAAoBC,WAAAA;AACvD,SAAO,CAACC,MAA+BC,aAAaD,CAAAA,MAAMA,uBAAGD,YAAWA;AAC1E,GAFqC;AAI9B,IAAMG,gCAAgC,wBAAoBH,WAAAA;AAC/D,SAAO,CAACC,MAAyCF,sBAAmCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEG,UAAUC;AAChH,GAF6C;AAItC,IAAMC,mCAAmC,wBAAoBN,WAAAA;AAClE,SAAO,CAACC,MACNF,sBAAsCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEM,YAAYF,UAAaG,MAAMC,QAAQR,EAAEM,OAAO;AAC1G,GAHgD;AAKzC,IAAMG,yBAAyB,wBAAoBV,WAAAA;AACxD,SAAO,CAACC,MAA+B,CAACC,aAAaD,CAAAA,MAAMA,uBAAGD,YAAWA;AAC3E,GAFsC;;;
|
|
1
|
+
{"version":3,"sources":["../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/isPayloadWithHash.ts","../../src/Meta.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts"],"sourcesContent":["import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport { Payload } from './Payload'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload =\n <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload, WithSources } from './Payload'\n\nexport const isPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithMeta = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithMeta<T> => isPayloadOfSchemaType<WithMeta<T>>(schema)(x) && x.$hash !== undefined\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.sources !== undefined && Array.isArray(x.sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload>(schema: string) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n//test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\nconst testWithMeta: WithMeta<Test> = { $hash: '1234abcd', $meta: { timestamp: Date.now() }, field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\nconst testMetaPayloads: WithMeta<Payload>[] = [testWithMeta]\n\nconst testType: Test = testWithMeta\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMeta: Payload[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\nconst isTestFromMetaWithMeta: PayloadWithMeta[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n\nconst isTestFromMetaTypedWithMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaType(TestSchema))\n\nconst isTestWithMeta: WithMeta<Test>[] = testPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\nconst isTestWithMetaFromMeta: WithMeta<Test>[] = testMetaPayloads.filter(isPayloadOfSchemaTypeWithMeta(TestSchema))\n*/\n","import { Hash } from '@xylabs/hex'\nimport { JsonValue } from '@xylabs/object'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType'\nimport { Payload } from './Payload'\n\nexport type ModuleErrorSchema = 'network.xyo.error.module'\nexport const ModuleErrorSchema: ModuleErrorSchema = 'network.xyo.error.module'\n\nexport type ModuleError = Payload<{\n details?: JsonValue\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n sources?: Hash[]\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","import { isAnyPayload } from './isPayload'\nimport { WithMeta } from './Meta'\nimport { Payload } from './Payload'\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isWithHash = <T extends Payload>(value: T): value is WithMeta<T> => {\n return typeof (value as WithMeta<T>)?.$hash === 'string'\n}\n\n/**\n * Return true if the value is a payload with the required meta fields\n * @param value The value to check\n * @returns True if the value is a payload with the required meta fields\n */\nexport const isPayloadWithHash = <T extends Payload>(value: unknown): value is WithMeta<T> => {\n return isAnyPayload(value) && isWithHash(value)\n}\n","import { EmptyObject, JsonObject } from '@xylabs/object'\n\nimport { Payload, PayloadMetaFields } from './Payload'\nimport { Schema, WithSchema } from './Schema'\n\nexport type WithMeta<T extends Payload = Payload, M extends JsonObject | void = void> = PayloadMetaFields<M> & T\nexport type WithOptionalMeta<T extends Payload = Payload, M extends JsonObject | void = void> = Partial<WithMeta<T, M>> &\n Omit<WithMeta<T, M>, '$hash'>\n\nexport type PayloadWithMeta<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithMeta<Payload<T, S>>\n\nexport const unMeta = <T extends WithMeta<Payload>>(payload?: T): T | undefined => {\n if (payload) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { $meta, $hash, ...result } = payload\n return result as T\n }\n}\n","export type PayloadSetSchema = 'network.xyo.payload.set'\nexport const PayloadSetSchema: PayloadSetSchema = 'network.xyo.payload.set'\n","import { AsTypeFactory, EmptyObject } from '@xylabs/object'\n\n/** Schema type in Javascript is a string */\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload'\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n if (typeof value === 'string') {\n return true\n }\n return false\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n"],"mappings":";;;;AAAA,SAASA,iBAAiBC,gBAAgB;AAInC,IAAMC,eAAe,wBAACC,UAAAA;AAC3B,MAAIC,SAASD,KAAAA,GAAQ;AACnB,WAAO,OAAOA,MAAME,WAAW;EACjC;AACA,SAAO;AACT,GAL4B;AAOrB,IAAMC,eAAeC,gBAAgBC,OAAON,YAAAA;AAE5C,IAAMO,YACX,wBAAoBJ,WACpB,CAACF,UAAAA;AACC,MAAID,aAAaC,KAAAA,GAAQ;AACvB,WAAOE,OAAOK,SAASP,MAAME,MAAM;EACrC;AACA,SAAO;AACT,GANA;AAQK,IAAMM,YAAY,wBAAoBN,WAAqBE,gBAAgBC,OAAO,CAACL,UAA+BM,UAAUJ,MAAAA,EAAQF,KAAAA,CAAAA,GAAlH;;;AClBlB,IAAMS,wBAAwB,wBAAoBC,WAAAA;AACvD,SAAO,CAACC,MAA+BC,aAAaD,CAAAA,MAAMA,uBAAGD,YAAWA;AAC1E,GAFqC;AAI9B,IAAMG,gCAAgC,wBAAoBH,WAAAA;AAC/D,SAAO,CAACC,MAAyCF,sBAAmCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEG,UAAUC;AAChH,GAF6C;AAItC,IAAMC,mCAAmC,wBAAoBN,WAAAA;AAClE,SAAO,CAACC,MACNF,sBAAsCC,MAAAA,EAAQC,CAAAA,KAAMA,EAAEM,YAAYF,UAAaG,MAAMC,QAAQR,EAAEM,OAAO;AAC1G,GAHgD;AAKzC,IAAMG,yBAAyB,wBAAoBV,WAAAA;AACxD,SAAO,CAACC,MAA+B,CAACC,aAAaD,CAAAA,MAAMA,uBAAGD,YAAWA;AAC3E,GAFsC;;;ACV/B,IAAMW,oBAAuC;AAW7C,IAAMC,gBAAgBC,sBAAmCF,iBAAAA;;;ACTzD,IAAMG,aAAa,wBAAoBC,UAAAA;AAC5C,SAAO,QAAQA,+BAAuBC,WAAU;AAClD,GAF0B;AASnB,IAAMC,oBAAoB,wBAAoBF,UAAAA;AACnD,SAAOG,aAAaH,KAAAA,KAAUD,WAAWC,KAAAA;AAC3C,GAFiC;;;ACP1B,IAAMI,SAAS,wBAA8BC,YAAAA;AAClD,MAAIA,SAAS;AAEX,UAAM,EAAEC,OAAOC,OAAO,GAAGC,OAAAA,IAAWH;AACpC,WAAOG;EACT;AACF,GANsB;;;ACVf,IAAMC,mBAAqC;;;ACDlD,SAASC,qBAAkC;AAKpC,IAAMC,gBAAgB;AAGtB,IAAMC,WAAW,wBAACC,UAAAA;AACvB,MAAI,OAAOA,UAAU,UAAU;AAC7B,WAAO;EACT;AACA,SAAO;AACT,GALwB;AAOjB,IAAMC,WAAWC,cAAcC,OAAeJ,QAAAA;","names":["AsObjectFactory","isObject","isAnyPayload","value","isObject","schema","asAnyPayload","AsObjectFactory","create","isPayload","includes","asPayload","isPayloadOfSchemaType","schema","x","isAnyPayload","isPayloadOfSchemaTypeWithMeta","$hash","undefined","isPayloadOfSchemaTypeWithSources","sources","Array","isArray","notPayloadOfSchemaType","ModuleErrorSchema","isModuleError","isPayloadOfSchemaType","isWithHash","value","$hash","isPayloadWithHash","isAnyPayload","unMeta","payload","$meta","$hash","result","PayloadSetSchema","AsTypeFactory","PayloadSchema","isSchema","value","asSchema","AsTypeFactory","create"]}
|
|
@@ -4,10 +4,10 @@ export declare const isAnyPayload: (value: unknown) => value is {
|
|
|
4
4
|
export declare const asAnyPayload: {
|
|
5
5
|
<TType extends {
|
|
6
6
|
schema: string;
|
|
7
|
-
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise
|
|
7
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
8
8
|
<TType_1 extends {
|
|
9
9
|
schema: string;
|
|
10
|
-
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise
|
|
10
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<{
|
|
11
11
|
schema: string;
|
|
12
12
|
} & import("./Payload").PayloadFields>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
13
13
|
};
|
|
@@ -17,7 +17,7 @@ export declare const isPayload: <T extends {
|
|
|
17
17
|
export declare const asPayload: <T extends {
|
|
18
18
|
schema: string;
|
|
19
19
|
} & import("./Payload").PayloadFields>(schema: string[]) => {
|
|
20
|
-
<TType extends T>(value: import("@xylabs/promise").AnyNonPromise
|
|
21
|
-
<TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise
|
|
20
|
+
<TType extends T>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
21
|
+
<TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=isPayload.d.ts.map
|
|
@@ -4,10 +4,10 @@ export declare const isAnyPayload: (value: unknown) => value is {
|
|
|
4
4
|
export declare const asAnyPayload: {
|
|
5
5
|
<TType extends {
|
|
6
6
|
schema: string;
|
|
7
|
-
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise
|
|
7
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
8
8
|
<TType_1 extends {
|
|
9
9
|
schema: string;
|
|
10
|
-
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise
|
|
10
|
+
} & import("./Payload").PayloadFields>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<{
|
|
11
11
|
schema: string;
|
|
12
12
|
} & import("./Payload").PayloadFields>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
13
13
|
};
|
|
@@ -17,7 +17,7 @@ export declare const isPayload: <T extends {
|
|
|
17
17
|
export declare const asPayload: <T extends {
|
|
18
18
|
schema: string;
|
|
19
19
|
} & import("./Payload").PayloadFields>(schema: string[]) => {
|
|
20
|
-
<TType extends T>(value: import("@xylabs/promise").AnyNonPromise
|
|
21
|
-
<TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise
|
|
20
|
+
<TType extends T>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
|
|
21
|
+
<TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=isPayload.d.ts.map
|