@kinotic-ai/idl 5.0.0-beta.1 → 5.0.0-beta.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.
package/README.md CHANGED
@@ -11,7 +11,7 @@ The type schema layer that makes Kinotic's cross-language RPC safe and consisten
11
11
  - **One schema, every language.** Define a data structure or service interface once in a language-neutral format — Java, TypeScript, and the platform all stay in sync automatically.
12
12
  - **No more integration surprises.** Schema contracts are enforced across the RPC boundary, catching mismatches at definition time rather than in production.
13
13
  - **Rich metadata, zero boilerplate.** Attach validation rules and behavioral decorators to your models without writing custom validators or annotation processors.
14
- - **Drives the whole platform.** OpenAPI specifications, GraphQL schemas, and serialization logic are all generated from the same IDL definitions — change once, update everywhere.
14
+ - **Drives the whole platform.** Entity storage, entity services, and serialization logic are all derived from the same IDL definitions — change once, update everywhere.
15
15
 
16
16
  ---
17
17
 
@@ -21,7 +21,7 @@ The type schema layer that makes Kinotic's cross-language RPC safe and consisten
21
21
  Describe any data structure or service interface in a format that is not tied to any one language or runtime. The same definition drives both the Java server and the TypeScript client.
22
22
 
23
23
  ### Automatic API Generation
24
- Publish a schema and the platform generates OpenAPI endpoints, GraphQL types, and serialization mappings for you. There is no manual mapping layer to maintain.
24
+ Publish a schema and the platform creates its backing storage, registers its services, and derives its serialization mappings for you. There is no manual mapping layer to maintain.
25
25
 
26
26
  ### Validation and Behavioral Metadata
27
27
  Annotate data models with constraints and behavioral hints directly in the schema. Validation rules travel with the definition instead of being scattered across your codebase.
@@ -39,13 +39,13 @@ Data moving between services is serialized and deserialized according to the sch
39
39
  `@kinotic-ai/idl` sits just above the core transport layer:
40
40
 
41
41
  ```
42
- @kinotic-ai/os-api ← cloud OS management
42
+ @kinotic-ai/management-api ← cloud OS management
43
43
  @kinotic-ai/persistence ← schema-driven data access
44
44
  @kinotic-ai/idl ← cross-language type schemas (this package)
45
45
  @kinotic-ai/core ← connection & transport
46
46
  ```
47
47
 
48
- `@kinotic-ai/persistence` and `@kinotic-ai/os-api` both depend on the schema definitions this package provides. Start here when you need to describe data that crosses a service boundary.
48
+ `@kinotic-ai/persistence` and `@kinotic-ai/management-api` both depend on the schema definitions this package provides. Start here when you need to describe data that crosses a service boundary.
49
49
 
50
50
  ---
51
51
 
package/dist/index.cjs CHANGED
@@ -66,6 +66,9 @@ __export(exports_src, {
66
66
  C3Decorator: () => C3Decorator,
67
67
  ByteC3Type: () => ByteC3Type,
68
68
  BooleanC3Type: () => BooleanC3Type,
69
+ AuthzRoleDeclaration: () => AuthzRoleDeclaration,
70
+ AuthzResourceDecorator: () => AuthzResourceDecorator,
71
+ AuthzCheckDecorator: () => AuthzCheckDecorator,
69
72
  AsyncC3Type: () => AsyncC3Type,
70
73
  ArrayC3Type: () => ArrayC3Type,
71
74
  AnyC3Type: () => AnyC3Type
@@ -76,6 +79,43 @@ module.exports = __toCommonJS(exports_src);
76
79
  class C3Decorator {
77
80
  type = "";
78
81
  }
82
+
83
+ // packages/idl/src/api/decorators/AuthzCheckDecorator.ts
84
+ class AuthzCheckDecorator extends C3Decorator {
85
+ resource = null;
86
+ objectId = null;
87
+ permissionResource = null;
88
+ permission = null;
89
+ implies = [];
90
+ unchecked = false;
91
+ consistent = false;
92
+ constructor() {
93
+ super();
94
+ this.type = "AuthzCheck";
95
+ }
96
+ }
97
+ // packages/idl/src/api/decorators/AuthzResourceDecorator.ts
98
+ class AuthzResourceDecorator extends C3Decorator {
99
+ resourceType;
100
+ parent = null;
101
+ objectId = null;
102
+ permission = null;
103
+ roles = [];
104
+ constructor(resourceType) {
105
+ super();
106
+ this.type = "AuthzResource";
107
+ this.resourceType = resourceType;
108
+ }
109
+ }
110
+ // packages/idl/src/api/decorators/AuthzRoleDeclaration.ts
111
+ class AuthzRoleDeclaration {
112
+ id;
113
+ permissions;
114
+ constructor(id, permissions) {
115
+ this.id = id;
116
+ this.permissions = permissions;
117
+ }
118
+ }
79
119
  // packages/idl/src/api/decorators/NotNullDecorator.ts
80
120
  class NotNullDecorator extends C3Decorator {
81
121
  constructor() {
@@ -376,12 +416,12 @@ class ServiceDefinition extends AbstractDefinition {
376
416
  super(name, decorators, metadata);
377
417
  this.namespace = namespace;
378
418
  }
379
- functions = new Set;
419
+ functions = [];
380
420
  addFunction(func) {
381
- if (this.functions.has(func)) {
421
+ if (this.functions.some((existing) => existing.name === func.name)) {
382
422
  throw new Error(`ServiceDefinition already contains function for name ${func.name}`);
383
423
  }
384
- this.functions.add(func);
424
+ this.functions.push(func);
385
425
  return this;
386
426
  }
387
427
  getQualifiedName() {
package/dist/index.d.cts CHANGED
@@ -7,6 +7,90 @@ declare class C3Decorator {
7
7
  type: string;
8
8
  }
9
9
  /**
10
+ * The authorization check a function requires. A service's definition declares what the derivation cannot
11
+ * read from the function's name and parameters: a permission of its own, another object than the derived
12
+ * one, the permissions it implies, a consistent answer, or that the function is served with no check. The
13
+ * platform derives the rest when the service registers, naming the object checked and the type the permission
14
+ * is named for.
15
+ */
16
+ declare class AuthzCheckDecorator extends C3Decorator {
17
+ /**
18
+ * The type of the object the check is made on, when it is not the derived one.
19
+ */
20
+ resource: string | null;
21
+ /**
22
+ * The id of the object the check is made on, as a template over the function's parameters and the
23
+ * caller's scope, such as `{reportId}` or `{@tenantId}`.
24
+ */
25
+ objectId: string | null;
26
+ /**
27
+ * The type the permission is named for, which the platform derives.
28
+ */
29
+ permissionResource: string | null;
30
+ /**
31
+ * The short permission name, such as `can_generate`.
32
+ */
33
+ permission: string | null;
34
+ /**
35
+ * Short names of permissions on the permission's type that this one implies.
36
+ */
37
+ implies: string[];
38
+ /**
39
+ * True for a function declared served with no check, which any caller the zone admits may call.
40
+ */
41
+ unchecked: boolean;
42
+ /**
43
+ * Whether the check must answer from the stored relationships rather than the engine's caches.
44
+ */
45
+ consistent: boolean;
46
+ constructor();
47
+ }
48
+ /**
49
+ * A role a resource service declares beside the built-in ones, as the {@link AuthzResourceDecorator} carries
50
+ * it: the role's id and the short names of the permissions of the type it bundles.
51
+ */
52
+ declare class AuthzRoleDeclaration {
53
+ /**
54
+ * The role's id, `<type>.<level>`, such as `report.generator`.
55
+ */
56
+ id: string;
57
+ /**
58
+ * Short names of the type's permissions the role bundles.
59
+ */
60
+ permissions: string[];
61
+ constructor(id: string, permissions: string[]);
62
+ }
63
+ /**
64
+ * Marks a service as acting on one authorization resource type: the service's functions are checked against
65
+ * that type, and the type, with its containment parent and the roles it declares, is part of the generated
66
+ * authorization model.
67
+ */
68
+ declare class AuthzResourceDecorator extends C3Decorator {
69
+ /**
70
+ * The resource type the service acts on, such as `report`.
71
+ */
72
+ resourceType: string;
73
+ /**
74
+ * The type that contains this one and from which grants inherit, or null for a root type.
75
+ */
76
+ parent: string | null;
77
+ /**
78
+ * The object every function of the service is checked on, as a template over the caller's scope, unless the
79
+ * function declares its own; null when each function's object is derived from what it names.
80
+ */
81
+ objectId: string | null;
82
+ /**
83
+ * The permission every function of the service requires unless it declares its own; null when each
84
+ * function's permission is derived from its name.
85
+ */
86
+ permission: string | null;
87
+ /**
88
+ * The roles the service declares for its type beside the built-in ones; empty when it declares none.
89
+ */
90
+ roles: AuthzRoleDeclaration[];
91
+ constructor(resourceType: string);
92
+ }
93
+ /**
10
94
  * Signifies that the decorated value must not be null
11
95
  * Created by Navíd Mitchell 🤪 on 4/23/23.
12
96
  */
@@ -331,10 +415,9 @@ declare class ServiceDefinition extends AbstractDefinition implements HasQualifi
331
415
  [p: string]: any;
332
416
  } | null);
333
417
  /**
334
- * This defines {@link FunctionDefinition}'s for this {@link ServiceDefinition}
335
- * The key is the function name and the value is the schema that defines the function
418
+ * The {@link FunctionDefinition}s of this {@link ServiceDefinition}, in declaration order; no two share a name.
336
419
  */
337
- functions: Set<FunctionDefinition>;
420
+ functions: FunctionDefinition[];
338
421
  /**
339
422
  * Stores the given value in the functions definitions for this schema
340
423
  * If a schema for the name already exists an error will be thrown
@@ -470,4 +553,4 @@ declare class UnionC3Type extends ComplexC3Type {
470
553
  declare class VoidC3Type extends C3Type {
471
554
  constructor();
472
555
  }
473
- export { VoidC3Type, UnionC3Type, StringC3Type, StreamC3Type, ShortC3Type, ServiceDefinition, ReferenceC3Type, PropertyDefinition, ParameterDefinition, ObjectC3Type, NotNullDecorator, NamespaceDefinition, MetadataType, MapC3Type, LongC3Type, IntC3Type, HasQualifiedName, HasMetadata, HasDecorators, FunctionDefinition, FloatC3Type, EnumC3Type, DoubleC3Type, DateC3Type, ComplexC3Type, CharC3Type, C3Type, C3Decorator, ByteC3Type, BooleanC3Type, AsyncC3Type, ArrayC3Type, AnyC3Type };
556
+ export { VoidC3Type, UnionC3Type, StringC3Type, StreamC3Type, ShortC3Type, ServiceDefinition, ReferenceC3Type, PropertyDefinition, ParameterDefinition, ObjectC3Type, NotNullDecorator, NamespaceDefinition, MetadataType, MapC3Type, LongC3Type, IntC3Type, HasQualifiedName, HasMetadata, HasDecorators, FunctionDefinition, FloatC3Type, EnumC3Type, DoubleC3Type, DateC3Type, ComplexC3Type, CharC3Type, C3Type, C3Decorator, ByteC3Type, BooleanC3Type, AuthzRoleDeclaration, AuthzResourceDecorator, AuthzCheckDecorator, AsyncC3Type, ArrayC3Type, AnyC3Type };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,90 @@ declare class C3Decorator {
7
7
  type: string;
8
8
  }
9
9
  /**
10
+ * The authorization check a function requires. A service's definition declares what the derivation cannot
11
+ * read from the function's name and parameters: a permission of its own, another object than the derived
12
+ * one, the permissions it implies, a consistent answer, or that the function is served with no check. The
13
+ * platform derives the rest when the service registers, naming the object checked and the type the permission
14
+ * is named for.
15
+ */
16
+ declare class AuthzCheckDecorator extends C3Decorator {
17
+ /**
18
+ * The type of the object the check is made on, when it is not the derived one.
19
+ */
20
+ resource: string | null;
21
+ /**
22
+ * The id of the object the check is made on, as a template over the function's parameters and the
23
+ * caller's scope, such as `{reportId}` or `{@tenantId}`.
24
+ */
25
+ objectId: string | null;
26
+ /**
27
+ * The type the permission is named for, which the platform derives.
28
+ */
29
+ permissionResource: string | null;
30
+ /**
31
+ * The short permission name, such as `can_generate`.
32
+ */
33
+ permission: string | null;
34
+ /**
35
+ * Short names of permissions on the permission's type that this one implies.
36
+ */
37
+ implies: string[];
38
+ /**
39
+ * True for a function declared served with no check, which any caller the zone admits may call.
40
+ */
41
+ unchecked: boolean;
42
+ /**
43
+ * Whether the check must answer from the stored relationships rather than the engine's caches.
44
+ */
45
+ consistent: boolean;
46
+ constructor();
47
+ }
48
+ /**
49
+ * A role a resource service declares beside the built-in ones, as the {@link AuthzResourceDecorator} carries
50
+ * it: the role's id and the short names of the permissions of the type it bundles.
51
+ */
52
+ declare class AuthzRoleDeclaration {
53
+ /**
54
+ * The role's id, `<type>.<level>`, such as `report.generator`.
55
+ */
56
+ id: string;
57
+ /**
58
+ * Short names of the type's permissions the role bundles.
59
+ */
60
+ permissions: string[];
61
+ constructor(id: string, permissions: string[]);
62
+ }
63
+ /**
64
+ * Marks a service as acting on one authorization resource type: the service's functions are checked against
65
+ * that type, and the type, with its containment parent and the roles it declares, is part of the generated
66
+ * authorization model.
67
+ */
68
+ declare class AuthzResourceDecorator extends C3Decorator {
69
+ /**
70
+ * The resource type the service acts on, such as `report`.
71
+ */
72
+ resourceType: string;
73
+ /**
74
+ * The type that contains this one and from which grants inherit, or null for a root type.
75
+ */
76
+ parent: string | null;
77
+ /**
78
+ * The object every function of the service is checked on, as a template over the caller's scope, unless the
79
+ * function declares its own; null when each function's object is derived from what it names.
80
+ */
81
+ objectId: string | null;
82
+ /**
83
+ * The permission every function of the service requires unless it declares its own; null when each
84
+ * function's permission is derived from its name.
85
+ */
86
+ permission: string | null;
87
+ /**
88
+ * The roles the service declares for its type beside the built-in ones; empty when it declares none.
89
+ */
90
+ roles: AuthzRoleDeclaration[];
91
+ constructor(resourceType: string);
92
+ }
93
+ /**
10
94
  * Signifies that the decorated value must not be null
11
95
  * Created by Navíd Mitchell 🤪 on 4/23/23.
12
96
  */
@@ -331,10 +415,9 @@ declare class ServiceDefinition extends AbstractDefinition implements HasQualifi
331
415
  [p: string]: any;
332
416
  } | null);
333
417
  /**
334
- * This defines {@link FunctionDefinition}'s for this {@link ServiceDefinition}
335
- * The key is the function name and the value is the schema that defines the function
418
+ * The {@link FunctionDefinition}s of this {@link ServiceDefinition}, in declaration order; no two share a name.
336
419
  */
337
- functions: Set<FunctionDefinition>;
420
+ functions: FunctionDefinition[];
338
421
  /**
339
422
  * Stores the given value in the functions definitions for this schema
340
423
  * If a schema for the name already exists an error will be thrown
@@ -470,4 +553,4 @@ declare class UnionC3Type extends ComplexC3Type {
470
553
  declare class VoidC3Type extends C3Type {
471
554
  constructor();
472
555
  }
473
- export { VoidC3Type, UnionC3Type, StringC3Type, StreamC3Type, ShortC3Type, ServiceDefinition, ReferenceC3Type, PropertyDefinition, ParameterDefinition, ObjectC3Type, NotNullDecorator, NamespaceDefinition, MetadataType, MapC3Type, LongC3Type, IntC3Type, HasQualifiedName, HasMetadata, HasDecorators, FunctionDefinition, FloatC3Type, EnumC3Type, DoubleC3Type, DateC3Type, ComplexC3Type, CharC3Type, C3Type, C3Decorator, ByteC3Type, BooleanC3Type, AsyncC3Type, ArrayC3Type, AnyC3Type };
556
+ export { VoidC3Type, UnionC3Type, StringC3Type, StreamC3Type, ShortC3Type, ServiceDefinition, ReferenceC3Type, PropertyDefinition, ParameterDefinition, ObjectC3Type, NotNullDecorator, NamespaceDefinition, MetadataType, MapC3Type, LongC3Type, IntC3Type, HasQualifiedName, HasMetadata, HasDecorators, FunctionDefinition, FloatC3Type, EnumC3Type, DoubleC3Type, DateC3Type, ComplexC3Type, CharC3Type, C3Type, C3Decorator, ByteC3Type, BooleanC3Type, AuthzRoleDeclaration, AuthzResourceDecorator, AuthzCheckDecorator, AsyncC3Type, ArrayC3Type, AnyC3Type };
package/dist/index.js CHANGED
@@ -2,6 +2,43 @@
2
2
  class C3Decorator {
3
3
  type = "";
4
4
  }
5
+
6
+ // packages/idl/src/api/decorators/AuthzCheckDecorator.ts
7
+ class AuthzCheckDecorator extends C3Decorator {
8
+ resource = null;
9
+ objectId = null;
10
+ permissionResource = null;
11
+ permission = null;
12
+ implies = [];
13
+ unchecked = false;
14
+ consistent = false;
15
+ constructor() {
16
+ super();
17
+ this.type = "AuthzCheck";
18
+ }
19
+ }
20
+ // packages/idl/src/api/decorators/AuthzResourceDecorator.ts
21
+ class AuthzResourceDecorator extends C3Decorator {
22
+ resourceType;
23
+ parent = null;
24
+ objectId = null;
25
+ permission = null;
26
+ roles = [];
27
+ constructor(resourceType) {
28
+ super();
29
+ this.type = "AuthzResource";
30
+ this.resourceType = resourceType;
31
+ }
32
+ }
33
+ // packages/idl/src/api/decorators/AuthzRoleDeclaration.ts
34
+ class AuthzRoleDeclaration {
35
+ id;
36
+ permissions;
37
+ constructor(id, permissions) {
38
+ this.id = id;
39
+ this.permissions = permissions;
40
+ }
41
+ }
5
42
  // packages/idl/src/api/decorators/NotNullDecorator.ts
6
43
  class NotNullDecorator extends C3Decorator {
7
44
  constructor() {
@@ -302,12 +339,12 @@ class ServiceDefinition extends AbstractDefinition {
302
339
  super(name, decorators, metadata);
303
340
  this.namespace = namespace;
304
341
  }
305
- functions = new Set;
342
+ functions = [];
306
343
  addFunction(func) {
307
- if (this.functions.has(func)) {
344
+ if (this.functions.some((existing) => existing.name === func.name)) {
308
345
  throw new Error(`ServiceDefinition already contains function for name ${func.name}`);
309
346
  }
310
- this.functions.add(func);
347
+ this.functions.push(func);
311
348
  return this;
312
349
  }
313
350
  getQualifiedName() {
@@ -368,6 +405,9 @@ export {
368
405
  C3Decorator,
369
406
  ByteC3Type,
370
407
  BooleanC3Type,
408
+ AuthzRoleDeclaration,
409
+ AuthzResourceDecorator,
410
+ AuthzCheckDecorator,
371
411
  AsyncC3Type,
372
412
  ArrayC3Type,
373
413
  AnyC3Type
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinotic-ai/idl",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"