@xyo-network/api 5.3.5 → 5.3.7

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.
@@ -0,0 +1,9 @@
1
+ import '@xylabs/vitest-extended';
2
+ import type { ApiConfig } from '@xyo-network/api-models';
3
+ import { ArchivistApi } from '../Api.ts';
4
+ export declare const getApiConfig: (configData?: Partial<ApiConfig>) => ApiConfig;
5
+ export declare const getApi: (configData?: Partial<ApiConfig>) => ArchivistApi;
6
+ export declare const testSchemaPrefix = "network.xyo.schema.test.";
7
+ export declare const getSchemaName: () => string;
8
+ export declare const getTimestampMinutesFromNow: (minutes?: number) => number;
9
+ //# sourceMappingURL=ApiUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiUtil.d.ts","sourceRoot":"","sources":["../../../../src/Api/spec/ApiUtil.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAIxD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAMxC,eAAO,MAAM,YAAY,GAAI,aAAY,OAAO,CAAC,SAAS,CAAM,KAAG,SASlE,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,aAAY,OAAO,CAAC,SAAS,CAAM,KAAG,YAE5D,CAAA;AAED,eAAO,MAAM,gBAAgB,6BAA6B,CAAA;AAC1D,eAAO,MAAM,aAAa,QAAO,MAEhC,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,gBAAW,WAIrD,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { StringKeyObject } from '@xylabs/sdk-js';
2
+ import { type Payload } from '@xyo-network/payload-model';
3
+ declare const testSchema: "network.xyo.test" & {
4
+ readonly __schema: true;
5
+ };
6
+ declare const testPayload: Payload<StringKeyObject>;
7
+ export { testPayload, testSchema };
8
+ //# sourceMappingURL=testPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testPayload.d.ts","sourceRoot":"","sources":["../../../src/spec/testPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGnE,QAAA,MAAM,UAAU;;CAAqC,CAAA;AACrD,QAAA,MAAM,WAAW,EAAE,OAAO,CAAC,eAAe,CAUzC,CAAA;AAMD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/api",
3
- "version": "5.3.5",
3
+ "version": "5.3.7",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -36,29 +36,31 @@
36
36
  "!**/*.test.*"
37
37
  ],
38
38
  "dependencies": {
39
- "@xyo-network/api-models": "~5.3.5",
40
- "@xyo-network/diviner-model": "~5.3.5",
41
- "@xyo-network/huri": "~5.3.5",
42
- "@xyo-network/payload-model": "~5.3.5"
39
+ "@xyo-network/api-models": "~5.3.7",
40
+ "@xyo-network/diviner-model": "~5.3.7",
41
+ "@xyo-network/huri": "~5.3.7",
42
+ "@xyo-network/payload-model": "~5.3.7"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^25.2.3",
46
46
  "@types/uuid": "~11.0.0",
47
- "@xylabs/sdk-js": "^5.0.79",
47
+ "@xylabs/sdk-js": "^5.0.80",
48
48
  "@xylabs/ts-scripts-yarn3": "~7.3.2",
49
49
  "@xylabs/tsconfig": "~7.3.2",
50
- "@xylabs/vitest-extended": "~5.0.79",
51
- "@xyo-network/boundwitness-model": "~5.3.5",
52
- "@xyo-network/module-model": "~5.3.5",
53
- "@xyo-network/query-payload-plugin": "~5.3.5",
50
+ "@xylabs/vitest-extended": "~5.0.80",
51
+ "@xyo-network/boundwitness-model": "~5.3.7",
52
+ "@xyo-network/module-model": "~5.3.7",
53
+ "@xyo-network/query-payload-plugin": "~5.3.7",
54
54
  "axios": "^1.13.5",
55
55
  "typescript": "~5.9.3",
56
56
  "uuid": "~13.0.0",
57
- "vitest": "~4.0.18"
57
+ "vitest": "~4.0.18",
58
+ "zod": "^4.3.6"
58
59
  },
59
60
  "peerDependencies": {
60
61
  "@xylabs/sdk-js": "^5",
61
- "axios": "^1"
62
+ "axios": "^1",
63
+ "zod": "^4"
62
64
  },
63
65
  "publishConfig": {
64
66
  "access": "public"
@@ -0,0 +1,37 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import type { ApiConfig } from '@xyo-network/api-models'
4
+ import { v4 as uuid } from 'uuid'
5
+ import { expect, test } from 'vitest'
6
+
7
+ import { ArchivistApi } from '../Api.ts'
8
+
9
+ test('Must have tests defined', () => {
10
+ expect(true).toBeTruthy()
11
+ })
12
+
13
+ export const getApiConfig = (configData: Partial<ApiConfig> = {}): ApiConfig => {
14
+ const apiDomain = process.env.API_DOMAIN ?? 'http://localhost:8080'
15
+ const defaults: ApiConfig = {
16
+ apiDomain,
17
+ onError: error => error,
18
+ onFailure: response => response,
19
+ onSuccess: response => response,
20
+ }
21
+ return Object.assign({}, defaults, configData)
22
+ }
23
+
24
+ export const getApi = (configData: Partial<ApiConfig> = {}): ArchivistApi => {
25
+ return new ArchivistApi(getApiConfig(configData))
26
+ }
27
+
28
+ export const testSchemaPrefix = 'network.xyo.schema.test.'
29
+ export const getSchemaName = (): string => {
30
+ return `${testSchemaPrefix}${uuid()}`
31
+ }
32
+
33
+ export const getTimestampMinutesFromNow = (minutes = 0) => {
34
+ const t = new Date()
35
+ t.setMinutes(t.getMinutes() + minutes)
36
+ return +t
37
+ }
@@ -0,0 +1,22 @@
1
+ import type { StringKeyObject } from '@xylabs/sdk-js'
2
+ import { asSchema, type Payload } from '@xyo-network/payload-model'
3
+ import { expect, it } from 'vitest'
4
+
5
+ const testSchema = asSchema('network.xyo.test', true)
6
+ const testPayload: Payload<StringKeyObject> = {
7
+ _hash: '20e14207f952a09f767ff614a648546c037fe524ace0bfe55db31f818aff1f1c',
8
+ _timestamp: 1_609_459_255_555,
9
+ numberField: 1,
10
+ objectField: {
11
+ numberField: 1,
12
+ stringField: 'stringValue',
13
+ },
14
+ schema: testSchema,
15
+ stringField: 'stringValue',
16
+ }
17
+
18
+ it('no test', () => {
19
+ expect(true).toBeTruthy()
20
+ })
21
+
22
+ export { testPayload, testSchema }