@xyo-network/sentinel-model 5.3.22 → 5.3.25

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/sentinel-model",
3
- "version": "5.3.22",
3
+ "version": "5.3.25",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,43 +30,39 @@
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "files": [
32
32
  "dist",
33
- "src",
34
33
  "!**/*.bench.*",
35
34
  "!**/*.spec.*",
36
35
  "!**/*.test.*",
37
36
  "README.md"
38
37
  ],
39
38
  "dependencies": {
40
- "@xyo-network/account-model": "~5.3.22",
41
- "@xyo-network/archivist-model": "~5.3.22",
42
- "@xyo-network/boundwitness-model": "~5.3.22",
43
- "@xyo-network/diviner-model": "~5.3.22",
44
- "@xyo-network/module-model": "~5.3.22",
45
- "@xyo-network/payload-model": "~5.3.22",
46
- "@xyo-network/witness-model": "~5.3.22"
39
+ "@xyo-network/archivist-model": "~5.3.25",
40
+ "@xyo-network/account-model": "~5.3.25",
41
+ "@xyo-network/module-model": "~5.3.25",
42
+ "@xyo-network/diviner-model": "~5.3.25",
43
+ "@xyo-network/boundwitness-model": "~5.3.25",
44
+ "@xyo-network/payload-model": "~5.3.25",
45
+ "@xyo-network/witness-model": "~5.3.25"
47
46
  },
48
47
  "devDependencies": {
49
48
  "@opentelemetry/api": "^1.9.1",
50
49
  "@types/node": "^25.5.0",
51
- "@xylabs/sdk-js": "^5.0.91",
52
- "@xylabs/ts-scripts-common": "~7.6.8",
53
- "@xylabs/ts-scripts-yarn3": "~7.6.8",
54
- "@xylabs/tsconfig": "~7.6.8",
55
- "@xyo-network/account-model": "~5.3.22",
56
- "@xyo-network/archivist-model": "~5.3.22",
57
- "@xyo-network/boundwitness-model": "~5.3.22",
58
- "@xyo-network/diviner-model": "~5.3.22",
59
- "@xyo-network/module-model": "~5.3.22",
60
- "@xyo-network/payload-model": "~5.3.22",
61
- "@xyo-network/witness-model": "~5.3.22",
50
+ "@xylabs/sdk-js": "^5.0.93",
51
+ "@xylabs/ts-scripts-common": "~7.6.16",
52
+ "@xylabs/ts-scripts-pnpm": "~7.6.16",
53
+ "@xylabs/tsconfig": "~7.6.16",
62
54
  "acorn": "^8.16.0",
63
55
  "axios": "^1.14.0",
64
- "cosmiconfig": "^9.0.1",
65
- "esbuild": "^0.27.4",
66
- "eslint": "^10.1.0",
67
- "rollup": "^4.60.1",
56
+ "esbuild": "^0.28.0",
68
57
  "typescript": "~5.9.3",
69
- "zod": "^4.3.6"
58
+ "zod": "^4.3.6",
59
+ "@xyo-network/account-model": "~5.3.25",
60
+ "@xyo-network/archivist-model": "~5.3.25",
61
+ "@xyo-network/boundwitness-model": "~5.3.25",
62
+ "@xyo-network/diviner-model": "~5.3.25",
63
+ "@xyo-network/module-model": "~5.3.25",
64
+ "@xyo-network/payload-model": "~5.3.25",
65
+ "@xyo-network/witness-model": "~5.3.25"
70
66
  },
71
67
  "peerDependencies": {
72
68
  "@xylabs/sdk-js": "^5",
@@ -75,4 +71,4 @@
75
71
  "publishConfig": {
76
72
  "access": "public"
77
73
  }
78
- }
74
+ }
package/src/Automation.ts DELETED
@@ -1,58 +0,0 @@
1
- import type { EventName } from '@xylabs/sdk-js'
2
- import type { ModuleIdentifier } from '@xyo-network/module-model'
3
- import type { Payload } from '@xyo-network/payload-model'
4
- import { asSchema, isPayloadOfSchemaType } from '@xyo-network/payload-model'
5
-
6
- export const SentinelAutomationSchema = asSchema('network.xyo.automation', true)
7
- export type SentinelAutomationSchema = typeof SentinelAutomationSchema
8
-
9
- export const SentinelIntervalAutomationSchema = asSchema('network.xyo.automation.interval', true)
10
- export type SentinelIntervalAutomationSchema = typeof SentinelIntervalAutomationSchema
11
-
12
- export const SentinelModuleEventAutomationSchema = asSchema('network.xyo.automation.event.module', true)
13
- export type SentinelModuleEventAutomationSchema = typeof SentinelModuleEventAutomationSchema
14
-
15
- export type SentinelBaseAutomationPayload<T extends Payload> = Payload<
16
- {
17
- type?: 'interval' | 'event'
18
- } & T
19
- >
20
-
21
- /** Settings for an Interval Automation */
22
- export type SentinelIntervalAutomationPayload = SentinelBaseAutomationPayload<{
23
- /** Epoch after which any reoccurrence stops */
24
- end?: number
25
-
26
- /** Time between triggers [non-repeating if undefined] */
27
- frequency?: number
28
-
29
- /** Units for frequency field [hour if undefined] */
30
- frequencyUnits?: 'second' | 'minute' | 'hour' | 'day' | 'millis'
31
-
32
- /** Remaining triggers [infinite if undefined] */
33
- remaining?: number
34
-
35
- schema: SentinelIntervalAutomationSchema
36
-
37
- /** Epoch of the next trigger */
38
- start: number
39
-
40
- /** The type of automation */
41
- type: 'interval'
42
- }>
43
-
44
- export const isSentinelIntervalAutomation = isPayloadOfSchemaType<SentinelIntervalAutomationPayload>(SentinelIntervalAutomationSchema)
45
-
46
- /** Settings for an Module Event Automation */
47
- export type SentinelModuleEventAutomationPayload = SentinelBaseAutomationPayload<{
48
- eventName: EventName
49
- schema: SentinelModuleEventAutomationSchema
50
- source: ModuleIdentifier
51
- type: 'event'
52
- }>
53
-
54
- /** Settings for an Automation */
55
- export type SentinelAutomationPayload = Payload<
56
- SentinelIntervalAutomationPayload | SentinelModuleEventAutomationPayload,
57
- SentinelAutomationSchema | SentinelIntervalAutomationSchema | SentinelModuleEventAutomationSchema
58
- >
package/src/Config.ts DELETED
@@ -1,25 +0,0 @@
1
- import type { WithAdditional } from '@xylabs/sdk-js'
2
- import type { ModuleConfig } from '@xyo-network/module-model'
3
- import {
4
- asSchema, type Payload, type Schema,
5
- } from '@xyo-network/payload-model'
6
-
7
- import type { SentinelAutomationPayload } from './Automation.ts'
8
- import type { Task } from './Task.ts'
9
-
10
- export const SentinelConfigSchema = asSchema('network.xyo.sentinel.config', true)
11
- export type SentinelConfigSchema = typeof SentinelConfigSchema
12
-
13
- export type SentinelConfig<TConfig extends Payload | void = void, TSchema extends Schema | void = void> = ModuleConfig<
14
- WithAdditional<
15
- {
16
- automations?: SentinelAutomationPayload[]
17
- schema: TConfig extends Payload ? TConfig['schema'] : SentinelConfigSchema
18
- synchronous?: boolean
19
- tasks: Task[]
20
- throwErrors?: boolean
21
- },
22
- TConfig
23
- >,
24
- TSchema
25
- >
package/src/EventData.ts DELETED
@@ -1,19 +0,0 @@
1
- import type { ModuleEventData, QueryableModule } from '@xyo-network/module-model'
2
-
3
- import type {
4
- JobEndEventData,
5
- JobStartEventData,
6
- ReportEndEventData,
7
- ReportStartEventData,
8
- TaskEndEventData,
9
- TaskStartEventData,
10
- } from './EventsModels/index.ts'
11
-
12
- export interface SentinelModuleEventData<T extends QueryableModule = QueryableModule>
13
- extends TaskEndEventData<T>,
14
- TaskStartEventData<T>,
15
- JobEndEventData<T>,
16
- JobStartEventData<T>,
17
- ReportEndEventData<T>,
18
- ReportStartEventData<T>,
19
- ModuleEventData<T> {}
@@ -1,15 +0,0 @@
1
- import type { Address, EventData } from '@xylabs/sdk-js'
2
- import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
3
- import type { Payload } from '@xyo-network/payload-model'
4
-
5
- export type JobEndEventArgs<T extends QueryableModule = QueryableModule> = ModuleEventArgs<
6
- T,
7
- {
8
- finalResult?: Record<Address, Payload[]>
9
- inPayloads?: Payload[]
10
- }
11
- >
12
-
13
- export interface JobEndEventData<T extends QueryableModule = QueryableModule> extends EventData {
14
- jobEnd: JobEndEventArgs<T>
15
- }
@@ -1,14 +0,0 @@
1
- import type { EventData } from '@xylabs/sdk-js'
2
- import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
3
- import type { Payload } from '@xyo-network/payload-model'
4
-
5
- export type JobStartEventArgs<T extends QueryableModule = QueryableModule> = ModuleEventArgs<
6
- T,
7
- {
8
- inPayloads?: Payload[]
9
- }
10
- >
11
-
12
- export interface JobStartEventData<T extends QueryableModule = QueryableModule> extends EventData {
13
- jobStart: JobStartEventArgs<T>
14
- }
@@ -1,17 +0,0 @@
1
- import type { EventData } from '@xylabs/sdk-js'
2
- import type { BoundWitness } from '@xyo-network/boundwitness-model'
3
- import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
4
- import type { Payload } from '@xyo-network/payload-model'
5
-
6
- export type ReportEndEventArgs<T extends QueryableModule = QueryableModule> = ModuleEventArgs<
7
- T,
8
- {
9
- boundwitness?: BoundWitness
10
- inPayloads?: Payload[]
11
- outPayloads?: Payload[]
12
- }
13
- >
14
-
15
- export interface ReportEndEventData<T extends QueryableModule = QueryableModule> extends EventData {
16
- reportEnd: ReportEndEventArgs<T>
17
- }
@@ -1,14 +0,0 @@
1
- import type { EventData } from '@xylabs/sdk-js'
2
- import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
3
- import type { Payload } from '@xyo-network/payload-model'
4
-
5
- export type ReportStartEventArgs<T extends QueryableModule = QueryableModule> = ModuleEventArgs<
6
- T,
7
- {
8
- inPayloads?: Payload[]
9
- }
10
- >
11
-
12
- export interface ReportStartEventData<T extends QueryableModule = QueryableModule> extends EventData {
13
- reportStart: ReportStartEventArgs<T>
14
- }
@@ -1,17 +0,0 @@
1
- import type { Address, EventData } from '@xylabs/sdk-js'
2
- import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
3
- import type { Payload } from '@xyo-network/payload-model'
4
-
5
- export type TaskEndEventArgs<T extends QueryableModule = QueryableModule> = ModuleEventArgs<
6
- T,
7
- {
8
- address: Address
9
- inPayloads?: Payload[]
10
- name?: string
11
- outPayloads?: Payload[]
12
- }
13
- >
14
-
15
- export interface TaskEndEventData<T extends QueryableModule = QueryableModule> extends EventData {
16
- taskEnd: TaskEndEventArgs<T>
17
- }
@@ -1,16 +0,0 @@
1
- import type { Address, EventData } from '@xylabs/sdk-js'
2
- import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
3
- import type { Payload } from '@xyo-network/payload-model'
4
-
5
- export type TaskStartEventArgs<T extends QueryableModule = QueryableModule> = ModuleEventArgs<
6
- T,
7
- {
8
- address: Address
9
- inPayloads?: Payload[]
10
- name?: string
11
- }
12
- >
13
-
14
- export interface TaskStartEventData<T extends QueryableModule = QueryableModule> extends EventData {
15
- taskStart: TaskStartEventArgs<T>
16
- }
@@ -1,6 +0,0 @@
1
- export * from './JobEnd.ts'
2
- export * from './JobStart.ts'
3
- export * from './ReportEnd.ts'
4
- export * from './ReportStart.ts'
5
- export * from './TaskEnd.ts'
6
- export * from './TaskStart.ts'
package/src/Instance.ts DELETED
@@ -1,20 +0,0 @@
1
- import type { ModuleInstance } from '@xyo-network/module-model'
2
-
3
- import type { SentinelModuleEventData } from './EventData.ts'
4
- import type { CustomSentinelModule, SentinelModule } from './Module.ts'
5
- import type { SentinelParams } from './Params.ts'
6
- import type { Sentinel } from './Sentinel.ts'
7
-
8
- export interface SentinelInstance<
9
- TParams extends SentinelParams = SentinelParams,
10
- TEventData extends SentinelModuleEventData = SentinelModuleEventData,
11
- > extends SentinelModule<TParams, TEventData>,
12
- Sentinel,
13
- ModuleInstance<TParams, TEventData> {}
14
-
15
- export interface CustomSentinelInstance<
16
- TParams extends SentinelParams = SentinelParams,
17
- TEvents extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>,
18
- > extends CustomSentinelModule<TParams, TEvents>,
19
- Sentinel,
20
- SentinelInstance<TParams, TEvents> {}
package/src/Job.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { ResolvedTask } from './ResolvedTask.ts'
2
-
3
- export interface SentinelJob {
4
- tasks: ResolvedTask[][]
5
- }
package/src/Module.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { QueryableModule } from '@xyo-network/module-model'
2
-
3
- import type { SentinelModuleEventData } from './EventData.ts'
4
- import type { SentinelParams } from './Params.ts'
5
-
6
- export interface SentinelModule<TParams extends SentinelParams = SentinelParams, TEventData extends SentinelModuleEventData = SentinelModuleEventData>
7
- extends QueryableModule<TParams, TEventData> {}
8
-
9
- export interface CustomSentinelModule<
10
- TParams extends SentinelParams = SentinelParams,
11
- TEvents extends SentinelModuleEventData<SentinelModule<TParams>> = SentinelModuleEventData<SentinelModule<TParams>>,
12
- > extends QueryableModule<TParams, TEvents> {}
package/src/Params.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { AnyConfigSchema, QueryableModuleParams } from '@xyo-network/module-model'
2
-
3
- import type { SentinelConfig } from './Config.ts'
4
-
5
- export interface SentinelParams<
6
- TConfig extends AnyConfigSchema<SentinelConfig> = AnyConfigSchema<SentinelConfig>,
7
- > extends QueryableModuleParams<TConfig> {
8
-
9
- }
@@ -1,8 +0,0 @@
1
- import { asSchema, type Query } from '@xyo-network/payload-model'
2
-
3
- export const SentinelReportQuerySchema = asSchema('network.xyo.query.sentinel.report', true)
4
- export type SentinelReportQuerySchema = typeof SentinelReportQuerySchema
5
-
6
- export type SentinelReportQuery = Query<{
7
- schema: SentinelReportQuerySchema
8
- }>
@@ -1,8 +0,0 @@
1
- export * from './Report.ts'
2
-
3
- import type { ModuleQueries } from '@xyo-network/module-model'
4
-
5
- import type { SentinelReportQuery } from './Report.ts'
6
-
7
- export type SentinelQueries = SentinelReportQuery
8
- export type SentinelModuleQueries = ModuleQueries | SentinelQueries
@@ -1,19 +0,0 @@
1
- import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
- import type { DivinerInstance } from '@xyo-network/diviner-model'
3
- import type { ModuleInstance } from '@xyo-network/module-model'
4
- import type { WitnessInstance } from '@xyo-network/witness-model'
5
-
6
- import type {
7
- ArchivistTask, DivinerTask, ModuleTask, WitnessTask,
8
- } from './Task.ts'
9
-
10
- export type ResolvedModuleTask<TTask extends ModuleTask = ModuleTask, TInstance extends ModuleInstance = ModuleInstance> = Omit<TTask, 'mod'> & {
11
- /** @field the modules that performs the task */
12
- mod: TInstance
13
- }
14
-
15
- export type ResolvedArchivistTask = ResolvedModuleTask<ArchivistTask, ArchivistInstance>
16
- export type ResolvedDivinerTask = ResolvedModuleTask<DivinerTask, DivinerInstance>
17
- export type ResolvedWitnessTask = ResolvedModuleTask<WitnessTask, WitnessInstance>
18
-
19
- export type ResolvedTask = ResolvedArchivistTask | ResolvedDivinerTask | ResolvedWitnessTask | ResolvedModuleTask
package/src/Sentinel.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { Promisable } from '@xylabs/sdk-js'
2
- import type { AccountInstance } from '@xyo-network/account-model'
3
- import type { ModuleQueryResult } from '@xyo-network/module-model'
4
- import type { Payload } from '@xyo-network/payload-model'
5
-
6
- export interface Sentinel<TIn extends Payload = Payload, TOut extends Payload = Payload> {
7
- report: (payloads?: TIn[]) => Promisable<TOut[]>
8
- reportQuery: (payloads?: TIn[], account?: AccountInstance) => Promisable<ModuleQueryResult<TOut>>
9
- }
package/src/Task.ts DELETED
@@ -1,17 +0,0 @@
1
- import type { ModuleIdentifier } from '@xyo-network/module-model'
2
-
3
- export interface ModuleTask<TEndpoints extends string = string> {
4
- /** @field the name of the endPoint that is being called. If not specified, the default endPoint is used */
5
- endPoint?: TEndpoints
6
- /** @field determines what inputs are sent to each module - if string, that is the output from other module (name/address) */
7
- input?: boolean | ModuleIdentifier | ModuleIdentifier[]
8
- /** @field the modules that performs the task */
9
- mod: ModuleIdentifier
10
- required?: boolean
11
- }
12
-
13
- export type ArchivistTask = ModuleTask<'all' | 'clear' | 'commit' | 'delete' | 'get' | 'insert'>
14
- export type DivinerTask = ModuleTask<'divine'>
15
- export type WitnessTask = ModuleTask<'observe'>
16
-
17
- export type Task = WitnessTask | DivinerTask | ArchivistTask | ModuleTask
@@ -1,19 +0,0 @@
1
- import type { TypeCheck } from '@xylabs/sdk-js'
2
- import { IsObjectFactory } from '@xylabs/sdk-js'
3
- import type { AttachableModuleInstance } from '@xyo-network/module-model'
4
-
5
- import type { SentinelModuleEventData } from '../EventData.ts'
6
- import type { SentinelInstance } from '../Instance.ts'
7
- import type { SentinelModule } from '../Module.ts'
8
- import type { SentinelParams } from '../Params.ts'
9
-
10
- export interface AttachableSentinelInstance<
11
- TParams extends SentinelParams = SentinelParams,
12
- TEventData extends SentinelModuleEventData = SentinelModuleEventData,
13
- > extends SentinelModule<TParams, TEventData>,
14
- AttachableModuleInstance<TParams, TEventData>,
15
- SentinelInstance<TParams, TEventData> {}
16
-
17
- export type AttachableSentinelInstanceTypeCheck<T extends AttachableSentinelInstance = AttachableSentinelInstance> = TypeCheck<T>
18
-
19
- export class IsAttachableSentinelInstanceFactory<T extends AttachableSentinelInstance = AttachableSentinelInstance> extends IsObjectFactory<T> {}
@@ -1,5 +0,0 @@
1
- import { AsObjectFactory } from '@xylabs/sdk-js'
2
-
3
- import { isAttachableSentinelInstance } from './isAttachableInstance.ts'
4
-
5
- export const asAttachableSentinelInstance = AsObjectFactory.create(isAttachableSentinelInstance)
@@ -1,3 +0,0 @@
1
- export * from './asAttachableInstance.ts'
2
- export * from './AttachableInstance.ts'
3
- export * from './isAttachableInstance.ts'
@@ -1,16 +0,0 @@
1
- import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'
2
- import { IsObjectFactory } from '@xylabs/sdk-js'
3
- import { isAttachableModuleInstance } from '@xyo-network/module-model'
4
-
5
- import { isSentinelInstance } from '../typeChecks.ts'
6
- import type { AttachableSentinelInstance } from './AttachableInstance.ts'
7
-
8
- export const requiredAttachableSentinelInstanceFunctions: ObjectTypeShape = {}
9
-
10
- // we do not use IsInstanceFactory here to prevent a cycle
11
- const factory = new IsObjectFactory<AttachableSentinelInstance>()
12
-
13
- export const isAttachableSentinelInstance: TypeCheck<AttachableSentinelInstance> = factory.create(requiredAttachableSentinelInstanceFunctions, [
14
- isSentinelInstance,
15
- isAttachableModuleInstance,
16
- ])
package/src/index.ts DELETED
@@ -1,14 +0,0 @@
1
- export * from './attachable/index.ts'
2
- export * from './Automation.ts'
3
- export * from './Config.ts'
4
- export * from './EventData.ts'
5
- export * from './EventsModels/index.ts'
6
- export * from './Instance.ts'
7
- export * from './Job.ts'
8
- export * from './Module.ts'
9
- export * from './Params.ts'
10
- export * from './Queries/index.ts'
11
- export * from './ResolvedTask.ts'
12
- export * from './Sentinel.ts'
13
- export * from './Task.ts'
14
- export * from './typeChecks.ts'
package/src/typeChecks.ts DELETED
@@ -1,22 +0,0 @@
1
- import { AsObjectFactory } from '@xylabs/sdk-js'
2
- import {
3
- // eslint-disable-next-line sonarjs/deprecation
4
- IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,
5
- } from '@xyo-network/module-model'
6
-
7
- import type { SentinelInstance } from './Instance.ts'
8
- import type { SentinelModule } from './Module.ts'
9
- import { SentinelReportQuerySchema } from './Queries/index.ts'
10
-
11
- export const isSentinelInstance = new IsInstanceFactory<SentinelInstance>().create({ report: 'function' }, [isModuleInstance])
12
- export const isSentinelModule = new IsQueryableModuleFactory<SentinelModule>().create([SentinelReportQuerySchema])
13
-
14
- export const asSentinelModule = AsObjectFactory.create(isSentinelModule)
15
- export const asSentinelInstance = AsObjectFactory.create(isSentinelInstance)
16
-
17
- /** @deprecated use narrowing instead [ if(is) ] */
18
- // eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated
19
- export const withSentinelModule = WithFactory.create(isSentinelModule)
20
- /** @deprecated use narrowing instead [ if(is) ] */
21
- // eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated
22
- export const withSentinelInstance = WithFactory.create(isSentinelInstance)