@xyo-network/api-graphql-plugin 2.85.0 → 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.
- package/dist/browser/Plugin.d.cts +0 -2
- package/dist/browser/Plugin.d.cts.map +1 -1
- package/dist/browser/Plugin.d.mts +0 -2
- package/dist/browser/Plugin.d.mts.map +1 -1
- package/dist/browser/Plugin.d.ts +0 -2
- package/dist/browser/Plugin.d.ts.map +1 -1
- package/dist/browser/index.cjs +1 -4
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +1 -3
- package/dist/browser/index.d.cts.map +1 -1
- package/dist/browser/index.d.mts +1 -3
- package/dist/browser/index.d.mts.map +1 -1
- package/dist/browser/index.d.ts +1 -3
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +1 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/node/Plugin.d.cts +0 -2
- package/dist/node/Plugin.d.cts.map +1 -1
- package/dist/node/Plugin.d.mts +0 -2
- package/dist/node/Plugin.d.mts.map +1 -1
- package/dist/node/Plugin.d.ts +0 -2
- package/dist/node/Plugin.d.ts.map +1 -1
- package/dist/node/index.cjs +1 -4
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1 -3
- package/dist/node/index.d.cts.map +1 -1
- package/dist/node/index.d.mts +1 -3
- package/dist/node/index.d.mts.map +1 -1
- package/dist/node/index.d.ts +1 -3
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -4
- package/dist/node/index.js.map +1 -1
- package/package.json +10 -10
- package/src/index.ts +1 -7
|
@@ -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
|
-
accountPath?: 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
|
-
accountPath?: 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;
|
|
@@ -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
|
|
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
|
-
accountPath?: 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
|
-
accountPath?: 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;
|
|
@@ -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
|
|
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"}
|
package/dist/browser/Plugin.d.ts
CHANGED
|
@@ -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
|
-
accountPath?: 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
|
-
accountPath?: 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;
|
|
@@ -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
|
|
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"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@ __export(src_exports, {
|
|
|
25
25
|
ApiGraphqlWitnessPlugin: () => ApiGraphqlWitnessPlugin,
|
|
26
26
|
GraphqlQuerySchema: () => GraphqlQuerySchema,
|
|
27
27
|
GraphqlResultSchema: () => GraphqlResultSchema,
|
|
28
|
-
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":["
|
|
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"]}
|
package/dist/browser/index.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
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,
|
|
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"}
|
package/dist/browser/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
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,
|
|
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"}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
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,
|
|
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"}
|
package/dist/browser/index.js
CHANGED
|
@@ -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
|
-
|
|
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"
|
|
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":[]}
|
package/dist/node/Plugin.d.cts
CHANGED
|
@@ -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
|
-
accountPath?: 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
|
-
accountPath?: 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;
|
|
@@ -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
|
|
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"}
|
package/dist/node/Plugin.d.mts
CHANGED
|
@@ -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
|
-
accountPath?: 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
|
-
accountPath?: 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;
|
|
@@ -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
|
|
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"}
|
package/dist/node/Plugin.d.ts
CHANGED
|
@@ -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
|
-
accountPath?: 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
|
-
accountPath?: 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;
|
|
@@ -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
|
|
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"}
|
package/dist/node/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@ __export(src_exports, {
|
|
|
25
25
|
ApiGraphqlWitnessPlugin: () => ApiGraphqlWitnessPlugin,
|
|
26
26
|
GraphqlQuerySchema: () => GraphqlQuerySchema,
|
|
27
27
|
GraphqlResultSchema: () => GraphqlResultSchema,
|
|
28
|
-
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,
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Witness.ts"],"sourcesContent":["
|
|
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"]}
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
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,
|
|
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"}
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
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,
|
|
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"}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
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
|
package/dist/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,
|
|
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"}
|
package/dist/node/index.js
CHANGED
|
@@ -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
|
-
|
|
61
|
+
ApiGraphqlWitnessPlugin as default,
|
|
65
62
|
isGraphqlQuery
|
|
66
63
|
};
|
|
67
64
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Plugin.ts","../../src/Witness.ts"
|
|
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.
|
|
14
|
-
"@xylabs/axios": "^2.13.
|
|
15
|
-
"@xyo-network/abstract-witness": "^2.85.
|
|
16
|
-
"@xyo-network/module-model": "^2.85.
|
|
17
|
-
"@xyo-network/payload-model": "^2.85.
|
|
18
|
-
"@xyo-network/payloadset-plugin": "^2.85.
|
|
19
|
-
"@xyo-network/witness-model": "^2.85.
|
|
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.
|
|
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.85.
|
|
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.85.
|
|
70
|
+
"version": "2.85.1",
|
|
71
71
|
"type": "module"
|
|
72
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
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
|