@executor-js/plugin-graphql 0.2.1 → 1.4.21
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/{AddGraphqlSource-LGXJQEAR.js → AddGraphqlSource-3Z3DB4KQ.js} +3 -3
- package/dist/{EditGraphqlSource-5Y47ZAZ7.js → EditGraphqlSource-F37RPNKV.js} +4 -4
- package/dist/{EditGraphqlSource-5Y47ZAZ7.js.map → EditGraphqlSource-F37RPNKV.js.map} +1 -1
- package/dist/{GraphqlSourceSummary-F3JWR4YN.js → GraphqlSourceSummary-6EYBXVD2.js} +3 -3
- package/dist/api/group.d.ts +38 -3
- package/dist/api/handlers.d.ts +38 -2
- package/dist/api/index.d.ts +76 -4
- package/dist/{chunk-7QSGNR4C.js → chunk-445ZPXHU.js} +18 -32
- package/dist/chunk-445ZPXHU.js.map +1 -0
- package/dist/{chunk-WPRU5C6M.js → chunk-EW4Y3KEX.js} +4 -4
- package/dist/chunk-EW4Y3KEX.js.map +1 -0
- package/dist/{chunk-HDPYOBBG.js → chunk-PO2TPM5B.js} +16 -13
- package/dist/chunk-PO2TPM5B.js.map +1 -0
- package/dist/client.js +3 -3
- package/dist/core.js +2 -2
- package/dist/index.js +2 -2
- package/dist/react/atoms.d.ts +38 -2
- package/dist/react/client.d.ts +38 -2
- package/dist/sdk/invoke.d.ts +16 -3
- package/dist/sdk/plugin.d.ts +77 -5
- package/dist/sdk/types.d.ts +46 -51
- package/package.json +3 -3
- package/dist/chunk-7QSGNR4C.js.map +0 -1
- package/dist/chunk-HDPYOBBG.js.map +0 -1
- package/dist/chunk-WPRU5C6M.js.map +0 -1
- /package/dist/{AddGraphqlSource-LGXJQEAR.js.map → AddGraphqlSource-3Z3DB4KQ.js.map} +0 -0
- /package/dist/{GraphqlSourceSummary-F3JWR4YN.js.map → GraphqlSourceSummary-6EYBXVD2.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts"],"sourcesContent":["import type { ScopeId } from \"@executor-js/sdk/core\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { sourcesOptimisticAtom } from \"@executor-js/react/api/atoms\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { GraphqlClient } from \"./client\";\n\n// ---------------------------------------------------------------------------\n// Query atoms\n// ---------------------------------------------------------------------------\n\nexport const graphqlSourceAtom = (scopeId: ScopeId, namespace: string) =>\n GraphqlClient.query(\"graphql\", \"getSource\", {\n params: { scopeId, namespace },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.sources, ReactivityKey.tools],\n });\n\nexport const graphqlSourceBindingsAtom = (\n scopeId: ScopeId,\n namespace: string,\n sourceScopeId: ScopeId,\n) =>\n GraphqlClient.query(\"graphql\", \"listSourceBindings\", {\n params: { scopeId, namespace, sourceScopeId },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.sources, ReactivityKey.secrets, ReactivityKey.connections],\n });\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const addGraphqlSource = GraphqlClient.mutation(\"graphql\", \"addSource\");\n\nexport const addGraphqlSourceOptimistic = Atom.family((scopeId: ScopeId) =>\n sourcesOptimisticAtom(scopeId).pipe(\n Atom.optimisticFn({\n reducer: (current, arg) =>\n AsyncResult.map(current, (rows) => {\n const id = arg.payload.namespace ?? `pending-${Math.random().toString(36).slice(2)}`;\n const source = {\n id,\n scopeId: arg.payload.targetScope,\n kind: \"graphql\",\n pluginId: \"graphql\",\n name: arg.payload.name ?? id,\n url: arg.payload.endpoint,\n canRemove: false,\n canRefresh: false,\n canEdit: false,\n runtime: false,\n };\n return [source, ...rows.filter((row) => row.id !== id)].sort((a, b) =>\n a.name.localeCompare(b.name),\n );\n }),\n fn: addGraphqlSource,\n }),\n ),\n);\n\nexport const updateGraphqlSource = GraphqlClient.mutation(\"graphql\", \"updateSource\");\n\nexport const setGraphqlSourceBinding = GraphqlClient.mutation(\"graphql\", \"setSourceBinding\");\n\nexport const removeGraphqlSourceBinding = GraphqlClient.mutation(\"graphql\", \"removeSourceBinding\");\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport { getBaseUrl } from \"@executor-js/react/api/base-url\";\nimport { GraphqlGroup } from \"../api/group\";\n\nexport const GraphqlClient = createPluginAtomClient(GraphqlGroup, {\n baseUrl: getBaseUrl,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport { InternalError, ScopeId } from \"@executor-js/sdk/core\";\n\nimport { GraphqlIntrospectionError, GraphqlExtractionError } from \"../sdk/errors\";\nimport {\n ConfiguredGraphqlCredentialValue,\n GraphqlCredentialInput,\n GraphqlSourceAuth,\n GraphqlSourceAuthInput,\n GraphqlSourceBindingInputSchema,\n GraphqlSourceBindingRef,\n} from \"../sdk/types\";\n\n// StoredGraphqlSource shape as an HTTP response schema. Kept local to the\n// api layer because the sdk-side `StoredGraphqlSource` is a plain interface.\nexport const StoredSourceSchema = Schema.Struct({\n namespace: Schema.String,\n scope: ScopeId,\n name: Schema.String,\n endpoint: Schema.String,\n headers: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue),\n queryParams: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue),\n auth: GraphqlSourceAuth,\n});\n\n// ---------------------------------------------------------------------------\n// Params\n// ---------------------------------------------------------------------------\n\nconst ScopeParams = {\n scopeId: ScopeId,\n};\n\nconst SourceParams = {\n scopeId: ScopeId,\n namespace: Schema.String,\n};\n\nconst SourceBindingParams = {\n scopeId: ScopeId,\n namespace: Schema.String,\n sourceScopeId: ScopeId,\n};\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst AddSourcePayload = Schema.Struct({\n targetScope: ScopeId,\n endpoint: Schema.String,\n name: Schema.optional(Schema.String),\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n credentialTargetScope: Schema.optional(ScopeId),\n auth: Schema.optional(GraphqlSourceAuthInput),\n});\n\nconst UpdateSourcePayload = Schema.Struct({\n sourceScope: ScopeId,\n name: Schema.optional(Schema.String),\n endpoint: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n credentialTargetScope: Schema.optional(ScopeId),\n auth: Schema.optional(GraphqlSourceAuthInput),\n});\n\nconst UpdateSourceResponse = Schema.Struct({\n updated: Schema.Boolean,\n});\n\nconst RemoveBindingPayload = Schema.Struct({\n sourceId: Schema.String,\n sourceScope: ScopeId,\n slot: Schema.String,\n scope: ScopeId,\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst AddSourceResponse = Schema.Struct({\n toolCount: Schema.Number,\n namespace: Schema.String,\n});\n\n// ---------------------------------------------------------------------------\n// Errors with HTTP status\n// ---------------------------------------------------------------------------\n\nconst IntrospectionError = GraphqlIntrospectionError.annotate({ httpApiStatus: 400 });\nconst ExtractionError = GraphqlExtractionError.annotate({ httpApiStatus: 400 });\n\n// ---------------------------------------------------------------------------\n// Group\n//\n// Plugin SDK errors (GraphqlIntrospectionError etc.) are declared once at\n// the group level via `.addError(...)` — every endpoint inherits them. The\n// errors themselves carry their HTTP status via `HttpApiSchema.annotations`\n// above, so handlers just `return yield* ext.foo(...)` and the schema\n// encodes whatever it gets.\n//\n// 5xx is handled at the API level: `.addError(InternalError)` adds a\n// single shared opaque-by-schema 500 surface translated from `StorageError`\n// by `withCapture` at the HTTP edge. No per-handler wrapping, no\n// per-plugin InternalError.\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrors = [InternalError, IntrospectionError, ExtractionError] as const;\n\nexport const GraphqlGroup = HttpApiGroup.make(\"graphql\")\n .add(\n HttpApiEndpoint.post(\"addSource\", \"/scopes/:scopeId/graphql/sources\", {\n params: ScopeParams,\n payload: AddSourcePayload,\n success: AddSourceResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getSource\", \"/scopes/:scopeId/graphql/sources/:namespace\", {\n params: SourceParams,\n success: Schema.NullOr(StoredSourceSchema),\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.patch(\"updateSource\", \"/scopes/:scopeId/graphql/sources/:namespace\", {\n params: SourceParams,\n payload: UpdateSourcePayload,\n success: UpdateSourceResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\n \"listSourceBindings\",\n \"/scopes/:scopeId/graphql/sources/:namespace/base/:sourceScopeId/bindings\",\n {\n params: SourceBindingParams,\n success: Schema.Array(GraphqlSourceBindingRef),\n error: GraphqlErrors,\n },\n ),\n )\n .add(\n HttpApiEndpoint.post(\"setSourceBinding\", \"/scopes/:scopeId/graphql/source-bindings\", {\n params: ScopeParams,\n payload: GraphqlSourceBindingInputSchema,\n success: GraphqlSourceBindingRef,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"removeSourceBinding\", \"/scopes/:scopeId/graphql/source-bindings/remove\", {\n params: ScopeParams,\n payload: RemoveBindingPayload,\n success: Schema.Struct({ removed: Schema.Boolean }),\n error: GraphqlErrors,\n }),\n );\n// Plugin domain errors carry their own HTTP status (4xx);\n// `InternalError` is the shared opaque 500 translated at the HTTP edge.\n"],"mappings":";;;;;;;;;;;;AACA,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;;;ACJ9B,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;;;ACD3B,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,cAA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