@xyo-network/api-graphql-plugin 2.84.5 → 2.85.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.
@@ -2,7 +2,6 @@ import { ApiGraphqlWitness } from './Witness';
2
2
  export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<ApiGraphqlWitness<import("@xyo-network/object").BaseParamsFields & {
3
3
  account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
4
4
  config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
5
- accountDerivationPath?: string | undefined;
6
5
  readonly archivist?: string | undefined;
7
6
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
8
7
  readonly name?: string | undefined;
@@ -19,7 +18,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
19
18
  readonly storeQueries?: boolean | undefined;
20
19
  readonly timestamp?: boolean | undefined;
21
20
  } & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
22
- accountDerivationPath?: string | undefined;
23
21
  readonly archivist?: string | undefined;
24
22
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
25
23
  readonly name?: string | undefined;
@@ -45,7 +43,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
45
43
  schema: string;
46
44
  };
47
45
  ephemeralQueryAccountEnabled?: boolean | undefined;
48
- wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
49
46
  } & {
50
47
  endpoint?: string | undefined;
51
48
  headers?: import("./Witness").HttpHeaders | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
@@ -2,7 +2,6 @@ import { ApiGraphqlWitness } from './Witness';
2
2
  export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<ApiGraphqlWitness<import("@xyo-network/object").BaseParamsFields & {
3
3
  account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
4
4
  config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
5
- accountDerivationPath?: string | undefined;
6
5
  readonly archivist?: string | undefined;
7
6
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
8
7
  readonly name?: string | undefined;
@@ -19,7 +18,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
19
18
  readonly storeQueries?: boolean | undefined;
20
19
  readonly timestamp?: boolean | undefined;
21
20
  } & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
22
- accountDerivationPath?: string | undefined;
23
21
  readonly archivist?: string | undefined;
24
22
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
25
23
  readonly name?: string | undefined;
@@ -45,7 +43,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
45
43
  schema: string;
46
44
  };
47
45
  ephemeralQueryAccountEnabled?: boolean | undefined;
48
- wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
49
46
  } & {
50
47
  endpoint?: string | undefined;
51
48
  headers?: import("./Witness").HttpHeaders | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
@@ -2,7 +2,6 @@ import { ApiGraphqlWitness } from './Witness';
2
2
  export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<ApiGraphqlWitness<import("@xyo-network/object").BaseParamsFields & {
3
3
  account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
4
4
  config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
5
- accountDerivationPath?: string | undefined;
6
5
  readonly archivist?: string | undefined;
7
6
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
8
7
  readonly name?: string | undefined;
@@ -19,7 +18,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
19
18
  readonly storeQueries?: boolean | undefined;
20
19
  readonly timestamp?: boolean | undefined;
21
20
  } & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
22
- accountDerivationPath?: string | undefined;
23
21
  readonly archivist?: string | undefined;
24
22
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
25
23
  readonly name?: string | undefined;
@@ -45,7 +43,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
45
43
  schema: string;
46
44
  };
47
45
  ephemeralQueryAccountEnabled?: boolean | undefined;
48
- wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
49
46
  } & {
50
47
  endpoint?: string | undefined;
51
48
  headers?: import("./Witness").HttpHeaders | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
@@ -25,7 +25,7 @@ __export(src_exports, {
25
25
  ApiGraphqlWitnessPlugin: () => ApiGraphqlWitnessPlugin,
26
26
  GraphqlQuerySchema: () => GraphqlQuerySchema,
27
27
  GraphqlResultSchema: () => GraphqlResultSchema,
28
- default: () => src_default,
28
+ default: () => ApiGraphqlWitnessPlugin,
29
29
  isGraphqlQuery: () => isGraphqlQuery
30
30
  });
31
31
  module.exports = __toCommonJS(src_exports);
@@ -84,7 +84,4 @@ var ApiGraphqlWitnessPlugin = () => (0, import_payloadset_plugin.createPayloadSe
84
84
  }
85
85
  }
86
86
  );
87
-
88
- // src/index.ts
89
- var src_default = ApiGraphqlWitnessPlugin;
90
87
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import { ApiGraphqlWitnessPlugin } from './Plugin'\n\nexport * from './Witness'\n\nexport { ApiGraphqlWitnessPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default ApiGraphqlWitnessPlugin\n","import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ApiGraphqlWitness, GraphqlQuerySchema } from './Witness'\n\nexport const ApiGraphqlWitnessPlugin = () =>\n createPayloadSetWitnessPlugin<ApiGraphqlWitness>(\n { required: { [GraphqlQuerySchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await ApiGraphqlWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { WitnessConfig, WitnessParams } from '@xyo-network/witness-model'\nimport type { ExecutionResult } from 'graphql'\n\nexport const ApiGraphqlWitnessConfigSchema = 'network.xyo.api.witness.config'\nexport type ApiGraphqlWitnessConfigSchema = typeof ApiGraphqlWitnessConfigSchema\n\nexport type ApiGraphqlWitnessConfig = WitnessConfig<{\n endpoint?: string\n schema: ApiGraphqlWitnessConfigSchema\n timeout?: number\n}>\n\nexport type HttpHeaderValue = string | string[] | number | boolean | null\n\nexport interface HttpHeaders {\n [key: string]: HttpHeaderValue\n}\n\nexport type ApiGraphqlWitnessParams = WitnessParams<\n AnyConfigSchema<ApiGraphqlWitnessConfig>,\n {\n endpoint?: string\n headers?: HttpHeaders\n }\n>\n\nexport const GraphqlQuerySchema = 'network.xyo.graphql.query'\nexport type GraphqlQuerySchema = typeof GraphqlQuerySchema\n\nexport type GraphqlQuery = Payload<\n {\n query: string\n variables: Record<string, unknown>\n },\n GraphqlQuerySchema\n>\n\nexport const GraphqlResultSchema = 'network.xyo.graphql.result'\nexport type GraphqlResultSchema = typeof GraphqlResultSchema\n\nexport type GraphqlResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Payload<\n {\n http?: {\n code?: string\n ipAddress?: string\n status?: number\n }\n result?: ExecutionResult<TData, TExtensions>\n },\n GraphqlResultSchema\n>\n\nexport const isGraphqlQuery = isPayloadOfSchemaType<GraphqlQuery>(GraphqlQuerySchema)\n\nexport class ApiGraphqlWitness<TParams extends ApiGraphqlWitnessParams = ApiGraphqlWitnessParams> extends AbstractWitness<\n TParams,\n GraphqlQuery,\n GraphqlResult\n> {\n static override configSchemas = [ApiGraphqlWitnessConfigSchema]\n\n get endpoint() {\n return assertEx(this.config.endpoint ?? this.params.endpoint, 'No endpoint specified')\n }\n\n get headers() {\n return this.params.headers\n }\n\n get timeout() {\n return this.config.timeout\n }\n\n protected override async observeHandler(payloads?: GraphqlQuery[]): Promise<GraphqlResult[]> {\n await this.started('throw')\n const queries = payloads?.filter(isGraphqlQuery) ?? []\n const axios = new AxiosJson({ headers: this.headers, timeout: this.timeout })\n const observations = await Promise.all(\n queries.map(async ({ query, variables }) => {\n const httpResult = await axios.post(this.endpoint, { query, variables })\n const result: GraphqlResult = {\n http: {\n status: httpResult.status,\n },\n result: httpResult.data,\n schema: GraphqlResultSchema,\n }\n return result\n }),\n )\n return observations.flat()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,wBAAiC;AACjC,+BAA8C;;;ACD9C,oBAAyB;AACzB,mBAA0B;AAC1B,8BAAgC;AAEhC,2BAA+C;AAIxC,IAAM,gCAAgC;AAuBtC,IAAM,qBAAqB;AAW3B,IAAM,sBAAsB;AAe5B,IAAM,qBAAiB,4CAAoC,kBAAkB;AAE7E,IAAM,oBAAN,cAAmG,wCAIxG;AAAA,EACA,OAAgB,gBAAgB,CAAC,6BAA6B;AAAA,EAE9D,IAAI,WAAW;AACb,eAAO,wBAAS,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU,uBAAuB;AAAA,EACvF;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,MAAyB,eAAe,UAAqD;AAC3F,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,UAAU,UAAU,OAAO,cAAc,KAAK,CAAC;AACrD,UAAM,QAAQ,IAAI,uBAAU,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,QAAQ,CAAC;AAC5E,UAAM,eAAe,MAAM,QAAQ;AAAA,MACjC,QAAQ,IAAI,OAAO,EAAE,OAAO,UAAU,MAAM;AAC1C,cAAM,aAAa,MAAM,MAAM,KAAK,KAAK,UAAU,EAAE,OAAO,UAAU,CAAC;AACvE,cAAM,SAAwB;AAAA,UAC5B,MAAM;AAAA,YACJ,QAAQ,WAAW;AAAA,UACrB;AAAA,UACA,QAAQ,WAAW;AAAA,UACnB,QAAQ;AAAA,QACV;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;;;AD5FO,IAAM,0BAA0B,UACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,uCAAiB;AAAA,EAClE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,kBAAkB,OAAO,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;;;ADNF,IAAO,cAAQ;","names":["import_payload_model"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin'\nexport * from './Witness'\n","import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ApiGraphqlWitness, GraphqlQuerySchema } from './Witness'\n\nexport const ApiGraphqlWitnessPlugin = () =>\n createPayloadSetWitnessPlugin<ApiGraphqlWitness>(\n { required: { [GraphqlQuerySchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await ApiGraphqlWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { WitnessConfig, WitnessParams } from '@xyo-network/witness-model'\nimport type { ExecutionResult } from 'graphql'\n\nexport const ApiGraphqlWitnessConfigSchema = 'network.xyo.api.witness.config'\nexport type ApiGraphqlWitnessConfigSchema = typeof ApiGraphqlWitnessConfigSchema\n\nexport type ApiGraphqlWitnessConfig = WitnessConfig<{\n endpoint?: string\n schema: ApiGraphqlWitnessConfigSchema\n timeout?: number\n}>\n\nexport type HttpHeaderValue = string | string[] | number | boolean | null\n\nexport interface HttpHeaders {\n [key: string]: HttpHeaderValue\n}\n\nexport type ApiGraphqlWitnessParams = WitnessParams<\n AnyConfigSchema<ApiGraphqlWitnessConfig>,\n {\n endpoint?: string\n headers?: HttpHeaders\n }\n>\n\nexport const GraphqlQuerySchema = 'network.xyo.graphql.query'\nexport type GraphqlQuerySchema = typeof GraphqlQuerySchema\n\nexport type GraphqlQuery = Payload<\n {\n query: string\n variables: Record<string, unknown>\n },\n GraphqlQuerySchema\n>\n\nexport const GraphqlResultSchema = 'network.xyo.graphql.result'\nexport type GraphqlResultSchema = typeof GraphqlResultSchema\n\nexport type GraphqlResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Payload<\n {\n http?: {\n code?: string\n ipAddress?: string\n status?: number\n }\n result?: ExecutionResult<TData, TExtensions>\n },\n GraphqlResultSchema\n>\n\nexport const isGraphqlQuery = isPayloadOfSchemaType<GraphqlQuery>(GraphqlQuerySchema)\n\nexport class ApiGraphqlWitness<TParams extends ApiGraphqlWitnessParams = ApiGraphqlWitnessParams> extends AbstractWitness<\n TParams,\n GraphqlQuery,\n GraphqlResult\n> {\n static override configSchemas = [ApiGraphqlWitnessConfigSchema]\n\n get endpoint() {\n return assertEx(this.config.endpoint ?? this.params.endpoint, 'No endpoint specified')\n }\n\n get headers() {\n return this.params.headers\n }\n\n get timeout() {\n return this.config.timeout\n }\n\n protected override async observeHandler(payloads?: GraphqlQuery[]): Promise<GraphqlResult[]> {\n await this.started('throw')\n const queries = payloads?.filter(isGraphqlQuery) ?? []\n const axios = new AxiosJson({ headers: this.headers, timeout: this.timeout })\n const observations = await Promise.all(\n queries.map(async ({ query, variables }) => {\n const httpResult = await axios.post(this.endpoint, { query, variables })\n const result: GraphqlResult = {\n http: {\n status: httpResult.status,\n },\n result: httpResult.data,\n schema: GraphqlResultSchema,\n }\n return result\n }),\n )\n return observations.flat()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,wBAAiC;AACjC,+BAA8C;;;ACD9C,oBAAyB;AACzB,mBAA0B;AAC1B,8BAAgC;AAEhC,2BAA+C;AAIxC,IAAM,gCAAgC;AAuBtC,IAAM,qBAAqB;AAW3B,IAAM,sBAAsB;AAe5B,IAAM,qBAAiB,4CAAoC,kBAAkB;AAE7E,IAAM,oBAAN,cAAmG,wCAIxG;AAAA,EACA,OAAgB,gBAAgB,CAAC,6BAA6B;AAAA,EAE9D,IAAI,WAAW;AACb,eAAO,wBAAS,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU,uBAAuB;AAAA,EACvF;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,MAAyB,eAAe,UAAqD;AAC3F,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,UAAU,UAAU,OAAO,cAAc,KAAK,CAAC;AACrD,UAAM,QAAQ,IAAI,uBAAU,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,QAAQ,CAAC;AAC5E,UAAM,eAAe,MAAM,QAAQ;AAAA,MACjC,QAAQ,IAAI,OAAO,EAAE,OAAO,UAAU,MAAM;AAC1C,cAAM,aAAa,MAAM,MAAM,KAAK,KAAK,UAAU,EAAE,OAAO,UAAU,CAAC;AACvE,cAAM,SAAwB;AAAA,UAC5B,MAAM;AAAA,YACJ,QAAQ,WAAW;AAAA,UACrB;AAAA,UACA,QAAQ,WAAW;AAAA,UACnB,QAAQ;AAAA,QACV;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;;;AD5FO,IAAM,0BAA0B,UACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,uCAAiB;AAAA,EAClE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,kBAAkB,OAAO,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;","names":["import_payload_model"]}
@@ -1,5 +1,3 @@
1
- import { ApiGraphqlWitnessPlugin } from './Plugin';
1
+ export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin';
2
2
  export * from './Witness';
3
- export { ApiGraphqlWitnessPlugin };
4
- export default ApiGraphqlWitnessPlugin;
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,eAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,IAAI,OAAO,EAAE,MAAM,UAAU,CAAA;AACtF,cAAc,WAAW,CAAA"}
@@ -1,5 +1,3 @@
1
- import { ApiGraphqlWitnessPlugin } from './Plugin';
1
+ export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin';
2
2
  export * from './Witness';
3
- export { ApiGraphqlWitnessPlugin };
4
- export default ApiGraphqlWitnessPlugin;
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,eAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,IAAI,OAAO,EAAE,MAAM,UAAU,CAAA;AACtF,cAAc,WAAW,CAAA"}
@@ -1,5 +1,3 @@
1
- import { ApiGraphqlWitnessPlugin } from './Plugin';
1
+ export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin';
2
2
  export * from './Witness';
3
- export { ApiGraphqlWitnessPlugin };
4
- export default ApiGraphqlWitnessPlugin;
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,eAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,IAAI,OAAO,EAAE,MAAM,UAAU,CAAA;AACtF,cAAc,WAAW,CAAA"}
@@ -52,16 +52,13 @@ var ApiGraphqlWitnessPlugin = () => createPayloadSetWitnessPlugin(
52
52
  }
53
53
  }
54
54
  );
55
-
56
- // src/index.ts
57
- var src_default = ApiGraphqlWitnessPlugin;
58
55
  export {
59
56
  ApiGraphqlWitness,
60
57
  ApiGraphqlWitnessConfigSchema,
61
58
  ApiGraphqlWitnessPlugin,
62
59
  GraphqlQuerySchema,
63
60
  GraphqlResultSchema,
64
- src_default as default,
61
+ ApiGraphqlWitnessPlugin as default,
65
62
  isGraphqlQuery
66
63
  };
67
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts","../../src/index.ts"],"sourcesContent":["import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ApiGraphqlWitness, GraphqlQuerySchema } from './Witness'\n\nexport const ApiGraphqlWitnessPlugin = () =>\n createPayloadSetWitnessPlugin<ApiGraphqlWitness>(\n { required: { [GraphqlQuerySchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await ApiGraphqlWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { WitnessConfig, WitnessParams } from '@xyo-network/witness-model'\nimport type { ExecutionResult } from 'graphql'\n\nexport const ApiGraphqlWitnessConfigSchema = 'network.xyo.api.witness.config'\nexport type ApiGraphqlWitnessConfigSchema = typeof ApiGraphqlWitnessConfigSchema\n\nexport type ApiGraphqlWitnessConfig = WitnessConfig<{\n endpoint?: string\n schema: ApiGraphqlWitnessConfigSchema\n timeout?: number\n}>\n\nexport type HttpHeaderValue = string | string[] | number | boolean | null\n\nexport interface HttpHeaders {\n [key: string]: HttpHeaderValue\n}\n\nexport type ApiGraphqlWitnessParams = WitnessParams<\n AnyConfigSchema<ApiGraphqlWitnessConfig>,\n {\n endpoint?: string\n headers?: HttpHeaders\n }\n>\n\nexport const GraphqlQuerySchema = 'network.xyo.graphql.query'\nexport type GraphqlQuerySchema = typeof GraphqlQuerySchema\n\nexport type GraphqlQuery = Payload<\n {\n query: string\n variables: Record<string, unknown>\n },\n GraphqlQuerySchema\n>\n\nexport const GraphqlResultSchema = 'network.xyo.graphql.result'\nexport type GraphqlResultSchema = typeof GraphqlResultSchema\n\nexport type GraphqlResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Payload<\n {\n http?: {\n code?: string\n ipAddress?: string\n status?: number\n }\n result?: ExecutionResult<TData, TExtensions>\n },\n GraphqlResultSchema\n>\n\nexport const isGraphqlQuery = isPayloadOfSchemaType<GraphqlQuery>(GraphqlQuerySchema)\n\nexport class ApiGraphqlWitness<TParams extends ApiGraphqlWitnessParams = ApiGraphqlWitnessParams> extends AbstractWitness<\n TParams,\n GraphqlQuery,\n GraphqlResult\n> {\n static override configSchemas = [ApiGraphqlWitnessConfigSchema]\n\n get endpoint() {\n return assertEx(this.config.endpoint ?? this.params.endpoint, 'No endpoint specified')\n }\n\n get headers() {\n return this.params.headers\n }\n\n get timeout() {\n return this.config.timeout\n }\n\n protected override async observeHandler(payloads?: GraphqlQuery[]): Promise<GraphqlResult[]> {\n await this.started('throw')\n const queries = payloads?.filter(isGraphqlQuery) ?? []\n const axios = new AxiosJson({ headers: this.headers, timeout: this.timeout })\n const observations = await Promise.all(\n queries.map(async ({ query, variables }) => {\n const httpResult = await axios.post(this.endpoint, { query, variables })\n const result: GraphqlResult = {\n http: {\n status: httpResult.status,\n },\n result: httpResult.data,\n schema: GraphqlResultSchema,\n }\n return result\n }),\n )\n return observations.flat()\n }\n}\n","import { ApiGraphqlWitnessPlugin } from './Plugin'\n\nexport * from './Witness'\n\nexport { ApiGraphqlWitnessPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default ApiGraphqlWitnessPlugin\n"],"mappings":";AAAA,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACD9C,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAEhC,SAAS,6BAAsC;AAIxC,IAAM,gCAAgC;AAuBtC,IAAM,qBAAqB;AAW3B,IAAM,sBAAsB;AAe5B,IAAM,iBAAiB,sBAAoC,kBAAkB;AAE7E,IAAM,oBAAN,cAAmG,gBAIxG;AAAA,EACA,OAAgB,gBAAgB,CAAC,6BAA6B;AAAA,EAE9D,IAAI,WAAW;AACb,WAAO,SAAS,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU,uBAAuB;AAAA,EACvF;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,MAAyB,eAAe,UAAqD;AAC3F,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,UAAU,UAAU,OAAO,cAAc,KAAK,CAAC;AACrD,UAAM,QAAQ,IAAI,UAAU,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,QAAQ,CAAC;AAC5E,UAAM,eAAe,MAAM,QAAQ;AAAA,MACjC,QAAQ,IAAI,OAAO,EAAE,OAAO,UAAU,MAAM;AAC1C,cAAM,aAAa,MAAM,MAAM,KAAK,KAAK,UAAU,EAAE,OAAO,UAAU,CAAC;AACvE,cAAM,SAAwB;AAAA,UAC5B,MAAM;AAAA,YACJ,QAAQ,WAAW;AAAA,UACrB;AAAA,UACA,QAAQ,WAAW;AAAA,UACnB,QAAQ;AAAA,QACV;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;;;AD5FO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EAClE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,kBAAkB,OAAO,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;;;AENF,IAAO,cAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ApiGraphqlWitness, GraphqlQuerySchema } from './Witness'\n\nexport const ApiGraphqlWitnessPlugin = () =>\n createPayloadSetWitnessPlugin<ApiGraphqlWitness>(\n { required: { [GraphqlQuerySchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await ApiGraphqlWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { WitnessConfig, WitnessParams } from '@xyo-network/witness-model'\nimport type { ExecutionResult } from 'graphql'\n\nexport const ApiGraphqlWitnessConfigSchema = 'network.xyo.api.witness.config'\nexport type ApiGraphqlWitnessConfigSchema = typeof ApiGraphqlWitnessConfigSchema\n\nexport type ApiGraphqlWitnessConfig = WitnessConfig<{\n endpoint?: string\n schema: ApiGraphqlWitnessConfigSchema\n timeout?: number\n}>\n\nexport type HttpHeaderValue = string | string[] | number | boolean | null\n\nexport interface HttpHeaders {\n [key: string]: HttpHeaderValue\n}\n\nexport type ApiGraphqlWitnessParams = WitnessParams<\n AnyConfigSchema<ApiGraphqlWitnessConfig>,\n {\n endpoint?: string\n headers?: HttpHeaders\n }\n>\n\nexport const GraphqlQuerySchema = 'network.xyo.graphql.query'\nexport type GraphqlQuerySchema = typeof GraphqlQuerySchema\n\nexport type GraphqlQuery = Payload<\n {\n query: string\n variables: Record<string, unknown>\n },\n GraphqlQuerySchema\n>\n\nexport const GraphqlResultSchema = 'network.xyo.graphql.result'\nexport type GraphqlResultSchema = typeof GraphqlResultSchema\n\nexport type GraphqlResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Payload<\n {\n http?: {\n code?: string\n ipAddress?: string\n status?: number\n }\n result?: ExecutionResult<TData, TExtensions>\n },\n GraphqlResultSchema\n>\n\nexport const isGraphqlQuery = isPayloadOfSchemaType<GraphqlQuery>(GraphqlQuerySchema)\n\nexport class ApiGraphqlWitness<TParams extends ApiGraphqlWitnessParams = ApiGraphqlWitnessParams> extends AbstractWitness<\n TParams,\n GraphqlQuery,\n GraphqlResult\n> {\n static override configSchemas = [ApiGraphqlWitnessConfigSchema]\n\n get endpoint() {\n return assertEx(this.config.endpoint ?? this.params.endpoint, 'No endpoint specified')\n }\n\n get headers() {\n return this.params.headers\n }\n\n get timeout() {\n return this.config.timeout\n }\n\n protected override async observeHandler(payloads?: GraphqlQuery[]): Promise<GraphqlResult[]> {\n await this.started('throw')\n const queries = payloads?.filter(isGraphqlQuery) ?? []\n const axios = new AxiosJson({ headers: this.headers, timeout: this.timeout })\n const observations = await Promise.all(\n queries.map(async ({ query, variables }) => {\n const httpResult = await axios.post(this.endpoint, { query, variables })\n const result: GraphqlResult = {\n http: {\n status: httpResult.status,\n },\n result: httpResult.data,\n schema: GraphqlResultSchema,\n }\n return result\n }),\n )\n return observations.flat()\n }\n}\n"],"mappings":";AAAA,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACD9C,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAEhC,SAAS,6BAAsC;AAIxC,IAAM,gCAAgC;AAuBtC,IAAM,qBAAqB;AAW3B,IAAM,sBAAsB;AAe5B,IAAM,iBAAiB,sBAAoC,kBAAkB;AAE7E,IAAM,oBAAN,cAAmG,gBAIxG;AAAA,EACA,OAAgB,gBAAgB,CAAC,6BAA6B;AAAA,EAE9D,IAAI,WAAW;AACb,WAAO,SAAS,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU,uBAAuB;AAAA,EACvF;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,MAAyB,eAAe,UAAqD;AAC3F,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,UAAU,UAAU,OAAO,cAAc,KAAK,CAAC;AACrD,UAAM,QAAQ,IAAI,UAAU,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,QAAQ,CAAC;AAC5E,UAAM,eAAe,MAAM,QAAQ;AAAA,MACjC,QAAQ,IAAI,OAAO,EAAE,OAAO,UAAU,MAAM;AAC1C,cAAM,aAAa,MAAM,MAAM,KAAK,KAAK,UAAU,EAAE,OAAO,UAAU,CAAC;AACvE,cAAM,SAAwB;AAAA,UAC5B,MAAM;AAAA,YACJ,QAAQ,WAAW;AAAA,UACrB;AAAA,UACA,QAAQ,WAAW;AAAA,UACnB,QAAQ;AAAA,QACV;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;;;AD5FO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EAClE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,kBAAkB,OAAO,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;","names":[]}
@@ -2,7 +2,6 @@ import { ApiGraphqlWitness } from './Witness';
2
2
  export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<ApiGraphqlWitness<import("@xyo-network/object").BaseParamsFields & {
3
3
  account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
4
4
  config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
5
- accountDerivationPath?: string | undefined;
6
5
  readonly archivist?: string | undefined;
7
6
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
8
7
  readonly name?: string | undefined;
@@ -19,7 +18,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
19
18
  readonly storeQueries?: boolean | undefined;
20
19
  readonly timestamp?: boolean | undefined;
21
20
  } & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
22
- accountDerivationPath?: string | undefined;
23
21
  readonly archivist?: string | undefined;
24
22
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
25
23
  readonly name?: string | undefined;
@@ -45,7 +43,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
45
43
  schema: string;
46
44
  };
47
45
  ephemeralQueryAccountEnabled?: boolean | undefined;
48
- wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
49
46
  } & {
50
47
  endpoint?: string | undefined;
51
48
  headers?: import("./Witness").HttpHeaders | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
@@ -2,7 +2,6 @@ import { ApiGraphqlWitness } from './Witness';
2
2
  export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<ApiGraphqlWitness<import("@xyo-network/object").BaseParamsFields & {
3
3
  account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
4
4
  config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
5
- accountDerivationPath?: string | undefined;
6
5
  readonly archivist?: string | undefined;
7
6
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
8
7
  readonly name?: string | undefined;
@@ -19,7 +18,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
19
18
  readonly storeQueries?: boolean | undefined;
20
19
  readonly timestamp?: boolean | undefined;
21
20
  } & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
22
- accountDerivationPath?: string | undefined;
23
21
  readonly archivist?: string | undefined;
24
22
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
25
23
  readonly name?: string | undefined;
@@ -45,7 +43,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
45
43
  schema: string;
46
44
  };
47
45
  ephemeralQueryAccountEnabled?: boolean | undefined;
48
- wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
49
46
  } & {
50
47
  endpoint?: string | undefined;
51
48
  headers?: import("./Witness").HttpHeaders | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
@@ -2,7 +2,6 @@ import { ApiGraphqlWitness } from './Witness';
2
2
  export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<ApiGraphqlWitness<import("@xyo-network/object").BaseParamsFields & {
3
3
  account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
4
4
  config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
5
- accountDerivationPath?: string | undefined;
6
5
  readonly archivist?: string | undefined;
7
6
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
8
7
  readonly name?: string | undefined;
@@ -19,7 +18,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
19
18
  readonly storeQueries?: boolean | undefined;
20
19
  readonly timestamp?: boolean | undefined;
21
20
  } & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
22
- accountDerivationPath?: string | undefined;
23
21
  readonly archivist?: string | undefined;
24
22
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
25
23
  readonly name?: string | undefined;
@@ -45,7 +43,6 @@ export declare const ApiGraphqlWitnessPlugin: () => import("@xyo-network/payload
45
43
  schema: string;
46
44
  };
47
45
  ephemeralQueryAccountEnabled?: boolean | undefined;
48
- wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
49
46
  } & {
50
47
  endpoint?: string | undefined;
51
48
  headers?: import("./Witness").HttpHeaders | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AAEjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQjC,CAAA"}
@@ -25,7 +25,7 @@ __export(src_exports, {
25
25
  ApiGraphqlWitnessPlugin: () => ApiGraphqlWitnessPlugin,
26
26
  GraphqlQuerySchema: () => GraphqlQuerySchema,
27
27
  GraphqlResultSchema: () => GraphqlResultSchema,
28
- default: () => src_default,
28
+ default: () => ApiGraphqlWitnessPlugin,
29
29
  isGraphqlQuery: () => isGraphqlQuery
30
30
  });
31
31
  module.exports = __toCommonJS(src_exports);
@@ -84,9 +84,6 @@ var ApiGraphqlWitnessPlugin = () => (0, import_payloadset_plugin.createPayloadSe
84
84
  }
85
85
  }
86
86
  );
87
-
88
- // src/index.ts
89
- var src_default = ApiGraphqlWitnessPlugin;
90
87
  // Annotate the CommonJS export names for ESM import in node:
91
88
  0 && (module.exports = {
92
89
  ApiGraphqlWitness,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import { ApiGraphqlWitnessPlugin } from './Plugin'\n\nexport * from './Witness'\n\nexport { ApiGraphqlWitnessPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default ApiGraphqlWitnessPlugin\n","import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ApiGraphqlWitness, GraphqlQuerySchema } from './Witness'\n\nexport const ApiGraphqlWitnessPlugin = () =>\n createPayloadSetWitnessPlugin<ApiGraphqlWitness>(\n { required: { [GraphqlQuerySchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await ApiGraphqlWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { WitnessConfig, WitnessParams } from '@xyo-network/witness-model'\nimport type { ExecutionResult } from 'graphql'\n\nexport const ApiGraphqlWitnessConfigSchema = 'network.xyo.api.witness.config'\nexport type ApiGraphqlWitnessConfigSchema = typeof ApiGraphqlWitnessConfigSchema\n\nexport type ApiGraphqlWitnessConfig = WitnessConfig<{\n endpoint?: string\n schema: ApiGraphqlWitnessConfigSchema\n timeout?: number\n}>\n\nexport type HttpHeaderValue = string | string[] | number | boolean | null\n\nexport interface HttpHeaders {\n [key: string]: HttpHeaderValue\n}\n\nexport type ApiGraphqlWitnessParams = WitnessParams<\n AnyConfigSchema<ApiGraphqlWitnessConfig>,\n {\n endpoint?: string\n headers?: HttpHeaders\n }\n>\n\nexport const GraphqlQuerySchema = 'network.xyo.graphql.query'\nexport type GraphqlQuerySchema = typeof GraphqlQuerySchema\n\nexport type GraphqlQuery = Payload<\n {\n query: string\n variables: Record<string, unknown>\n },\n GraphqlQuerySchema\n>\n\nexport const GraphqlResultSchema = 'network.xyo.graphql.result'\nexport type GraphqlResultSchema = typeof GraphqlResultSchema\n\nexport type GraphqlResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Payload<\n {\n http?: {\n code?: string\n ipAddress?: string\n status?: number\n }\n result?: ExecutionResult<TData, TExtensions>\n },\n GraphqlResultSchema\n>\n\nexport const isGraphqlQuery = isPayloadOfSchemaType<GraphqlQuery>(GraphqlQuerySchema)\n\nexport class ApiGraphqlWitness<TParams extends ApiGraphqlWitnessParams = ApiGraphqlWitnessParams> extends AbstractWitness<\n TParams,\n GraphqlQuery,\n GraphqlResult\n> {\n static override configSchemas = [ApiGraphqlWitnessConfigSchema]\n\n get endpoint() {\n return assertEx(this.config.endpoint ?? this.params.endpoint, 'No endpoint specified')\n }\n\n get headers() {\n return this.params.headers\n }\n\n get timeout() {\n return this.config.timeout\n }\n\n protected override async observeHandler(payloads?: GraphqlQuery[]): Promise<GraphqlResult[]> {\n await this.started('throw')\n const queries = payloads?.filter(isGraphqlQuery) ?? []\n const axios = new AxiosJson({ headers: this.headers, timeout: this.timeout })\n const observations = await Promise.all(\n queries.map(async ({ query, variables }) => {\n const httpResult = await axios.post(this.endpoint, { query, variables })\n const result: GraphqlResult = {\n http: {\n status: httpResult.status,\n },\n result: httpResult.data,\n schema: GraphqlResultSchema,\n }\n return result\n }),\n )\n return observations.flat()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,wBAAiC;AACjC,+BAA8C;;;ACD9C,oBAAyB;AACzB,mBAA0B;AAC1B,8BAAgC;AAEhC,2BAA+C;AAIxC,IAAM,gCAAgC;AAuBtC,IAAM,qBAAqB;AAW3B,IAAM,sBAAsB;AAe5B,IAAM,qBAAiB,4CAAoC,kBAAkB;AAE7E,IAAM,oBAAN,cAAmG,wCAIxG;AAAA,EACA,OAAgB,gBAAgB,CAAC,6BAA6B;AAAA,EAE9D,IAAI,WAAW;AACb,eAAO,wBAAS,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU,uBAAuB;AAAA,EACvF;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,MAAyB,eAAe,UAAqD;AAC3F,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,WAAU,qCAAU,OAAO,oBAAmB,CAAC;AACrD,UAAM,QAAQ,IAAI,uBAAU,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,QAAQ,CAAC;AAC5E,UAAM,eAAe,MAAM,QAAQ;AAAA,MACjC,QAAQ,IAAI,OAAO,EAAE,OAAO,UAAU,MAAM;AAC1C,cAAM,aAAa,MAAM,MAAM,KAAK,KAAK,UAAU,EAAE,OAAO,UAAU,CAAC;AACvE,cAAM,SAAwB;AAAA,UAC5B,MAAM;AAAA,YACJ,QAAQ,WAAW;AAAA,UACrB;AAAA,UACA,QAAQ,WAAW;AAAA,UACnB,QAAQ;AAAA,QACV;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;;;AD5FO,IAAM,0BAA0B,UACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,uCAAiB;AAAA,EAClE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,kBAAkB,OAAO,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;;;ADNF,IAAO,cAAQ;","names":["import_payload_model"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin'\nexport * from './Witness'\n","import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ApiGraphqlWitness, GraphqlQuerySchema } from './Witness'\n\nexport const ApiGraphqlWitnessPlugin = () =>\n createPayloadSetWitnessPlugin<ApiGraphqlWitness>(\n { required: { [GraphqlQuerySchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await ApiGraphqlWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { WitnessConfig, WitnessParams } from '@xyo-network/witness-model'\nimport type { ExecutionResult } from 'graphql'\n\nexport const ApiGraphqlWitnessConfigSchema = 'network.xyo.api.witness.config'\nexport type ApiGraphqlWitnessConfigSchema = typeof ApiGraphqlWitnessConfigSchema\n\nexport type ApiGraphqlWitnessConfig = WitnessConfig<{\n endpoint?: string\n schema: ApiGraphqlWitnessConfigSchema\n timeout?: number\n}>\n\nexport type HttpHeaderValue = string | string[] | number | boolean | null\n\nexport interface HttpHeaders {\n [key: string]: HttpHeaderValue\n}\n\nexport type ApiGraphqlWitnessParams = WitnessParams<\n AnyConfigSchema<ApiGraphqlWitnessConfig>,\n {\n endpoint?: string\n headers?: HttpHeaders\n }\n>\n\nexport const GraphqlQuerySchema = 'network.xyo.graphql.query'\nexport type GraphqlQuerySchema = typeof GraphqlQuerySchema\n\nexport type GraphqlQuery = Payload<\n {\n query: string\n variables: Record<string, unknown>\n },\n GraphqlQuerySchema\n>\n\nexport const GraphqlResultSchema = 'network.xyo.graphql.result'\nexport type GraphqlResultSchema = typeof GraphqlResultSchema\n\nexport type GraphqlResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Payload<\n {\n http?: {\n code?: string\n ipAddress?: string\n status?: number\n }\n result?: ExecutionResult<TData, TExtensions>\n },\n GraphqlResultSchema\n>\n\nexport const isGraphqlQuery = isPayloadOfSchemaType<GraphqlQuery>(GraphqlQuerySchema)\n\nexport class ApiGraphqlWitness<TParams extends ApiGraphqlWitnessParams = ApiGraphqlWitnessParams> extends AbstractWitness<\n TParams,\n GraphqlQuery,\n GraphqlResult\n> {\n static override configSchemas = [ApiGraphqlWitnessConfigSchema]\n\n get endpoint() {\n return assertEx(this.config.endpoint ?? this.params.endpoint, 'No endpoint specified')\n }\n\n get headers() {\n return this.params.headers\n }\n\n get timeout() {\n return this.config.timeout\n }\n\n protected override async observeHandler(payloads?: GraphqlQuery[]): Promise<GraphqlResult[]> {\n await this.started('throw')\n const queries = payloads?.filter(isGraphqlQuery) ?? []\n const axios = new AxiosJson({ headers: this.headers, timeout: this.timeout })\n const observations = await Promise.all(\n queries.map(async ({ query, variables }) => {\n const httpResult = await axios.post(this.endpoint, { query, variables })\n const result: GraphqlResult = {\n http: {\n status: httpResult.status,\n },\n result: httpResult.data,\n schema: GraphqlResultSchema,\n }\n return result\n }),\n )\n return observations.flat()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,wBAAiC;AACjC,+BAA8C;;;ACD9C,oBAAyB;AACzB,mBAA0B;AAC1B,8BAAgC;AAEhC,2BAA+C;AAIxC,IAAM,gCAAgC;AAuBtC,IAAM,qBAAqB;AAW3B,IAAM,sBAAsB;AAe5B,IAAM,qBAAiB,4CAAoC,kBAAkB;AAE7E,IAAM,oBAAN,cAAmG,wCAIxG;AAAA,EACA,OAAgB,gBAAgB,CAAC,6BAA6B;AAAA,EAE9D,IAAI,WAAW;AACb,eAAO,wBAAS,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU,uBAAuB;AAAA,EACvF;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,MAAyB,eAAe,UAAqD;AAC3F,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,WAAU,qCAAU,OAAO,oBAAmB,CAAC;AACrD,UAAM,QAAQ,IAAI,uBAAU,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,QAAQ,CAAC;AAC5E,UAAM,eAAe,MAAM,QAAQ;AAAA,MACjC,QAAQ,IAAI,OAAO,EAAE,OAAO,UAAU,MAAM;AAC1C,cAAM,aAAa,MAAM,MAAM,KAAK,KAAK,UAAU,EAAE,OAAO,UAAU,CAAC;AACvE,cAAM,SAAwB;AAAA,UAC5B,MAAM;AAAA,YACJ,QAAQ,WAAW;AAAA,UACrB;AAAA,UACA,QAAQ,WAAW;AAAA,UACnB,QAAQ;AAAA,QACV;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;;;AD5FO,IAAM,0BAA0B,UACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,uCAAiB;AAAA,EAClE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,kBAAkB,OAAO,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;","names":["import_payload_model"]}
@@ -1,5 +1,3 @@
1
- import { ApiGraphqlWitnessPlugin } from './Plugin';
1
+ export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin';
2
2
  export * from './Witness';
3
- export { ApiGraphqlWitnessPlugin };
4
- export default ApiGraphqlWitnessPlugin;
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,eAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,IAAI,OAAO,EAAE,MAAM,UAAU,CAAA;AACtF,cAAc,WAAW,CAAA"}
@@ -1,5 +1,3 @@
1
- import { ApiGraphqlWitnessPlugin } from './Plugin';
1
+ export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin';
2
2
  export * from './Witness';
3
- export { ApiGraphqlWitnessPlugin };
4
- export default ApiGraphqlWitnessPlugin;
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,eAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,IAAI,OAAO,EAAE,MAAM,UAAU,CAAA;AACtF,cAAc,WAAW,CAAA"}
@@ -1,5 +1,3 @@
1
- import { ApiGraphqlWitnessPlugin } from './Plugin';
1
+ export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin';
2
2
  export * from './Witness';
3
- export { ApiGraphqlWitnessPlugin };
4
- export default ApiGraphqlWitnessPlugin;
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,eAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,IAAI,OAAO,EAAE,MAAM,UAAU,CAAA;AACtF,cAAc,WAAW,CAAA"}
@@ -52,16 +52,13 @@ var ApiGraphqlWitnessPlugin = () => createPayloadSetWitnessPlugin(
52
52
  }
53
53
  }
54
54
  );
55
-
56
- // src/index.ts
57
- var src_default = ApiGraphqlWitnessPlugin;
58
55
  export {
59
56
  ApiGraphqlWitness,
60
57
  ApiGraphqlWitnessConfigSchema,
61
58
  ApiGraphqlWitnessPlugin,
62
59
  GraphqlQuerySchema,
63
60
  GraphqlResultSchema,
64
- src_default as default,
61
+ ApiGraphqlWitnessPlugin as default,
65
62
  isGraphqlQuery
66
63
  };
67
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts","../../src/index.ts"],"sourcesContent":["import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ApiGraphqlWitness, GraphqlQuerySchema } from './Witness'\n\nexport const ApiGraphqlWitnessPlugin = () =>\n createPayloadSetWitnessPlugin<ApiGraphqlWitness>(\n { required: { [GraphqlQuerySchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await ApiGraphqlWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { WitnessConfig, WitnessParams } from '@xyo-network/witness-model'\nimport type { ExecutionResult } from 'graphql'\n\nexport const ApiGraphqlWitnessConfigSchema = 'network.xyo.api.witness.config'\nexport type ApiGraphqlWitnessConfigSchema = typeof ApiGraphqlWitnessConfigSchema\n\nexport type ApiGraphqlWitnessConfig = WitnessConfig<{\n endpoint?: string\n schema: ApiGraphqlWitnessConfigSchema\n timeout?: number\n}>\n\nexport type HttpHeaderValue = string | string[] | number | boolean | null\n\nexport interface HttpHeaders {\n [key: string]: HttpHeaderValue\n}\n\nexport type ApiGraphqlWitnessParams = WitnessParams<\n AnyConfigSchema<ApiGraphqlWitnessConfig>,\n {\n endpoint?: string\n headers?: HttpHeaders\n }\n>\n\nexport const GraphqlQuerySchema = 'network.xyo.graphql.query'\nexport type GraphqlQuerySchema = typeof GraphqlQuerySchema\n\nexport type GraphqlQuery = Payload<\n {\n query: string\n variables: Record<string, unknown>\n },\n GraphqlQuerySchema\n>\n\nexport const GraphqlResultSchema = 'network.xyo.graphql.result'\nexport type GraphqlResultSchema = typeof GraphqlResultSchema\n\nexport type GraphqlResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Payload<\n {\n http?: {\n code?: string\n ipAddress?: string\n status?: number\n }\n result?: ExecutionResult<TData, TExtensions>\n },\n GraphqlResultSchema\n>\n\nexport const isGraphqlQuery = isPayloadOfSchemaType<GraphqlQuery>(GraphqlQuerySchema)\n\nexport class ApiGraphqlWitness<TParams extends ApiGraphqlWitnessParams = ApiGraphqlWitnessParams> extends AbstractWitness<\n TParams,\n GraphqlQuery,\n GraphqlResult\n> {\n static override configSchemas = [ApiGraphqlWitnessConfigSchema]\n\n get endpoint() {\n return assertEx(this.config.endpoint ?? this.params.endpoint, 'No endpoint specified')\n }\n\n get headers() {\n return this.params.headers\n }\n\n get timeout() {\n return this.config.timeout\n }\n\n protected override async observeHandler(payloads?: GraphqlQuery[]): Promise<GraphqlResult[]> {\n await this.started('throw')\n const queries = payloads?.filter(isGraphqlQuery) ?? []\n const axios = new AxiosJson({ headers: this.headers, timeout: this.timeout })\n const observations = await Promise.all(\n queries.map(async ({ query, variables }) => {\n const httpResult = await axios.post(this.endpoint, { query, variables })\n const result: GraphqlResult = {\n http: {\n status: httpResult.status,\n },\n result: httpResult.data,\n schema: GraphqlResultSchema,\n }\n return result\n }),\n )\n return observations.flat()\n }\n}\n","import { ApiGraphqlWitnessPlugin } from './Plugin'\n\nexport * from './Witness'\n\nexport { ApiGraphqlWitnessPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default ApiGraphqlWitnessPlugin\n"],"mappings":";AAAA,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACD9C,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAEhC,SAAS,6BAAsC;AAIxC,IAAM,gCAAgC;AAuBtC,IAAM,qBAAqB;AAW3B,IAAM,sBAAsB;AAe5B,IAAM,iBAAiB,sBAAoC,kBAAkB;AAE7E,IAAM,oBAAN,cAAmG,gBAIxG;AAAA,EACA,OAAgB,gBAAgB,CAAC,6BAA6B;AAAA,EAE9D,IAAI,WAAW;AACb,WAAO,SAAS,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU,uBAAuB;AAAA,EACvF;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,MAAyB,eAAe,UAAqD;AAC3F,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,WAAU,qCAAU,OAAO,oBAAmB,CAAC;AACrD,UAAM,QAAQ,IAAI,UAAU,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,QAAQ,CAAC;AAC5E,UAAM,eAAe,MAAM,QAAQ;AAAA,MACjC,QAAQ,IAAI,OAAO,EAAE,OAAO,UAAU,MAAM;AAC1C,cAAM,aAAa,MAAM,MAAM,KAAK,KAAK,UAAU,EAAE,OAAO,UAAU,CAAC;AACvE,cAAM,SAAwB;AAAA,UAC5B,MAAM;AAAA,YACJ,QAAQ,WAAW;AAAA,UACrB;AAAA,UACA,QAAQ,WAAW;AAAA,UACnB,QAAQ;AAAA,QACV;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;;;AD5FO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EAClE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,kBAAkB,OAAO,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;;;AENF,IAAO,cAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ApiGraphqlWitness, GraphqlQuerySchema } from './Witness'\n\nexport const ApiGraphqlWitnessPlugin = () =>\n createPayloadSetWitnessPlugin<ApiGraphqlWitness>(\n { required: { [GraphqlQuerySchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await ApiGraphqlWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { AxiosJson } from '@xylabs/axios'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\nimport { WitnessConfig, WitnessParams } from '@xyo-network/witness-model'\nimport type { ExecutionResult } from 'graphql'\n\nexport const ApiGraphqlWitnessConfigSchema = 'network.xyo.api.witness.config'\nexport type ApiGraphqlWitnessConfigSchema = typeof ApiGraphqlWitnessConfigSchema\n\nexport type ApiGraphqlWitnessConfig = WitnessConfig<{\n endpoint?: string\n schema: ApiGraphqlWitnessConfigSchema\n timeout?: number\n}>\n\nexport type HttpHeaderValue = string | string[] | number | boolean | null\n\nexport interface HttpHeaders {\n [key: string]: HttpHeaderValue\n}\n\nexport type ApiGraphqlWitnessParams = WitnessParams<\n AnyConfigSchema<ApiGraphqlWitnessConfig>,\n {\n endpoint?: string\n headers?: HttpHeaders\n }\n>\n\nexport const GraphqlQuerySchema = 'network.xyo.graphql.query'\nexport type GraphqlQuerySchema = typeof GraphqlQuerySchema\n\nexport type GraphqlQuery = Payload<\n {\n query: string\n variables: Record<string, unknown>\n },\n GraphqlQuerySchema\n>\n\nexport const GraphqlResultSchema = 'network.xyo.graphql.result'\nexport type GraphqlResultSchema = typeof GraphqlResultSchema\n\nexport type GraphqlResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> = Payload<\n {\n http?: {\n code?: string\n ipAddress?: string\n status?: number\n }\n result?: ExecutionResult<TData, TExtensions>\n },\n GraphqlResultSchema\n>\n\nexport const isGraphqlQuery = isPayloadOfSchemaType<GraphqlQuery>(GraphqlQuerySchema)\n\nexport class ApiGraphqlWitness<TParams extends ApiGraphqlWitnessParams = ApiGraphqlWitnessParams> extends AbstractWitness<\n TParams,\n GraphqlQuery,\n GraphqlResult\n> {\n static override configSchemas = [ApiGraphqlWitnessConfigSchema]\n\n get endpoint() {\n return assertEx(this.config.endpoint ?? this.params.endpoint, 'No endpoint specified')\n }\n\n get headers() {\n return this.params.headers\n }\n\n get timeout() {\n return this.config.timeout\n }\n\n protected override async observeHandler(payloads?: GraphqlQuery[]): Promise<GraphqlResult[]> {\n await this.started('throw')\n const queries = payloads?.filter(isGraphqlQuery) ?? []\n const axios = new AxiosJson({ headers: this.headers, timeout: this.timeout })\n const observations = await Promise.all(\n queries.map(async ({ query, variables }) => {\n const httpResult = await axios.post(this.endpoint, { query, variables })\n const result: GraphqlResult = {\n http: {\n status: httpResult.status,\n },\n result: httpResult.data,\n schema: GraphqlResultSchema,\n }\n return result\n }),\n )\n return observations.flat()\n }\n}\n"],"mappings":";AAAA,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACD9C,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAEhC,SAAS,6BAAsC;AAIxC,IAAM,gCAAgC;AAuBtC,IAAM,qBAAqB;AAW3B,IAAM,sBAAsB;AAe5B,IAAM,iBAAiB,sBAAoC,kBAAkB;AAE7E,IAAM,oBAAN,cAAmG,gBAIxG;AAAA,EACA,OAAgB,gBAAgB,CAAC,6BAA6B;AAAA,EAE9D,IAAI,WAAW;AACb,WAAO,SAAS,KAAK,OAAO,YAAY,KAAK,OAAO,UAAU,uBAAuB;AAAA,EACvF;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,MAAyB,eAAe,UAAqD;AAC3F,UAAM,KAAK,QAAQ,OAAO;AAC1B,UAAM,WAAU,qCAAU,OAAO,oBAAmB,CAAC;AACrD,UAAM,QAAQ,IAAI,UAAU,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,QAAQ,CAAC;AAC5E,UAAM,eAAe,MAAM,QAAQ;AAAA,MACjC,QAAQ,IAAI,OAAO,EAAE,OAAO,UAAU,MAAM;AAC1C,cAAM,aAAa,MAAM,MAAM,KAAK,KAAK,UAAU,EAAE,OAAO,UAAU,CAAC;AACvE,cAAM,SAAwB;AAAA,UAC5B,MAAM;AAAA,YACJ,QAAQ,WAAW;AAAA,UACrB;AAAA,UACA,QAAQ,WAAW;AAAA,UACnB,QAAQ;AAAA,QACV;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;;;AD5FO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,kBAAkB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EAClE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,kBAAkB,OAAO,MAAM;AAAA,IAC9C;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -10,19 +10,19 @@
10
10
  "url": "https://github.com/XYOracleNetwork/plugins/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/assert": "^2.13.20",
14
- "@xylabs/axios": "^2.13.20",
15
- "@xyo-network/abstract-witness": "^2.84.18",
16
- "@xyo-network/module-model": "^2.84.18",
17
- "@xyo-network/payload-model": "^2.84.18",
18
- "@xyo-network/payloadset-plugin": "^2.84.18",
19
- "@xyo-network/witness-model": "^2.84.18"
13
+ "@xylabs/assert": "^2.13.22",
14
+ "@xylabs/axios": "^2.13.22",
15
+ "@xyo-network/abstract-witness": "^2.85.3",
16
+ "@xyo-network/module-model": "^2.85.3",
17
+ "@xyo-network/payload-model": "^2.85.3",
18
+ "@xyo-network/payloadset-plugin": "^2.85.3",
19
+ "@xyo-network/witness-model": "^2.85.3"
20
20
  },
21
21
  "devDependencies": {
22
- "@xylabs/jest-helpers": "^2.13.20",
22
+ "@xylabs/jest-helpers": "^2.13.22",
23
23
  "@xylabs/ts-scripts-yarn3": "^3.2.25",
24
24
  "@xylabs/tsconfig": "^3.2.25",
25
- "@xyo-network/account": "^2.84.18",
25
+ "@xyo-network/account": "^2.85.3",
26
26
  "ethers": "^6.9.1",
27
27
  "graphql": "^16.8.1",
28
28
  "jest": "^29.7.0",
@@ -67,6 +67,6 @@
67
67
  "url": "https://github.com/XYOracleNetwork/plugins.git"
68
68
  },
69
69
  "sideEffects": false,
70
- "version": "2.84.5",
70
+ "version": "2.85.1",
71
71
  "type": "module"
72
72
  }
package/src/index.ts CHANGED
@@ -1,8 +1,2 @@
1
- import { ApiGraphqlWitnessPlugin } from './Plugin'
2
-
1
+ export { ApiGraphqlWitnessPlugin, ApiGraphqlWitnessPlugin as default } from './Plugin'
3
2
  export * from './Witness'
4
-
5
- export { ApiGraphqlWitnessPlugin }
6
-
7
- // eslint-disable-next-line import/no-default-export
8
- export default ApiGraphqlWitnessPlugin