@aigne/afs 1.11.0-beta → 1.11.0-beta.10

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 (164) hide show
  1. package/LICENSE.md +17 -84
  2. package/README.md +4 -13
  3. package/dist/_virtual/rolldown_runtime.mjs +7 -0
  4. package/dist/afs.cjs +1330 -0
  5. package/dist/afs.d.cts +275 -0
  6. package/dist/afs.d.cts.map +1 -0
  7. package/dist/afs.d.mts +275 -0
  8. package/dist/afs.d.mts.map +1 -0
  9. package/dist/afs.mjs +1331 -0
  10. package/dist/afs.mjs.map +1 -0
  11. package/dist/capabilities/index.d.mts +2 -0
  12. package/dist/capabilities/types.d.cts +100 -0
  13. package/dist/capabilities/types.d.cts.map +1 -0
  14. package/dist/capabilities/types.d.mts +100 -0
  15. package/dist/capabilities/types.d.mts.map +1 -0
  16. package/dist/capabilities/world-mapping.cjs +20 -0
  17. package/dist/capabilities/world-mapping.d.cts +139 -0
  18. package/dist/capabilities/world-mapping.d.cts.map +1 -0
  19. package/dist/capabilities/world-mapping.d.mts +139 -0
  20. package/dist/capabilities/world-mapping.d.mts.map +1 -0
  21. package/dist/capabilities/world-mapping.mjs +20 -0
  22. package/dist/capabilities/world-mapping.mjs.map +1 -0
  23. package/dist/error.cjs +63 -0
  24. package/dist/error.d.cts +39 -0
  25. package/dist/error.d.cts.map +1 -0
  26. package/dist/error.d.mts +39 -0
  27. package/dist/error.d.mts.map +1 -0
  28. package/dist/error.mjs +59 -0
  29. package/dist/error.mjs.map +1 -0
  30. package/dist/index.cjs +72 -345
  31. package/dist/index.d.cts +18 -300
  32. package/dist/index.d.mts +20 -300
  33. package/dist/index.mjs +16 -342
  34. package/dist/loader/index.cjs +110 -0
  35. package/dist/loader/index.d.cts +48 -0
  36. package/dist/loader/index.d.cts.map +1 -0
  37. package/dist/loader/index.d.mts +48 -0
  38. package/dist/loader/index.d.mts.map +1 -0
  39. package/dist/loader/index.mjs +110 -0
  40. package/dist/loader/index.mjs.map +1 -0
  41. package/dist/meta/index.cjs +4 -0
  42. package/dist/meta/index.mjs +6 -0
  43. package/dist/meta/kind.cjs +161 -0
  44. package/dist/meta/kind.d.cts +134 -0
  45. package/dist/meta/kind.d.cts.map +1 -0
  46. package/dist/meta/kind.d.mts +134 -0
  47. package/dist/meta/kind.d.mts.map +1 -0
  48. package/dist/meta/kind.mjs +157 -0
  49. package/dist/meta/kind.mjs.map +1 -0
  50. package/dist/meta/path.cjs +116 -0
  51. package/dist/meta/path.d.cts +43 -0
  52. package/dist/meta/path.d.cts.map +1 -0
  53. package/dist/meta/path.d.mts +43 -0
  54. package/dist/meta/path.d.mts.map +1 -0
  55. package/dist/meta/path.mjs +112 -0
  56. package/dist/meta/path.mjs.map +1 -0
  57. package/dist/meta/type.d.cts +96 -0
  58. package/dist/meta/type.d.cts.map +1 -0
  59. package/dist/meta/type.d.mts +96 -0
  60. package/dist/meta/type.d.mts.map +1 -0
  61. package/dist/meta/validation.cjs +77 -0
  62. package/dist/meta/validation.d.cts +19 -0
  63. package/dist/meta/validation.d.cts.map +1 -0
  64. package/dist/meta/validation.d.mts +19 -0
  65. package/dist/meta/validation.d.mts.map +1 -0
  66. package/dist/meta/validation.mjs +77 -0
  67. package/dist/meta/validation.mjs.map +1 -0
  68. package/dist/meta/well-known-kinds.cjs +228 -0
  69. package/dist/meta/well-known-kinds.d.cts +52 -0
  70. package/dist/meta/well-known-kinds.d.cts.map +1 -0
  71. package/dist/meta/well-known-kinds.d.mts +52 -0
  72. package/dist/meta/well-known-kinds.d.mts.map +1 -0
  73. package/dist/meta/well-known-kinds.mjs +219 -0
  74. package/dist/meta/well-known-kinds.mjs.map +1 -0
  75. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.cts +141 -0
  76. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.cts.map +1 -0
  77. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts +141 -0
  78. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts.map +1 -0
  79. package/dist/path.cjs +255 -0
  80. package/dist/path.d.cts +93 -0
  81. package/dist/path.d.cts.map +1 -0
  82. package/dist/path.d.mts +93 -0
  83. package/dist/path.d.mts.map +1 -0
  84. package/dist/path.mjs +249 -0
  85. package/dist/path.mjs.map +1 -0
  86. package/dist/provider/base.cjs +425 -0
  87. package/dist/provider/base.d.cts +175 -0
  88. package/dist/provider/base.d.cts.map +1 -0
  89. package/dist/provider/base.d.mts +175 -0
  90. package/dist/provider/base.d.mts.map +1 -0
  91. package/dist/provider/base.mjs +426 -0
  92. package/dist/provider/base.mjs.map +1 -0
  93. package/dist/provider/decorators.cjs +268 -0
  94. package/dist/provider/decorators.d.cts +244 -0
  95. package/dist/provider/decorators.d.cts.map +1 -0
  96. package/dist/provider/decorators.d.mts +244 -0
  97. package/dist/provider/decorators.d.mts.map +1 -0
  98. package/dist/provider/decorators.mjs +256 -0
  99. package/dist/provider/decorators.mjs.map +1 -0
  100. package/dist/provider/index.cjs +19 -0
  101. package/dist/provider/index.d.cts +5 -0
  102. package/dist/provider/index.d.mts +5 -0
  103. package/dist/provider/index.mjs +5 -0
  104. package/dist/provider/router.cjs +185 -0
  105. package/dist/provider/router.d.cts +50 -0
  106. package/dist/provider/router.d.cts.map +1 -0
  107. package/dist/provider/router.d.mts +50 -0
  108. package/dist/provider/router.d.mts.map +1 -0
  109. package/dist/provider/router.mjs +185 -0
  110. package/dist/provider/router.mjs.map +1 -0
  111. package/dist/provider/types.d.cts +113 -0
  112. package/dist/provider/types.d.cts.map +1 -0
  113. package/dist/provider/types.d.mts +113 -0
  114. package/dist/provider/types.d.mts.map +1 -0
  115. package/dist/registry.cjs +358 -0
  116. package/dist/registry.d.cts +96 -0
  117. package/dist/registry.d.cts.map +1 -0
  118. package/dist/registry.d.mts +96 -0
  119. package/dist/registry.d.mts.map +1 -0
  120. package/dist/registry.mjs +360 -0
  121. package/dist/registry.mjs.map +1 -0
  122. package/dist/type.cjs +34 -0
  123. package/dist/type.d.cts +420 -0
  124. package/dist/type.d.cts.map +1 -0
  125. package/dist/type.d.mts +420 -0
  126. package/dist/type.d.mts.map +1 -0
  127. package/dist/type.mjs +33 -0
  128. package/dist/type.mjs.map +1 -0
  129. package/dist/utils/camelize.d.cts.map +1 -1
  130. package/dist/utils/camelize.d.mts.map +1 -1
  131. package/dist/utils/schema.cjs +129 -0
  132. package/dist/utils/schema.d.cts +65 -0
  133. package/dist/utils/schema.d.cts.map +1 -0
  134. package/dist/utils/schema.d.mts +65 -0
  135. package/dist/utils/schema.d.mts.map +1 -0
  136. package/dist/utils/schema.mjs +124 -0
  137. package/dist/utils/schema.mjs.map +1 -0
  138. package/dist/utils/type-utils.d.cts.map +1 -1
  139. package/dist/utils/type-utils.d.mts.map +1 -1
  140. package/dist/utils/uri-template.cjs +123 -0
  141. package/dist/utils/uri-template.d.cts +48 -0
  142. package/dist/utils/uri-template.d.cts.map +1 -0
  143. package/dist/utils/uri-template.d.mts +48 -0
  144. package/dist/utils/uri-template.d.mts.map +1 -0
  145. package/dist/utils/uri-template.mjs +120 -0
  146. package/dist/utils/uri-template.mjs.map +1 -0
  147. package/dist/utils/uri.cjs +49 -0
  148. package/dist/utils/uri.d.cts +34 -0
  149. package/dist/utils/uri.d.cts.map +1 -0
  150. package/dist/utils/uri.d.mts +34 -0
  151. package/dist/utils/uri.d.mts.map +1 -0
  152. package/dist/utils/uri.mjs +49 -0
  153. package/dist/utils/uri.mjs.map +1 -0
  154. package/dist/utils/zod.cjs +6 -8
  155. package/dist/utils/zod.d.cts +2 -2
  156. package/dist/utils/zod.d.cts.map +1 -1
  157. package/dist/utils/zod.d.mts +2 -2
  158. package/dist/utils/zod.d.mts.map +1 -1
  159. package/dist/utils/zod.mjs +6 -8
  160. package/dist/utils/zod.mjs.map +1 -1
  161. package/package.json +27 -4
  162. package/dist/index.d.cts.map +0 -1
  163. package/dist/index.d.mts.map +0 -1
  164. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,141 @@
1
+ //#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
2
+ // ==================================================================================================
3
+ // JSON Schema Draft 07
4
+ // ==================================================================================================
5
+ // https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
6
+ // --------------------------------------------------------------------------------------------------
7
+ /**
8
+ * Primitive type
9
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
10
+ */
11
+ type JSONSchema7TypeName = "string" //
12
+ | "number" | "integer" | "boolean" | "object" | "array" | "null";
13
+ /**
14
+ * Primitive type
15
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
16
+ */
17
+ type JSONSchema7Type = string //
18
+ | number | boolean | JSONSchema7Object | JSONSchema7Array | null;
19
+ // Workaround for infinite type recursion
20
+ interface JSONSchema7Object {
21
+ [key: string]: JSONSchema7Type;
22
+ }
23
+ // Workaround for infinite type recursion
24
+ // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
25
+ interface JSONSchema7Array extends Array<JSONSchema7Type> {}
26
+ /**
27
+ * Meta schema
28
+ *
29
+ * Recommended values:
30
+ * - 'http://json-schema.org/schema#'
31
+ * - 'http://json-schema.org/hyper-schema#'
32
+ * - 'http://json-schema.org/draft-07/schema#'
33
+ * - 'http://json-schema.org/draft-07/hyper-schema#'
34
+ *
35
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
36
+ */
37
+ type JSONSchema7Version = string;
38
+ /**
39
+ * JSON Schema v7
40
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
41
+ */
42
+ type JSONSchema7Definition = JSONSchema7 | boolean;
43
+ interface JSONSchema7 {
44
+ $id?: string | undefined;
45
+ $ref?: string | undefined;
46
+ $schema?: JSONSchema7Version | undefined;
47
+ $comment?: string | undefined;
48
+ /**
49
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
50
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
51
+ */
52
+ $defs?: {
53
+ [key: string]: JSONSchema7Definition;
54
+ } | undefined;
55
+ /**
56
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
57
+ */
58
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
59
+ enum?: JSONSchema7Type[] | undefined;
60
+ const?: JSONSchema7Type | undefined;
61
+ /**
62
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
63
+ */
64
+ multipleOf?: number | undefined;
65
+ maximum?: number | undefined;
66
+ exclusiveMaximum?: number | undefined;
67
+ minimum?: number | undefined;
68
+ exclusiveMinimum?: number | undefined;
69
+ /**
70
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
71
+ */
72
+ maxLength?: number | undefined;
73
+ minLength?: number | undefined;
74
+ pattern?: string | undefined;
75
+ /**
76
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
77
+ */
78
+ items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
79
+ additionalItems?: JSONSchema7Definition | undefined;
80
+ maxItems?: number | undefined;
81
+ minItems?: number | undefined;
82
+ uniqueItems?: boolean | undefined;
83
+ contains?: JSONSchema7Definition | undefined;
84
+ /**
85
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
86
+ */
87
+ maxProperties?: number | undefined;
88
+ minProperties?: number | undefined;
89
+ required?: string[] | undefined;
90
+ properties?: {
91
+ [key: string]: JSONSchema7Definition;
92
+ } | undefined;
93
+ patternProperties?: {
94
+ [key: string]: JSONSchema7Definition;
95
+ } | undefined;
96
+ additionalProperties?: JSONSchema7Definition | undefined;
97
+ dependencies?: {
98
+ [key: string]: JSONSchema7Definition | string[];
99
+ } | undefined;
100
+ propertyNames?: JSONSchema7Definition | undefined;
101
+ /**
102
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
103
+ */
104
+ if?: JSONSchema7Definition | undefined;
105
+ then?: JSONSchema7Definition | undefined;
106
+ else?: JSONSchema7Definition | undefined;
107
+ /**
108
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
109
+ */
110
+ allOf?: JSONSchema7Definition[] | undefined;
111
+ anyOf?: JSONSchema7Definition[] | undefined;
112
+ oneOf?: JSONSchema7Definition[] | undefined;
113
+ not?: JSONSchema7Definition | undefined;
114
+ /**
115
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
116
+ */
117
+ format?: string | undefined;
118
+ /**
119
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
120
+ */
121
+ contentMediaType?: string | undefined;
122
+ contentEncoding?: string | undefined;
123
+ /**
124
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
125
+ */
126
+ definitions?: {
127
+ [key: string]: JSONSchema7Definition;
128
+ } | undefined;
129
+ /**
130
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
131
+ */
132
+ title?: string | undefined;
133
+ description?: string | undefined;
134
+ default?: JSONSchema7Type | undefined;
135
+ readOnly?: boolean | undefined;
136
+ writeOnly?: boolean | undefined;
137
+ examples?: JSONSchema7Type | undefined;
138
+ }
139
+ //#endregion
140
+ export { JSONSchema7 };
141
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":["JSONSchema4TypeName","JSONSchema4Type","JSONSchema4Object","JSONSchema4Array","key","Array","JSONSchema4Version","JSONSchema4","id","$ref","$schema","title","description","default","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","items","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","definitions","k","properties","patternProperties","dependencies","enum","type","allOf","anyOf","oneOf","not","extends","format","JSONSchema6TypeName","JSONSchema6Type","JSONSchema6Object","JSONSchema6Array","JSONSchema6Version","JSONSchema6Definition","JSONSchema6","$id","contains","propertyNames","const","examples","JSONSchema7TypeName","JSONSchema7Type","JSONSchema7Object","JSONSchema7Array","JSONSchema7Version","JSONSchema7Definition","JSONSchema7","$comment","$defs","if","then","else","contentMediaType","contentEncoding","readOnly","writeOnly","ValidationResult","ValidationError","valid","errors","property","message","validate","instance","schema","checkPropertyChange","value","mustBeValid","result"],"sources":["../../../../../../../../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;KA+iBYwD,mBAAAA;AAAAA;;;;;KAaAC,eAAAA;AAAAA,qBAINC,iBAAAA,GACAC,gBAAAA;AAAAA;AAAAA,UAIWD,iBAAAA;EAAAA,CACZtD,GAAAA,WAAcqD,eAAAA;AAAAA;AAAAA;AAAAA;AAAAA,UAKFE,gBAAAA,SAAyBtD,KAAAA,CAAMoD,eAAAA;;;;;;;;;;;;KAapCG,kBAAAA;;;;;KAMAC,qBAAAA,GAAwBC,WAAAA;AAAAA,UACnBA,WAAAA;EACbX,GAAAA;EACA1C,IAAAA;EACAC,OAAAA,GAAUkD,kBAAAA;EACVG,QAAAA;;;;;EAMAC,KAAAA;IAAAA,CACK5D,GAAAA,WAAcyD,qBAAAA;EAAAA;;;;EAMnBxB,IAAAA,GAAOmB,mBAAAA,GAAsBA,mBAAAA;EAC7BpB,IAAAA,GAAOqB,eAAAA;EACPH,KAAAA,GAAQG,eAAAA;;;;EAKR3C,UAAAA;EACAC,OAAAA;EACAC,gBAAAA;EACAC,OAAAA;EACAC,gBAAAA;;;;EAKAC,SAAAA;EACAC,SAAAA;EACAC,OAAAA;;;;EAKAE,KAAAA,GAAQsC,qBAAAA,GAAwBA,qBAAAA;EAChCvC,eAAAA,GAAkBuC,qBAAAA;EAClBrC,QAAAA;EACAC,QAAAA;EACAC,WAAAA;EACA0B,QAAAA,GAAWS,qBAAAA;;;;EAKXlC,aAAAA;EACAC,aAAAA;EACAC,QAAAA;EACAI,UAAAA;IAAAA,CACK7B,GAAAA,WAAcyD,qBAAAA;EAAAA;EAEnB3B,iBAAAA;IAAAA,CACK9B,GAAAA,WAAcyD,qBAAAA;EAAAA;EAEnB/B,oBAAAA,GAAuB+B,qBAAAA;EACvB1B,YAAAA;IAAAA,CACK/B,GAAAA,WAAcyD,qBAAAA;EAAAA;EAEnBR,aAAAA,GAAgBQ,qBAAAA;;;;EAKhBI,EAAAA,GAAKJ,qBAAAA;EACLK,IAAAA,GAAOL,qBAAAA;EACPM,IAAAA,GAAON,qBAAAA;;;;EAKPvB,KAAAA,GAAQuB,qBAAAA;EACRtB,KAAAA,GAAQsB,qBAAAA;EACRrB,KAAAA,GAAQqB,qBAAAA;EACRpB,GAAAA,GAAMoB,qBAAAA;;;;EAKNlB,MAAAA;;;;EAKAyB,gBAAAA;EACAC,eAAAA;;;;EAKAtC,WAAAA;IAAAA,CACK3B,GAAAA,WAAcyD,qBAAAA;EAAAA;;;;EAMnBlD,KAAAA;EACAC,WAAAA;EACAC,OAAAA,GAAU4C,eAAAA;EACVa,QAAAA;EACAC,SAAAA;EACAhB,QAAAA,GAAWE,eAAAA;AAAAA"}
@@ -0,0 +1,141 @@
1
+ //#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
2
+ // ==================================================================================================
3
+ // JSON Schema Draft 07
4
+ // ==================================================================================================
5
+ // https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
6
+ // --------------------------------------------------------------------------------------------------
7
+ /**
8
+ * Primitive type
9
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
10
+ */
11
+ type JSONSchema7TypeName = "string" //
12
+ | "number" | "integer" | "boolean" | "object" | "array" | "null";
13
+ /**
14
+ * Primitive type
15
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
16
+ */
17
+ type JSONSchema7Type = string //
18
+ | number | boolean | JSONSchema7Object | JSONSchema7Array | null;
19
+ // Workaround for infinite type recursion
20
+ interface JSONSchema7Object {
21
+ [key: string]: JSONSchema7Type;
22
+ }
23
+ // Workaround for infinite type recursion
24
+ // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
25
+ interface JSONSchema7Array extends Array<JSONSchema7Type> {}
26
+ /**
27
+ * Meta schema
28
+ *
29
+ * Recommended values:
30
+ * - 'http://json-schema.org/schema#'
31
+ * - 'http://json-schema.org/hyper-schema#'
32
+ * - 'http://json-schema.org/draft-07/schema#'
33
+ * - 'http://json-schema.org/draft-07/hyper-schema#'
34
+ *
35
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
36
+ */
37
+ type JSONSchema7Version = string;
38
+ /**
39
+ * JSON Schema v7
40
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
41
+ */
42
+ type JSONSchema7Definition = JSONSchema7 | boolean;
43
+ interface JSONSchema7 {
44
+ $id?: string | undefined;
45
+ $ref?: string | undefined;
46
+ $schema?: JSONSchema7Version | undefined;
47
+ $comment?: string | undefined;
48
+ /**
49
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
50
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
51
+ */
52
+ $defs?: {
53
+ [key: string]: JSONSchema7Definition;
54
+ } | undefined;
55
+ /**
56
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
57
+ */
58
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
59
+ enum?: JSONSchema7Type[] | undefined;
60
+ const?: JSONSchema7Type | undefined;
61
+ /**
62
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
63
+ */
64
+ multipleOf?: number | undefined;
65
+ maximum?: number | undefined;
66
+ exclusiveMaximum?: number | undefined;
67
+ minimum?: number | undefined;
68
+ exclusiveMinimum?: number | undefined;
69
+ /**
70
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
71
+ */
72
+ maxLength?: number | undefined;
73
+ minLength?: number | undefined;
74
+ pattern?: string | undefined;
75
+ /**
76
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
77
+ */
78
+ items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
79
+ additionalItems?: JSONSchema7Definition | undefined;
80
+ maxItems?: number | undefined;
81
+ minItems?: number | undefined;
82
+ uniqueItems?: boolean | undefined;
83
+ contains?: JSONSchema7Definition | undefined;
84
+ /**
85
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
86
+ */
87
+ maxProperties?: number | undefined;
88
+ minProperties?: number | undefined;
89
+ required?: string[] | undefined;
90
+ properties?: {
91
+ [key: string]: JSONSchema7Definition;
92
+ } | undefined;
93
+ patternProperties?: {
94
+ [key: string]: JSONSchema7Definition;
95
+ } | undefined;
96
+ additionalProperties?: JSONSchema7Definition | undefined;
97
+ dependencies?: {
98
+ [key: string]: JSONSchema7Definition | string[];
99
+ } | undefined;
100
+ propertyNames?: JSONSchema7Definition | undefined;
101
+ /**
102
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
103
+ */
104
+ if?: JSONSchema7Definition | undefined;
105
+ then?: JSONSchema7Definition | undefined;
106
+ else?: JSONSchema7Definition | undefined;
107
+ /**
108
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
109
+ */
110
+ allOf?: JSONSchema7Definition[] | undefined;
111
+ anyOf?: JSONSchema7Definition[] | undefined;
112
+ oneOf?: JSONSchema7Definition[] | undefined;
113
+ not?: JSONSchema7Definition | undefined;
114
+ /**
115
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
116
+ */
117
+ format?: string | undefined;
118
+ /**
119
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
120
+ */
121
+ contentMediaType?: string | undefined;
122
+ contentEncoding?: string | undefined;
123
+ /**
124
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
125
+ */
126
+ definitions?: {
127
+ [key: string]: JSONSchema7Definition;
128
+ } | undefined;
129
+ /**
130
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
131
+ */
132
+ title?: string | undefined;
133
+ description?: string | undefined;
134
+ default?: JSONSchema7Type | undefined;
135
+ readOnly?: boolean | undefined;
136
+ writeOnly?: boolean | undefined;
137
+ examples?: JSONSchema7Type | undefined;
138
+ }
139
+ //#endregion
140
+ export { JSONSchema7 };
141
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":["JSONSchema4TypeName","JSONSchema4Type","JSONSchema4Object","JSONSchema4Array","key","Array","JSONSchema4Version","JSONSchema4","id","$ref","$schema","title","description","default","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","items","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","definitions","k","properties","patternProperties","dependencies","enum","type","allOf","anyOf","oneOf","not","extends","format","JSONSchema6TypeName","JSONSchema6Type","JSONSchema6Object","JSONSchema6Array","JSONSchema6Version","JSONSchema6Definition","JSONSchema6","$id","contains","propertyNames","const","examples","JSONSchema7TypeName","JSONSchema7Type","JSONSchema7Object","JSONSchema7Array","JSONSchema7Version","JSONSchema7Definition","JSONSchema7","$comment","$defs","if","then","else","contentMediaType","contentEncoding","readOnly","writeOnly","ValidationResult","ValidationError","valid","errors","property","message","validate","instance","schema","checkPropertyChange","value","mustBeValid","result"],"sources":["../../../../../../../../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;KA+iBYwD,mBAAAA;AAAAA;;;;;KAaAC,eAAAA;AAAAA,qBAINC,iBAAAA,GACAC,gBAAAA;AAAAA;AAAAA,UAIWD,iBAAAA;EAAAA,CACZtD,GAAAA,WAAcqD,eAAAA;AAAAA;AAAAA;AAAAA;AAAAA,UAKFE,gBAAAA,SAAyBtD,KAAAA,CAAMoD,eAAAA;;;;;;;;;;;;KAapCG,kBAAAA;;;;;KAMAC,qBAAAA,GAAwBC,WAAAA;AAAAA,UACnBA,WAAAA;EACbX,GAAAA;EACA1C,IAAAA;EACAC,OAAAA,GAAUkD,kBAAAA;EACVG,QAAAA;;;;;EAMAC,KAAAA;IAAAA,CACK5D,GAAAA,WAAcyD,qBAAAA;EAAAA;;;;EAMnBxB,IAAAA,GAAOmB,mBAAAA,GAAsBA,mBAAAA;EAC7BpB,IAAAA,GAAOqB,eAAAA;EACPH,KAAAA,GAAQG,eAAAA;;;;EAKR3C,UAAAA;EACAC,OAAAA;EACAC,gBAAAA;EACAC,OAAAA;EACAC,gBAAAA;;;;EAKAC,SAAAA;EACAC,SAAAA;EACAC,OAAAA;;;;EAKAE,KAAAA,GAAQsC,qBAAAA,GAAwBA,qBAAAA;EAChCvC,eAAAA,GAAkBuC,qBAAAA;EAClBrC,QAAAA;EACAC,QAAAA;EACAC,WAAAA;EACA0B,QAAAA,GAAWS,qBAAAA;;;;EAKXlC,aAAAA;EACAC,aAAAA;EACAC,QAAAA;EACAI,UAAAA;IAAAA,CACK7B,GAAAA,WAAcyD,qBAAAA;EAAAA;EAEnB3B,iBAAAA;IAAAA,CACK9B,GAAAA,WAAcyD,qBAAAA;EAAAA;EAEnB/B,oBAAAA,GAAuB+B,qBAAAA;EACvB1B,YAAAA;IAAAA,CACK/B,GAAAA,WAAcyD,qBAAAA;EAAAA;EAEnBR,aAAAA,GAAgBQ,qBAAAA;;;;EAKhBI,EAAAA,GAAKJ,qBAAAA;EACLK,IAAAA,GAAOL,qBAAAA;EACPM,IAAAA,GAAON,qBAAAA;;;;EAKPvB,KAAAA,GAAQuB,qBAAAA;EACRtB,KAAAA,GAAQsB,qBAAAA;EACRrB,KAAAA,GAAQqB,qBAAAA;EACRpB,GAAAA,GAAMoB,qBAAAA;;;;EAKNlB,MAAAA;;;;EAKAyB,gBAAAA;EACAC,eAAAA;;;;EAKAtC,WAAAA;IAAAA,CACK3B,GAAAA,WAAcyD,qBAAAA;EAAAA;;;;EAMnBlD,KAAAA;EACAC,WAAAA;EACAC,OAAAA,GAAU4C,eAAAA;EACVa,QAAAA;EACAC,SAAAA;EACAhB,QAAAA,GAAWE,eAAAA;AAAAA"}
package/dist/path.cjs ADDED
@@ -0,0 +1,255 @@
1
+
2
+ //#region src/path.ts
3
+ /**
4
+ * AFS Path Validation and Normalization
5
+ *
6
+ * All AFS paths must follow Unix filesystem semantics:
7
+ * - Must be absolute paths (start with /)
8
+ * - Use / as path separator (not Windows \)
9
+ * - No NUL characters in path components
10
+ * - Consistent semantics regardless of underlying platform
11
+ */
12
+ /**
13
+ * Error thrown when path validation fails
14
+ */
15
+ var AFSPathError = class extends Error {
16
+ constructor(message, path) {
17
+ super(message);
18
+ this.path = path;
19
+ this.name = "AFSPathError";
20
+ }
21
+ };
22
+ /**
23
+ * Characters that are not allowed in AFS paths
24
+ */
25
+ const FORBIDDEN_CHARS = [
26
+ "\0",
27
+ "",
28
+ "",
29
+ "",
30
+ "",
31
+ "",
32
+ "",
33
+ "\x07",
34
+ "\b",
35
+ " ",
36
+ "\n",
37
+ "\v",
38
+ "\f",
39
+ "\r",
40
+ "",
41
+ "",
42
+ "",
43
+ "",
44
+ "",
45
+ "",
46
+ "",
47
+ "",
48
+ "",
49
+ "",
50
+ "",
51
+ "",
52
+ "",
53
+ "\x1B",
54
+ "",
55
+ "",
56
+ "",
57
+ ""
58
+ ];
59
+ /**
60
+ * Check if a string contains any forbidden control characters
61
+ */
62
+ function containsForbiddenChars(str) {
63
+ for (const char of FORBIDDEN_CHARS) if (str.includes(char)) return true;
64
+ return false;
65
+ }
66
+ /**
67
+ * Normalize a path by:
68
+ * - Collapsing multiple consecutive slashes
69
+ * - Resolving . (current directory)
70
+ * - Resolving .. (parent directory) while preventing escape above root
71
+ * - Removing trailing slashes (except for root /)
72
+ * - Rejecting whitespace-only path segments
73
+ *
74
+ * @throws AFSPathError if a path segment is whitespace-only
75
+ */
76
+ function normalizePath(path) {
77
+ const segments = path.split("/").filter((s) => s !== "");
78
+ const result = [];
79
+ for (const segment of segments) {
80
+ if (segment.trim() === "") throw new AFSPathError("Path segment cannot be whitespace-only", path);
81
+ if (segment === ".") continue;
82
+ if (segment === "..") {
83
+ if (result.length > 0) result.pop();
84
+ continue;
85
+ }
86
+ result.push(segment);
87
+ }
88
+ return `/${result.join("/")}`;
89
+ }
90
+ /**
91
+ * Validate an AFS path
92
+ *
93
+ * @param path - The path to validate
94
+ * @throws AFSPathError if the path is invalid
95
+ * @returns The normalized path
96
+ */
97
+ function validatePath(path) {
98
+ if (!path || path.trim() === "") throw new AFSPathError("Path cannot be empty or whitespace-only", path);
99
+ if (containsForbiddenChars(path)) throw new AFSPathError("Path contains forbidden control characters", path);
100
+ if (!path.startsWith("/")) throw new AFSPathError("Path must be absolute (start with /)", path);
101
+ if (path.replace(/^\/+/, "").startsWith("~")) throw new AFSPathError("Path cannot use tilde expansion", path);
102
+ return normalizePath(path);
103
+ }
104
+ /**
105
+ * Validate a module name
106
+ *
107
+ * Module names must:
108
+ * - Not be empty or whitespace-only
109
+ * - Not contain / or \
110
+ * - Not contain control characters
111
+ * - Not be "." or ".."
112
+ *
113
+ * @param name - The module name to validate
114
+ * @throws Error if the name is invalid
115
+ */
116
+ function validateModuleName(name) {
117
+ if (!name || name.trim() === "") throw new Error("Module name cannot be empty or whitespace-only");
118
+ if (containsForbiddenChars(name)) throw new Error(`Invalid module name: ${name}. Module name must not contain control characters`);
119
+ if (name.includes("/")) throw new Error(`Invalid module name: ${name}. Module name must not contain '/'`);
120
+ if (name.includes("\\")) throw new Error(`Invalid module name: ${name}. Module name must not contain '\\'`);
121
+ if (name === ".") throw new Error("Invalid module name: '.'. Module name cannot be '.'");
122
+ if (name === "..") throw new Error("Invalid module name: '..'. Module name cannot be '..'");
123
+ }
124
+ /**
125
+ * Canonical path prefix for AFS
126
+ */
127
+ const CANONICAL_PREFIX = "$afs";
128
+ /**
129
+ * Characters forbidden in namespace names (security-sensitive)
130
+ */
131
+ const NAMESPACE_FORBIDDEN_CHARS = [
132
+ "/",
133
+ "\\",
134
+ ":",
135
+ ";",
136
+ "|",
137
+ "&",
138
+ "`",
139
+ "$",
140
+ "(",
141
+ ")",
142
+ ">",
143
+ "<",
144
+ "\n",
145
+ "\r",
146
+ " ",
147
+ "\0",
148
+ ...FORBIDDEN_CHARS
149
+ ];
150
+ /**
151
+ * Check if a string contains any namespace-forbidden characters
152
+ */
153
+ function containsNamespaceForbiddenChars(str) {
154
+ for (const char of NAMESPACE_FORBIDDEN_CHARS) if (str.includes(char)) return true;
155
+ return false;
156
+ }
157
+ /**
158
+ * Validate a namespace name
159
+ *
160
+ * @throws AFSPathError if namespace is invalid
161
+ */
162
+ function validateNamespace(namespace, fullPath) {
163
+ if (!namespace || namespace.trim() === "") throw new AFSPathError("Namespace cannot be empty or whitespace-only", fullPath);
164
+ if (containsNamespaceForbiddenChars(namespace)) throw new AFSPathError(`Namespace contains forbidden characters: ${namespace}`, fullPath);
165
+ if (namespace === "." || namespace === "..") throw new AFSPathError("Namespace cannot be '.' or '..'", fullPath);
166
+ if (namespace.startsWith("..") || namespace.includes("/..") || namespace.includes("\\..")) throw new AFSPathError("Namespace cannot contain path traversal", fullPath);
167
+ }
168
+ /**
169
+ * Check if a string is a canonical AFS path
170
+ *
171
+ * Canonical paths have the format:
172
+ * - $afs/path (default namespace)
173
+ * - $afs:namespace/path (named namespace)
174
+ *
175
+ * @param input - String to check
176
+ * @returns true if input is a canonical AFS path
177
+ */
178
+ function isCanonicalPath(input) {
179
+ if (!input || typeof input !== "string") return false;
180
+ if (!input.startsWith(CANONICAL_PREFIX)) return false;
181
+ const afterPrefix = input.slice(4);
182
+ if (afterPrefix.length === 0) return false;
183
+ const firstChar = afterPrefix[0];
184
+ if (firstChar !== "/" && firstChar !== ":") return false;
185
+ if (firstChar === ":") {
186
+ const slashIndex = afterPrefix.indexOf("/", 1);
187
+ if (slashIndex === -1) return false;
188
+ const namespace = afterPrefix.slice(1, slashIndex);
189
+ if (!namespace || namespace.trim() === "") return false;
190
+ }
191
+ return true;
192
+ }
193
+ /**
194
+ * Parse a canonical AFS path
195
+ *
196
+ * Canonical paths have the format:
197
+ * - $afs/path (default namespace)
198
+ * - $afs:namespace/path (named namespace)
199
+ *
200
+ * @param canonical - Canonical path string
201
+ * @returns Parsed path with namespace and path
202
+ * @throws AFSPathError if path format is invalid
203
+ */
204
+ function parseCanonicalPath(canonical) {
205
+ if (!canonical || canonical.trim() === "") throw new AFSPathError("Canonical path cannot be empty", canonical);
206
+ if (containsForbiddenChars(canonical)) throw new AFSPathError("Canonical path contains forbidden control characters", canonical);
207
+ if (!canonical.startsWith(CANONICAL_PREFIX)) throw new AFSPathError(`Canonical path must start with '${CANONICAL_PREFIX}', got: ${canonical}`, canonical);
208
+ const afterPrefix = canonical.slice(4);
209
+ if (afterPrefix.length === 0) throw new AFSPathError("Canonical path must have '/' or ':' after $afs", canonical);
210
+ const firstChar = afterPrefix[0];
211
+ if (firstChar === "/") return {
212
+ namespace: null,
213
+ path: normalizePath(afterPrefix)
214
+ };
215
+ if (firstChar === ":") {
216
+ const rest = afterPrefix.slice(1);
217
+ const slashIndex = rest.indexOf("/");
218
+ if (slashIndex === -1) throw new AFSPathError("Named namespace path must have '/' after namespace", canonical);
219
+ const namespace = rest.slice(0, slashIndex);
220
+ const pathPart = rest.slice(slashIndex);
221
+ validateNamespace(namespace, canonical);
222
+ if (namespace.includes(":")) throw new AFSPathError("Namespace cannot contain ':'", canonical);
223
+ return {
224
+ namespace,
225
+ path: normalizePath(pathPart)
226
+ };
227
+ }
228
+ throw new AFSPathError(`Canonical path must have '/' or ':' after $afs, got: '${firstChar}'`, canonical);
229
+ }
230
+ /**
231
+ * Create a canonical AFS path from components
232
+ *
233
+ * @param namespace - Namespace name, or null for default namespace
234
+ * @param path - Path within namespace (must start with /)
235
+ * @returns Canonical path string
236
+ * @throws AFSPathError if namespace or path is invalid
237
+ */
238
+ function toCanonicalPath(namespace, path) {
239
+ if (!path || path.trim() === "") throw new AFSPathError("Path cannot be empty", path);
240
+ if (!path.startsWith("/")) throw new AFSPathError("Path must start with '/'", path);
241
+ if (containsForbiddenChars(path)) throw new AFSPathError("Path contains forbidden control characters", path);
242
+ const normalizedPath = normalizePath(path);
243
+ if (namespace === null || namespace === void 0) return `${CANONICAL_PREFIX}${normalizedPath}`;
244
+ validateNamespace(namespace, `${CANONICAL_PREFIX}:${namespace}${path}`);
245
+ return `${CANONICAL_PREFIX}:${namespace}${normalizedPath}`;
246
+ }
247
+
248
+ //#endregion
249
+ exports.AFSPathError = AFSPathError;
250
+ exports.isCanonicalPath = isCanonicalPath;
251
+ exports.normalizePath = normalizePath;
252
+ exports.parseCanonicalPath = parseCanonicalPath;
253
+ exports.toCanonicalPath = toCanonicalPath;
254
+ exports.validateModuleName = validateModuleName;
255
+ exports.validatePath = validatePath;
@@ -0,0 +1,93 @@
1
+ //#region src/path.d.ts
2
+ /**
3
+ * AFS Path Validation and Normalization
4
+ *
5
+ * All AFS paths must follow Unix filesystem semantics:
6
+ * - Must be absolute paths (start with /)
7
+ * - Use / as path separator (not Windows \)
8
+ * - No NUL characters in path components
9
+ * - Consistent semantics regardless of underlying platform
10
+ */
11
+ /**
12
+ * Error thrown when path validation fails
13
+ */
14
+ declare class AFSPathError extends Error {
15
+ readonly path: string;
16
+ constructor(message: string, path: string);
17
+ }
18
+ /**
19
+ * Normalize a path by:
20
+ * - Collapsing multiple consecutive slashes
21
+ * - Resolving . (current directory)
22
+ * - Resolving .. (parent directory) while preventing escape above root
23
+ * - Removing trailing slashes (except for root /)
24
+ * - Rejecting whitespace-only path segments
25
+ *
26
+ * @throws AFSPathError if a path segment is whitespace-only
27
+ */
28
+ declare function normalizePath(path: string): string;
29
+ /**
30
+ * Validate an AFS path
31
+ *
32
+ * @param path - The path to validate
33
+ * @throws AFSPathError if the path is invalid
34
+ * @returns The normalized path
35
+ */
36
+ declare function validatePath(path: string): string;
37
+ /**
38
+ * Validate a module name
39
+ *
40
+ * Module names must:
41
+ * - Not be empty or whitespace-only
42
+ * - Not contain / or \
43
+ * - Not contain control characters
44
+ * - Not be "." or ".."
45
+ *
46
+ * @param name - The module name to validate
47
+ * @throws Error if the name is invalid
48
+ */
49
+ declare function validateModuleName(name: string): void;
50
+ /**
51
+ * Parsed canonical AFS path
52
+ */
53
+ interface ParsedCanonicalPath {
54
+ /** Namespace name, or null for default namespace */
55
+ namespace: string | null;
56
+ /** Path within the namespace (always starts with /) */
57
+ path: string;
58
+ }
59
+ /**
60
+ * Check if a string is a canonical AFS path
61
+ *
62
+ * Canonical paths have the format:
63
+ * - $afs/path (default namespace)
64
+ * - $afs:namespace/path (named namespace)
65
+ *
66
+ * @param input - String to check
67
+ * @returns true if input is a canonical AFS path
68
+ */
69
+ declare function isCanonicalPath(input: string): boolean;
70
+ /**
71
+ * Parse a canonical AFS path
72
+ *
73
+ * Canonical paths have the format:
74
+ * - $afs/path (default namespace)
75
+ * - $afs:namespace/path (named namespace)
76
+ *
77
+ * @param canonical - Canonical path string
78
+ * @returns Parsed path with namespace and path
79
+ * @throws AFSPathError if path format is invalid
80
+ */
81
+ declare function parseCanonicalPath(canonical: string): ParsedCanonicalPath;
82
+ /**
83
+ * Create a canonical AFS path from components
84
+ *
85
+ * @param namespace - Namespace name, or null for default namespace
86
+ * @param path - Path within namespace (must start with /)
87
+ * @returns Canonical path string
88
+ * @throws AFSPathError if namespace or path is invalid
89
+ */
90
+ declare function toCanonicalPath(namespace: string | null, path: string): string;
91
+ //#endregion
92
+ export { AFSPathError, ParsedCanonicalPath, isCanonicalPath, normalizePath, parseCanonicalPath, toCanonicalPath, validateModuleName, validatePath };
93
+ //# sourceMappingURL=path.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.cts","names":[],"sources":["../src/path.ts"],"mappings":";;AAaA;;;;;;;;;;;cAAa,YAAA,SAAqB,KAAA;EAAA,SAGd,IAAA;cADhB,OAAA,UACgB,IAAA;AAAA;;AAwGpB;;;;;AAyCA;;;;iBA9EgB,aAAA,CAAc,IAAA;AAiJ9B;;;;;AAuDA;;AAvDA,iBA5GgB,YAAA,CAAa,IAAA;;;AAmN7B;;;;;AAoFA;;;;;iBA9PgB,kBAAA,CAAmB,IAAA;;;;UAmElB,mBAAA;;EAEf,SAAA;;EAEA,IAAA;AAAA;;;;;;;;;;;iBAmDc,eAAA,CAAgB,KAAA;;;;;;;;;;;;iBAgDhB,kBAAA,CAAmB,SAAA,WAAoB,mBAAA;;;;;;;;;iBAoFvC,eAAA,CAAgB,SAAA,iBAA0B,IAAA"}