@xyo-network/id-payload-plugin 6.1.1 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,86 @@
1
- import type { Payload, WithSources } from '@xyo-network/payload-model';
2
- import { IdSchema } from './Schema.ts';
1
+ import type { WithSources } from '@xyo-network/payload-model';
2
+ import * as z from 'zod/mini';
3
3
  /**
4
4
  * The fields of an ID Payload
5
5
  */
6
6
  export interface IdFields {
7
7
  salt: string;
8
8
  }
9
+ export declare const IdPayloadZod: z.ZodMiniObject<{
10
+ schema: z.ZodMiniLiteral<"network.xyo.id" & {
11
+ readonly __schema: true;
12
+ }>;
13
+ salt: z.ZodMiniString<string>;
14
+ }, z.core.$strip>;
9
15
  /**
10
16
  * The ID Payload
11
17
  */
12
- export type Id = Payload<IdFields, IdSchema>;
18
+ export type Id = z.infer<typeof IdPayloadZod>;
13
19
  /**
14
20
  * @deprecated Use `Id` instead
15
21
  */
16
22
  export type IdPayload = Id;
17
23
  /**
18
- * Identity helper for ID Payload
24
+ * Identity helpers for ID Payload
19
25
  */
20
- export declare const isId: (x?: unknown) => x is Id;
21
- export declare const asId: import("@xylabs/sdk-js").AsTypeFunction<Id>;
22
- export declare const asOptionalId: (value: import("@xylabs/sdk-js").AnyNonPromise) => Id | undefined;
26
+ export declare const isId: <T>(value: T) => value is T & {
27
+ schema: "network.xyo.id" & {
28
+ readonly __schema: true;
29
+ };
30
+ salt: string;
31
+ };
32
+ export declare const asId: {
33
+ <T>(value: T): (T & {
34
+ schema: "network.xyo.id" & {
35
+ readonly __schema: true;
36
+ };
37
+ salt: string;
38
+ }) | undefined;
39
+ <T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
40
+ schema: "network.xyo.id" & {
41
+ readonly __schema: true;
42
+ };
43
+ salt: string;
44
+ };
45
+ };
46
+ export declare const toId: {
47
+ <T>(value: T): (T & {
48
+ schema: "network.xyo.id" & {
49
+ readonly __schema: true;
50
+ };
51
+ salt: string;
52
+ }) | undefined;
53
+ <T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
54
+ schema: "network.xyo.id" & {
55
+ readonly __schema: true;
56
+ };
57
+ salt: string;
58
+ };
59
+ };
60
+ /**
61
+ * @deprecated Use `asId` instead (returns undefined on failure when called without an assert config)
62
+ */
63
+ export declare const asOptionalId: {
64
+ <T>(value: T): (T & {
65
+ schema: "network.xyo.id" & {
66
+ readonly __schema: true;
67
+ };
68
+ salt: string;
69
+ }) | undefined;
70
+ <T>(value: T, assert: import("@xylabs/sdk-js").ZodFactoryConfig): T & {
71
+ schema: "network.xyo.id" & {
72
+ readonly __schema: true;
73
+ };
74
+ salt: string;
75
+ };
76
+ };
23
77
  /**
24
78
  * Identity helper for ID Payload with sources
25
79
  */
26
- export declare const isIdWithSources: (x?: unknown) => x is WithSources<WithSources<Id>>;
80
+ export declare const isIdWithSources: (x?: unknown) => x is WithSources<WithSources<{
81
+ schema: "network.xyo.id" & {
82
+ readonly __schema: true;
83
+ };
84
+ salt: string;
85
+ }>>;
27
86
  //# sourceMappingURL=Payload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACZ,MAAM,4BAA4B,CAAA;AAMnC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAE5C;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,EAAE,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,IAAI,0BAAsC,CAAA;AACvD,eAAO,MAAM,IAAI,6CAA+B,CAAA;AAChD,eAAO,MAAM,YAAY,mEAAuC,CAAA;AAEhE;;GAEG;AACH,eAAO,MAAM,eAAe,oDAA8D,CAAA"}
1
+ {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE7D,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAI7B;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,YAAY;;;;;iBAA+D,CAAA;AAExF;;GAEG;AACH,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAE7C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,EAAE,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;CAA6B,CAAA;AAC9C,eAAO,MAAM,IAAI;;;;;;;;;;;;;CAAqC,CAAA;AACtD,eAAO,MAAM,IAAI;;;;;;;;;;;;;CAAqC,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAAO,CAAA;AAEhC;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;GAA8D,CAAA"}
@@ -1,3 +1,7 @@
1
- import type { Id } from './Payload.ts';
2
- export declare const IdPayloadPlugin: () => import("@xyo-network/payload-plugin").PayloadPlugin<Id>;
1
+ export declare const IdPayloadPlugin: () => import("@xyo-network/payload-plugin").PayloadPlugin<{
2
+ schema: "network.xyo.id" & {
3
+ readonly __schema: true;
4
+ };
5
+ salt: string;
6
+ }>;
3
7
  //# sourceMappingURL=Plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAItC,eAAO,MAAM,eAAe,+DAIxB,CAAA"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;;;EAIxB,CAAA"}
@@ -1,18 +1,22 @@
1
1
  // src/Payload.ts
2
- import { AsObjectFactory } from "@xylabs/sdk-js";
3
2
  import {
4
- isPayloadOfSchemaType,
5
- isPayloadOfSchemaTypeWithSources
6
- } from "@xyo-network/payload-model";
3
+ zodAsFactory,
4
+ zodIsFactory,
5
+ zodToFactory
6
+ } from "@xylabs/sdk-js";
7
+ import { isPayloadOfSchemaTypeWithSources, PayloadZodOfSchema } from "@xyo-network/payload-model";
8
+ import * as z from "zod/mini";
7
9
 
8
10
  // src/Schema.ts
9
11
  import { asSchema } from "@xyo-network/payload-model";
10
12
  var IdSchema = asSchema("network.xyo.id", true);
11
13
 
12
14
  // src/Payload.ts
13
- var isId = isPayloadOfSchemaType(IdSchema);
14
- var asId = AsObjectFactory.create(isId);
15
- var asOptionalId = AsObjectFactory.createOptional(isId);
15
+ var IdPayloadZod = z.extend(PayloadZodOfSchema(IdSchema), { salt: z.string() });
16
+ var isId = zodIsFactory(IdPayloadZod);
17
+ var asId = zodAsFactory(IdPayloadZod, "asId");
18
+ var toId = zodToFactory(IdPayloadZod, "toId");
19
+ var asOptionalId = asId;
16
20
  var isIdWithSources = isPayloadOfSchemaTypeWithSources(IdSchema);
17
21
 
18
22
  // src/Plugin.ts
@@ -31,12 +35,14 @@ var IdPayloadPlugin = () => createPayloadPlugin({
31
35
  });
32
36
  export {
33
37
  IdPayloadPlugin,
38
+ IdPayloadZod,
34
39
  IdSchema,
35
40
  asId,
36
41
  asOptionalId,
37
42
  IdPayloadPlugin as default,
38
43
  idPayloadTemplate,
39
44
  isId,
40
- isIdWithSources
45
+ isIdWithSources,
46
+ toId
41
47
  };
42
48
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Payload.ts", "../../src/Schema.ts", "../../src/Plugin.ts", "../../src/Template.ts"],
4
- "sourcesContent": ["import { AsObjectFactory } from '@xylabs/sdk-js'\nimport type {\n Payload,\n WithSources,\n} from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { IdSchema } from './Schema.ts'\n\n/**\n * The fields of an ID Payload\n */\nexport interface IdFields {\n salt: string\n}\n\n/**\n * The ID Payload\n */\nexport type Id = Payload<IdFields, IdSchema>\n\n/**\n * @deprecated Use `Id` instead\n */\n\nexport type IdPayload = Id\n\n/**\n * Identity helper for ID Payload\n */\nexport const isId = isPayloadOfSchemaType<Id>(IdSchema)\nexport const asId = AsObjectFactory.create(isId)\nexport const asOptionalId = AsObjectFactory.createOptional(isId)\n\n/**\n * Identity helper for ID Payload with sources\n */\nexport const isIdWithSources = isPayloadOfSchemaTypeWithSources<WithSources<Id>>(IdSchema)\n", "import { asSchema } from '@xyo-network/payload-model'\n\nexport const IdSchema = asSchema('network.xyo.id', true)\nexport type IdSchema = typeof IdSchema\n", "import { createPayloadPlugin } from '@xyo-network/payload-plugin'\n\nimport type { Id } from './Payload.ts'\nimport { IdSchema } from './Schema.ts'\nimport { idPayloadTemplate } from './Template.ts'\n\nexport const IdPayloadPlugin = () =>\n createPayloadPlugin<Id>({\n schema: IdSchema,\n template: idPayloadTemplate,\n })\n", "import type { Id } from './Payload.ts'\nimport { IdSchema } from './Schema.ts'\n\nexport const idPayloadTemplate = (): Id => ({\n salt: '',\n schema: IdSchema,\n})\n"],
5
- "mappings": ";AAAA,SAAS,uBAAuB;AAKhC;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACRP,SAAS,gBAAgB;AAElB,IAAM,WAAW,SAAS,kBAAkB,IAAI;;;AD+BhD,IAAM,OAAO,sBAA0B,QAAQ;AAC/C,IAAM,OAAO,gBAAgB,OAAO,IAAI;AACxC,IAAM,eAAe,gBAAgB,eAAe,IAAI;AAKxD,IAAM,kBAAkB,iCAAkD,QAAQ;;;AExCzF,SAAS,2BAA2B;;;ACG7B,IAAM,oBAAoB,OAAW;AAAA,EAC1C,MAAM;AAAA,EACN,QAAQ;AACV;;;ADAO,IAAM,kBAAkB,MAC7B,oBAAwB;AAAA,EACtB,QAAQ;AAAA,EACR,UAAU;AACZ,CAAC;",
4
+ "sourcesContent": ["import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@xylabs/sdk-js'\nimport type { WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaTypeWithSources, PayloadZodOfSchema } from '@xyo-network/payload-model'\nimport * as z from 'zod/mini'\n\nimport { IdSchema } from './Schema.ts'\n\n/**\n * The fields of an ID Payload\n */\nexport interface IdFields {\n salt: string\n}\n\nexport const IdPayloadZod = z.extend(PayloadZodOfSchema(IdSchema), { salt: z.string() })\n\n/**\n * The ID Payload\n */\nexport type Id = z.infer<typeof IdPayloadZod>\n\n/**\n * @deprecated Use `Id` instead\n */\nexport type IdPayload = Id\n\n/**\n * Identity helpers for ID Payload\n */\nexport const isId = zodIsFactory(IdPayloadZod)\nexport const asId = zodAsFactory(IdPayloadZod, 'asId')\nexport const toId = zodToFactory(IdPayloadZod, 'toId')\n\n/**\n * @deprecated Use `asId` instead (returns undefined on failure when called without an assert config)\n */\nexport const asOptionalId = asId\n\n/**\n * Identity helper for ID Payload with sources\n */\nexport const isIdWithSources = isPayloadOfSchemaTypeWithSources<WithSources<Id>>(IdSchema)\n", "import { asSchema } from '@xyo-network/payload-model'\n\nexport const IdSchema = asSchema('network.xyo.id', true)\nexport type IdSchema = typeof IdSchema\n", "import { createPayloadPlugin } from '@xyo-network/payload-plugin'\n\nimport type { Id } from './Payload.ts'\nimport { IdSchema } from './Schema.ts'\nimport { idPayloadTemplate } from './Template.ts'\n\nexport const IdPayloadPlugin = () =>\n createPayloadPlugin<Id>({\n schema: IdSchema,\n template: idPayloadTemplate,\n })\n", "import type { Id } from './Payload.ts'\nimport { IdSchema } from './Schema.ts'\n\nexport const idPayloadTemplate = (): Id => ({\n salt: '',\n schema: IdSchema,\n})\n"],
5
+ "mappings": ";AAAA;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AAEP,SAAS,kCAAkC,0BAA0B;AACrE,YAAY,OAAO;;;ACLnB,SAAS,gBAAgB;AAElB,IAAM,WAAW,SAAS,kBAAkB,IAAI;;;ADchD,IAAM,eAAiB,SAAO,mBAAmB,QAAQ,GAAG,EAAE,MAAQ,SAAO,EAAE,CAAC;AAehF,IAAM,OAAO,aAAa,YAAY;AACtC,IAAM,OAAO,aAAa,cAAc,MAAM;AAC9C,IAAM,OAAO,aAAa,cAAc,MAAM;AAK9C,IAAM,eAAe;AAKrB,IAAM,kBAAkB,iCAAkD,QAAQ;;;AE3CzF,SAAS,2BAA2B;;;ACG7B,IAAM,oBAAoB,OAAW;AAAA,EAC1C,MAAM;AAAA,EACN,QAAQ;AACV;;;ADAO,IAAM,kBAAkB,MAC7B,oBAAwB;AAAA,EACtB,QAAQ;AAAA,EACR,UAAU;AACZ,CAAC;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/id-payload-plugin",
3
- "version": "6.1.1",
3
+ "version": "7.0.2",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -34,26 +34,26 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "@xyo-network/payload-model": "~6.1.1",
38
- "@xyo-network/payload-plugin": "~6.1.1"
37
+ "@xyo-network/payload-model": "~7.0.2",
38
+ "@xyo-network/payload-plugin": "~7.0.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@opentelemetry/api": "^1.9.1",
42
42
  "@opentelemetry/sdk-trace-base": "^2.8.0",
43
43
  "@scure/base": "~2.2.0",
44
- "@xylabs/sdk-js": "^6.1.1",
45
- "@xylabs/threads": "^6.1.1",
46
- "@xylabs/toolchain": "~8.1.20",
47
- "@xylabs/tsconfig": "~8.1.20",
48
- "@xylabs/vitest-extended": "^6.1.1",
44
+ "@xylabs/sdk-js": "^6.1.4",
45
+ "@xylabs/threads": "^6.1.4",
46
+ "@xylabs/toolchain": "~8.3.0",
47
+ "@xylabs/tsconfig": "~8.3.0",
48
+ "@xylabs/vitest-extended": "^6.1.4",
49
49
  "async-mutex": "^0.5.0",
50
50
  "debug": "^4.4.3",
51
- "eslint": "^10.4.1",
51
+ "eslint": "^10.5.0",
52
52
  "hash-wasm": "~4.12.0",
53
53
  "observable-fns": "^0.6.1",
54
54
  "typescript": "~6.0.3",
55
- "vite": "^8.0.16",
56
- "vitest": "~4.1.8",
55
+ "vite": "^8.1.0",
56
+ "vitest": "~4.1.9",
57
57
  "zod": "^4.4.3"
58
58
  },
59
59
  "peerDependencies": {