@xyo-network/id-payload-plugin 6.1.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,27 +1,86 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
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 =
|
|
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
|
|
24
|
+
* Identity helpers for ID Payload
|
|
19
25
|
*/
|
|
20
|
-
export declare const isId: (
|
|
21
|
-
|
|
22
|
-
|
|
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<
|
|
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":"
|
|
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"}
|
package/dist/neutral/Plugin.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;;;EAIxB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
// src/Payload.ts
|
|
2
|
-
import { AsObjectFactory } from "@xylabs/sdk-js";
|
|
3
2
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
14
|
-
var
|
|
15
|
-
var
|
|
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 {
|
|
5
|
-
"mappings": ";AAAA
|
|
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": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xyo-network/payload-model": "~
|
|
38
|
-
"@xyo-network/payload-plugin": "~
|
|
37
|
+
"@xyo-network/payload-model": "~7.0.0",
|
|
38
|
+
"@xyo-network/payload-plugin": "~7.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@opentelemetry/api": "^1.9.1",
|