@xyo-network/witness-environment 4.2.1 → 5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/witness-environment",
3
- "version": "4.2.1",
3
+ "version": "5.0.0",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -28,20 +28,24 @@
28
28
  },
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "src"
34
+ ],
31
35
  "dependencies": {
32
- "@xylabs/object": "^4.14.1",
33
- "@xyo-network/abstract-witness": "^4.2.1",
34
- "@xyo-network/module-model": "^4.2.1",
35
- "@xyo-network/payload-model": "^4.2.1",
36
- "@xyo-network/value-payload-plugin": "^4.2.1",
37
- "@xyo-network/witness-model": "^4.2.1"
36
+ "@xylabs/object": "^5.0.0",
37
+ "@xyo-network/abstract-witness": "^5.0.0",
38
+ "@xyo-network/module-model": "^5.0.0",
39
+ "@xyo-network/payload-model": "^5.0.0",
40
+ "@xyo-network/value-payload-plugin": "^5.0.0",
41
+ "@xyo-network/witness-model": "^5.0.0"
38
42
  },
39
43
  "devDependencies": {
40
- "@xylabs/ts-scripts-yarn3": "^7.0.1",
41
- "@xylabs/tsconfig": "^7.0.1",
42
- "@xylabs/vitest-extended": "^4.14.1",
43
- "@xyo-network/account": "^4.2.1",
44
- "@xyo-network/payload-builder": "^4.2.1",
44
+ "@xylabs/ts-scripts-yarn3": "^7.0.2",
45
+ "@xylabs/tsconfig": "^7.0.2",
46
+ "@xylabs/vitest-extended": "^5.0.0",
47
+ "@xyo-network/account": "^5.0.0",
48
+ "@xyo-network/payload-builder": "^5.0.0",
45
49
  "typescript": "^5.8.3",
46
50
  "vitest": "^3.2.4"
47
51
  },
@@ -0,0 +1,56 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { Account } from '@xyo-network/account'
4
+ import { PayloadBuilder } from '@xyo-network/payload-builder'
5
+ import { isValuePayload } from '@xyo-network/value-payload-plugin'
6
+ import {
7
+ beforeAll,
8
+ describe, expect, it,
9
+ } from 'vitest'
10
+
11
+ import { EnvironmentWitnessConfigSchema } from '../Config.ts'
12
+ import type { EnvironmentSubset } from '../Payload.ts'
13
+ import { EnvironmentSubsetSchema } from '../Payload.ts'
14
+ import { EnvironmentWitness } from '../Witness.ts'
15
+
16
+ /**
17
+ * @group witness
18
+ * @group module
19
+ */
20
+
21
+ describe('EnvironmentWitness', () => {
22
+ let sut: EnvironmentWitness
23
+ beforeAll(async () => {
24
+ const config = { schema: EnvironmentWitnessConfigSchema }
25
+ const account = await Account.random()
26
+ sut = await EnvironmentWitness.create({ account, config })
27
+ })
28
+ describe('witness', () => {
29
+ describe('without template payload', () => {
30
+ it('should return the environment', async () => {
31
+ const result = await sut.observe()
32
+ expect(result).toBeArrayOfSize(1)
33
+ const env = result.find(isValuePayload)
34
+ expect(env).toBeDefined()
35
+ expect(env?.value).toBeDefined()
36
+ // NOTE: Due to how we sanitize __ fields from payloads
37
+ // this test can fail on systems where __ fields are present
38
+ // in the environment so we'll sanitize those when comparing
39
+ const processEnv = process.env
40
+ expect(env?.value).toEqual(processEnv)
41
+ })
42
+ })
43
+ describe('with subset payload', () => {
44
+ it('should return only the environment subset', async () => {
45
+ type EnvironmentWithPath = { PATH: string }
46
+ const template: EnvironmentSubset = { schema: EnvironmentSubsetSchema, values: ['PATH'] }
47
+ const result = await sut.observe([template])
48
+ expect(result).toBeArrayOfSize(1)
49
+ const env = result.find(isValuePayload)
50
+ expect(env).toBeDefined()
51
+ expect(env?.value).toContainAllKeys(template.values)
52
+ expect((env?.value as EnvironmentWithPath)?.PATH).toEqual(process.env.PATH)
53
+ })
54
+ })
55
+ })
56
+ })
package/xy.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
- const config: XyTsupConfig = {
3
- compile: {
4
- browser: {},
5
- neutral: { src: true },
6
- node: {},
7
- },
8
- }
9
-
10
- export default config