@meshmakers/octo-services 3.4.1480 → 3.5.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/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@meshmakers/octo-services",
3
- "version": "3.4.1480",
3
+ "version": "3.5.00",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^22.0.0",
6
6
  "@angular/core": "^22.0.0",
7
+ "@apollo/client": "^4.1.0",
7
8
  "@meshmakers/shared-auth": "*",
8
9
  "@meshmakers/shared-services": "*",
9
10
  "apollo-angular": "^14.0.0",
11
+ "graphql": "^16.0.0 || ^17.0.0",
10
12
  "tus-js-client": "^4.3.1"
11
13
  },
12
14
  "dependencies": {
@@ -22,6 +24,10 @@
22
24
  ".": {
23
25
  "types": "./types/meshmakers-octo-services.d.ts",
24
26
  "default": "./fesm2022/meshmakers-octo-services.mjs"
27
+ },
28
+ "./testing": {
29
+ "types": "./types/meshmakers-octo-services-testing.d.ts",
30
+ "default": "./fesm2022/meshmakers-octo-services-testing.mjs"
25
31
  }
26
32
  },
27
33
  "type": "module"
@@ -0,0 +1,44 @@
1
+ import { GraphQLSchema, DocumentNode } from 'graphql';
2
+
3
+ /**
4
+ * SECRET-safe GraphQL document rule (AB#5542), shared by the guard specs of the libraries
5
+ * (`octo-services/src/lib/graphql-secret-guard.spec.ts`) and the Refinery Studio
6
+ * (`src/app/graphql-secret-guard.spec.ts`). Pure functions — the specs do the file scanning.
7
+ *
8
+ * A document violates the rule when
9
+ * 1. a generic runtime `attributes` selection (`RtEntityAttributeDtoConnection`) has no
10
+ * `attributeNames` argument, binds it to a NULLABLE variable, or lists a credential-like name
11
+ * (list or single string) — omitting the filter returns every attribute incl. secrets;
12
+ * 2. a typed selection contains a credential-like String field (`password`, `clientSecret`,
13
+ * `apiKey`, `botToken`, …; Boolean/number fields such as `isSecret` or `maxTokens` are fine) —
14
+ * the fallback for models whose credentials are not SECRET yet;
15
+ * 3. a SECRET-typed field (schema type `OctoSecretState`, AB#5528) is selected without `isSet`
16
+ * (the server refuses a scalar selection anyway; the state must be read as `{ isSet … }`).
17
+ *
18
+ * A non-null variable with a default (`$attributeNames: [String!]! = []`) is accepted.
19
+ */
20
+ /** One violation: `key` = `<file>#<field path>` (allow-list key), `message` = human readable. */
21
+ interface SecretGuardViolation {
22
+ readonly key: string;
23
+ readonly message: string;
24
+ }
25
+ /** Schema type of a typed SECRET field (AB#5528). */
26
+ declare const SECRET_STATE_TYPE = "OctoSecretState";
27
+ /**
28
+ * The GraphQL documents of a source file: the whole text of a `.graphql` file, or the inline
29
+ * `gql` template literals (interpolations removed) of a `.ts` file.
30
+ */
31
+ declare function extractGraphQlDocuments(path: string, source: string): string[];
32
+ /** Violations of the SECRET rule in one parsed document, validated against `schema`. */
33
+ declare function findSecretUnsafeSelections(schema: GraphQLSchema, doc: DocumentNode, file: string): SecretGuardViolation[];
34
+ /**
35
+ * Same rule as {@link findSecretUnsafeSelections}, but from source text: the schema SDL and the
36
+ * document are parsed with THIS module's `graphql` instance. Hosts that consume the library as a
37
+ * published package must use this variant — passing a schema or document built with the host's
38
+ * own `graphql` copy fails with "Cannot use GraphQLObjectType from another module or realm"
39
+ * whenever the bundler resolves `graphql` twice (ESM/CJS or nested copies).
40
+ */
41
+ declare function findSecretUnsafeSelectionsInSource(schemaSdl: string, documentText: string, file: string): SecretGuardViolation[];
42
+
43
+ export { SECRET_STATE_TYPE, extractGraphQlDocuments, findSecretUnsafeSelections, findSecretUnsafeSelectionsInSource };
44
+ export type { SecretGuardViolation };