@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.
Files changed (130) hide show
  1. package/dist/browser/Error.d.cts +3 -0
  2. package/dist/browser/Error.d.cts.map +1 -1
  3. package/dist/browser/Error.d.mts +3 -0
  4. package/dist/browser/Error.d.mts.map +1 -1
  5. package/dist/browser/Error.d.ts +3 -0
  6. package/dist/browser/Error.d.ts.map +1 -1
  7. package/dist/browser/Schema.d.cts +2 -2
  8. package/dist/browser/Schema.d.mts +2 -2
  9. package/dist/browser/Schema.d.ts +2 -2
  10. package/dist/browser/index.cjs.map +1 -1
  11. package/dist/browser/index.js.map +1 -1
  12. package/dist/browser/isPayload.d.cts +4 -4
  13. package/dist/browser/isPayload.d.mts +4 -4
  14. package/dist/browser/isPayload.d.ts +4 -4
  15. package/dist/neutral/Error.d.cts +22 -0
  16. package/dist/neutral/Error.d.cts.map +1 -0
  17. package/dist/neutral/Error.d.mts +22 -0
  18. package/dist/neutral/Error.d.mts.map +1 -0
  19. package/dist/neutral/Error.d.ts +22 -0
  20. package/dist/neutral/Error.d.ts.map +1 -0
  21. package/dist/neutral/Meta.d.cts +10 -0
  22. package/dist/neutral/Meta.d.cts.map +1 -0
  23. package/dist/neutral/Meta.d.mts +10 -0
  24. package/dist/neutral/Meta.d.mts.map +1 -0
  25. package/dist/neutral/Meta.d.ts +10 -0
  26. package/dist/neutral/Meta.d.ts.map +1 -0
  27. package/dist/neutral/Payload.d.cts +33 -0
  28. package/dist/neutral/Payload.d.cts.map +1 -0
  29. package/dist/neutral/Payload.d.mts +33 -0
  30. package/dist/neutral/Payload.d.mts.map +1 -0
  31. package/dist/neutral/Payload.d.ts +33 -0
  32. package/dist/neutral/Payload.d.ts.map +1 -0
  33. package/dist/neutral/PayloadFindFilter.d.cts +8 -0
  34. package/dist/neutral/PayloadFindFilter.d.cts.map +1 -0
  35. package/dist/neutral/PayloadFindFilter.d.mts +8 -0
  36. package/dist/neutral/PayloadFindFilter.d.mts.map +1 -0
  37. package/dist/neutral/PayloadFindFilter.d.ts +8 -0
  38. package/dist/neutral/PayloadFindFilter.d.ts.map +1 -0
  39. package/dist/neutral/PayloadSet/PayloadSetPayload.d.cts +8 -0
  40. package/dist/neutral/PayloadSet/PayloadSetPayload.d.cts.map +1 -0
  41. package/dist/neutral/PayloadSet/PayloadSetPayload.d.mts +8 -0
  42. package/dist/neutral/PayloadSet/PayloadSetPayload.d.mts.map +1 -0
  43. package/dist/neutral/PayloadSet/PayloadSetPayload.d.ts +8 -0
  44. package/dist/neutral/PayloadSet/PayloadSetPayload.d.ts.map +1 -0
  45. package/dist/neutral/PayloadSet/PayloadSetSchema.d.cts +3 -0
  46. package/dist/neutral/PayloadSet/PayloadSetSchema.d.cts.map +1 -0
  47. package/dist/neutral/PayloadSet/PayloadSetSchema.d.mts +3 -0
  48. package/dist/neutral/PayloadSet/PayloadSetSchema.d.mts.map +1 -0
  49. package/dist/neutral/PayloadSet/PayloadSetSchema.d.ts +3 -0
  50. package/dist/neutral/PayloadSet/PayloadSetSchema.d.ts.map +1 -0
  51. package/dist/neutral/PayloadSet/index.d.cts +3 -0
  52. package/dist/neutral/PayloadSet/index.d.cts.map +1 -0
  53. package/dist/neutral/PayloadSet/index.d.mts +3 -0
  54. package/dist/neutral/PayloadSet/index.d.mts.map +1 -0
  55. package/dist/neutral/PayloadSet/index.d.ts +3 -0
  56. package/dist/neutral/PayloadSet/index.d.ts.map +1 -0
  57. package/dist/neutral/PayloadValidationFunction.d.cts +6 -0
  58. package/dist/neutral/PayloadValidationFunction.d.cts.map +1 -0
  59. package/dist/neutral/PayloadValidationFunction.d.mts +6 -0
  60. package/dist/neutral/PayloadValidationFunction.d.mts.map +1 -0
  61. package/dist/neutral/PayloadValidationFunction.d.ts +6 -0
  62. package/dist/neutral/PayloadValidationFunction.d.ts.map +1 -0
  63. package/dist/neutral/PayloadValueExpression.d.cts +38 -0
  64. package/dist/neutral/PayloadValueExpression.d.cts.map +1 -0
  65. package/dist/neutral/PayloadValueExpression.d.mts +38 -0
  66. package/dist/neutral/PayloadValueExpression.d.mts.map +1 -0
  67. package/dist/neutral/PayloadValueExpression.d.ts +38 -0
  68. package/dist/neutral/PayloadValueExpression.d.ts.map +1 -0
  69. package/dist/neutral/Query.d.cts +16 -0
  70. package/dist/neutral/Query.d.cts.map +1 -0
  71. package/dist/neutral/Query.d.mts +16 -0
  72. package/dist/neutral/Query.d.mts.map +1 -0
  73. package/dist/neutral/Query.d.ts +16 -0
  74. package/dist/neutral/Query.d.ts.map +1 -0
  75. package/dist/neutral/Schema.d.cts +18 -0
  76. package/dist/neutral/Schema.d.cts.map +1 -0
  77. package/dist/neutral/Schema.d.mts +18 -0
  78. package/dist/neutral/Schema.d.mts.map +1 -0
  79. package/dist/neutral/Schema.d.ts +18 -0
  80. package/dist/neutral/Schema.d.ts.map +1 -0
  81. package/dist/neutral/Timestamp.d.cts +8 -0
  82. package/dist/neutral/Timestamp.d.cts.map +1 -0
  83. package/dist/neutral/Timestamp.d.mts +8 -0
  84. package/dist/neutral/Timestamp.d.mts.map +1 -0
  85. package/dist/neutral/Timestamp.d.ts +8 -0
  86. package/dist/neutral/Timestamp.d.ts.map +1 -0
  87. package/dist/neutral/index.cjs +108 -0
  88. package/dist/neutral/index.cjs.map +1 -0
  89. package/dist/neutral/index.d.cts +13 -0
  90. package/dist/neutral/index.d.cts.map +1 -0
  91. package/dist/neutral/index.d.mts +13 -0
  92. package/dist/neutral/index.d.mts.map +1 -0
  93. package/dist/neutral/index.d.ts +13 -0
  94. package/dist/neutral/index.d.ts.map +1 -0
  95. package/dist/neutral/index.js +87 -0
  96. package/dist/neutral/index.js.map +1 -0
  97. package/dist/neutral/isPayload.d.cts +23 -0
  98. package/dist/neutral/isPayload.d.cts.map +1 -0
  99. package/dist/neutral/isPayload.d.mts +23 -0
  100. package/dist/neutral/isPayload.d.mts.map +1 -0
  101. package/dist/neutral/isPayload.d.ts +23 -0
  102. package/dist/neutral/isPayload.d.ts.map +1 -0
  103. package/dist/neutral/isPayloadOfSchemaType.d.cts +15 -0
  104. package/dist/neutral/isPayloadOfSchemaType.d.cts.map +1 -0
  105. package/dist/neutral/isPayloadOfSchemaType.d.mts +15 -0
  106. package/dist/neutral/isPayloadOfSchemaType.d.mts.map +1 -0
  107. package/dist/neutral/isPayloadOfSchemaType.d.ts +15 -0
  108. package/dist/neutral/isPayloadOfSchemaType.d.ts.map +1 -0
  109. package/dist/neutral/isPayloadWithHash.d.cts +18 -0
  110. package/dist/neutral/isPayloadWithHash.d.cts.map +1 -0
  111. package/dist/neutral/isPayloadWithHash.d.mts +18 -0
  112. package/dist/neutral/isPayloadWithHash.d.mts.map +1 -0
  113. package/dist/neutral/isPayloadWithHash.d.ts +18 -0
  114. package/dist/neutral/isPayloadWithHash.d.ts.map +1 -0
  115. package/dist/node/Error.d.cts +3 -0
  116. package/dist/node/Error.d.cts.map +1 -1
  117. package/dist/node/Error.d.mts +3 -0
  118. package/dist/node/Error.d.mts.map +1 -1
  119. package/dist/node/Error.d.ts +3 -0
  120. package/dist/node/Error.d.ts.map +1 -1
  121. package/dist/node/Schema.d.cts +2 -2
  122. package/dist/node/Schema.d.mts +2 -2
  123. package/dist/node/Schema.d.ts +2 -2
  124. package/dist/node/index.cjs.map +1 -1
  125. package/dist/node/index.js.map +1 -1
  126. package/dist/node/isPayload.d.cts +4 -4
  127. package/dist/node/isPayload.d.mts +4 -4
  128. package/dist/node/isPayload.d.ts +4 -4
  129. package/package.json +5 -5
  130. package/src/Error.ts +2 -0
@@ -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;AAGlC,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,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"}
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"}
@@ -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;AAGlC,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,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"}
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"}
@@ -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;AAGlC,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,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"}
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"}
@@ -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<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
9
- <TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise<T>, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
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 {
@@ -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<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
9
- <TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise<T>, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
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 {
@@ -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<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
9
- <TType_1 extends string>(value: import("@xylabs/promise").AnyNonPromise<T>, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
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 {
@@ -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,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;;;ACX/B,IAAMW,oBAAuC;AAU7C,IAAMC,gBAAgBC,sBAAmCF,iBAAAA;;;ACPzD,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,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"]}
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,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,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"]}
@@ -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,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;;;ACX/B,IAAMW,oBAAuC;AAU7C,IAAMC,gBAAgBC,sBAAmCF,iBAAAA;;;ACPzD,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"]}
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"]}
@@ -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<T_1>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
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<T_1>, assert: import("@xylabs/object").StringOrAlertFunction<{
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<T_1>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
21
- <TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise<T_1>, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
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<T_1>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
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<T_1>, assert: import("@xylabs/object").StringOrAlertFunction<{
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<T_1>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
21
- <TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise<T_1>, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
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<T_1>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
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<T_1>, assert: import("@xylabs/object").StringOrAlertFunction<{
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<T_1>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType | undefined;
21
- <TType_1 extends T>(value: import("@xylabs/promise").AnyNonPromise<T_1>, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig | undefined): TType_1;
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
@@ -0,0 +1,22 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ import { JsonValue } from '@xylabs/object';
3
+ import { Payload } from './Payload';
4
+ export type ModuleErrorSchema = 'network.xyo.error.module';
5
+ export declare const ModuleErrorSchema: ModuleErrorSchema;
6
+ export type ModuleError = Payload<{
7
+ details?: JsonValue;
8
+ message?: string;
9
+ name?: string;
10
+ query?: Hash;
11
+ schema: ModuleErrorSchema;
12
+ sources?: Hash[];
13
+ }>;
14
+ export declare const isModuleError: (x?: unknown) => x is import("./Schema").SchemaFields & import("./Payload").PayloadFields & {
15
+ details?: JsonValue | undefined;
16
+ message?: string | undefined;
17
+ name?: string | undefined;
18
+ query?: Lowercase<string> | undefined;
19
+ schema: ModuleErrorSchema;
20
+ sources?: Lowercase<string>[] | undefined;
21
+ };
22
+ //# sourceMappingURL=Error.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,22 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ import { JsonValue } from '@xylabs/object';
3
+ import { Payload } from './Payload';
4
+ export type ModuleErrorSchema = 'network.xyo.error.module';
5
+ export declare const ModuleErrorSchema: ModuleErrorSchema;
6
+ export type ModuleError = Payload<{
7
+ details?: JsonValue;
8
+ message?: string;
9
+ name?: string;
10
+ query?: Hash;
11
+ schema: ModuleErrorSchema;
12
+ sources?: Hash[];
13
+ }>;
14
+ export declare const isModuleError: (x?: unknown) => x is import("./Schema").SchemaFields & import("./Payload").PayloadFields & {
15
+ details?: JsonValue | undefined;
16
+ message?: string | undefined;
17
+ name?: string | undefined;
18
+ query?: Lowercase<string> | undefined;
19
+ schema: ModuleErrorSchema;
20
+ sources?: Lowercase<string>[] | undefined;
21
+ };
22
+ //# sourceMappingURL=Error.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,22 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ import { JsonValue } from '@xylabs/object';
3
+ import { Payload } from './Payload';
4
+ export type ModuleErrorSchema = 'network.xyo.error.module';
5
+ export declare const ModuleErrorSchema: ModuleErrorSchema;
6
+ export type ModuleError = Payload<{
7
+ details?: JsonValue;
8
+ message?: string;
9
+ name?: string;
10
+ query?: Hash;
11
+ schema: ModuleErrorSchema;
12
+ sources?: Hash[];
13
+ }>;
14
+ export declare const isModuleError: (x?: unknown) => x is import("./Schema").SchemaFields & import("./Payload").PayloadFields & {
15
+ details?: JsonValue | undefined;
16
+ message?: string | undefined;
17
+ name?: string | undefined;
18
+ query?: Lowercase<string> | undefined;
19
+ schema: ModuleErrorSchema;
20
+ sources?: Lowercase<string>[] | undefined;
21
+ };
22
+ //# sourceMappingURL=Error.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,10 @@
1
+ import { EmptyObject, JsonObject } from '@xylabs/object';
2
+ import { Payload, PayloadMetaFields } from './Payload';
3
+ import { Schema, WithSchema } from './Schema';
4
+ export type WithMeta<T extends Payload = Payload, M extends JsonObject | void = void> = PayloadMetaFields<M> & T;
5
+ export type WithOptionalMeta<T extends Payload = Payload, M extends JsonObject | void = void> = Partial<WithMeta<T, M>> & Omit<WithMeta<T, M>, '$hash'>;
6
+ export type PayloadWithMeta<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithMeta<Payload<T, S>>;
7
+ export declare const unMeta: <T extends WithMeta<{
8
+ schema: string;
9
+ } & import("./Payload").PayloadFields, void>>(payload?: T) => T | undefined;
10
+ //# sourceMappingURL=Meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meta.d.ts","sourceRoot":"","sources":["../../src/Meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE7C,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,UAAU,GAAG,IAAI,GAAG,IAAI,IAAI,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAChH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,UAAU,GAAG,IAAI,GAAG,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACrH,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AAE/B,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAEvI,eAAO,MAAM,MAAM;;wDAA2C,CAAC,KAAG,CAAC,GAAG,SAMrE,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { EmptyObject, JsonObject } from '@xylabs/object';
2
+ import { Payload, PayloadMetaFields } from './Payload';
3
+ import { Schema, WithSchema } from './Schema';
4
+ export type WithMeta<T extends Payload = Payload, M extends JsonObject | void = void> = PayloadMetaFields<M> & T;
5
+ export type WithOptionalMeta<T extends Payload = Payload, M extends JsonObject | void = void> = Partial<WithMeta<T, M>> & Omit<WithMeta<T, M>, '$hash'>;
6
+ export type PayloadWithMeta<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithMeta<Payload<T, S>>;
7
+ export declare const unMeta: <T extends WithMeta<{
8
+ schema: string;
9
+ } & import("./Payload").PayloadFields, void>>(payload?: T) => T | undefined;
10
+ //# sourceMappingURL=Meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meta.d.ts","sourceRoot":"","sources":["../../src/Meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE7C,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,UAAU,GAAG,IAAI,GAAG,IAAI,IAAI,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAChH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,UAAU,GAAG,IAAI,GAAG,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACrH,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AAE/B,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAEvI,eAAO,MAAM,MAAM;;wDAA2C,CAAC,KAAG,CAAC,GAAG,SAMrE,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { EmptyObject, JsonObject } from '@xylabs/object';
2
+ import { Payload, PayloadMetaFields } from './Payload';
3
+ import { Schema, WithSchema } from './Schema';
4
+ export type WithMeta<T extends Payload = Payload, M extends JsonObject | void = void> = PayloadMetaFields<M> & T;
5
+ export type WithOptionalMeta<T extends Payload = Payload, M extends JsonObject | void = void> = Partial<WithMeta<T, M>> & Omit<WithMeta<T, M>, '$hash'>;
6
+ export type PayloadWithMeta<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithMeta<Payload<T, S>>;
7
+ export declare const unMeta: <T extends WithMeta<{
8
+ schema: string;
9
+ } & import("./Payload").PayloadFields, void>>(payload?: T) => T | undefined;
10
+ //# sourceMappingURL=Meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meta.d.ts","sourceRoot":"","sources":["../../src/Meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE7C,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,UAAU,GAAG,IAAI,GAAG,IAAI,IAAI,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAChH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,UAAU,GAAG,IAAI,GAAG,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACrH,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AAE/B,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAEvI,eAAO,MAAM,MAAM;;wDAA2C,CAAC,KAAG,CAAC,GAAG,SAMrE,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ import { EmptyObject, JsonObject } from '@xylabs/object';
3
+ import { Schema, WithSchema } from './Schema';
4
+ /** Meta fields for a payload - Either both $hash and $meta should exist or neither */
5
+ export interface PayloadMetaFields<TAdditionalMeta extends EmptyObject | void = void> extends EmptyObject {
6
+ /** Hash of the body of the payload excluding the items in the $meta object */
7
+ $hash: Hash;
8
+ /** Meta data that should be included in the main hash of the payload */
9
+ $meta?: TAdditionalMeta extends void ? JsonObject : TAdditionalMeta;
10
+ }
11
+ /** Additional fields for a payload */
12
+ export interface PayloadFields extends EmptyObject {
13
+ schema: Schema;
14
+ }
15
+ export type WithPayload<T extends EmptyObject | void = void> = WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>;
16
+ /** Base Type for Payloads */
17
+ export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
18
+ schema: S;
19
+ } & PayloadFields> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
20
+ schema: S;
21
+ } & PayloadFields> : WithPayload<T & {
22
+ schema: Schema;
23
+ } & PayloadFields> : /* Either just S or neither S or T provided */ {
24
+ schema: S extends Schema ? S : Schema;
25
+ } & PayloadFields;
26
+ export type OverridablePayload<T extends Payload> = Omit<T, 'schema'> & {
27
+ schema: string;
28
+ };
29
+ export type WithSources<T extends EmptyObject> = T & {
30
+ sources?: Hash[];
31
+ };
32
+ export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
33
+ //# sourceMappingURL=Payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE7C,sFAAsF;AACtF,MAAM,WAAW,iBAAiB,CAAC,eAAe,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,CAAE,SAAQ,WAAW;IACvG,8EAA8E;IAC9E,KAAK,EAAE,IAAI,CAAA;IACX,wEAAwE;IACxE,KAAK,CAAC,EAAE,eAAe,SAAS,IAAI,GAAG,UAAU,GAAG,eAAe,CAAA;CACpE;AAED,sCAAsC;AACtC,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IAAI,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAA;AAEpI,6BAA6B;AAC7B,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAClG,CAAC,SAAS,UAAU,GAClB,CAAC,SAAS,MAAM,GAEd,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG,aAAa,CAAC,GAC7B,WAAW,CAAC,CAAC,CAAC,GACjD,CAAC,SAAS,MAAM,GAChB,CAAC,SAAS,MAAM,GAEd,WAAW,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG,aAAa,CAAC,GACX,WAAW,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAAC,GAExF,AADA,8CAA8C,CAC9C;IACE,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,MAAM,CAAA;CACtC,GAAG,aAAa,CAAA;AAErB,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1F,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAA;CAAE,CAAA;AACzE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ import { EmptyObject, JsonObject } from '@xylabs/object';
3
+ import { Schema, WithSchema } from './Schema';
4
+ /** Meta fields for a payload - Either both $hash and $meta should exist or neither */
5
+ export interface PayloadMetaFields<TAdditionalMeta extends EmptyObject | void = void> extends EmptyObject {
6
+ /** Hash of the body of the payload excluding the items in the $meta object */
7
+ $hash: Hash;
8
+ /** Meta data that should be included in the main hash of the payload */
9
+ $meta?: TAdditionalMeta extends void ? JsonObject : TAdditionalMeta;
10
+ }
11
+ /** Additional fields for a payload */
12
+ export interface PayloadFields extends EmptyObject {
13
+ schema: Schema;
14
+ }
15
+ export type WithPayload<T extends EmptyObject | void = void> = WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>;
16
+ /** Base Type for Payloads */
17
+ export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
18
+ schema: S;
19
+ } & PayloadFields> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
20
+ schema: S;
21
+ } & PayloadFields> : WithPayload<T & {
22
+ schema: Schema;
23
+ } & PayloadFields> : /* Either just S or neither S or T provided */ {
24
+ schema: S extends Schema ? S : Schema;
25
+ } & PayloadFields;
26
+ export type OverridablePayload<T extends Payload> = Omit<T, 'schema'> & {
27
+ schema: string;
28
+ };
29
+ export type WithSources<T extends EmptyObject> = T & {
30
+ sources?: Hash[];
31
+ };
32
+ export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
33
+ //# sourceMappingURL=Payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE7C,sFAAsF;AACtF,MAAM,WAAW,iBAAiB,CAAC,eAAe,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,CAAE,SAAQ,WAAW;IACvG,8EAA8E;IAC9E,KAAK,EAAE,IAAI,CAAA;IACX,wEAAwE;IACxE,KAAK,CAAC,EAAE,eAAe,SAAS,IAAI,GAAG,UAAU,GAAG,eAAe,CAAA;CACpE;AAED,sCAAsC;AACtC,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IAAI,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAA;AAEpI,6BAA6B;AAC7B,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAClG,CAAC,SAAS,UAAU,GAClB,CAAC,SAAS,MAAM,GAEd,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG,aAAa,CAAC,GAC7B,WAAW,CAAC,CAAC,CAAC,GACjD,CAAC,SAAS,MAAM,GAChB,CAAC,SAAS,MAAM,GAEd,WAAW,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG,aAAa,CAAC,GACX,WAAW,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAAC,GAExF,AADA,8CAA8C,CAC9C;IACE,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,MAAM,CAAA;CACtC,GAAG,aAAa,CAAA;AAErB,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1F,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAA;CAAE,CAAA;AACzE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ import { EmptyObject, JsonObject } from '@xylabs/object';
3
+ import { Schema, WithSchema } from './Schema';
4
+ /** Meta fields for a payload - Either both $hash and $meta should exist or neither */
5
+ export interface PayloadMetaFields<TAdditionalMeta extends EmptyObject | void = void> extends EmptyObject {
6
+ /** Hash of the body of the payload excluding the items in the $meta object */
7
+ $hash: Hash;
8
+ /** Meta data that should be included in the main hash of the payload */
9
+ $meta?: TAdditionalMeta extends void ? JsonObject : TAdditionalMeta;
10
+ }
11
+ /** Additional fields for a payload */
12
+ export interface PayloadFields extends EmptyObject {
13
+ schema: Schema;
14
+ }
15
+ export type WithPayload<T extends EmptyObject | void = void> = WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>;
16
+ /** Base Type for Payloads */
17
+ export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
18
+ schema: S;
19
+ } & PayloadFields> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
20
+ schema: S;
21
+ } & PayloadFields> : WithPayload<T & {
22
+ schema: Schema;
23
+ } & PayloadFields> : /* Either just S or neither S or T provided */ {
24
+ schema: S extends Schema ? S : Schema;
25
+ } & PayloadFields;
26
+ export type OverridablePayload<T extends Payload> = Omit<T, 'schema'> & {
27
+ schema: string;
28
+ };
29
+ export type WithSources<T extends EmptyObject> = T & {
30
+ sources?: Hash[];
31
+ };
32
+ export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
33
+ //# sourceMappingURL=Payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE7C,sFAAsF;AACtF,MAAM,WAAW,iBAAiB,CAAC,eAAe,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,CAAE,SAAQ,WAAW;IACvG,8EAA8E;IAC9E,KAAK,EAAE,IAAI,CAAA;IACX,wEAAwE;IACxE,KAAK,CAAC,EAAE,eAAe,SAAS,IAAI,GAAG,UAAU,GAAG,eAAe,CAAA;CACpE;AAED,sCAAsC;AACtC,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IAAI,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,aAAa,GAAG,CAAC,GAAG,aAAa,CAAC,CAAA;AAEpI,6BAA6B;AAC7B,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAClG,CAAC,SAAS,UAAU,GAClB,CAAC,SAAS,MAAM,GAEd,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG,aAAa,CAAC,GAC7B,WAAW,CAAC,CAAC,CAAC,GACjD,CAAC,SAAS,MAAM,GAChB,CAAC,SAAS,MAAM,GAEd,WAAW,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG,aAAa,CAAC,GACX,WAAW,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAAC,GAExF,AADA,8CAA8C,CAC9C;IACE,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,MAAM,CAAA;CACtC,GAAG,aAAa,CAAA;AAErB,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1F,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAA;CAAE,CAAA;AACzE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ export interface PayloadFindFilter {
3
+ limit?: number;
4
+ offset?: Hash;
5
+ order?: 'desc' | 'asc';
6
+ schema?: string | string[];
7
+ }
8
+ //# sourceMappingURL=PayloadFindFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadFindFilter.d.ts","sourceRoot":"","sources":["../../src/PayloadFindFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,IAAI,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC3B"}
@@ -0,0 +1,8 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ export interface PayloadFindFilter {
3
+ limit?: number;
4
+ offset?: Hash;
5
+ order?: 'desc' | 'asc';
6
+ schema?: string | string[];
7
+ }
8
+ //# sourceMappingURL=PayloadFindFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadFindFilter.d.ts","sourceRoot":"","sources":["../../src/PayloadFindFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,IAAI,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC3B"}
@@ -0,0 +1,8 @@
1
+ import { Hash } from '@xylabs/hex';
2
+ export interface PayloadFindFilter {
3
+ limit?: number;
4
+ offset?: Hash;
5
+ order?: 'desc' | 'asc';
6
+ schema?: string | string[];
7
+ }
8
+ //# sourceMappingURL=PayloadFindFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadFindFilter.d.ts","sourceRoot":"","sources":["../../src/PayloadFindFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,IAAI,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC3B"}
@@ -0,0 +1,8 @@
1
+ import { Payload } from '../Payload';
2
+ import { PayloadSetSchema } from './PayloadSetSchema';
3
+ export interface PayloadSet {
4
+ optional?: Record<string, number>;
5
+ required?: Record<string, number>;
6
+ }
7
+ export type PayloadSetPayload = Payload<PayloadSet, PayloadSetSchema>;
8
+ //# sourceMappingURL=PayloadSetPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadSetPayload.d.ts","sourceRoot":"","sources":["../../../src/PayloadSet/PayloadSetPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAA"}