@xyo-network/id-payload-plugin 3.6.0-rc.9 → 3.6.1

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.
@@ -21,6 +21,23 @@ export declare const isId: (x?: unknown | null) => x is import("@xylabs/object")
21
21
  schema: "network.xyo.id";
22
22
  salt: string;
23
23
  }>;
24
+ export declare const asId: {
25
+ <TType extends import("@xylabs/object").DeepRestrictToStringKeys<{
26
+ schema: "network.xyo.id";
27
+ salt: string;
28
+ }>>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
29
+ <TType extends import("@xylabs/object").DeepRestrictToStringKeys<{
30
+ schema: "network.xyo.id";
31
+ salt: string;
32
+ }>>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<import("@xylabs/object").DeepRestrictToStringKeys<{
33
+ schema: "network.xyo.id";
34
+ salt: string;
35
+ }>>, config?: import("@xylabs/object").TypeCheckConfig): TType;
36
+ };
37
+ export declare const asOptionalId: <TType extends import("@xylabs/object").DeepRestrictToStringKeys<{
38
+ schema: "network.xyo.id";
39
+ salt: string;
40
+ }>>(value: import("@xylabs/promise").AnyNonPromise) => TType | undefined;
24
41
  /**
25
42
  * Identity helper for ID Payload with sources
26
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACZ,MAAM,4BAA4B,CAAA;AAMnC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAE5C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,EAAE,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,IAAI;;UAhBT,MAAM;EAgByC,CAAA;AAEvD;;GAEG;AACH,eAAO,MAAM,eAAe;;UArBpB,MAAM;IAqB4E,CAAA"}
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,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAE5C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,EAAE,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,IAAI;;UAhBT,MAAM;EAgByC,CAAA;AACvD,eAAO,MAAM,IAAI;;;cAjBT,MAAM;sBANI,iBAAiB,iCAGX,gBAEf;;;cACD,MAAM;sBAMK,iBAAiB;;cAN5B,MAAM;yBAcA,gBACd;CAEgD,CAAA;AAChD,eAAO,MAAM,YAAY;;UAlBjB,MAAM;kBAkBe,iBAAiB,qCAAkB,CAAA;AAEhE;;GAEG;AACH,eAAO,MAAM,eAAe;;UAvBpB,MAAM;IAuB4E,CAAA"}
@@ -1,4 +1,5 @@
1
1
  // src/Payload.ts
2
+ import { AsObjectFactory } from "@xylabs/object";
2
3
  import {
3
4
  isPayloadOfSchemaType,
4
5
  isPayloadOfSchemaTypeWithSources
@@ -9,6 +10,8 @@ var IdSchema = "network.xyo.id";
9
10
 
10
11
  // src/Payload.ts
11
12
  var isId = isPayloadOfSchemaType(IdSchema);
13
+ var asId = AsObjectFactory.create(isId);
14
+ var asOptionalId = AsObjectFactory.createOptional(isId);
12
15
  var isIdWithSources = isPayloadOfSchemaTypeWithSources(IdSchema);
13
16
 
14
17
  // src/Plugin.ts
@@ -28,6 +31,8 @@ var IdPayloadPlugin = () => createPayloadPlugin({
28
31
  export {
29
32
  IdPayloadPlugin,
30
33
  IdSchema,
34
+ asId,
35
+ asOptionalId,
31
36
  IdPayloadPlugin as default,
32
37
  idPayloadTemplate,
33
38
  isId,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Payload.ts","../../src/Schema.ts","../../src/Plugin.ts","../../src/Template.ts"],"sourcesContent":["import 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 type 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 */\nexport type IdPayload = Id\n\n/**\n * Identity helper for ID Payload\n */\nexport const isId = isPayloadOfSchemaType<Id>(IdSchema)\n\n/**\n * Identity helper for ID Payload with sources\n */\nexport const isIdWithSources = isPayloadOfSchemaTypeWithSources<WithSources<Id>>(IdSchema)\n","export type IdSchema = 'network.xyo.id'\nexport const IdSchema: IdSchema = 'network.xyo.id'\n","import { createPayloadPlugin } from '@xyo-network/payload-plugin'\n\nimport type { IdPayload } from './Payload.ts'\nimport { IdSchema } from './Schema.ts'\nimport { idPayloadTemplate } from './Template.ts'\n\nexport const IdPayloadPlugin = () =>\n createPayloadPlugin<IdPayload>({\n schema: IdSchema,\n template: idPayloadTemplate,\n })\n","import type { IdPayload } from './Payload.ts'\nimport { IdSchema } from './Schema.ts'\n\nexport const idPayloadTemplate = (): IdPayload => ({\n salt: '',\n schema: IdSchema,\n})\n"],"mappings":";AAIA;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACNA,IAAM,WAAqB;;;AD8B3B,IAAM,OAAO,sBAA0B,QAAQ;AAK/C,IAAM,kBAAkB,iCAAkD,QAAQ;;;AEpCzF,SAAS,2BAA2B;;;ACG7B,IAAM,oBAAoB,OAAkB;AAAA,EACjD,MAAM;AAAA,EACN,QAAQ;AACV;;;ADAO,IAAM,kBAAkB,MAC7B,oBAA+B;AAAA,EAC7B,QAAQ;AAAA,EACR,UAAU;AACZ,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/Payload.ts","../../src/Schema.ts","../../src/Plugin.ts","../../src/Template.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\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 type 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 */\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","export type IdSchema = 'network.xyo.id'\nexport const IdSchema: IdSchema = 'network.xyo.id'\n","import { createPayloadPlugin } from '@xyo-network/payload-plugin'\n\nimport type { IdPayload } from './Payload.ts'\nimport { IdSchema } from './Schema.ts'\nimport { idPayloadTemplate } from './Template.ts'\n\nexport const IdPayloadPlugin = () =>\n createPayloadPlugin<IdPayload>({\n schema: IdSchema,\n template: idPayloadTemplate,\n })\n","import type { IdPayload } from './Payload.ts'\nimport { IdSchema } from './Schema.ts'\n\nexport const idPayloadTemplate = (): IdPayload => ({\n salt: '',\n schema: IdSchema,\n})\n"],"mappings":";AAAA,SAAS,uBAAuB;AAKhC;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACPA,IAAM,WAAqB;;;AD+B3B,IAAM,OAAO,sBAA0B,QAAQ;AAC/C,IAAM,OAAO,gBAAgB,OAAO,IAAI;AACxC,IAAM,eAAe,gBAAgB,eAAe,IAAI;AAKxD,IAAM,kBAAkB,iCAAkD,QAAQ;;;AEvCzF,SAAS,2BAA2B;;;ACG7B,IAAM,oBAAoB,OAAkB;AAAA,EACjD,MAAM;AAAA,EACN,QAAQ;AACV;;;ADAO,IAAM,kBAAkB,MAC7B,oBAA+B;AAAA,EAC7B,QAAQ;AAAA,EACR,UAAU;AACZ,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/id-payload-plugin",
3
- "version": "3.6.0-rc.9",
3
+ "version": "3.6.1",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -29,18 +29,18 @@
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "dependencies": {
32
- "@xyo-network/payload-model": "^3.6.0-rc.9",
33
- "@xyo-network/payload-plugin": "^3.6.0-rc.9"
32
+ "@xylabs/object": "^4.4.26",
33
+ "@xyo-network/payload-model": "^3.6.1",
34
+ "@xyo-network/payload-plugin": "^3.6.1"
34
35
  },
35
36
  "devDependencies": {
36
- "@xylabs/ts-scripts-yarn3": "^4.2.4",
37
- "@xylabs/tsconfig": "^4.2.4",
38
- "@xylabs/vitest-extended": "^4.4.18",
37
+ "@xylabs/ts-scripts-yarn3": "^4.2.6",
38
+ "@xylabs/tsconfig": "^4.2.6",
39
+ "@xylabs/vitest-extended": "^4.4.26",
39
40
  "typescript": "^5.7.2",
40
41
  "vitest": "^2.1.8"
41
42
  },
42
43
  "publishConfig": {
43
44
  "access": "public"
44
- },
45
- "stableVersion": "3.5.2"
45
+ }
46
46
  }
package/src/Payload.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AsObjectFactory } from '@xylabs/object'
1
2
  import type {
2
3
  Payload,
3
4
  WithSources,
@@ -30,6 +31,8 @@ export type IdPayload = Id
30
31
  * Identity helper for ID Payload
31
32
  */
32
33
  export const isId = isPayloadOfSchemaType<Id>(IdSchema)
34
+ export const asId = AsObjectFactory.create(isId)
35
+ export const asOptionalId = AsObjectFactory.createOptional(isId)
33
36
 
34
37
  /**
35
38
  * Identity helper for ID Payload with sources