@nxgt/shared-graphql 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/directives/federation.d.ts +2 -0
- package/dist/directives/federation.d.ts.map +1 -0
- package/dist/directives/index.d.ts +2 -0
- package/dist/directives/index.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +907 -0
- package/dist/index.js.map +31 -0
- package/dist/integrations/hono.d.ts +13 -0
- package/dist/integrations/hono.d.ts.map +1 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/plugins/auth.d.ts +4 -0
- package/dist/plugins/auth.d.ts.map +1 -0
- package/dist/plugins/extract-jwt.d.ts +9 -0
- package/dist/plugins/extract-jwt.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/ory-auth.d.ts +55 -0
- package/dist/plugins/ory-auth.d.ts.map +1 -0
- package/dist/scalars/any/any.scalars.d.ts +5 -0
- package/dist/scalars/any/any.scalars.d.ts.map +1 -0
- package/dist/scalars/any/index.d.ts +2 -0
- package/dist/scalars/any/index.d.ts.map +1 -0
- package/dist/scalars/custom/custom.scalars.d.ts +3 -0
- package/dist/scalars/custom/custom.scalars.d.ts.map +1 -0
- package/dist/scalars/custom/index.d.ts +2 -0
- package/dist/scalars/custom/index.d.ts.map +1 -0
- package/dist/scalars/custom/utils.d.ts +8 -0
- package/dist/scalars/custom/utils.d.ts.map +1 -0
- package/dist/scalars/index.d.ts +3 -0
- package/dist/scalars/index.d.ts.map +1 -0
- package/dist/scalars/upload/index.d.ts +2 -0
- package/dist/scalars/upload/index.d.ts.map +1 -0
- package/dist/scalars/upload/upload.scalar.d.ts +4 -0
- package/dist/scalars/upload/upload.scalar.d.ts.map +1 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +28 -0
- package/dist/security/index.js.map +11 -0
- package/dist/security/policies/evaluation.service.d.ts +9 -0
- package/dist/security/policies/evaluation.service.d.ts.map +1 -0
- package/dist/security/policies/exaluation.utils.d.ts +4 -0
- package/dist/security/policies/exaluation.utils.d.ts.map +1 -0
- package/dist/security/policies/index.d.ts +3 -0
- package/dist/security/policies/index.d.ts.map +1 -0
- package/dist/security/policies/policy.types.d.ts +3 -0
- package/dist/security/policies/policy.types.d.ts.map +1 -0
- package/dist/shared.d.ts +2 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/types/context.d.ts +14 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/graphql.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/upload.d.ts +3 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/utils/change-resolvers.utils.d.ts +66 -0
- package/dist/utils/change-resolvers.utils.d.ts.map +1 -0
- package/dist/utils/codegen.utils.d.ts +68 -0
- package/dist/utils/codegen.utils.d.ts.map +1 -0
- package/dist/utils/data-loader.utils.d.ts +14 -0
- package/dist/utils/data-loader.utils.d.ts.map +1 -0
- package/dist/utils/errors.utils.d.ts +23 -0
- package/dist/utils/errors.utils.d.ts.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/publish.d.ts +8 -0
- package/dist/utils/publish.d.ts.map +1 -0
- package/dist/utils/sandbox.d.ts +9 -0
- package/dist/utils/sandbox.d.ts.map +1 -0
- package/dist/utils/schema.utils.d.ts +11 -0
- package/dist/utils/schema.utils.d.ts.map +1 -0
- package/dist/utils/websocket.d.ts +11 -0
- package/dist/utils/websocket.d.ts.map +1 -0
- package/dist/utils/ws-context.d.ts +24 -0
- package/dist/utils/ws-context.d.ts.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../src/directives/federation.ts", "../src/integrations/hono.ts", "../src/utils/change-resolvers.utils.ts", "../src/utils/codegen.utils.ts", "../src/utils/data-loader.utils.ts", "../src/utils/errors.utils.ts", "../src/utils/publish.ts", "../src/utils/sandbox.ts", "../src/utils/schema.utils.ts", "../src/utils/websocket.ts", "../src/utils/ws-context.ts", "../src/plugins/auth.ts", "../src/plugins/extract-jwt.ts", "../src/plugins/ory-auth.ts", "../src/scalars/any/any.scalars.ts", "../src/scalars/custom/custom.scalars.ts", "../src/scalars/custom/utils.ts", "../src/scalars/upload/upload.scalar.ts", "../src/scalars/index.ts", "../src/shared.ts", "../src/upload.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import DataLoader from 'dataloader';\n\nexport * from 'graphql-subscriptions';\nexport * from './directives';\nexport * from './integrations';\nexport * from './plugins';\nexport * from './scalars';\nexport * from './shared';\nexport * from './types';\nexport * from './upload';\nexport * from './utils';\n\nexport { DataLoader };\n",
|
|
6
|
+
"export const FEDERATION_DIRECTIVES = `\ndirective @external on FIELD_DEFINITION | OBJECT\ndirective @requires(fields: FieldSet!) on FIELD_DEFINITION\ndirective @provides(fields: FieldSet!) on FIELD_DEFINITION\ndirective @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE\ndirective @shareable repeatable on OBJECT | FIELD_DEFINITION\ndirective @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION\ndirective @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION\ndirective @override(from: String!) on FIELD_DEFINITION\ndirective @composeDirective(name: String!) repeatable on SCHEMA\ndirective @interfaceObject on OBJECT\ndirective @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM\n`;\n",
|
|
7
|
+
"import type { YogaInitialContext, YogaServerInstance } from 'graphql-yoga';\nimport { Hono } from 'hono';\nimport { contextStorage } from 'hono/context-storage';\nimport { createMiddleware } from 'hono/factory';\nimport { languageDetector } from 'hono/language';\nimport { type RenderSandboxOptions, renderSandbox } from '../utils';\n\nexport function sandboxExpolorer(options: RenderSandboxOptions) {\n\treturn createMiddleware(async (ctx) => {\n\t\treturn ctx.html(renderSandbox(options));\n\t});\n}\n\ntype HonoYogaOptions = {\n\tsandbox?: RenderSandboxOptions & { endpoint?: string };\n};\n\nexport function honoYoga<\n\tServerContext extends Partial<YogaInitialContext>,\n\tUserContext extends {},\n>(yoga: YogaServerInstance<ServerContext, UserContext>) {\n\treturn createMiddleware(async (ctx) => {\n\t\tconst response = await yoga.fetch(ctx.req.raw);\n\n\t\treturn response;\n\t});\n}\n\nexport function createYogaHono<\n\tServerContext extends Partial<YogaInitialContext>,\n\tUserContext extends {},\n>(\n\tyoga: YogaServerInstance<ServerContext, UserContext>,\n\toptions?: HonoYogaOptions,\n) {\n\tconst app = new Hono();\n\n\tapp.use(contextStorage());\n\tapp.use(\n\t\tlanguageDetector({\n\t\t\torder: ['header'],\n\t\t\tsupportedLanguages: ['en', 'fr'],\n\t\t\tfallbackLanguage: 'en',\n\t\t\tcaches: [],\n\t\t}),\n\t);\n\n\tapp.get('/health', (ctx) => {\n\t\treturn ctx.json({ status: 'ok' }, 200);\n\t});\n\n\tapp.get(\n\t\toptions?.sandbox?.endpoint || 'sandbox',\n\t\tsandboxExpolorer(options?.sandbox || {}),\n\t);\n\n\tapp.use(yoga.graphqlEndpoint, honoYoga(yoga));\n\n\treturn app;\n}\n",
|
|
8
|
+
"import {\n\tAUDIT_EVENT,\n\ttype Audit,\n\ttype AuditService,\n\tCommitType,\n} from '@nxgt/shared-mongo';\nimport { withFilter } from 'graphql-subscriptions';\n\n/**\n * Minimal structural shape of the app's pubsub instance. Kept structural so\n * this factory does not couple to a specific `graphql-yoga` `PubSub<...>`\n * instantiation.\n */\nexport type ChangeResolversPubSub = {\n\tsubscribe: (event: string) => any;\n};\n\n/**\n * Minimal structural shape of the context every subgraph builds: an\n * `AuditService` under `services.audit`, plus the module's own CRUD service\n * exposing `findById`.\n */\nexport type ChangeResolversContext = {\n\tservices: {\n\t\taudit: AuditService;\n\t\t[key: string]: any;\n\t};\n};\n\nexport type CreateChangeResolversConfig = {\n\t/**\n\t * Singular camelCase entity name used to build the resolver field names:\n\t * `bed` -> `bedChanges`, `bedChangesById`, `bedChanged`.\n\t */\n\tentity: string;\n\t/**\n\t * Mongo collection name, i.e. `BedModel.collection.collectionName`.\n\t */\n\tcollection: string;\n\t/**\n\t * Key of the module's CRUD service on `context.services`, i.e. `beds`.\n\t */\n\tservice: string;\n\t/**\n\t * The app's pubsub instance, or a getter returning it. Prefer the getter\n\t * form (`() => pubsub`) when the app can re-create its pubsub at runtime,\n\t * so the subscription always resolves against the current instance.\n\t */\n\tpubsub: ChangeResolversPubSub | (() => ChangeResolversPubSub);\n};\n\nexport type ChangeResolvers = {\n\tQuery: Record<string, any>;\n\tSubscription: Record<string, any>;\n};\n\n/**\n * Builds the audit change-stream resolver block that is otherwise repeated\n * verbatim in every module's `*.resolver.ts`: the two paginated `Changes`\n * queries and the `Changed` subscription.\n *\n * ```ts\n * const changes = createChangeResolvers({\n * entity: 'bed',\n * collection: BedModel.collection.collectionName,\n * service: 'beds',\n * pubsub: () => pubsub,\n * });\n *\n * export const beds: Resolvers = {\n * Query: { bed: ..., beds: ..., ...changes.Query },\n * Subscription: { ...changes.Subscription },\n * };\n * ```\n */\nexport function createChangeResolvers(\n\tconfig: CreateChangeResolversConfig,\n): ChangeResolvers {\n\tconst { entity, collection, service, pubsub } = config;\n\n\tconst resolvePubSub = () =>\n\t\ttypeof pubsub === 'function' ? pubsub() : pubsub;\n\n\treturn {\n\t\tQuery: {\n\t\t\t[`${entity}Changes`]: async (\n\t\t\t\t_parent: unknown,\n\t\t\t\targs: any,\n\t\t\t\tcontext: ChangeResolversContext,\n\t\t\t) =>\n\t\t\t\tcontext.services.audit.findChangesPaginatedByCollection(\n\t\t\t\t\tcollection,\n\t\t\t\t\targs,\n\t\t\t\t),\n\t\t\t[`${entity}ChangesById`]: async (\n\t\t\t\t_parent: unknown,\n\t\t\t\targs: any,\n\t\t\t\tcontext: ChangeResolversContext,\n\t\t\t) =>\n\t\t\t\tcontext.services.audit.findChangesPaginatedByCollectionAndOid(\n\t\t\t\t\targs.id,\n\t\t\t\t\tcollection,\n\t\t\t\t\targs,\n\t\t\t\t),\n\t\t},\n\t\tSubscription: {\n\t\t\t[`${entity}Changed`]: {\n\t\t\t\tresolve: async (\n\t\t\t\t\tpayload: Audit,\n\t\t\t\t\t_args: any,\n\t\t\t\t\tcontext: ChangeResolversContext,\n\t\t\t\t) => ({\n\t\t\t\t\tid: context.services.audit.extractId(payload),\n\t\t\t\t\tdata:\n\t\t\t\t\t\tpayload.type !== CommitType.TERMINAL\n\t\t\t\t\t\t\t? await context.services[service].findById(payload.state._id)\n\t\t\t\t\t\t\t: null,\n\t\t\t\t\ttype: payload.type,\n\t\t\t\t}),\n\t\t\t\tsubscribe: withFilter(\n\t\t\t\t\t() => resolvePubSub().subscribe(AUDIT_EVENT),\n\t\t\t\t\t(payload: any, _variables: any, context?: ChangeResolversContext) =>\n\t\t\t\t\t\tcontext\n\t\t\t\t\t\t\t? context.services.audit.matches(payload, { collection })\n\t\t\t\t\t\t\t: false,\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t};\n}\n",
|
|
9
|
+
"export const SCALARS_MAPPING = {\n\tID: 'any',\n\tDateTime: 'any',\n\tDate: 'any',\n\tAny: 'any',\n\tBigInt: 'number',\n\tEmailAddress: 'string',\n\tGeoJSON: 'any',\n\tHSL: 'string',\n\tHSLA: 'string',\n\tHexColorCode: 'string',\n\tHexadecimal: 'string',\n\tIBAN: 'string',\n\tIP: 'string',\n\tTime: 'string',\n\tLocalTime: 'string',\n\tUUID: 'string',\n\tPositiveInt: 'number',\n\tNegativeInt: 'number',\n\tNonPositiveInt: 'number',\n\tNonNegativeInt: 'number',\n\tPositiveFloat: 'number',\n\tNegativeFloat: 'number',\n\tNonPositiveFloat: 'number',\n\tNonNegativeFloat: 'number',\n\tNonEmptyString: 'string',\n\tPostalCode: 'string',\n\tRGB: 'string',\n\tRGBA: 'string',\n\tSESSN: 'string',\n\tTimestamp: 'string',\n\tURL: 'string',\n\tUSCurrency: 'string',\n\tUTCOffset: 'string',\n\tLong: 'number',\n\tShort: 'number',\n\tByte: 'number',\n\tBigDecimal: 'string',\n\tBigInteger: 'string',\n\tChar: 'string',\n\tLocale: 'string',\n\tCountryCode: 'string',\n\tCountryName: 'string',\n\tAccountNumber: 'string',\n\tCurrencyCode: 'string',\n\tDuration: 'string',\n\tUrl: 'string',\n\tJSONObject: 'Record<string, any>',\n\tJSON: 'any',\n\tVoid: 'void',\n\tObjectID: 'any',\n\tUpload: 'File | Blob',\n\tEmail: 'string',\n\tPort: 'number',\n\tIPv4: 'string',\n\tIPv6: 'string',\n\tMAC: 'string',\n\tPassword: 'string',\n\tPhoneNumber: 'string',\n\tZIPCode: 'string',\n\tSSN: 'string',\n\tGUID: 'string',\n\tISBN: 'string',\n\tLatitude: 'number',\n\tLongitude: 'number',\n\tJWT: 'string',\n};\n",
|
|
10
|
+
"import { cast } from '@nxgt/shared/helpers';\nimport {\n\ttype HydratedDocument,\n\ttype IConnection,\n\ttype Model,\n\ttype mongoose,\n\ttype PaginationOptions,\n\tpaginateList,\n\ttype QueryFilter,\n\ttype SimplePaginationOptions,\n} from '@nxgt/shared-mongo';\nimport DataLoader from 'dataloader';\nimport { isArray } from 'lodash';\n\nexport function createDataLoader<K, V>(\n\tbatchLoadFn: DataLoader.BatchLoadFn<K, V>,\n\toptions?: DataLoader.Options<K, V, K>,\n) {\n\treturn new DataLoader(batchLoadFn, options);\n}\n\nexport function createConnectionListDataLoader<K, V>(\n\tpath: keyof K,\n\tmodel: Model<V, any, any, any, any, any, any>,\n\toptions: PaginationOptions,\n) {\n\treturn createDataLoader<K, IConnection<HydratedDocument<V>>>(async (docs) => {\n\t\tconst data: HydratedDocument<V>[] = await model\n\t\t\t.find({\n\t\t\t\t...(options.filter ?? {}),\n\t\t\t\t_id: docs.flatMap((doc) => {\n\t\t\t\t\tconst ids = doc[path] ?? [];\n\t\t\t\t\treturn isArray(ids)\n\t\t\t\t\t\t? cast<mongoose.Schema.Types.ObjectId[]>(\n\t\t\t\t\t\t\t\tids.filter(\n\t\t\t\t\t\t\t\t\t(item) =>\n\t\t\t\t\t\t\t\t\t\t!!item &&\n\t\t\t\t\t\t\t\t\t\t!['undefined', 'null'].includes((item as any)?.toString()),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: [];\n\t\t\t\t}),\n\t\t\t})\n\t\t\t.exec();\n\t\treturn cast(\n\t\t\tdocs.map((doc) =>\n\t\t\t\tmodel.paginateList(\n\t\t\t\t\tdata.filter((child) =>\n\t\t\t\t\t\tcast<mongoose.Schema.Types.ObjectId[]>(doc[path] ?? [])\n\t\t\t\t\t\t\t.map((item) => item.toString())\n\t\t\t\t\t\t\t.includes((child._id as any).toString()),\n\t\t\t\t\t),\n\t\t\t\t\toptions,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t});\n}\n\nexport function createChildrenConnectionDataLoader<K, V>(\n\tpath: keyof V,\n\tmodel: Model<V, any, any, any, any, any, any>,\n\toptions: PaginationOptions,\n) {\n\treturn createDataLoader<\n\t\tHydratedDocument<K>,\n\t\tIConnection<HydratedDocument<V>>\n\t>(async (docs) => {\n\t\tconst filter = {} as any;\n\t\tfilter[path] = docs.map((doc) => doc._id);\n\t\tconst data: HydratedDocument<V>[] = await model.find(filter).exec();\n\t\treturn cast(\n\t\t\tdocs.map((doc) =>\n\t\t\t\tpaginateList(\n\t\t\t\t\tdata.filter(\n\t\t\t\t\t\t(child) => doc._id?.toString() === (child[path] as any)?.toString(),\n\t\t\t\t\t) as any,\n\t\t\t\t\toptions,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t});\n}\n\nexport function createSimpleListDataLoader<K, V>(\n\tpath: keyof K,\n\tmodel: Model<V, any, any, any, any, any, any>,\n\toptions?: SimplePaginationOptions,\n) {\n\treturn createDataLoader<K, HydratedDocument<V>[]>(async (docs) => {\n\t\tconst filter: QueryFilter<any> = options?.filter ?? {};\n\t\tconst ids = docs.flatMap((doc) => {\n\t\t\tconst ids = doc[path] ?? [];\n\t\t\treturn isArray(ids) ? cast<mongoose.Schema.Types.ObjectId[]>(ids) : [];\n\t\t});\n\t\tfilter._id = ids;\n\t\tconst query = model.find(filter);\n\t\tconst data: HydratedDocument<V>[] = await query.exec();\n\t\treturn cast(\n\t\t\tdocs.map((doc) => {\n\t\t\t\tconst result = data.filter((child) =>\n\t\t\t\t\tcast<mongoose.Schema.Types.ObjectId[]>(doc[path] ?? [])\n\t\t\t\t\t\t.map((item) => item.toString())\n\t\t\t\t\t\t.includes((child._id as any).toString()),\n\t\t\t\t);\n\t\t\t\tif (options?.skip && options?.limit) {\n\t\t\t\t\treturn result.slice(options.skip, options.skip + options.limit);\n\t\t\t\t}\n\t\t\t\tif (options?.limit) {\n\t\t\t\t\treturn result.slice(0, options.limit);\n\t\t\t\t}\n\t\t\t\tif (options?.skip) {\n\t\t\t\t\treturn result.slice(options.skip);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}),\n\t\t);\n\t});\n}\n\nexport function createChildrenListDataLoader<K, V>(\n\tpath: keyof V,\n\tmodel: Model<V, any, any, any, any, any, any>,\n\toptions?: SimplePaginationOptions,\n) {\n\treturn createDataLoader<HydratedDocument<K>, HydratedDocument<V>[]>(\n\t\tasync (docs) => {\n\t\t\tconst filter: QueryFilter<any> = options?.filter ?? {};\n\t\t\tconst key = path as any;\n\t\t\tfilter[key] = docs.map((doc) => doc._id);\n\t\t\tconst query = model.find(filter);\n\t\t\tconst data: HydratedDocument<V>[] = await query.exec();\n\t\t\treturn cast(\n\t\t\t\tdocs.map((doc) => {\n\t\t\t\t\tconst result = data.filter(\n\t\t\t\t\t\t(child) => child[path]?.toString() === (doc._id as any).toString(),\n\t\t\t\t\t);\n\n\t\t\t\t\tif (options?.skip && options?.limit) {\n\t\t\t\t\t\treturn result.slice(options.skip, options.skip + options.limit);\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.limit) {\n\t\t\t\t\t\treturn result.slice(0, options.limit);\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.skip) {\n\t\t\t\t\t\treturn result.slice(options.skip);\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t}),\n\t\t\t);\n\t\t},\n\t);\n}\n\nexport function createSingleChildDataLoader<K, V extends { id: string }>(\n\tpath: keyof K,\n\tmodel: Model<V, any, any, any, any, any, any>,\n) {\n\treturn createDataLoader<K, HydratedDocument<V> | null>(async (docs) => {\n\t\tconst data: HydratedDocument<V>[] = await model\n\t\t\t.find({\n\t\t\t\t_id: docs\n\t\t\t\t\t.map((doc) => cast<mongoose.Schema.Types.ObjectId>(doc[path]))\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t(item) =>\n\t\t\t\t\t\t\t!!item && !['undefined', 'null'].includes(item?.toString()),\n\t\t\t\t\t),\n\t\t\t})\n\t\t\t.exec();\n\n\t\tconst map = new Map<string, HydratedDocument<V>>(\n\t\t\tdata.map((doc) => [doc.id, doc]),\n\t\t);\n\t\treturn docs.map((doc) => map.get(doc[path]?.toString() ?? '') ?? null);\n\t});\n}\n\nexport function createEntitiesReferenceLoader<V extends { id: string }>(\n\tmodel: Model<V, any, any, any, any, any, any>,\n) {\n\treturn createDataLoader<string, HydratedDocument<V> | null>(async (ids) => {\n\t\tconst docs: HydratedDocument<V>[] = await model\n\t\t\t.find({\n\t\t\t\t_id: ids.filter(\n\t\t\t\t\t(item) => !!item && !['undefined', 'null'].includes(item?.toString()),\n\t\t\t\t),\n\t\t\t})\n\t\t\t.exec();\n\n\t\tconst map = new Map<string, HydratedDocument<V>>(\n\t\t\tdocs.map((doc) => [doc.id, doc]),\n\t\t);\n\n\t\treturn ids.map((id) => map.get(id) ?? null);\n\t}) as DataLoader<string, HydratedDocument<V> | null>;\n}\n",
|
|
11
|
+
"import type { ApolloServerOptions } from '@apollo/server';\nimport {\n\tApolloServerErrorCode,\n\tunwrapResolverError,\n} from '@apollo/server/errors';\nimport {\n\ttype LocaleKey,\n\ttype TranslationContext,\n\ttranslate as translateBase,\n} from '@nxgt/i18n';\nimport { CustomException, ErrorCode } from '@nxgt/shared-exceptions';\nimport { MONGO_UTILS, mongoose } from '@nxgt/shared-mongo';\nimport { GraphQLError, type GraphQLErrorOptions } from 'graphql';\nimport type { MaskError } from 'graphql-yoga';\nimport { kebabCase } from 'lodash';\nimport { OryUnavailable } from 'stx-sdk/ory';\nimport type { GraphQLBaseContext } from '../types';\n\nexport function createGraphQLError(\n\tmessage: string,\n\toptions?: GraphQLErrorOptions,\n): GraphQLError {\n\treturn new GraphQLError(message, options);\n}\n\nexport function createFormatError<\n\tK extends LocaleKey,\n\tC extends GraphQLBaseContext = GraphQLBaseContext,\n>(\n\ttranslate: (\n\t\tmessage: K,\n\t\tcontext?: TranslationContext,\n\t) => string = translateBase,\n\tproduction?: boolean,\n): ApolloServerOptions<C>['formatError'] {\n\treturn (formattedError, graphQLError) => {\n\t\tif (production && formattedError.extensions?.stacktrace) {\n\t\t\tformattedError.extensions.stacktrace = undefined;\n\t\t}\n\t\tconst error = unwrapResolverError(graphQLError);\n\t\tif (\n\t\t\terror instanceof CustomException ||\n\t\t\terror instanceof mongoose.MongooseError\n\t\t) {\n\t\t\tconst exception =\n\t\t\t\terror instanceof mongoose.MongooseError\n\t\t\t\t\t? MONGO_UTILS.castError(error)\n\t\t\t\t\t: (error as CustomException);\n\t\t\treturn {\n\t\t\t\t...formattedError,\n\t\t\t\tmessage:\n\t\t\t\t\texception.errorCode === ErrorCode.ValidationError\n\t\t\t\t\t\t? exception.message\n\t\t\t\t\t\t: translate(exception.message as K, exception.options),\n\t\t\t\textensions: {\n\t\t\t\t\t...formattedError.extensions,\n\t\t\t\t\tcode: exception.errorCode,\n\t\t\t\t\tdebugMessage: exception.debugMessage,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (\n\t\t\t[\n\t\t\t\tApolloServerErrorCode.GRAPHQL_VALIDATION_FAILED,\n\t\t\t\tApolloServerErrorCode.BAD_REQUEST,\n\t\t\t\tApolloServerErrorCode.BAD_USER_INPUT,\n\t\t\t\tApolloServerErrorCode.GRAPHQL_PARSE_FAILED,\n\t\t\t\tApolloServerErrorCode.OPERATION_RESOLUTION_FAILURE,\n\t\t\t\tApolloServerErrorCode.PERSISTED_QUERY_NOT_FOUND,\n\t\t\t\tApolloServerErrorCode.PERSISTED_QUERY_NOT_SUPPORTED,\n\t\t\t].includes(formattedError.extensions?.code as any)\n\t\t) {\n\t\t\treturn {\n\t\t\t\t...formattedError,\n\t\t\t\tmessage: translate(\n\t\t\t\t\t`errors.${kebabCase(formattedError.extensions?.code as string)}` as K,\n\t\t\t\t\t{},\n\t\t\t\t),\n\t\t\t\textensions: {\n\t\t\t\t\t...formattedError.extensions,\n\t\t\t\t\tdebugMessage: formattedError.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn formattedError;\n\t};\n}\n\nconst HTTP_STATUS_BY_CODE: Record<string, number> = {\n\t[ErrorCode.BadRequest]: 400,\n\t[ErrorCode.ValidationError]: 400,\n\t[ErrorCode.Unauthenticated]: 401,\n\t[ErrorCode.Forbidden]: 403,\n\t[ErrorCode.NotFound]: 404,\n\t[ErrorCode.Conflict]: 409,\n\t[ErrorCode.ServiceUnavailable]: 503,\n};\n\n/**\n * Yoga's `maskedErrors.maskError`, taught this repo's exceptions.\n *\n * Yoga masks anything that is not a `GraphQLError` as \"Unexpected error.\" —\n * and `CustomException` extends `Error`, so out of the box a service's\n * `notFound()` or `forbidden()` reaches the client as an opaque 500. This\n * turns one into a `GraphQLError` with the translated message, the\n * exception's `code` in `extensions`, and a matching HTTP status; a Mongoose\n * error goes through `castError` first, as `createFormatError` does for\n * Apollo. `OryUnavailable` (stx-sdk/ory) becomes a 503 `SERVICE_UNAVAILABLE`,\n * never a denial. Everything else is masked exactly as before.\n *\n * createYoga({ maskedErrors: { maskError: createMaskError(translate) } })\n */\nexport function createMaskError<K extends LocaleKey>(\n\ttranslate: (\n\t\tmessage: K,\n\t\tcontext?: TranslationContext,\n\t) => string = translateBase,\n): MaskError {\n\treturn (error, message, isDev) => {\n\t\tconst original =\n\t\t\terror instanceof GraphQLError && error.originalError\n\t\t\t\t? error.originalError\n\t\t\t\t: error;\n\n\t\tif (original instanceof OryUnavailable) {\n\t\t\treturn new GraphQLError(`ory: ${original.service} is unavailable`, {\n\t\t\t\textensions: {\n\t\t\t\t\tcode: ErrorCode.ServiceUnavailable,\n\t\t\t\t\thttp: { status: 503 },\n\t\t\t\t\tdebugMessage: original.message,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tif (\n\t\t\toriginal instanceof CustomException ||\n\t\t\toriginal instanceof mongoose.MongooseError\n\t\t) {\n\t\t\tconst exception =\n\t\t\t\toriginal instanceof mongoose.MongooseError\n\t\t\t\t\t? MONGO_UTILS.castError(original)\n\t\t\t\t\t: (original as CustomException);\n\t\t\t// The exception carries the status itself now.\n\t\t\tconst status = exception.code;\n\t\t\treturn new GraphQLError(\n\t\t\t\texception.errorCode === ErrorCode.ValidationError\n\t\t\t\t\t? exception.message\n\t\t\t\t\t: translate(exception.message as K, exception.options),\n\t\t\t\t{\n\t\t\t\t\textensions: {\n\t\t\t\t\t\tcode: exception.errorCode,\n\t\t\t\t\t\t...(status ? { http: { status } } : {}),\n\t\t\t\t\t\t...(exception.debugMessage\n\t\t\t\t\t\t\t? { debugMessage: exception.debugMessage }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tif (error instanceof GraphQLError) return error;\n\t\treturn new GraphQLError(message, {\n\t\t\textensions: isDev\n\t\t\t\t? { code: ErrorCode.InternalServerError, debugMessage: String(error) }\n\t\t\t\t: { code: ErrorCode.InternalServerError },\n\t\t});\n\t};\n}\n",
|
|
12
|
+
"import { createRedisEventTarget } from '@graphql-yoga/redis-event-target';\nimport { createPubSub } from 'graphql-yoga';\nimport type { Redis } from 'ioredis';\n\nexport const createYogaPubSub = ({\n\tpublishClient,\n\tsubscribeClient,\n}: {\n\tpublishClient: Redis;\n\tsubscribeClient: Redis;\n}) => {\n\tconst eventTarget = createRedisEventTarget({\n\t\tpublishClient,\n\t\tsubscribeClient,\n\t});\n\n\treturn createPubSub({ eventTarget });\n};\n",
|
|
13
|
+
"import { html } from 'hono/html';\n\nexport type RenderSandboxOptions = {\n\tport?: number;\n\tgraphqlEndpoint?: string;\n\tprotocol?: string;\n\thostname?: string;\n\ttitle?: string;\n};\n\nexport const renderSandbox = ({\n\tport = 8080,\n\thostname = 'localhost',\n\tgraphqlEndpoint = 'graphql',\n\tprotocol = 'http',\n\ttitle = 'Sandbox Explorer',\n}: RenderSandboxOptions) => html`\n<title>${title}</title>\n<div id=\"sandbox\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\"></div>\n<script src=\"https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js\"></script>\n<script>\n new window.EmbeddedSandbox({\n target: \"#sandbox\",\n // Pass through your server href if you are embedding on an endpoint.\n // Otherwise, you can pass whatever endpoint you want Sandbox to start up with here.\n initialEndpoint: \"${protocol}://${hostname}:${port}/${graphqlEndpoint}\",\n handleRequest: (endpointUrl, options) => {\n return fetch(endpointUrl, {\n ...options,\n headers: {\n ...options.headers\n },\n })\n },\n hideCookieToggle: true,\n });\n // advanced options: https://www.apollographql.com/docs/studio/explorer/sandbox#embedding-sandbox\n</script>\n\n`;\n",
|
|
14
|
+
"import { join } from 'node:path';\nimport { buildSubgraphSchema as buildSubgraphSchemaBase } from '@apollo/subgraph';\nimport { loadFilesSync } from '@graphql-tools/load-files';\nimport { mergeTypeDefs } from '@graphql-tools/merge';\nimport { pruneSchema } from '@graphql-tools/utils';\nimport { printSchema } from 'graphql';\n\nexport const SHARED_SCHEMA_PATH = join(__dirname, './**/*.graphqls');\n\nexport function loadTypeDefs(...paths: string[]) {\n\tconst typeDefs = mergeTypeDefs([\n\t\t...paths.flatMap((path) =>\n\t\t\tloadFilesSync(path, {\n\t\t\t\trecursive: true,\n\t\t\t}),\n\t\t),\n\t]);\n\n\treturn typeDefs;\n}\n\nexport function buildSubgraphSchema(\n\tmodulesOrSdl: Parameters<typeof buildSubgraphSchemaBase>[0],\n) {\n\treturn pruneSchema(buildSubgraphSchemaBase(modulesOrSdl), {\n\t\tskipUnusedTypesPruning: false,\n\t});\n}\n\n/**\n * Utility function to generate a GraphQL schema file from the provided type definitions.\n * @param output - The path where the generated schema file should be saved.\n * @param paths - An array of glob patterns to locate the GraphQL type definition files.\n */\nexport async function generateSchema(output: string, ...paths: string[]) {\n\tawait Bun.write(\n\t\toutput,\n\t\tprintSchema(buildSubgraphSchema(loadTypeDefs(...paths))),\n\t);\n}\n",
|
|
15
|
+
"import { createServer } from 'node:http';\nimport type { ServerOptions } from 'graphql-ws';\nimport { useServer } from 'graphql-ws/use/ws';\nimport type { YogaServerInstance } from 'graphql-yoga';\nimport { WebSocketServer } from 'ws';\n\nexport function setupYogaWebSocketServer<\n\tServerContext extends {},\n\tUserContext extends {},\n>({\n\tyoga,\n\tcontext,\n}: {\n\tyoga: YogaServerInstance<ServerContext, UserContext>;\n\tcontext?: ServerOptions['context'];\n}) {\n\tconst httpServer = createServer(yoga);\n\tconst wsServer = new WebSocketServer({\n\t\tserver: httpServer,\n\t\tpath: yoga.graphqlEndpoint,\n\t});\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: Not react related\n\tuseServer(\n\t\t{\n\t\t\texecute: (args: any) => args.rootValue.execute(args),\n\t\t\tsubscribe: (args: any) => args.rootValue.subscribe(args),\n\t\t\tonSubscribe: async (ctx, _id, params) => {\n\t\t\t\tconst { schema, execute, subscribe, contextFactory, parse, validate } =\n\t\t\t\t\tyoga.getEnveloped({\n\t\t\t\t\t\t...ctx,\n\t\t\t\t\t\treq: ctx.extra.request,\n\t\t\t\t\t\tsocket: ctx.extra.socket,\n\t\t\t\t\t\tparams,\n\t\t\t\t\t});\n\n\t\t\t\tconst args = {\n\t\t\t\t\tschema,\n\t\t\t\t\toperationName: params.operationName,\n\t\t\t\t\tdocument: parse(params.query),\n\t\t\t\t\tvariableValues: params.variables,\n\t\t\t\t\tcontextValue: await contextFactory(),\n\t\t\t\t\trootValue: {\n\t\t\t\t\t\texecute,\n\t\t\t\t\t\tsubscribe,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tconst errors = validate(args.schema, args.document);\n\t\t\t\tif (errors.length) return errors;\n\t\t\t\treturn args;\n\t\t\t},\n\t\t\tcontext,\n\t\t},\n\t\twsServer,\n\t);\n\n\tconst startServer = (port: number) =>\n\t\tnew Promise<void>((resolve) => httpServer.listen({ port }, resolve));\n\treturn { yoga, httpServer, startServer };\n}\n",
|
|
16
|
+
"import type { Principal } from '@nxgt/shared';\nimport type { Context } from 'graphql-ws';\nimport type { createAuthClient } from 'stx-sdk/auth';\n\ntype AuthClient = ReturnType<typeof createAuthClient>;\n\nexport interface ResolvedWsUser {\n\tuser: Principal | undefined;\n\ttoken: string | undefined;\n}\n\n/**\n * Resolves the authenticated Principal for a `graphql-ws` connection - the\n * WS-transport equivalent of the HTTP-path `useAuth()`/`useGenericAuth()`\n * plugins. There is no gateway hop for WS connections, so each app performs\n * the OAuth introspection call itself using its own `auth` client.\n *\n * Reads the bearer token off `connectionParams.authorization` /\n * `connectionParams.Authorization` (both casings are used by existing\n * clients), strips the `Bearer ` prefix, and introspects it. Returns\n * `user: undefined` for a missing, invalid, or inactive token - callers\n * pass `user ?? null` into their own `services()` factory, exactly as the\n * HTTP-path plugins already do.\n */\nexport async function resolveWsUser(\n\tconnectionParams: Context['connectionParams'],\n\tauthClient: AuthClient,\n): Promise<ResolvedWsUser> {\n\tconst rawToken =\n\t\t(connectionParams?.authorization as string | undefined) ??\n\t\t(connectionParams?.Authorization as string | undefined);\n\tconst token = rawToken?.replace('Bearer ', '');\n\n\tconst { data } = token\n\t\t? await authClient.POST('/oauth/introspect', { body: { token } })\n\t\t: { data: null };\n\n\tconst user = data?.active\n\t\t? ({ ...(data as any), name: (data as any).sub } as Principal)\n\t\t: undefined;\n\n\treturn { user, token };\n}\n",
|
|
17
|
+
"import type { Plugin } from 'graphql-yoga';\nimport type { GraphQLBaseContext } from '../types';\n\nexport function useAuth(): Plugin<GraphQLBaseContext> {\n\treturn {\n\t\tonContextBuilding: async ({ context, extendContext }) => {\n\t\t\textendContext({\n\t\t\t\tuser: context.params.extensions?.user,\n\t\t\t\ttoken: context.params.extensions?.token,\n\t\t\t});\n\t\t},\n\t};\n}\n",
|
|
18
|
+
"import type { ApolloServerPlugin } from '@apollo/server';\nimport type { Principal } from '@nxgt/shared';\nimport { logger } from '@nxgt/shared-logging';\n\nexport const extractJwtPlugin = {\n\tasync requestDidStart({ request, contextValue }) {\n\t\tlogger.info(\n\t\t\t`[${request.extensions?.subgraphName}] Extracting JWT from request extensions: ${request.extensions?.payload?.sub}`,\n\t\t\trequest.extensions,\n\t\t);\n\t\tcontextValue.jwt = {\n\t\t\tpayload: request.extensions?.payload,\n\t\t};\n\t},\n} satisfies ApolloServerPlugin<{\n\tjwt?: { payload: Principal };\n}>;\n",
|
|
19
|
+
"import type { TokenPrincipal } from '@nxgt/shared';\nimport { GraphQLError } from 'graphql';\nimport type { Plugin } from 'graphql-yoga';\nimport {\n\tbearerOf,\n\ttype Ory,\n\ttype OryPrincipal,\n\tOryUnavailable,\n} from 'stx-sdk/ory';\nimport type { GraphQLBaseContext } from '../types';\n\n/**\n * What `useOryAuth()` adds to the context, next to `user` and `token`: the\n * Ory principal itself, or `null` when the request carried no honoured\n * credential. `user.sub === ory.subject` by construction; read `ory` when the\n * value is going to Keto, so the code says what it is.\n */\nexport type OryContext = {\n\tory?: OryPrincipal | null;\n};\n\n/**\n * The repo-wide TokenPrincipal an Ory principal becomes.\n *\n * `sub` and `uid` are both the Ory subject — a Kratos identity id for a\n * session or a person's token, the client id for a `client_credentials`\n * token — so every service that reads `this.principal?.sub` (or `.uid`) keeps\n * working unchanged. `authorities` is EMPTY on purpose: Keto answers per\n * object, and an empty list is what keeps `@policy` / `useGenericAuth`'s\n * policy extraction from granting anything by accident.\n */\nexport function toPrincipal(ory: OryPrincipal): TokenPrincipal {\n\tconst email = ory.identity?.email;\n\treturn {\n\t\tsub: ory.subject,\n\t\tuid: ory.subject,\n\t\tname: email ?? ory.clientId ?? ory.subject,\n\t\tusername: email,\n\t\tclientId: ory.clientId,\n\t\tscope: ory.scopes.join(' ') || undefined,\n\t\ttokenType: ory.kind,\n\t\texp: ory.expiresAt ? Math.floor(ory.expiresAt.getTime() / 1000) : undefined,\n\t\tauthorities: [],\n\t\troles: [],\n\t};\n}\n\n/**\n * A 503 the client can read as one — a real `GraphQLError` so Yoga's masking\n * leaves it alone, `extensions.http.status` so the transport says 503 too.\n * Never a denial: `stx-sdk/ory` throws `OryUnavailable` only when Kratos,\n * Hydra or Keto could not answer, and that must not read as \"not signed in\".\n */\nexport function oryUnavailableError(error: OryUnavailable): GraphQLError {\n\treturn new GraphQLError(`ory: ${error.service} is unavailable`, {\n\t\textensions: {\n\t\t\tcode: 'SERVICE_UNAVAILABLE',\n\t\t\thttp: { status: 503 },\n\t\t\tdebugMessage: error.message,\n\t\t},\n\t});\n}\n\n/**\n * The one introspection code path — `Bearer` first, then `X-Session-Token`,\n * then the Kratos cookie; the first credential present decides. Exported so\n * a REST route mounted beside the GraphQL endpoint (content-hub-api's\n * webhook shape) authenticates through the same function instead of a\n * second call.\n */\nexport async function resolveOryPrincipal(\n\tory: Ory,\n\theaders: Headers,\n): Promise<OryContext & { user?: TokenPrincipal; token?: string }> {\n\tlet principal: OryPrincipal | null;\n\ttry {\n\t\tprincipal = await ory.resolve(headers);\n\t} catch (error) {\n\t\tif (error instanceof OryUnavailable) throw oryUnavailableError(error);\n\t\tthrow error;\n\t}\n\n\treturn {\n\t\tory: principal,\n\t\tuser: principal ? toPrincipal(principal) : undefined,\n\t\ttoken: bearerOf(headers) ?? undefined,\n\t};\n}\n\n/**\n * `useAuth()` for an Ory-native API: resolves the caller through Kratos\n * (session cookie, session token) or Hydra (Bearer, introspected) and puts\n * `user`, `token` and `ory` on the context. Wire it exactly where the\n * standalone APIs wire `useAuth()`, ahead of `useGenericAuth` — which then\n * enforces `@authenticated` from `context.user` unchanged.\n *\n * The `Ory` instance comes from the app's `createOry()` — one per process —\n * and is the same one the services use for `isAllowed`.\n */\nexport function useOryAuth(ory: Ory): Plugin<GraphQLBaseContext & OryContext> {\n\treturn {\n\t\tonContextBuilding: async ({ context, extendContext }) => {\n\t\t\textendContext(await resolveOryPrincipal(ory, context.request.headers));\n\t\t},\n\t};\n}\n",
|
|
20
|
+
"import { GraphQLScalarType, Kind } from 'graphql';\n\nexport const ANY_SCALAR = {\n\tAny: new GraphQLScalarType<any, any>({\n\t\tname: 'Any',\n\t\tdescription: 'Generic scalar to represent any type',\n\t\tserialize(value) {\n\t\t\treturn value;\n\t\t},\n\t\tparseValue(value: any) {\n\t\t\treturn value;\n\t\t},\n\t\tparseLiteral(ast, variables) {\n\t\t\tswitch (ast.kind) {\n\t\t\t\tcase Kind.STRING:\n\t\t\t\tcase Kind.BOOLEAN:\n\t\t\t\t\treturn ast.value;\n\t\t\t\tcase Kind.INT:\n\t\t\t\tcase Kind.FLOAT:\n\t\t\t\t\treturn parseFloat(ast.value);\n\t\t\t\tcase Kind.OBJECT:\n\t\t\t\t\treturn Object.fromEntries(\n\t\t\t\t\t\tast.fields.map((field) => [field.name, field.value]),\n\t\t\t\t\t);\n\t\t\t\tcase Kind.LIST:\n\t\t\t\t\treturn ast.values.map((n) => this?.parseLiteral?.(n, variables));\n\t\t\t\tcase Kind.NULL:\n\t\t\t\t\treturn null;\n\t\t\t\tcase Kind.VARIABLE: {\n\t\t\t\t\tconst name = ast.name.value;\n\t\t\t\t\treturn variables ? variables[name] : undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}),\n};\n",
|
|
21
|
+
"import type { GraphQLScalarType } from 'graphql';\nimport {\n\tAccountNumberResolver,\n\tBigIntResolver,\n\tCountryCodeResolver,\n\tCountryNameResolver,\n\tCuidResolver,\n\tCurrencyResolver,\n\tDateResolver,\n\tDateTimeISOResolver,\n\tDurationResolver,\n\tEmailAddressResolver,\n\tGeoJSONResolver,\n\tGUIDResolver,\n\tHexadecimalResolver,\n\tHexColorCodeResolver,\n\tHSLAResolver,\n\tHSLResolver,\n\tIBANResolver,\n\tIPResolver,\n\tIPv4Resolver,\n\tIPv6Resolver,\n\tISBNResolver,\n\tJSONObjectResolver,\n\tJSONResolver,\n\tJWTResolver,\n\tLatitudeResolver,\n\tLocaleResolver,\n\tLongitudeResolver,\n\tLongResolver,\n\tMACResolver,\n\tNegativeFloatResolver,\n\tNegativeIntResolver,\n\tNonEmptyStringResolver,\n\tNonNegativeFloatResolver,\n\tNonNegativeIntResolver,\n\tNonPositiveFloatResolver,\n\tNonPositiveIntResolver,\n\tObjectIDResolver,\n\tPhoneNumberResolver,\n\tPortResolver,\n\tPositiveFloatResolver,\n\tPositiveIntResolver,\n\tPostalCodeResolver,\n\tRGBAResolver,\n\tRGBResolver,\n\tSESSNResolver,\n\tTimeResolver,\n\tTimestampResolver,\n\tURLResolver,\n\tUSCurrencyResolver,\n\tUtcOffsetResolver,\n\tUUIDResolver,\n\tVoidResolver,\n} from 'graphql-scalars';\nimport { createScalarFrom } from './utils';\n\nexport const CUSTOM_SCALARS: Record<string, GraphQLScalarType> = {\n\tAccountNumber: createScalarFrom(AccountNumberResolver, {\n\t\terrorMessage: 'validation.errors.invalid-account-number',\n\t}),\n\tBigInt: createScalarFrom(BigIntResolver, {\n\t\terrorMessage: 'validation.errors.invalid-big-int',\n\t}),\n\tCountryCode: createScalarFrom(CountryCodeResolver, {\n\t\terrorMessage: 'validation.errors.invalid-country-code',\n\t}),\n\tCountryName: createScalarFrom(CountryNameResolver, {\n\t\terrorMessage: 'validation.errors.invalid-country-name',\n\t}),\n\tCuid: createScalarFrom(CuidResolver, {\n\t\terrorMessage: 'validation.errors.invalid-cuid',\n\t}),\n\tCurrencyCode: createScalarFrom(CurrencyResolver, {\n\t\tname: 'CurrencyCode',\n\t\terrorMessage: 'validation.errors.invalid-currency',\n\t}),\n\tDate: createScalarFrom(DateResolver, {\n\t\terrorMessage: 'validation.errors.invalid-date',\n\t}),\n\tDateTime: createScalarFrom(DateTimeISOResolver, {\n\t\tname: 'DateTime',\n\t\terrorMessage: 'validation.errors.invalid-date-time',\n\t}),\n\tDuration: createScalarFrom(DurationResolver, {\n\t\terrorMessage: 'validation.errors.invalid-duration',\n\t}),\n\tEmailAddress: createScalarFrom(EmailAddressResolver, {\n\t\terrorMessage: 'validation.errors.invalid-email-address',\n\t}),\n\tGeoJSON: createScalarFrom(GeoJSONResolver, {\n\t\terrorMessage: 'validation.errors.invalid-geo-json',\n\t}),\n\tGUID: createScalarFrom(GUIDResolver, {\n\t\terrorMessage: 'validation.errors.invalid-guid',\n\t}),\n\tHexColorCode: createScalarFrom(HexColorCodeResolver, {\n\t\terrorMessage: 'validation.errors.invalid-hex-color-code',\n\t}),\n\tHexadecimal: createScalarFrom(HexadecimalResolver, {\n\t\terrorMessage: 'validation.errors.invalid-hexadecimal',\n\t}),\n\tHSL: createScalarFrom(HSLResolver, {\n\t\terrorMessage: 'validation.errors.invalid-hsl',\n\t}),\n\tHSLA: createScalarFrom(HSLAResolver, {\n\t\terrorMessage: 'validation.errors.invalid-hsla',\n\t}),\n\tIBAN: createScalarFrom(IBANResolver, {\n\t\terrorMessage: 'validation.errors.invalid-iban',\n\t}),\n\tIP: createScalarFrom(IPResolver, {\n\t\terrorMessage: 'validation.errors.invalid-ip',\n\t}),\n\tIPv4: createScalarFrom(IPv4Resolver, {\n\t\terrorMessage: 'validation.errors.invalid-ipv4',\n\t}),\n\tIPv6: createScalarFrom(IPv6Resolver, {\n\t\terrorMessage: 'validation.errors.invalid-ipv6',\n\t}),\n\tISBN: createScalarFrom(ISBNResolver, {\n\t\terrorMessage: 'validation.errors.invalid-isbn',\n\t}),\n\tJSON: createScalarFrom(JSONResolver, {\n\t\terrorMessage: 'validation.errors.invalid-json',\n\t}),\n\tJSONObject: createScalarFrom(JSONObjectResolver, {\n\t\terrorMessage: 'validation.errors.invalid-json-object',\n\t}),\n\tJWT: createScalarFrom(JWTResolver, {\n\t\terrorMessage: 'validation.errors.invalid-jwt',\n\t}),\n\tLatitude: createScalarFrom(LatitudeResolver, {\n\t\terrorMessage: 'validation.errors.invalid-latitude',\n\t}),\n\tLocale: createScalarFrom(LocaleResolver, {\n\t\terrorMessage: 'validation.errors.invalid-locale',\n\t}),\n\tLongitude: createScalarFrom(LongitudeResolver, {\n\t\terrorMessage: 'validation.errors.invalid-longitude',\n\t}),\n\tLong: createScalarFrom(LongResolver, {\n\t\terrorMessage: 'validation.errors.invalid-long',\n\t}),\n\tMAC: createScalarFrom(MACResolver, {\n\t\terrorMessage: 'validation.errors.invalid-mac',\n\t}),\n\tNegativeFloat: createScalarFrom(NegativeFloatResolver, {\n\t\terrorMessage: 'validation.errors.invalid-negative-float',\n\t}),\n\tNegativeInt: createScalarFrom(NegativeIntResolver, {\n\t\terrorMessage: 'validation.errors.invalid-negative-int',\n\t}),\n\tNonEmptyString: createScalarFrom(NonEmptyStringResolver, {\n\t\terrorMessage: 'validation.errors.invalid-non-empty-string',\n\t}),\n\tNonNegativeFloat: createScalarFrom(NonNegativeFloatResolver, {\n\t\terrorMessage: 'validation.errors.invalid-non-negative-float',\n\t}),\n\tNonNegativeInt: createScalarFrom(NonNegativeIntResolver, {\n\t\terrorMessage: 'validation.errors.invalid-non-negative-int',\n\t}),\n\tNonPositiveFloat: createScalarFrom(NonPositiveFloatResolver, {\n\t\terrorMessage: 'validation.errors.invalid-non-positive-float',\n\t}),\n\tNonPositiveInt: createScalarFrom(NonPositiveIntResolver, {\n\t\terrorMessage: 'validation.errors.invalid-non-positive-int',\n\t}),\n\tObjectID: createScalarFrom(ObjectIDResolver, {\n\t\terrorMessage: 'validation.errors.invalid-object-id',\n\t}),\n\tPhoneNumber: createScalarFrom(PhoneNumberResolver, {\n\t\terrorMessage: 'validation.errors.invalid-phone-number',\n\t}),\n\tPort: createScalarFrom(PortResolver, {\n\t\terrorMessage: 'validation.errors.invalid-port',\n\t}),\n\tPositiveFloat: createScalarFrom(PositiveFloatResolver, {\n\t\terrorMessage: 'validation.errors.invalid-positive-float',\n\t}),\n\tPositiveInt: createScalarFrom(PositiveIntResolver, {\n\t\terrorMessage: 'validation.errors.invalid-positive-int',\n\t}),\n\tPostalCode: createScalarFrom(PostalCodeResolver, {\n\t\terrorMessage: 'validation.errors.invalid-postal-code',\n\t}),\n\tRGB: createScalarFrom(RGBResolver, {\n\t\terrorMessage: 'validation.errors.invalid-rgb',\n\t}),\n\tRGBA: createScalarFrom(RGBAResolver, {\n\t\terrorMessage: 'validation.errors.invalid-rgba',\n\t}),\n\tSESSN: createScalarFrom(SESSNResolver, {\n\t\terrorMessage: 'validation.errors.invalid-sessn',\n\t}),\n\tTime: createScalarFrom(TimeResolver, {\n\t\terrorMessage: 'validation.errors.invalid-time',\n\t}),\n\tTimestamp: createScalarFrom(TimestampResolver, {\n\t\terrorMessage: 'validation.errors.invalid-timestamp',\n\t}),\n\tURL: createScalarFrom(URLResolver, {\n\t\terrorMessage: 'validation.errors.invalid-url',\n\t}),\n\tUSCurrency: createScalarFrom(USCurrencyResolver, {\n\t\terrorMessage: 'validation.errors.invalid-us-currency',\n\t}),\n\tUTCOffset: createScalarFrom(UtcOffsetResolver, {\n\t\terrorMessage: 'validation.errors.invalid-utc-offset',\n\t}),\n\tUUID: createScalarFrom(UUIDResolver, {\n\t\terrorMessage: 'validation.errors.invalid-uuid',\n\t}),\n\tVoid: createScalarFrom(VoidResolver, {\n\t\terrorMessage: 'validation.errors.invalid-void',\n\t}),\n};\n",
|
|
22
|
+
"import type { LocaleKey } from '@nxgt/i18n';\nimport { CustomException } from '@nxgt/shared-exceptions';\nimport { logger } from '@nxgt/shared-logging';\nimport { GraphQLScalarType } from 'graphql';\n\nexport function createScalarFrom<T, R>(\n\tscalar: GraphQLScalarType<T, R>,\n\t{\n\t\tname,\n\t\tdescription,\n\t\terrorMessage,\n\t}: {\n\t\tname?: string;\n\t\tdescription?: string;\n\t\terrorMessage?: LocaleKey | string;\n\t},\n) {\n\tconst exception = CustomException.badRequest({\n\t\tmessage: errorMessage as LocaleKey,\n\t});\n\treturn new GraphQLScalarType<T, R>({\n\t\t...scalar,\n\t\tname: name ?? scalar.name,\n\t\tdescription: (description ?? scalar.description)?.replaceAll('`', \"'\"),\n\t\tserialize(value) {\n\t\t\tif (!errorMessage) {\n\t\t\t\treturn scalar.serialize(value);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn scalar.serialize(value);\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e);\n\t\t\t\tthrow exception;\n\t\t\t}\n\t\t},\n\t\tparseValue(value) {\n\t\t\tif (!errorMessage) {\n\t\t\t\treturn scalar.parseValue(value);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn scalar.parseValue(value);\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e);\n\t\t\t\tthrow exception;\n\t\t\t}\n\t\t},\n\t\tparseLiteral(ast) {\n\t\t\tif (!errorMessage) {\n\t\t\t\treturn scalar.parseLiteral(ast);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn scalar.parseLiteral(ast);\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e);\n\t\t\t\tthrow exception;\n\t\t\t}\n\t\t},\n\t});\n}\n",
|
|
23
|
+
"import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';\nimport { createScalarFrom } from '../custom/utils';\n\nexport const UPLOAD_SCALAR = {\n\tUpload: createScalarFrom(GraphQLUpload as any, { name: 'Upload' }),\n};\n",
|
|
24
|
+
"import type { GraphQLScalarType } from 'graphql';\nimport { ANY_SCALAR } from './any';\nimport { CUSTOM_SCALARS } from './custom';\nimport { UPLOAD_SCALAR } from './upload';\n\nexport const SCALAR_RESOLVERS: Record<string, GraphQLScalarType> = {\n\t...UPLOAD_SCALAR,\n\t...ANY_SCALAR,\n\t...CUSTOM_SCALARS,\n};\n",
|
|
25
|
+
"export const SHARED_TYPE_DEFS = `\ntype Query {\n\t_empty: String\n}\ntype Mutation {\n\t_empty: String\n}\ntype Subscription {\n\t_empty: String\n}\n\ndirective @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM\n\ndirective @policy(policies: [[String!]!]!) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM\n\ndirective @shareable on OBJECT | FIELD_DEFINITION\n\ndirective @link(url: String!, import: [String!]) on SCHEMA\n\n`;\n",
|
|
26
|
+
"import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';\n\nexport { graphqlUploadExpress };\n"
|
|
27
|
+
],
|
|
28
|
+
"mappings": ";AAAA;AAAA;AAEA;;;ACFO,IAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;ACCrC;AACA;AACA;AACA;;;ACJA;AAAA;AAAA;AAAA;AAMA;AAqEO,SAAS,qBAAqB,CACpC,QACkB;AAAA,EAClB,QAAQ,QAAQ,YAAY,SAAS,WAAW;AAAA,EAEhD,MAAM,gBAAgB,MACrB,OAAO,WAAW,aAAa,OAAO,IAAI;AAAA,EAE3C,OAAO;AAAA,IACN,OAAO;AAAA,OACL,GAAG,kBAAkB,OACrB,SACA,MACA,YAEA,QAAQ,SAAS,MAAM,iCACtB,YACA,IACD;AAAA,OACA,GAAG,sBAAsB,OACzB,SACA,MACA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f,CAAC;AAAA,EACD,YAAY,iBAAiB,oBAAoB;AAAA,IAChD,cAAc;AAAA,EACf,CAAC;AAAA,EACD,WAAW,iBAAiB,mBAAmB;AAAA,IAC9C,cAAc;AAAA,EACf,CAAC;AAAA,EACD,MAAM,iBAAiB,cAAc;AAAA,IACpC,cAAc;AAAA,EACf,CAAC;AAAA,EACD,MAAM,iBAAiB,cAAc;AAAA,IACpC,cAAc;AAAA,EACf,CAAC;AACF;;AExNA;AAGO,IAAM,gBAAgB;AAAA,EAC5B,QAAQ,iBAAiB,eAAsB,EAAE,MAAM,SAAS,CAAC;AAClE;;ACAO,IAAM,mBAAsD;AAAA,KAC/D;AAAA,KACA;AAAA,KACA;AACJ;;ACTO,IAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;ACAhC;",
|
|
29
|
+
"debugId": "E74E2102AC1DAAFD64756E2164756E21",
|
|
30
|
+
"names": []
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { YogaInitialContext, YogaServerInstance } from 'graphql-yoga';
|
|
2
|
+
import { Hono } from 'hono';
|
|
3
|
+
import { type RenderSandboxOptions } from '../utils';
|
|
4
|
+
export declare function sandboxExpolorer(options: RenderSandboxOptions): import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
5
|
+
type HonoYogaOptions = {
|
|
6
|
+
sandbox?: RenderSandboxOptions & {
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare function honoYoga<ServerContext extends Partial<YogaInitialContext>, UserContext extends {}>(yoga: YogaServerInstance<ServerContext, UserContext>): import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
11
|
+
export declare function createYogaHono<ServerContext extends Partial<YogaInitialContext>, UserContext extends {}>(yoga: YogaServerInstance<ServerContext, UserContext>, options?: HonoYogaOptions): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=hono.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hono.d.ts","sourceRoot":"","sources":["../../src/integrations/hono.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,OAAO,EAAE,KAAK,oBAAoB,EAAiB,MAAM,UAAU,CAAC;AAEpE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,+DAI7D;AAED,KAAK,eAAe,GAAG;IACtB,OAAO,CAAC,EAAE,oBAAoB,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD,CAAC;AAEF,wBAAgB,QAAQ,CACvB,aAAa,SAAS,OAAO,CAAC,kBAAkB,CAAC,EACjD,WAAW,SAAS,EAAE,EACrB,IAAI,EAAE,kBAAkB,CAAC,aAAa,EAAE,WAAW,CAAC,+DAMrD;AAED,wBAAgB,cAAc,CAC7B,aAAa,SAAS,OAAO,CAAC,kBAAkB,CAAC,EACjD,WAAW,SAAS,EAAE,EAEtB,IAAI,EAAE,kBAAkB,CAAC,aAAa,EAAE,WAAW,CAAC,EACpD,OAAO,CAAC,EAAE,eAAe,8EA0BzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/plugins/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,wBAAgB,OAAO,IAAI,MAAM,CAAC,kBAAkB,CAAC,CASpD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Principal } from '@nxgt/shared';
|
|
2
|
+
export declare const extractJwtPlugin: {
|
|
3
|
+
requestDidStart({ request, contextValue }: import("@apollo/server").GraphQLRequestContext<{
|
|
4
|
+
jwt?: {
|
|
5
|
+
payload: Principal;
|
|
6
|
+
};
|
|
7
|
+
}>): Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=extract-jwt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-jwt.d.ts","sourceRoot":"","sources":["../../src/plugins/extract-jwt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,eAAO,MAAM,gBAAgB;;cAWtB;YAAE,OAAO,EAAE,SAAS,CAAA;SAAE;;CAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { TokenPrincipal } from '@nxgt/shared';
|
|
2
|
+
import { GraphQLError } from 'graphql';
|
|
3
|
+
import type { Plugin } from 'graphql-yoga';
|
|
4
|
+
import { type Ory, type OryPrincipal, OryUnavailable } from 'stx-sdk/ory';
|
|
5
|
+
import type { GraphQLBaseContext } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* What `useOryAuth()` adds to the context, next to `user` and `token`: the
|
|
8
|
+
* Ory principal itself, or `null` when the request carried no honoured
|
|
9
|
+
* credential. `user.sub === ory.subject` by construction; read `ory` when the
|
|
10
|
+
* value is going to Keto, so the code says what it is.
|
|
11
|
+
*/
|
|
12
|
+
export type OryContext = {
|
|
13
|
+
ory?: OryPrincipal | null;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The repo-wide TokenPrincipal an Ory principal becomes.
|
|
17
|
+
*
|
|
18
|
+
* `sub` and `uid` are both the Ory subject — a Kratos identity id for a
|
|
19
|
+
* session or a person's token, the client id for a `client_credentials`
|
|
20
|
+
* token — so every service that reads `this.principal?.sub` (or `.uid`) keeps
|
|
21
|
+
* working unchanged. `authorities` is EMPTY on purpose: Keto answers per
|
|
22
|
+
* object, and an empty list is what keeps `@policy` / `useGenericAuth`'s
|
|
23
|
+
* policy extraction from granting anything by accident.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toPrincipal(ory: OryPrincipal): TokenPrincipal;
|
|
26
|
+
/**
|
|
27
|
+
* A 503 the client can read as one — a real `GraphQLError` so Yoga's masking
|
|
28
|
+
* leaves it alone, `extensions.http.status` so the transport says 503 too.
|
|
29
|
+
* Never a denial: `stx-sdk/ory` throws `OryUnavailable` only when Kratos,
|
|
30
|
+
* Hydra or Keto could not answer, and that must not read as "not signed in".
|
|
31
|
+
*/
|
|
32
|
+
export declare function oryUnavailableError(error: OryUnavailable): GraphQLError;
|
|
33
|
+
/**
|
|
34
|
+
* The one introspection code path — `Bearer` first, then `X-Session-Token`,
|
|
35
|
+
* then the Kratos cookie; the first credential present decides. Exported so
|
|
36
|
+
* a REST route mounted beside the GraphQL endpoint (content-hub-api's
|
|
37
|
+
* webhook shape) authenticates through the same function instead of a
|
|
38
|
+
* second call.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveOryPrincipal(ory: Ory, headers: Headers): Promise<OryContext & {
|
|
41
|
+
user?: TokenPrincipal;
|
|
42
|
+
token?: string;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* `useAuth()` for an Ory-native API: resolves the caller through Kratos
|
|
46
|
+
* (session cookie, session token) or Hydra (Bearer, introspected) and puts
|
|
47
|
+
* `user`, `token` and `ory` on the context. Wire it exactly where the
|
|
48
|
+
* standalone APIs wire `useAuth()`, ahead of `useGenericAuth` — which then
|
|
49
|
+
* enforces `@authenticated` from `context.user` unchanged.
|
|
50
|
+
*
|
|
51
|
+
* The `Ory` instance comes from the app's `createOry()` — one per process —
|
|
52
|
+
* and is the same one the services use for `isAllowed`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function useOryAuth(ory: Ory): Plugin<GraphQLBaseContext & OryContext>;
|
|
55
|
+
//# sourceMappingURL=ory-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ory-auth.d.ts","sourceRoot":"","sources":["../../src/plugins/ory-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAEN,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,cAAc,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACxB,GAAG,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,cAAc,CAc7D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAQvE;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACxC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,UAAU,GAAG;IAAE,IAAI,CAAC,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAcjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,kBAAkB,GAAG,UAAU,CAAC,CAM5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any.scalars.d.ts","sourceRoot":"","sources":["../../../src/scalars/any/any.scalars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAQ,MAAM,SAAS,CAAC;AAElD,eAAO,MAAM,UAAU;;CAiCtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scalars/any/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.scalars.d.ts","sourceRoot":"","sources":["../../../src/scalars/custom/custom.scalars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAyDjD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CA+J5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scalars/custom/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LocaleKey } from '@nxgt/i18n';
|
|
2
|
+
import { GraphQLScalarType } from 'graphql';
|
|
3
|
+
export declare function createScalarFrom<T, R>(scalar: GraphQLScalarType<T, R>, { name, description, errorMessage, }: {
|
|
4
|
+
name?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
errorMessage?: LocaleKey | string;
|
|
7
|
+
}): GraphQLScalarType<T, R>;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/scalars/custom/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EACpC,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,EAC/B,EACC,IAAI,EACJ,WAAW,EACX,YAAY,GACZ,EAAE;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAClC,2BA2CD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scalars/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAKjD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAI9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scalars/upload/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.scalar.d.ts","sourceRoot":"","sources":["../../../src/scalars/upload/upload.scalar.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;CAEzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/security/policies/exaluation.utils.ts
|
|
2
|
+
import {
|
|
3
|
+
compilePolicy,
|
|
4
|
+
evaluateGraphql,
|
|
5
|
+
evaluateRest
|
|
6
|
+
} from "@nxgt/security/policy";
|
|
7
|
+
import { zDecision } from "stx-sdk/auth";
|
|
8
|
+
async function evaluateFromRules(rules, input) {
|
|
9
|
+
const policy = compilePolicy(rules);
|
|
10
|
+
const result = input.type === "rest" ? evaluateRest(policy, input) : evaluateGraphql(policy, input);
|
|
11
|
+
return {
|
|
12
|
+
decision: result.decision === "ALLOW" ? zDecision.enum.ALLOW : result.decision === "DENY" ? zDecision.enum.DENY : zDecision.enum.NOT_APPLICABLE,
|
|
13
|
+
reason: result.reason
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/security/policies/evaluation.service.ts
|
|
18
|
+
class PolicyEvaluationService {
|
|
19
|
+
async evaluateFromRules(rules, input) {
|
|
20
|
+
return evaluateFromRules(rules, input);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
PolicyEvaluationService
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//# debugId=AC7984A057C85CB364756E2164756E21
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/security/policies/exaluation.utils.ts", "../src/security/policies/evaluation.service.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import {\n\tcompilePolicy,\n\tevaluateGraphql,\n\tevaluateRest,\n\ttype GraphqlEvaluateInput,\n\ttype RestEvaluateInput,\n\ttype Rules,\n} from '@nxgt/security/policy';\nimport { zDecision } from 'stx-sdk/auth';\nimport type { EvaluateResponse } from './policy.types';\n\nexport async function evaluateFromRules(\n\trules: Rules,\n\tinput: RestEvaluateInput | GraphqlEvaluateInput,\n): Promise<EvaluateResponse> {\n\t// `@nxgt/security`'s evaluators take a compiled policy — the rules with\n\t// their path patterns and expressions already built — where the copy this\n\t// replaced took the raw document and compiled on every request.\n\tconst policy = compilePolicy(rules);\n\tconst result =\n\t\tinput.type === 'rest'\n\t\t\t? evaluateRest(policy, input)\n\t\t\t: evaluateGraphql(policy, input);\n\n\treturn {\n\t\tdecision:\n\t\t\tresult.decision === 'ALLOW'\n\t\t\t\t? zDecision.enum.ALLOW\n\t\t\t\t: result.decision === 'DENY'\n\t\t\t\t\t? zDecision.enum.DENY\n\t\t\t\t\t: zDecision.enum.NOT_APPLICABLE,\n\t\treason: result.reason,\n\t};\n}\n",
|
|
6
|
+
"import type {\n\tGraphqlEvaluateInput,\n\tRestEvaluateInput,\n\tRules,\n} from '@nxgt/security/policy';\nimport { evaluateFromRules } from './exaluation.utils';\nimport type { EvaluateResponse } from './policy.types';\n\nexport class PolicyEvaluationService {\n\t/**\n\t * Evaluate a REST or GraphQL request against the static `rules.yaml`.\n\t */\n\tasync evaluateFromRules(\n\t\trules: Rules,\n\t\tinput: RestEvaluateInput | GraphqlEvaluateInput,\n\t): Promise<EvaluateResponse> {\n\t\treturn evaluateFromRules(rules, input);\n\t}\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AAGA,eAAsB,iBAAiB,CACtC,OACA,OAC4B;AAAA,EAI5B,MAAM,SAAS,cAAc,KAAK;AAAA,EAClC,MAAM,SACL,MAAM,SAAS,SACZ,aAAa,QAAQ,KAAK,IAC1B,gBAAgB,QAAQ,KAAK;AAAA,EAEjC,OAAO;AAAA,IACN,UACC,OAAO,aAAa,UACjB,UAAU,KAAK,QACf,OAAO,aAAa,SACnB,UAAU,KAAK,OACf,UAAU,KAAK;AAAA,IACpB,QAAQ,OAAO;AAAA,EAChB;AAAA;;;ACxBM,MAAM,wBAAwB;AAAA,OAI9B,kBAAiB,CACtB,OACA,OAC4B;AAAA,IAC5B,OAAO,kBAAkB,OAAO,KAAK;AAAA;AAEvC;",
|
|
9
|
+
"debugId": "AC7984A057C85CB364756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GraphqlEvaluateInput, RestEvaluateInput, Rules } from '@nxgt/security/policy';
|
|
2
|
+
import type { EvaluateResponse } from './policy.types';
|
|
3
|
+
export declare class PolicyEvaluationService {
|
|
4
|
+
/**
|
|
5
|
+
* Evaluate a REST or GraphQL request against the static `rules.yaml`.
|
|
6
|
+
*/
|
|
7
|
+
evaluateFromRules(rules: Rules, input: RestEvaluateInput | GraphqlEvaluateInput): Promise<EvaluateResponse>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=evaluation.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation.service.d.ts","sourceRoot":"","sources":["../../../src/security/policies/evaluation.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,EACL,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,qBAAa,uBAAuB;IACnC;;OAEG;IACG,iBAAiB,CACtB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,iBAAiB,GAAG,oBAAoB,GAC7C,OAAO,CAAC,gBAAgB,CAAC;CAG5B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type GraphqlEvaluateInput, type RestEvaluateInput, type Rules } from '@nxgt/security/policy';
|
|
2
|
+
import type { EvaluateResponse } from './policy.types';
|
|
3
|
+
export declare function evaluateFromRules(rules: Rules, input: RestEvaluateInput | GraphqlEvaluateInput): Promise<EvaluateResponse>;
|
|
4
|
+
//# sourceMappingURL=exaluation.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exaluation.utils.d.ts","sourceRoot":"","sources":["../../../src/security/policies/exaluation.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,KAAK,EACV,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,wBAAsB,iBAAiB,CACtC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,iBAAiB,GAAG,oBAAoB,GAC7C,OAAO,CAAC,gBAAgB,CAAC,CAmB3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/security/policies/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.types.d.ts","sourceRoot":"","sources":["../../../src/security/policies/policy.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC"}
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const SHARED_TYPE_DEFS = "\ntype Query {\n\t_empty: String\n}\ntype Mutation {\n\t_empty: String\n}\ntype Subscription {\n\t_empty: String\n}\n\ndirective @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM\n\ndirective @policy(policies: [[String!]!]!) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM\n\ndirective @shareable on OBJECT | FIELD_DEFINITION\n\ndirective @link(url: String!, import: [String!]) on SCHEMA\n\n";
|
|
2
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,2aAmB5B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Principal } from '@nxgt/shared';
|
|
2
|
+
import type { YogaInitialContext } from 'graphql-yoga';
|
|
3
|
+
export interface GraphQLBaseContext extends YogaInitialContext {
|
|
4
|
+
user?: Principal;
|
|
5
|
+
token?: string;
|
|
6
|
+
}
|
|
7
|
+
export type ServerContext = {
|
|
8
|
+
request: Request;
|
|
9
|
+
};
|
|
10
|
+
export type PrincipalContext = {
|
|
11
|
+
user?: Principal;
|
|
12
|
+
token?: string;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC7D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*.graphql';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,gBAAgB,CAAC"}
|
package/dist/upload.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type AuditService } from '@nxgt/shared-mongo';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal structural shape of the app's pubsub instance. Kept structural so
|
|
4
|
+
* this factory does not couple to a specific `graphql-yoga` `PubSub<...>`
|
|
5
|
+
* instantiation.
|
|
6
|
+
*/
|
|
7
|
+
export type ChangeResolversPubSub = {
|
|
8
|
+
subscribe: (event: string) => any;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Minimal structural shape of the context every subgraph builds: an
|
|
12
|
+
* `AuditService` under `services.audit`, plus the module's own CRUD service
|
|
13
|
+
* exposing `findById`.
|
|
14
|
+
*/
|
|
15
|
+
export type ChangeResolversContext = {
|
|
16
|
+
services: {
|
|
17
|
+
audit: AuditService;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type CreateChangeResolversConfig = {
|
|
22
|
+
/**
|
|
23
|
+
* Singular camelCase entity name used to build the resolver field names:
|
|
24
|
+
* `bed` -> `bedChanges`, `bedChangesById`, `bedChanged`.
|
|
25
|
+
*/
|
|
26
|
+
entity: string;
|
|
27
|
+
/**
|
|
28
|
+
* Mongo collection name, i.e. `BedModel.collection.collectionName`.
|
|
29
|
+
*/
|
|
30
|
+
collection: string;
|
|
31
|
+
/**
|
|
32
|
+
* Key of the module's CRUD service on `context.services`, i.e. `beds`.
|
|
33
|
+
*/
|
|
34
|
+
service: string;
|
|
35
|
+
/**
|
|
36
|
+
* The app's pubsub instance, or a getter returning it. Prefer the getter
|
|
37
|
+
* form (`() => pubsub`) when the app can re-create its pubsub at runtime,
|
|
38
|
+
* so the subscription always resolves against the current instance.
|
|
39
|
+
*/
|
|
40
|
+
pubsub: ChangeResolversPubSub | (() => ChangeResolversPubSub);
|
|
41
|
+
};
|
|
42
|
+
export type ChangeResolvers = {
|
|
43
|
+
Query: Record<string, any>;
|
|
44
|
+
Subscription: Record<string, any>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Builds the audit change-stream resolver block that is otherwise repeated
|
|
48
|
+
* verbatim in every module's `*.resolver.ts`: the two paginated `Changes`
|
|
49
|
+
* queries and the `Changed` subscription.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* const changes = createChangeResolvers({
|
|
53
|
+
* entity: 'bed',
|
|
54
|
+
* collection: BedModel.collection.collectionName,
|
|
55
|
+
* service: 'beds',
|
|
56
|
+
* pubsub: () => pubsub,
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* export const beds: Resolvers = {
|
|
60
|
+
* Query: { bed: ..., beds: ..., ...changes.Query },
|
|
61
|
+
* Subscription: { ...changes.Subscription },
|
|
62
|
+
* };
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function createChangeResolvers(config: CreateChangeResolversConfig): ChangeResolvers;
|
|
66
|
+
//# sourceMappingURL=change-resolvers.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-resolvers.utils.d.ts","sourceRoot":"","sources":["../../src/utils/change-resolvers.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,YAAY,EAEjB,MAAM,oBAAoB,CAAC;AAG5B;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IACnC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC;CAClC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE;QACT,KAAK,EAAE,YAAY,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACnB,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACzC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,MAAM,EAAE,qBAAqB,GAAG,CAAC,MAAM,qBAAqB,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,2BAA2B,GACjC,eAAe,CAoDjB"}
|