@haneinfo/metadata-schema 0.0.0-stage → 1.1.3

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.
Files changed (41) hide show
  1. package/README.md +75 -2
  2. package/dist/cube-tags.d.ts +15 -0
  3. package/dist/cube-tags.d.ts.map +1 -0
  4. package/dist/cube-tags.js +43 -0
  5. package/dist/cube-tags.js.map +1 -0
  6. package/dist/data-dictionary.d.ts +9 -0
  7. package/dist/data-dictionary.d.ts.map +1 -0
  8. package/dist/data-dictionary.js +54 -0
  9. package/dist/data-dictionary.js.map +1 -0
  10. package/dist/enum-i18n.d.ts +8 -0
  11. package/dist/enum-i18n.d.ts.map +1 -0
  12. package/dist/enum-i18n.js +17 -0
  13. package/dist/enum-i18n.js.map +1 -0
  14. package/dist/index.d.ts +8 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +26 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/meta-scope.guard.d.ts +18 -0
  19. package/dist/meta-scope.guard.d.ts.map +1 -0
  20. package/dist/meta-scope.guard.js +62 -0
  21. package/dist/meta-scope.guard.js.map +1 -0
  22. package/dist/meta.controller.d.ts +7 -0
  23. package/dist/meta.controller.d.ts.map +1 -0
  24. package/dist/meta.controller.js +47 -0
  25. package/dist/meta.controller.js.map +1 -0
  26. package/dist/meta.module.d.ts +7 -0
  27. package/dist/meta.module.d.ts.map +1 -0
  28. package/dist/meta.module.js +35 -0
  29. package/dist/meta.module.js.map +1 -0
  30. package/dist/meta.service.d.ts +57 -0
  31. package/dist/meta.service.d.ts.map +1 -0
  32. package/dist/meta.service.js +93 -0
  33. package/dist/meta.service.js.map +1 -0
  34. package/dist/plugin.d.ts +20 -0
  35. package/dist/plugin.d.ts.map +1 -0
  36. package/dist/plugin.js +61 -0
  37. package/dist/plugin.js.map +1 -0
  38. package/haneinfo.plugin.json +30 -0
  39. package/package.json +58 -4
  40. package/plugin.d.ts +3 -0
  41. package/plugin.js +4 -0
package/README.md CHANGED
@@ -1,3 +1,76 @@
1
- # Temporary Holding Version
1
+ # `@haneinfo/metadata-schema`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@haneinfo/metadata-schema` exposes the Prisma DMMF used by an app through `GET /metadata/schema`.
4
+ The response includes scalar and enum fields, relation metadata, database column names, and
5
+ structured annotations parsed from Prisma `///` documentation comments.
6
+
7
+ ## Prisma documentation tags
8
+
9
+ Tags are line-oriented and case-sensitive. A tag is recognised only when it starts a documentation
10
+ line, after optional whitespace. A description can follow the tag on the same line, or appear on
11
+ separate `///` lines. The original `documentation` value in the metadata response is preserved
12
+ byte-for-byte; parsing adds structured properties without removing tag text.
13
+
14
+ ### `@internal`
15
+
16
+ Place `@internal` in a model's documentation to exclude that model from the derived
17
+ `availableScopes` list. The model and its metadata are still exposed in `models`; only the scope
18
+ derivation filters it out.
19
+
20
+ ```prisma
21
+ /// @internal
22
+ /// Framework bookkeeping; not part of the public data scopes.
23
+ model AuditLog {
24
+ id String @id @default(cuid())
25
+ }
26
+ ```
27
+
28
+ ### `@cubeMeasure <hint>`
29
+
30
+ Place `@cubeMeasure` on a scalar or enum field and provide one non-whitespace hint. The current
31
+ recommended dictionary is `sum`, `avg`, `min`, `max`, and `count`, but `measureHint` is an open
32
+ `string` so future Cube measures such as `countDistinct`, `countDistinctApprox`, and `runningTotal`
33
+ can be used without a package type change. The parser does not validate whether the field type is
34
+ appropriate for the hint. Consumers should ignore or warn on unknown hints rather than failing the
35
+ whole query.
36
+
37
+ ```prisma
38
+ model InvoiceLine {
39
+ id String @id @default(cuid())
40
+ /// @cubeMeasure sum Line amount in the invoice currency.
41
+ amount Decimal
42
+ }
43
+ ```
44
+
45
+ ### `@cubeRef <app>.<Model>.<field>`
46
+
47
+ Place `@cubeRef` on a field that refers to a field owned by another app. The three dot-separated
48
+ parts are returned as `crossAppRef: { app, model, field }`. Parsing is syntactic only: the app,
49
+ model, and field do not need to exist in the current repository. Cross-app joins are never inferred
50
+ when this tag is absent.
51
+
52
+ ```prisma
53
+ model Shipment {
54
+ id String @id @default(cuid())
55
+ /// @cubeRef sales.Order.id
56
+ /// The order identifier is owned by the sales app.
57
+ salesOrderId String @map("sales_order_id")
58
+ }
59
+ ```
60
+
61
+ Tags can be combined on one field and can be mixed with ordinary text:
62
+
63
+ ```prisma
64
+ model Payment {
65
+ id String @id @default(cuid())
66
+ /// Payment amount in the settlement currency.
67
+ /// @cubeMeasure sum
68
+ /// @cubeRef billing.Invoice.total
69
+ amount Decimal @map("amount_value")
70
+ }
71
+ ```
72
+
73
+ Malformed `@cubeMeasure` or `@cubeRef` lines are ignored and produce a warning. Lowercase variants
74
+ such as `@cubemeasure` are ordinary text. If a tag appears more than once on a field, the first
75
+ valid occurrence wins. A tag string embedded in the middle of a sentence is not a tag; move it to
76
+ the beginning of a `///` documentation line.
@@ -0,0 +1,15 @@
1
+ export interface CubeTags {
2
+ measureHint?: string;
3
+ crossAppRef?: {
4
+ app: string;
5
+ model: string;
6
+ field: string;
7
+ };
8
+ }
9
+ /**
10
+ * Parses Cube tags from Prisma documentation without changing the source documentation string.
11
+ * Tags are valid only when they begin a documentation line, matching the existing line-oriented
12
+ * convention used for `@internal` metadata in this package.
13
+ */
14
+ export declare function parseCubeTags(documentation: string | undefined): CubeTags;
15
+ //# sourceMappingURL=cube-tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cube-tags.d.ts","sourceRoot":"","sources":["../src/cube-tags.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7D;AAMD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CA+BzE"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCubeTags = parseCubeTags;
4
+ const CUBE_MEASURE_TAG = /^\s*@cubeMeasure(?:\s+(\S+))?(?:\s+.*)?$/;
5
+ const CUBE_REF_TAG = /^\s*@cubeRef(?:\s+(\S+))?(?:\s+.*)?$/;
6
+ const CUBE_REF_VALUE = /^([^.\s]+)\.([^.\s]+)\.([^.\s]+)$/;
7
+ /**
8
+ * Parses Cube tags from Prisma documentation without changing the source documentation string.
9
+ * Tags are valid only when they begin a documentation line, matching the existing line-oriented
10
+ * convention used for `@internal` metadata in this package.
11
+ */
12
+ function parseCubeTags(documentation) {
13
+ if (!documentation)
14
+ return {};
15
+ const result = {};
16
+ const lines = documentation.replace(/\\n/g, '\n').split(/\r?\n/);
17
+ for (const line of lines) {
18
+ const measureMatch = line.match(CUBE_MEASURE_TAG);
19
+ if (measureMatch) {
20
+ const hint = measureMatch[1];
21
+ if (!hint || hint.startsWith('@')) {
22
+ console.warn('Ignoring malformed @cubeMeasure tag: expected a hint.');
23
+ }
24
+ else if (result.measureHint === undefined) {
25
+ result.measureHint = hint;
26
+ }
27
+ continue;
28
+ }
29
+ const refMatch = line.match(CUBE_REF_TAG);
30
+ if (refMatch) {
31
+ const value = refMatch[1];
32
+ const parts = value?.match(CUBE_REF_VALUE);
33
+ if (!parts) {
34
+ console.warn('Ignoring malformed @cubeRef tag: expected <app>.<Model>.<field>.');
35
+ }
36
+ else if (result.crossAppRef === undefined) {
37
+ result.crossAppRef = { app: parts[1], model: parts[2], field: parts[3] };
38
+ }
39
+ }
40
+ }
41
+ return result;
42
+ }
43
+ //# sourceMappingURL=cube-tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cube-tags.js","sourceRoot":"","sources":["../src/cube-tags.ts"],"names":[],"mappings":";;AAcA,sCA+BC;AAxCD,MAAM,gBAAgB,GAAG,0CAA0C,CAAC;AACpE,MAAM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AC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3E,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { SchemaMeta } from './meta.service';
2
+ /**
3
+ * Renders a SchemaMeta (from MetaService.buildMeta()) into the docs/data-dictionary.md
4
+ * markdown format. Shared by both the build-time script and (indirectly, via the same
5
+ * SchemaMeta shape) the GET /metadata/schema runtime endpoint — see dev_docs 001
6
+ * "Metadata Schema API".
7
+ */
8
+ export declare function renderDataDictionary(meta: SchemaMeta): string;
9
+ //# sourceMappingURL=data-dictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-dictionary.d.ts","sourceRoot":"","sources":["../src/data-dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CA6D7D"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderDataDictionary = renderDataDictionary;
4
+ /** Normalise multi-line /// comments into a single clean string. */
5
+ function doc(s) {
6
+ return (s ?? '').replace(/\\n/g, ' ').replace(/\n/g, ' ').trim();
7
+ }
8
+ /**
9
+ * Renders a SchemaMeta (from MetaService.buildMeta()) into the docs/data-dictionary.md
10
+ * markdown format. Shared by both the build-time script and (indirectly, via the same
11
+ * SchemaMeta shape) the GET /metadata/schema runtime endpoint — see dev_docs 001
12
+ * "Metadata Schema API".
13
+ */
14
+ function renderDataDictionary(meta) {
15
+ const lines = [];
16
+ const push = (...args) => lines.push(...args);
17
+ push('# Data Dictionary', '', `> Auto-generated from Prisma schema on ${meta.generatedAt.slice(0, 10)}.`, "> Do not edit manually — run your app's schema:docs script to regenerate.", '', '---', '');
18
+ push('## Enums', '');
19
+ for (const e of meta.enums) {
20
+ push(`### ${e.name}`, '');
21
+ if (e.documentation)
22
+ push(`> ${doc(e.documentation)}`, '');
23
+ push('| Value | Description |', '|-------|-------------|');
24
+ for (const v of e.values) {
25
+ push(`| \`${v.name}\` | ${doc(v.documentation)} |`);
26
+ }
27
+ push('');
28
+ }
29
+ push('## Models', '');
30
+ for (const m of meta.models) {
31
+ push(`### ${m.name}`, '');
32
+ if (m.documentation)
33
+ push(`> ${doc(m.documentation)}`, '');
34
+ push(`**DB table:** \`${m.dbTable}\``, '', '| Field | Type | Required | Unique | Description |', '|-------|------|----------|--------|-------------|');
35
+ for (const f of m.fields) {
36
+ const required = f.isRequired ? '✓' : '';
37
+ const unique = f.isUnique || f.isId ? '✓' : '';
38
+ const type = f.isList ? `${f.type}[]` : f.type;
39
+ push(`| \`${f.name}\` | ${type} | ${required} | ${unique} | ${doc(f.documentation)} |`);
40
+ }
41
+ push('');
42
+ if (m.relations.length > 0) {
43
+ push('#### Relations', '', '| Relation Field | Target Model | Required | List |', '|----------------|--------------|----------|------|');
44
+ for (const relation of m.relations) {
45
+ const required = relation.isRequired ? '✓' : '';
46
+ const list = relation.isList ? '✓' : '';
47
+ push(`| \`${relation.fieldName}\` | \`${relation.targetModel}\` | ${required} | ${list} |`);
48
+ }
49
+ push('');
50
+ }
51
+ }
52
+ return lines.join('\n');
53
+ }
54
+ //# sourceMappingURL=data-dictionary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-dictionary.js","sourceRoot":"","sources":["../src/data-dictionary.ts"],"names":[],"mappings":";;AAaA,oDA6DC;AAxED,oEAAoE;AACpE,SAAS,GAAG,CAAC,CAAqB;IAChC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACnE,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IAAI,CAAC,CAAC;YAC9F,CAAC;YACD,IAAI,CAAC,EAAE,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { SchemaMeta } from './meta.service';
2
+ export interface EnumTranslationGap {
3
+ locale: string;
4
+ key: string;
5
+ kind: 'missing' | 'orphaned';
6
+ }
7
+ export declare function collectEnumTranslationGaps(meta: Pick<SchemaMeta, 'enums'>, dictionaries: Record<string, Record<string, unknown>>): EnumTranslationGap[];
8
+ //# sourceMappingURL=enum-i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum-i18n.d.ts","sourceRoot":"","sources":["../src/enum-i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;CAC9B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EAC/B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACpD,kBAAkB,EAAE,CAoBtB"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collectEnumTranslationGaps = collectEnumTranslationGaps;
4
+ function collectEnumTranslationGaps(meta, dictionaries) {
5
+ const expectedKeys = new Set(meta.enums.flatMap((enumMeta) => enumMeta.values.map((value) => `${enumMeta.name}.${value.name}`)));
6
+ return Object.entries(dictionaries).flatMap(([locale, dictionary]) => {
7
+ const actualKeys = new Set(Object.keys(dictionary).filter((key) => typeof dictionary[key] === 'string'));
8
+ const missing = [...expectedKeys]
9
+ .filter((key) => !actualKeys.has(key))
10
+ .map((key) => ({ locale, key, kind: 'missing' }));
11
+ const orphaned = [...actualKeys]
12
+ .filter((key) => !expectedKeys.has(key))
13
+ .map((key) => ({ locale, key, kind: 'orphaned' }));
14
+ return [...missing, ...orphaned];
15
+ });
16
+ }
17
+ //# sourceMappingURL=enum-i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum-i18n.js","sourceRoot":"","sources":["../src/enum-i18n.ts"],"names":[],"mappings":";;AAQA,gEAuBC;AAvBD,SAAgB,0BAA0B,CACxC,IAA+B,EAC/B,YAAqD;IAErD,MAAM,YAAY,GAAG,IAAI,GAAG,CAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC9B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CACjE,CACF,CAAC;IAEF,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE;QACnE,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,CAC7E,CAAC;QACF,MAAM,OAAO,GAAG,CAAC,GAAG,YAAY,CAAC;aAC9B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACrC,GAAG,CAAqB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,CAAC,GAAG,UAAU,CAAC;aAC7B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACvC,GAAG,CAAqB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAEzE,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { METADATA_SCHEMA, type MetadataSchemaPort } from '@haneinfo/plugin-api';
2
+ export * from './data-dictionary';
3
+ export * from './enum-i18n';
4
+ export * from './meta.controller';
5
+ export * from './meta.module';
6
+ export * from './meta.service';
7
+ export * from './meta-scope.guard';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAChF,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.METADATA_SCHEMA = void 0;
18
+ var plugin_api_1 = require("@haneinfo/plugin-api");
19
+ Object.defineProperty(exports, "METADATA_SCHEMA", { enumerable: true, get: function () { return plugin_api_1.METADATA_SCHEMA; } });
20
+ __exportStar(require("./data-dictionary"), exports);
21
+ __exportStar(require("./enum-i18n"), exports);
22
+ __exportStar(require("./meta.controller"), exports);
23
+ __exportStar(require("./meta.module"), exports);
24
+ __exportStar(require("./meta.service"), exports);
25
+ __exportStar(require("./meta-scope.guard"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAgF;AAAvE,6GAAA,eAAe,OAAA;AACxB,oDAAkC;AAClC,8CAA4B;AAC5B,oDAAkC;AAClC,gDAA8B;AAC9B,iDAA+B;AAC/B,qDAAmC"}
@@ -0,0 +1,18 @@
1
+ import { type ScopeMatcherPort } from '@haneinfo/plugin-api';
2
+ import { type CanActivate, type ExecutionContext } from '@nestjs/common';
3
+ /**
4
+ * Authorization guard for metadata schema access.
5
+ *
6
+ * Requirements:
7
+ * - Interactive users (human logins / JWT) have full access to schema introspection.
8
+ * - Machine users (API keys) must possess the `metadata:read` scope (or a wildcard like `metadata:*` or `*`).
9
+ * - Decoupled from concrete `@haneinfo/m2m-api-key` implementations via the neutral `SCOPE_MATCHER` token.
10
+ * - Strict Fail-Closed: if a machine credential is presented but no scope matcher capability
11
+ * is registered, access is denied (403 Forbidden).
12
+ */
13
+ export declare class MetadataScopeGuard implements CanActivate {
14
+ private readonly scopeMatcher?;
15
+ constructor(scopeMatcher?: ScopeMatcherPort | undefined);
16
+ canActivate(context: ExecutionContext): boolean;
17
+ }
18
+ //# sourceMappingURL=meta-scope.guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta-scope.guard.d.ts","sourceRoot":"","sources":["../src/meta-scope.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAKtB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;GASG;AACH,qBACa,kBAAmB,YAAW,WAAW;IAIlD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAAb,YAAY,CAAC,EAAE,gBAAgB,YAAA;IAGlD,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;CAkChD"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MetadataScopeGuard = void 0;
16
+ const plugin_api_1 = require("@haneinfo/plugin-api");
17
+ const common_1 = require("@nestjs/common");
18
+ /**
19
+ * Authorization guard for metadata schema access.
20
+ *
21
+ * Requirements:
22
+ * - Interactive users (human logins / JWT) have full access to schema introspection.
23
+ * - Machine users (API keys) must possess the `metadata:read` scope (or a wildcard like `metadata:*` or `*`).
24
+ * - Decoupled from concrete `@haneinfo/m2m-api-key` implementations via the neutral `SCOPE_MATCHER` token.
25
+ * - Strict Fail-Closed: if a machine credential is presented but no scope matcher capability
26
+ * is registered, access is denied (403 Forbidden).
27
+ */
28
+ let MetadataScopeGuard = class MetadataScopeGuard {
29
+ constructor(scopeMatcher) {
30
+ this.scopeMatcher = scopeMatcher;
31
+ }
32
+ canActivate(context) {
33
+ const request = context.switchToHttp().getRequest();
34
+ const user = request.user;
35
+ if (!user) {
36
+ return false;
37
+ }
38
+ const isApiKey = 'isApiKey' in user ? Boolean(user.isApiKey) : user.kind === 'machine';
39
+ // Interactive principals are not scope-restricted.
40
+ if (!isApiKey) {
41
+ return true;
42
+ }
43
+ // Machine caller: require a scope matcher port to validate scopes.
44
+ if (!this.scopeMatcher) {
45
+ throw new common_1.ForbiddenException('No scope matcher provider is available to validate API key scopes');
46
+ }
47
+ const scopes = 'scopes' in user && Array.isArray(user.scopes) ? user.scopes : [];
48
+ const allowed = this.scopeMatcher.matches(scopes, 'metadata:read');
49
+ if (!allowed) {
50
+ throw new common_1.ForbiddenException('Insufficient API key scopes');
51
+ }
52
+ return true;
53
+ }
54
+ };
55
+ exports.MetadataScopeGuard = MetadataScopeGuard;
56
+ exports.MetadataScopeGuard = MetadataScopeGuard = __decorate([
57
+ (0, common_1.Injectable)(),
58
+ __param(0, (0, common_1.Optional)()),
59
+ __param(0, (0, common_1.Inject)(plugin_api_1.SCOPE_MATCHER)),
60
+ __metadata("design:paramtypes", [Object])
61
+ ], MetadataScopeGuard);
62
+ //# sourceMappingURL=meta-scope.guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta-scope.guard.js","sourceRoot":"","sources":["../src/meta-scope.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAA4F;AAC5F,2CAOwB;AAExB;;;;;;;;;GASG;AAEI,IAAM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;GAHb,kBAAkB,CAyC9B"}
@@ -0,0 +1,7 @@
1
+ import { MetaService, type SchemaMeta } from './meta.service';
2
+ export declare class MetaController {
3
+ private readonly metaService;
4
+ constructor(metaService: MetaService);
5
+ schema(): SchemaMeta;
6
+ }
7
+ //# sourceMappingURL=meta.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.controller.d.ts","sourceRoot":"","sources":["../src/meta.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAM9D,qBAEa,cAAc;IACQ,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAM1E,MAAM,IAAI,UAAU;CAGrB"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MetaController = void 0;
16
+ const plugin_host_nest_1 = require("@haneinfo/plugin-host-nest");
17
+ const common_1 = require("@nestjs/common");
18
+ const meta_service_1 = require("./meta.service");
19
+ const meta_scope_guard_1 = require("./meta-scope.guard");
20
+ // Readable by any logged-in interactive (JWT) user, or by an M2M API key with the metadata:read
21
+ // scope — external agents without repo access query this at runtime (dev_docs 001
22
+ // "Metadata Schema API").
23
+ let MetaController = class MetaController {
24
+ constructor(metaService) {
25
+ this.metaService = metaService;
26
+ }
27
+ // Declares the scope for the API-key scope catalog (m2m-api-key reads the 'scopes' metadata key), so
28
+ // metadata:read can be issued. Written as plain metadata to keep this package free of an m2m runtime import.
29
+ schema() {
30
+ return this.metaService.buildMeta();
31
+ }
32
+ };
33
+ exports.MetaController = MetaController;
34
+ __decorate([
35
+ (0, common_1.Get)('schema'),
36
+ (0, common_1.SetMetadata)('scopes', ['metadata:read']),
37
+ __metadata("design:type", Function),
38
+ __metadata("design:paramtypes", []),
39
+ __metadata("design:returntype", Object)
40
+ ], MetaController.prototype, "schema", null);
41
+ exports.MetaController = MetaController = __decorate([
42
+ (0, common_1.Controller)('metadata'),
43
+ (0, common_1.UseGuards)(plugin_host_nest_1.HaneinfoAuthGuard, meta_scope_guard_1.MetadataScopeGuard),
44
+ __param(0, (0, common_1.Inject)(meta_service_1.MetaService)),
45
+ __metadata("design:paramtypes", [meta_service_1.MetaService])
46
+ ], MetaController);
47
+ //# sourceMappingURL=meta.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.controller.js","sourceRoot":"","sources":["../src/meta.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iEAA+D;AAC/D,2CAAiF;AACjF,iDAA8D;AAC9D,yDAAwD;AAExD,gGAAgG;AAChG,kFAAkF;AAClF,0BAA0B;AAGnB,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAAkD,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAE9E,qGAAqG;IACrG,6GAA6G;IAG7G,MAAM;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;IACtC,CAAC;CACF,CAAA;AAVY,wCAAc;AAOzB;IAFC,IAAA,YAAG,EAAC,QAAQ,CAAC;IACb,IAAA,oBAAW,EAAC,QAAQ,EAAE,CAAC,eAAe,CAAC,CAAC;;;;4CAGxC;yBATU,cAAc;IAF1B,IAAA,mBAAU,EAAC,UAAU,CAAC;IACtB,IAAA,kBAAS,EAAC,oCAAiB,EAAE,qCAAkB,CAAC;IAElC,WAAA,IAAA,eAAM,EAAC,0BAAW,CAAC,CAAA;qCAA+B,0BAAW;GAD/D,cAAc,CAU1B"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Provides the metadata schema introspection service both as a concrete class and behind
3
+ * the stable `METADATA_SCHEMA` capability token (PL4-04).
4
+ */
5
+ export declare class MetaModule {
6
+ }
7
+ //# sourceMappingURL=meta.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.module.d.ts","sourceRoot":"","sources":["../src/meta.module.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,qBAUa,UAAU;CAAG"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MetaModule = void 0;
10
+ const plugin_api_1 = require("@haneinfo/plugin-api");
11
+ const plugin_host_nest_1 = require("@haneinfo/plugin-host-nest");
12
+ const common_1 = require("@nestjs/common");
13
+ const meta_controller_1 = require("./meta.controller");
14
+ const meta_service_1 = require("./meta.service");
15
+ const meta_scope_guard_1 = require("./meta-scope.guard");
16
+ /**
17
+ * Provides the metadata schema introspection service both as a concrete class and behind
18
+ * the stable `METADATA_SCHEMA` capability token (PL4-04).
19
+ */
20
+ let MetaModule = class MetaModule {
21
+ };
22
+ exports.MetaModule = MetaModule;
23
+ exports.MetaModule = MetaModule = __decorate([
24
+ (0, common_1.Module)({
25
+ imports: [plugin_host_nest_1.HaneinfoAuthInfrastructureModule],
26
+ controllers: [meta_controller_1.MetaController],
27
+ providers: [
28
+ meta_service_1.MetaService,
29
+ meta_scope_guard_1.MetadataScopeGuard,
30
+ { provide: plugin_api_1.METADATA_SCHEMA, useExisting: meta_service_1.MetaService },
31
+ ],
32
+ exports: [meta_service_1.MetaService, plugin_api_1.METADATA_SCHEMA, meta_scope_guard_1.MetadataScopeGuard],
33
+ })
34
+ ], MetaModule);
35
+ //# sourceMappingURL=meta.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.module.js","sourceRoot":"","sources":["../src/meta.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qDAAuD;AACvD,iEAA8E;AAC9E,2CAAwC;AACxC,uDAAmD;AACnD,iDAA6C;AAC7C,yDAAwD;AAExD;;;GAGG;AAWI,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAVtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,mDAAgC,CAAC;QAC3C,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,SAAS,EAAE;YACT,0BAAW;YACX,qCAAkB;YAClB,EAAE,OAAO,EAAE,4BAAe,EAAE,WAAW,EAAE,0BAAW,EAAE;SACvD;QACD,OAAO,EAAE,CAAC,0BAAW,EAAE,4BAAe,EAAE,qCAAkB,CAAC;KAC5D,CAAC;GACW,UAAU,CAAG"}
@@ -0,0 +1,57 @@
1
+ export interface FieldMeta {
2
+ name: string;
3
+ type: string;
4
+ kind: string;
5
+ dbColumn: string;
6
+ isRequired: boolean;
7
+ isUnique: boolean;
8
+ isId: boolean;
9
+ isList: boolean;
10
+ hasDefault: boolean;
11
+ default?: unknown;
12
+ documentation?: string;
13
+ measureHint?: string;
14
+ crossAppRef?: {
15
+ app: string;
16
+ model: string;
17
+ field: string;
18
+ };
19
+ }
20
+ export interface RelationMeta {
21
+ fieldName: string;
22
+ targetModel: string;
23
+ relationName: string;
24
+ isRequired: boolean;
25
+ isList: boolean;
26
+ fromFields: string[];
27
+ toFields: string[];
28
+ fromDbColumns: string[];
29
+ toDbColumns: string[];
30
+ }
31
+ export interface ModelMeta {
32
+ name: string;
33
+ dbTable: string;
34
+ documentation?: string;
35
+ fields: FieldMeta[];
36
+ relations: RelationMeta[];
37
+ }
38
+ export interface EnumValueMeta {
39
+ name: string;
40
+ documentation?: string;
41
+ }
42
+ export interface EnumMeta {
43
+ name: string;
44
+ documentation?: string;
45
+ values: EnumValueMeta[];
46
+ }
47
+ export interface SchemaMeta {
48
+ generatedAt: string;
49
+ models: ModelMeta[];
50
+ enums: EnumMeta[];
51
+ availableScopes: string[];
52
+ }
53
+ export declare class MetaService {
54
+ buildMeta(): SchemaMeta;
55
+ private deriveScopes;
56
+ }
57
+ //# sourceMappingURL=meta.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.service.d.ts","sourceRoot":"","sources":["../src/meta.service.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7D;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,qBACa,WAAW;IACtB,SAAS,IAAI,UAAU;IA6EvB,OAAO,CAAC,YAAY;CAKrB"}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MetaService = void 0;
10
+ const common_1 = require("@haneinfo/common");
11
+ const common_2 = require("@nestjs/common");
12
+ const cube_tags_1 = require("./cube-tags");
13
+ let MetaService = class MetaService {
14
+ buildMeta() {
15
+ // Prisma.dmmf's shape isn't exposed in @prisma/client's public types, so this cast is the
16
+ // one place that bridges to it; everything downstream is properly typed.
17
+ const { models, enums } = common_1.Prisma.dmmf.datamodel;
18
+ const modelsMeta = models.map((m) => ({
19
+ name: m.name,
20
+ dbTable: m.dbName ?? m.name.toLowerCase(),
21
+ documentation: m.documentation,
22
+ fields: m.fields
23
+ .filter((f) => f.kind !== 'object')
24
+ .map((f) => {
25
+ const cubeTags = (0, cube_tags_1.parseCubeTags)(f.documentation);
26
+ return {
27
+ name: f.name,
28
+ type: f.type,
29
+ kind: f.kind,
30
+ dbColumn: f.dbName ?? f.name,
31
+ isRequired: f.isRequired,
32
+ isUnique: f.isUnique ?? false,
33
+ isId: f.isId ?? false,
34
+ isList: f.isList,
35
+ hasDefault: f.hasDefaultValue ?? false,
36
+ default: f.default,
37
+ documentation: f.documentation,
38
+ ...cubeTags,
39
+ };
40
+ }),
41
+ relations: m.fields
42
+ .filter((f) => f.kind === 'object')
43
+ .filter((f) => {
44
+ // Prisma represents implicit many-to-many relations with explicit empty arrays on both
45
+ // sides. Do not emit a half-complete relation when the join table is not in the DMMF.
46
+ return !(Array.isArray(f.relationFromFields) &&
47
+ Array.isArray(f.relationToFields) &&
48
+ f.relationFromFields.length === 0 &&
49
+ f.relationToFields.length === 0);
50
+ })
51
+ .map((f) => {
52
+ const fromFields = [...(f.relationFromFields ?? [])];
53
+ const toFields = [...(f.relationToFields ?? [])];
54
+ const targetModel = models.find((target) => target.name === f.type);
55
+ const dbColumnFor = (fieldName, model) => model.fields.find((field) => field.name === fieldName)?.dbName ?? fieldName;
56
+ return {
57
+ fieldName: f.name,
58
+ targetModel: f.type,
59
+ relationName: f.relationName ?? '',
60
+ isRequired: f.isRequired,
61
+ isList: f.isList,
62
+ fromFields,
63
+ toFields,
64
+ fromDbColumns: fromFields.map((fieldName) => dbColumnFor(fieldName, m)),
65
+ toDbColumns: toFields.map((fieldName) => dbColumnFor(fieldName, targetModel ?? m)),
66
+ };
67
+ }),
68
+ }));
69
+ return {
70
+ generatedAt: new Date().toISOString(),
71
+ models: modelsMeta,
72
+ enums: enums.map((e) => ({
73
+ name: e.name,
74
+ documentation: e.documentation,
75
+ values: e.values.map((v) => ({
76
+ name: v.name,
77
+ documentation: v.documentation,
78
+ })),
79
+ })),
80
+ availableScopes: this.deriveScopes(modelsMeta),
81
+ };
82
+ }
83
+ deriveScopes(models) {
84
+ return models
85
+ .filter((m) => !m.documentation?.includes('@internal'))
86
+ .flatMap((m) => [`${m.dbTable}:read`, `${m.dbTable}:write`, `${m.dbTable}:*`]);
87
+ }
88
+ };
89
+ exports.MetaService = MetaService;
90
+ exports.MetaService = MetaService = __decorate([
91
+ (0, common_2.Injectable)()
92
+ ], MetaService);
93
+ //# sourceMappingURL=meta.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.service.js","sourceRoot":"","sources":["../src/meta.service.ts"],"names":[],"mappings":";;;;;;;;;AACA,6CAA0C;AAC1C,2CAA4C;AAE5C,2CAA4C;AAyDrC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,SAAS;QACP,0FAA0F;QAC1F,yEAAyE;QACzE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,eAAM,CAAC,IAAI,CAAC,SAA2C,CAAC;QAElF,MAAM,UAAU,GAAgB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACjD,IAAI,E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,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,MAAM,EAAE,UAAU;YAClB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACvB,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,aAAa,EAAE,CAAC,CAAC,aAAa;gBAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC3B,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,aAAa,EAAE,CAAC,CAAC,aAAa;iBAC/B,CAAC,CAAC;aACJ,CAAC,CAAC;YACH,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;SAC/C,CAAC;IACJ,CAAC;IAEO,YAAY,CAAC,MAAsD;QACzE,OAAO,MAAM;aACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;aACtD,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,QAAQ,EAAE,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;IACnF,CAAC;CACF,CAAA;AAnFY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;GACA,WAAW,CAmFvB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `@haneinfo/metadata-schema/plugin` — manifest and plugin descriptor (PL4-04).
3
+ */
4
+ import { METADATA_SCHEMA, type MetadataSchemaPort, type PluginManifestV1 } from '@haneinfo/plugin-api';
5
+ import { MetaController } from './meta.controller';
6
+ import { MetaModule } from './meta.module';
7
+ import { MetaService } from './meta.service';
8
+ import { MetadataScopeGuard } from './meta-scope.guard';
9
+ export { METADATA_SCHEMA, MetaController, type MetadataSchemaPort, MetadataScopeGuard, MetaModule, MetaService, };
10
+ /** Mirrors `haneinfo.plugin.json`; `plugin.spec.ts` fails if the two drift apart. */
11
+ export declare const metadataSchemaManifest: PluginManifestV1;
12
+ export declare const metadataSchemaPlugin: import("@haneinfo/plugin-api").DefinedPlugin<unknown, {
13
+ module: typeof MetaModule;
14
+ providers: {
15
+ provide: symbol;
16
+ useExisting: typeof MetaService;
17
+ }[];
18
+ }>;
19
+ export default metadataSchemaPlugin;
20
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EACL,eAAe,EACf,cAAc,EACd,KAAK,kBAAkB,EACvB,kBAAkB,EAClB,UAAU,EACV,WAAW,GACZ,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,EAAE,gBA6BpC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;EAW/B,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * `@haneinfo/metadata-schema/plugin` — manifest and plugin descriptor (PL4-04).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.metadataSchemaPlugin = exports.metadataSchemaManifest = exports.MetaService = exports.MetaModule = exports.MetadataScopeGuard = exports.MetaController = exports.METADATA_SCHEMA = void 0;
7
+ const plugin_api_1 = require("@haneinfo/plugin-api");
8
+ Object.defineProperty(exports, "METADATA_SCHEMA", { enumerable: true, get: function () { return plugin_api_1.METADATA_SCHEMA; } });
9
+ const meta_controller_1 = require("./meta.controller");
10
+ Object.defineProperty(exports, "MetaController", { enumerable: true, get: function () { return meta_controller_1.MetaController; } });
11
+ const meta_module_1 = require("./meta.module");
12
+ Object.defineProperty(exports, "MetaModule", { enumerable: true, get: function () { return meta_module_1.MetaModule; } });
13
+ const meta_service_1 = require("./meta.service");
14
+ Object.defineProperty(exports, "MetaService", { enumerable: true, get: function () { return meta_service_1.MetaService; } });
15
+ const meta_scope_guard_1 = require("./meta-scope.guard");
16
+ Object.defineProperty(exports, "MetadataScopeGuard", { enumerable: true, get: function () { return meta_scope_guard_1.MetadataScopeGuard; } });
17
+ /** Mirrors `haneinfo.plugin.json`; `plugin.spec.ts` fails if the two drift apart. */
18
+ exports.metadataSchemaManifest = {
19
+ schemaVersion: 'haneinfo.plugin/v1',
20
+ id: 'metadata-schema',
21
+ displayName: 'Metadata Schema Introspection',
22
+ cardinality: 'singleton',
23
+ distribution: 'official',
24
+ engine: {
25
+ haneinfoPluginApi: '^1.0.0',
26
+ node: '>=22.0.0',
27
+ frameworks: {
28
+ '@nestjs/common': '^11.0.5',
29
+ '@nestjs/core': '^11.0.5',
30
+ '@prisma/client': '^6.2.0',
31
+ },
32
+ },
33
+ provides: ['haneinfo.metadata-schema'],
34
+ requires: ['haneinfo.prisma'],
35
+ optionalRequires: ['haneinfo.scope-matcher'],
36
+ facets: {
37
+ backend: {
38
+ modulePath: './dist/meta.module.js',
39
+ exportName: 'MetaModule',
40
+ controllerRoutes: ['metadata'],
41
+ providerTokens: ['haneinfo.metadata-schema'],
42
+ },
43
+ permissions: {
44
+ definitions: ['metadata:schema:read'],
45
+ },
46
+ },
47
+ };
48
+ exports.metadataSchemaPlugin = (0, plugin_api_1.definePlugin)({
49
+ manifest: exports.metadataSchemaManifest,
50
+ backend: () => ({
51
+ module: meta_module_1.MetaModule,
52
+ providers: [
53
+ {
54
+ provide: plugin_api_1.METADATA_SCHEMA,
55
+ useExisting: meta_service_1.MetaService,
56
+ },
57
+ ],
58
+ }),
59
+ });
60
+ exports.default = exports.metadataSchemaPlugin;
61
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,qDAK8B;AAO5B,gGAVA,4BAAe,OAUA;AANjB,uDAAmD;AAOjD,+FAPO,gCAAc,OAOP;AANhB,+CAA2C;AASzC,2FATO,wBAAU,OASP;AARZ,iDAA6C;AAS3C,4FATO,0BAAW,OASP;AARb,yDAAwD;AAMtD,mGANO,qCAAkB,OAMP;AAKpB,qFAAqF;AACxE,QAAA,sBAAsB,GAAqB;IACtD,aAAa,EAAE,oBAAoB;IACnC,EAAE,EAAE,iBAAiB;IACrB,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EAAE,WAAW;IACxB,YAAY,EAAE,UAAU;IACxB,MAAM,EAAE;QACN,iBAAiB,EAAE,QAAQ;QAC3B,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE;YACV,gBAAgB,EAAE,SAAS;YAC3B,cAAc,EAAE,SAAS;YACzB,gBAAgB,EAAE,QAAQ;SAC3B;KACF;IACD,QAAQ,EAAE,CAAC,0BAA0B,CAAC;IACtC,QAAQ,EAAE,CAAC,iBAAiB,CAAC;IAC7B,gBAAgB,EAAE,CAAC,wBAAwB,CAAC;IAC5C,MAAM,EAAE;QACN,OAAO,EAAE;YACP,UAAU,EAAE,uBAAuB;YACnC,UAAU,EAAE,YAAY;YACxB,gBAAgB,EAAE,CAAC,UAAU,CAAC;YAC9B,cAAc,EAAE,CAAC,0BAA0B,CAAC;SAC7C;QACD,WAAW,EAAE;YACX,WAAW,EAAE,CAAC,sBAAsB,CAAC;SACtC;KACF;CACF,CAAC;AAEW,QAAA,oBAAoB,GAAG,IAAA,yBAAY,EAAC;IAC/C,QAAQ,EAAE,8BAAsB;IAChC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,wBAAU;QAClB,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,4BAAe;gBACxB,WAAW,EAAE,0BAAW;aACzB;SACF;KACF,CAAC;CACH,CAAC,CAAC;AAEH,kBAAe,4BAAoB,CAAC"}
@@ -0,0 +1,30 @@
1
+ {
2
+ "schemaVersion": "haneinfo.plugin/v1",
3
+ "id": "metadata-schema",
4
+ "displayName": "Metadata Schema Introspection",
5
+ "cardinality": "singleton",
6
+ "distribution": "official",
7
+ "engine": {
8
+ "haneinfoPluginApi": "^1.0.0",
9
+ "node": ">=22.0.0",
10
+ "frameworks": {
11
+ "@nestjs/common": "^11.0.5",
12
+ "@nestjs/core": "^11.0.5",
13
+ "@prisma/client": "^6.2.0"
14
+ }
15
+ },
16
+ "provides": ["haneinfo.metadata-schema"],
17
+ "requires": ["haneinfo.prisma"],
18
+ "optionalRequires": ["haneinfo.scope-matcher"],
19
+ "facets": {
20
+ "backend": {
21
+ "modulePath": "./dist/meta.module.js",
22
+ "exportName": "MetaModule",
23
+ "controllerRoutes": ["metadata"],
24
+ "providerTokens": ["haneinfo.metadata-schema"]
25
+ },
26
+ "permissions": {
27
+ "definitions": ["metadata:schema:read"]
28
+ }
29
+ }
30
+ }
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@haneinfo/metadata-schema",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.3",
4
+ "private": false,
5
+ "files": [
6
+ "dist",
7
+ "haneinfo.plugin.json",
8
+ "plugin.js",
9
+ "plugin.d.ts"
10
+ ],
11
+ "type": "commonjs",
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./plugin": {
20
+ "types": "./dist/plugin.d.ts",
21
+ "default": "./dist/plugin.js"
22
+ },
23
+ "./haneinfo.plugin.json": "./haneinfo.plugin.json",
24
+ "./package.json": "./package.json"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.build.json",
28
+ "dev": "tsc -p tsconfig.build.json --watch",
29
+ "test": "vitest run",
30
+ "typecheck": "tsc --noEmit"
31
+ },
32
+ "dependencies": {
33
+ "@haneinfo/common": "workspace:*",
34
+ "@haneinfo/plugin-api": "workspace:*",
35
+ "@haneinfo/plugin-host-nest": "workspace:*"
36
+ },
37
+ "peerDependencies": {
38
+ "@haneinfo/plugin-host-nest": "^2.0.0",
39
+ "@nestjs/common": "^11.0.0",
40
+ "@nestjs/core": "^11.0.0",
41
+ "@prisma/client": "^6.19.0"
42
+ },
43
+ "devDependencies": {
44
+ "@haneinfo/m2m-api-key": "workspace:*",
45
+ "@haneinfo/plugin-testkit": "workspace:*",
46
+ "@nestjs/common": "^11.0.0",
47
+ "@nestjs/core": "^11.0.0",
48
+ "@nestjs/platform-express": "^11.0.0",
49
+ "@nestjs/testing": "^11.0.0",
50
+ "@prisma/client": "^6.19.0",
51
+ "@types/node": "^24.13.0",
52
+ "typescript": "^5.9.3",
53
+ "vitest": "^4.1.11"
54
+ },
55
+ "license": "UNLICENSED",
56
+ "publishConfig": {
57
+ "registry": "https://registry.npmjs.org/",
58
+ "access": "public"
59
+ }
60
+ }
package/plugin.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ // See plugin.js for why this file exists (classic/node10 moduleResolution compatibility shim).
2
+ export * from './dist/plugin';
3
+ export { default } from './dist/plugin';
package/plugin.js ADDED
@@ -0,0 +1,4 @@
1
+ // Compatibility shim for consumers whose TypeScript config uses "classic"/"node10"
2
+ // moduleResolution, which resolves `@haneinfo/metadata-schema/plugin` by looking for a real file at
3
+ // the package root — it does not consult package.json's "exports" map at all.
4
+ module.exports = require('./dist/plugin');