inferred-types 0.36.4 → 0.37.1

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 (280) hide show
  1. package/README.md +1 -1
  2. package/dist/{index.mjs → index.js} +0 -0
  3. package/package.json +15 -21
  4. package/.eslintrc +0 -77
  5. package/.github/workflows/main.yml +0 -34
  6. package/.github/workflows/other.yml +0 -15
  7. package/.nvmrc +0 -1
  8. package/.prettierrc.js +0 -3
  9. package/.vscode/launch.json +0 -27
  10. package/.vscode/settings.json +0 -19
  11. package/devops/build.js +0 -243
  12. package/docs/builder-overview.md +0 -45
  13. package/docs/builder.md +0 -94
  14. package/src/errors/ReadOnlyViolation.ts +0 -3
  15. package/src/errors/index.ts +0 -12
  16. package/src/index.ts +0 -14
  17. package/src/runtime/README.md +0 -3
  18. package/src/runtime/api/api.ts +0 -10
  19. package/src/runtime/api/index.ts +0 -12
  20. package/src/runtime/builders/Model.ts +0 -25
  21. package/src/runtime/builders/url.ts +0 -15
  22. package/src/runtime/combinators/and.ts +0 -15
  23. package/src/runtime/combinators/filter.ts +0 -267
  24. package/src/runtime/combinators/index.ts +0 -4
  25. package/src/runtime/combinators/not.ts +0 -15
  26. package/src/runtime/combinators/or.ts +0 -5
  27. package/src/runtime/createFnWithProps.ts +0 -37
  28. package/src/runtime/dictionary/arrayToKeyLookup.ts +0 -19
  29. package/src/runtime/dictionary/defineProperties.ts +0 -35
  30. package/src/runtime/dictionary/dictArr.ts +0 -69
  31. package/src/runtime/dictionary/dictionaryTransform.ts +0 -22
  32. package/src/runtime/dictionary/entries.ts +0 -33
  33. package/src/runtime/dictionary/index.ts +0 -21
  34. package/src/runtime/dictionary/kv/dictToKv.ts +0 -21
  35. package/src/runtime/dictionary/kv/filterDictArray.ts +0 -31
  36. package/src/runtime/dictionary/kv/index.ts +0 -15
  37. package/src/runtime/dictionary/kv/kv.ts +0 -18
  38. package/src/runtime/dictionary/kv/kvToDict.ts +0 -24
  39. package/src/runtime/dictionary/mapTo.ts +0 -206
  40. package/src/runtime/dictionary/mapValues.ts +0 -23
  41. package/src/runtime/dictionary/merge.ts +0 -36
  42. package/src/runtime/dictionary/strArrayToDict.ts +0 -12
  43. package/src/runtime/index.ts +0 -23
  44. package/src/runtime/keys.ts +0 -16
  45. package/src/runtime/lists/asArray.ts +0 -38
  46. package/src/runtime/lists/createConverter.ts +0 -62
  47. package/src/runtime/lists/groupBy.ts +0 -15
  48. package/src/runtime/lists/index.ts +0 -15
  49. package/src/runtime/literals/ExplicitFunction.ts +0 -10
  50. package/src/runtime/literals/Suggest.ts +0 -19
  51. package/src/runtime/literals/arrayToObject.ts +0 -78
  52. package/src/runtime/literals/box.ts +0 -98
  53. package/src/runtime/literals/defineType.ts +0 -20
  54. package/src/runtime/literals/ensureLeading.ts +0 -17
  55. package/src/runtime/literals/ensureTrailing.ts +0 -17
  56. package/src/runtime/literals/identity.ts +0 -12
  57. package/src/runtime/literals/index.ts +0 -23
  58. package/src/runtime/literals/literal.ts +0 -48
  59. package/src/runtime/literals/pathJoin.ts +0 -33
  60. package/src/runtime/literals/stripLeading.ts +0 -15
  61. package/src/runtime/literals/stripTrailing.ts +0 -15
  62. package/src/runtime/literals/wide.ts +0 -13
  63. package/src/runtime/ruleset.ts +0 -42
  64. package/src/runtime/runtime/README.md +0 -3
  65. package/src/runtime/runtime/condition.ts +0 -13
  66. package/src/runtime/runtime/index.ts +0 -16
  67. package/src/runtime/runtime/type.ts +0 -127
  68. package/src/runtime/runtime/withValue.ts +0 -39
  69. package/src/runtime/state/Configurator.ts +0 -76
  70. package/src/runtime/state/FluentConfigurator.ts +0 -49
  71. package/src/runtime/state/index.ts +0 -13
  72. package/src/runtime/type-checks/ifSameType.ts +0 -20
  73. package/src/runtime/type-checks/ifTypeOf.ts +0 -124
  74. package/src/runtime/type-checks/index.ts +0 -24
  75. package/src/runtime/type-checks/isArray.ts +0 -34
  76. package/src/runtime/type-checks/isBoolean.ts +0 -24
  77. package/src/runtime/type-checks/isFalse.ts +0 -29
  78. package/src/runtime/type-checks/isFunction.ts +0 -26
  79. package/src/runtime/type-checks/isNull.ts +0 -26
  80. package/src/runtime/type-checks/isNumber.ts +0 -20
  81. package/src/runtime/type-checks/isObject.ts +0 -22
  82. package/src/runtime/type-checks/isString.ts +0 -34
  83. package/src/runtime/type-checks/isSymbol.ts +0 -3
  84. package/src/runtime/type-checks/isTrue.ts +0 -31
  85. package/src/runtime/type-checks/isUndefined.ts +0 -33
  86. package/src/runtime/type-checks/startsWith.ts +0 -107
  87. package/src/runtime/valueTypes.ts +0 -48
  88. package/src/types/Api.ts +0 -16
  89. package/src/types/Constructor.ts +0 -5
  90. package/src/types/EnumValues.ts +0 -14
  91. package/src/types/ExpandRecursively.ts +0 -12
  92. package/src/types/FunctionType.ts +0 -19
  93. package/src/types/If.ts +0 -10
  94. package/src/types/Include.ts +0 -18
  95. package/src/types/KeyedRecord.ts +0 -21
  96. package/src/types/Keys.ts +0 -26
  97. package/src/types/Length.ts +0 -8
  98. package/src/types/Mutable.ts +0 -8
  99. package/src/types/Narrowable.ts +0 -5
  100. package/src/types/Not.ts +0 -13
  101. package/src/types/Numeric.ts +0 -20
  102. package/src/types/Opaque.ts +0 -11
  103. package/src/types/README.md +0 -3
  104. package/src/types/Retain.ts +0 -16
  105. package/src/types/SimplifyObject.ts +0 -12
  106. package/src/types/Transformer.ts +0 -15
  107. package/src/types/TypeGuard.ts +0 -7
  108. package/src/types/Where.ts +0 -40
  109. package/src/types/alphabetic/AllCaps.ts +0 -15
  110. package/src/types/alphabetic/CamelCase.ts +0 -3
  111. package/src/types/alphabetic/CapFirstAlpha.ts +0 -23
  112. package/src/types/alphabetic/CapitalizeWords.ts +0 -9
  113. package/src/types/alphabetic/Cardinality.ts +0 -80
  114. package/src/types/alphabetic/DashToSnake.ts +0 -3
  115. package/src/types/alphabetic/DashUppercase.ts +0 -19
  116. package/src/types/alphabetic/Dasherize.ts +0 -23
  117. package/src/types/alphabetic/EnsureLeading.ts +0 -24
  118. package/src/types/alphabetic/EnsureTrailing.ts +0 -24
  119. package/src/types/alphabetic/HasUppercase.ts +0 -16
  120. package/src/types/alphabetic/IsCapitalized.ts +0 -18
  121. package/src/types/alphabetic/KebabCase.ts +0 -13
  122. package/src/types/alphabetic/LowerAllCaps.ts +0 -5
  123. package/src/types/alphabetic/PascalCase.ts +0 -29
  124. package/src/types/alphabetic/PathJoin.ts +0 -54
  125. package/src/types/alphabetic/Pluralize.ts +0 -112
  126. package/src/types/alphabetic/SnakeCase.ts +0 -27
  127. package/src/types/alphabetic/StripLeading.ts +0 -23
  128. package/src/types/alphabetic/StripTrailing.ts +0 -23
  129. package/src/types/alphabetic/Url.ts +0 -29
  130. package/src/types/alphabetic/alpha-characters.ts +0 -81
  131. package/src/types/alphabetic/index.ts +0 -32
  132. package/src/types/append-types.ts +0 -10
  133. package/src/types/boolean-logic/EndsWith.ts +0 -40
  134. package/src/types/boolean-logic/Extends.ts +0 -22
  135. package/src/types/boolean-logic/HasParameters.ts +0 -21
  136. package/src/types/boolean-logic/Includes.ts +0 -33
  137. package/src/types/boolean-logic/IsLiteral.ts +0 -101
  138. package/src/types/boolean-logic/IsScalar.ts +0 -20
  139. package/src/types/boolean-logic/IsUndefined.ts +0 -20
  140. package/src/types/boolean-logic/Or.ts +0 -12
  141. package/src/types/boolean-logic/StartsWith.ts +0 -42
  142. package/src/types/boolean-logic/TypeDefault.ts +0 -58
  143. package/src/types/boolean-logic/array.ts +0 -57
  144. package/src/types/boolean-logic/boolean.ts +0 -84
  145. package/src/types/boolean-logic/equivalency.ts +0 -15
  146. package/src/types/boolean-logic/index.ts +0 -14
  147. package/src/types/boolean-logic/object.ts +0 -30
  148. package/src/types/boolean-logic/string.ts +0 -21
  149. package/src/types/dictionary/DictChangeValue.ts +0 -34
  150. package/src/types/dictionary/DictPartialApplication.ts +0 -30
  151. package/src/types/dictionary/DictPrependWithFn.ts +0 -23
  152. package/src/types/dictionary/DictReturnValues.ts +0 -27
  153. package/src/types/dictionary/Get.ts +0 -14
  154. package/src/types/dictionary/MapTo.ts +0 -428
  155. package/src/types/dictionary/MutableProps.ts +0 -19
  156. package/src/types/dictionary/RequireProps.ts +0 -15
  157. package/src/types/dictionary/SameKeys.ts +0 -11
  158. package/src/types/dictionary/index.ts +0 -21
  159. package/src/types/dictionary/props.ts +0 -145
  160. package/src/types/fluent/fluent.ts +0 -61
  161. package/src/types/fluent/index.ts +0 -12
  162. package/src/types/functions/FinalReturn.ts +0 -12
  163. package/src/types/functions/LogicFunction.ts +0 -4
  164. package/src/types/functions/index.ts +0 -13
  165. package/src/types/index.ts +0 -49
  166. package/src/types/kv/DictFromKv.ts +0 -3
  167. package/src/types/kv/KeyValue.ts +0 -12
  168. package/src/types/kv/KvFrom.ts +0 -8
  169. package/src/types/kv/KvTuple.ts +0 -14
  170. package/src/types/kv/index.ts +0 -15
  171. package/src/types/lists/AfterFirst.ts +0 -10
  172. package/src/types/lists/ConvertAndMap.ts +0 -151
  173. package/src/types/lists/FilterTuple.ts +0 -20
  174. package/src/types/lists/First.ts +0 -8
  175. package/src/types/lists/FirstString.ts +0 -4
  176. package/src/types/lists/Split.ts +0 -21
  177. package/src/types/lists/UniqueForProp.ts +0 -18
  178. package/src/types/lists/index.ts +0 -18
  179. package/src/types/literal-unions/OptRequired.ts +0 -4
  180. package/src/types/literal-unions/index.ts +0 -1
  181. package/src/types/maybe.ts +0 -9
  182. package/src/types/ruleset-types.ts +0 -76
  183. package/src/types/runtime.ts +0 -39
  184. package/src/types/string-literals/Break.ts +0 -22
  185. package/src/types/string-literals/Concat.ts +0 -9
  186. package/src/types/string-literals/LeftWhitespace.ts +0 -13
  187. package/src/types/string-literals/Replace.ts +0 -17
  188. package/src/types/string-literals/RightWhitespace.ts +0 -13
  189. package/src/types/string-literals/StringLength.ts +0 -34
  190. package/src/types/string-literals/Trim.ts +0 -15
  191. package/src/types/string-literals/TrimLeft.ts +0 -14
  192. package/src/types/string-literals/TrimRight.ts +0 -14
  193. package/src/types/string-literals/form-fields.ts +0 -15
  194. package/src/types/string-literals/index.ts +0 -21
  195. package/src/types/tuples/DictArray.ts +0 -21
  196. package/src/types/tuples/FirstKey.ts +0 -10
  197. package/src/types/tuples/FirstKeyValue.ts +0 -9
  198. package/src/types/tuples/FirstOfEach.ts +0 -13
  199. package/src/types/tuples/FromDictArray.ts +0 -14
  200. package/src/types/tuples/SecondOfEach.ts +0 -13
  201. package/src/types/tuples/index.ts +0 -17
  202. package/src/types/type-conversion/TupleToUnion.ts +0 -9
  203. package/src/types/type-conversion/UnionToIntersection.ts +0 -9
  204. package/src/types/type-conversion/UnionToTuple.ts +0 -20
  205. package/src/types/type-conversion/Widen.ts +0 -22
  206. package/src/types/type-conversion/index.ts +0 -16
  207. package/src/types/type-testing.ts +0 -14
  208. package/tests/CamelCase-spec.ts +0 -20
  209. package/tests/Configurator-spec.hold +0 -106
  210. package/tests/ExplicitFunction-spec.ts +0 -50
  211. package/tests/IncludeAndRetain-spec.ts +0 -67
  212. package/tests/Includes-spec.ts +0 -36
  213. package/tests/KebabCase-spec.ts +0 -21
  214. package/tests/PascalCase-spec.ts +0 -22
  215. package/tests/Pluralize-spec.ts +0 -23
  216. package/tests/SnakeCase-spec.ts +0 -21
  217. package/tests/Where.spec.ts +0 -38
  218. package/tests/arrayToKeyLookup-spec.ts +0 -17
  219. package/tests/arrayToObject-spec.ts +0 -115
  220. package/tests/boolean-logic/Contains.test.ts +0 -55
  221. package/tests/boolean-logic/HasParameters.ts +0 -29
  222. package/tests/boolean-logic/IsLiteral.spec.ts +0 -65
  223. package/tests/boolean-logic/boolean.spec.ts +0 -21
  224. package/tests/boolean-logic/filter.spec.ts +0 -52
  225. package/tests/constructor.spec.ts +0 -42
  226. package/tests/createFnWithProps.spec.ts +0 -14
  227. package/tests/data/SimpleTable.hold +0 -21
  228. package/tests/data/index.ts +0 -12
  229. package/tests/data/playlist.hold +0 -25
  230. package/tests/data/song.hold +0 -23
  231. package/tests/defineType-spec.ts +0 -57
  232. package/tests/dictionary/DictChangeValue.test.ts +0 -30
  233. package/tests/dictionary/DictPartialApplication.test.ts +0 -43
  234. package/tests/dictionary/DictReturnValues.test.ts +0 -36
  235. package/tests/dictionary/Get.spec.ts +0 -28
  236. package/tests/dictionary/IntersectingKeys.test.ts +0 -42
  237. package/tests/dictionary/MutableProps.test.ts +0 -30
  238. package/tests/dictionary/OptionalKeys.test.ts +0 -24
  239. package/tests/dictionary/PrependValuesWithFunction.test.ts +0 -34
  240. package/tests/dictionary/RequireProps.test.ts +0 -21
  241. package/tests/dictionary/RequiredKeys.test.ts +0 -53
  242. package/tests/dictionary/TypeDefault.test.ts +0 -76
  243. package/tests/dictionary/mapTo.test.ts +0 -388
  244. package/tests/dictionary/merge.test.ts +0 -41
  245. package/tests/dictionaryTransform-spec.ts +0 -280
  246. package/tests/ifTypeOf-spec.ts +0 -191
  247. package/tests/kv/KeyValue-spec.ts +0 -22
  248. package/tests/kv/SameKeys-spec.ts +0 -35
  249. package/tests/kv/dict-to-kv-and-back.spec.ts +0 -169
  250. package/tests/kv/entries-spec.ts +0 -65
  251. package/tests/kv/keys.spec.ts +0 -66
  252. package/tests/kv/kv-spec.ts +0 -20
  253. package/tests/lists/First.test.ts +0 -43
  254. package/tests/lists/Length.test.ts +0 -19
  255. package/tests/lists/Split.test.ts +0 -29
  256. package/tests/lists/UniqueForProp.spec.ts +0 -59
  257. package/tests/lists/asArray.test.ts +0 -109
  258. package/tests/lists/dictArr.test.ts +0 -110
  259. package/tests/literal-spec.ts +0 -82
  260. package/tests/literals/AllCaps.spec.ts +0 -33
  261. package/tests/literals/CamelCase.spec.ts +0 -109
  262. package/tests/literals/Dasherize.spec.ts +0 -107
  263. package/tests/literals/EnsureStripLeadingTrailing.test.ts +0 -79
  264. package/tests/literals/HasUppercase.spec.ts +0 -33
  265. package/tests/literals/PascalCase.spec.ts +0 -109
  266. package/tests/literals/PathJoin.test.ts +0 -111
  267. package/tests/literals/SnakeCase.spec.ts +0 -109
  268. package/tests/literals/box.test.ts +0 -85
  269. package/tests/literals/whitespace-capture.spec.ts +0 -60
  270. package/tests/mapValues-spec.ts +0 -50
  271. package/tests/props-spec.ts +0 -234
  272. package/tests/runtime/condition.spec.ts +0 -19
  273. package/tests/runtime/if-is.spec.ts +0 -390
  274. package/tests/runtime/map-and-convert.test.ts +0 -31
  275. package/tests/runtime/type.spec.ts +0 -190
  276. package/tests/strArrayToDict-spec.ts +0 -40
  277. package/tests/tuples/TupleToUnion.spec.ts +0 -20
  278. package/tests/withValue.spec.ts +0 -173
  279. package/tsconfig.json +0 -36
  280. package/vitest.config.ts +0 -17
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Inferred Types
2
2
 
3
- A collection of Typescript utilities which try to preserve as much strong and narrow typing as is possible. The repo's `src/` directory ia broken into a set of **runtime** utilities as well as pure **design-type** type utilities.
3
+ A collection of Typescript utilities which try to preserve as much strong and narrow typing as is possible. The repo's `src/` directory ia broken into a set of **runtime** utilities as well as pure **design-time** type utilities.
4
4
 
5
5
  All utilities are tested for runtime and design-time correctness.
File without changes
package/package.json CHANGED
@@ -1,25 +1,30 @@
1
1
  {
2
2
  "name": "inferred-types",
3
- "version": "0.36.4",
3
+ "version": "0.37.1",
4
4
  "description": "Functions which provide useful type inference on TS projects",
5
5
  "license": "MIT",
6
6
  "author": "Ken Snyder<ken@ken.net>",
7
- "main": "dist/index.js",
8
- "module": "dist/index.mjs",
9
- "typings": "dist/index.d.ts",
7
+ "module": "./dist/index.js",
8
+ "typings": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "type": "module",
10
18
  "repository": {
11
19
  "url": "https://github.com/inocan-group/inferred-types"
12
20
  },
13
21
  "sideEffects": false,
14
22
  "scripts": {
15
23
  "about": "tokei src",
16
- "autoindex": "npx dd autoindex",
17
- "build": "run-s clean autoindex lint build:bundle",
18
- "build:force": "run-s clean autoindex build:bundle",
19
- "build:bundle": "npx tsup src/index.ts --dts --format=esm --clean",
24
+ "build": "run-s lint build:bundle",
25
+ "build:bundle": "tsup src/index.ts --dts --format=esm --clean",
20
26
  "watch": "run-p watch:*",
21
- "watch:autoindex": "npx dd autoindex --watch",
22
- "watch:bundle": "npx tsup src/index.ts --dts --format=esm --watch",
27
+ "watch:bundle": "tsup src/index.ts --dts --format=esm --watch",
23
28
  "clean": "rimraf dist/**/*",
24
29
  "lint": "eslint src/**/*.ts --fix && tsc --noEmit ",
25
30
  "lint:full": "eslint src/**/*.ts && eslint tests/**/*.ts && tsc --noEmit",
@@ -38,10 +43,7 @@
38
43
  "@typescript-eslint/parser": "^5.46.0",
39
44
  "@vitest/ui": "^0.25.6",
40
45
  "bumpp": "^8.2.1",
41
- "common-types": "^1.33.2",
42
46
  "cross-env": "^7.0.3",
43
- "dd": "^0.25.4",
44
- "dotenv": "^16.0.3",
45
47
  "eslint": "^8.29.0",
46
48
  "eslint-config-prettier": "^8.5.0",
47
49
  "eslint-plugin-import": "^2.26.0",
@@ -50,8 +52,6 @@
50
52
  "npm-run-all": "~4.1.5",
51
53
  "pathe": "^1.0.0",
52
54
  "prettier": "~2.8.1",
53
- "rimraf": "^3.0.2",
54
- "sharp": "^0.31.2",
55
55
  "tsup": "^6.5.0",
56
56
  "typescript": "^4.9.4",
57
57
  "vite": "^3.2.5",
@@ -59,11 +59,5 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "brilliant-errors": "^0.7.1"
62
- },
63
- "pnpm": {
64
- "overrides": {
65
- "simple-git@<3.3.0": ">=3.3.0",
66
- "simple-git@<3.5.0": ">=3.5.0"
67
- }
68
62
  }
69
63
  }
package/.eslintrc DELETED
@@ -1,77 +0,0 @@
1
- {
2
- "extends": [
3
- "plugin:import/warnings",
4
- "plugin:import/typescript"
5
- ],
6
- "plugins": [
7
- "@typescript-eslint",
8
- "import",
9
- "promise"
10
- ],
11
- "parser": "@typescript-eslint/parser",
12
- "parserOptions": {
13
- "parser": "@typescript-eslint/parser",
14
- "sourceType": "module",
15
- "ecmaVersion": 12
16
- },
17
- "rules": {
18
- "prefer-const": "error",
19
- "semi": [
20
- "error",
21
- "always"
22
- ],
23
- "quotes": [
24
- "warn",
25
- "double",
26
- {
27
- "avoidEscape": true,
28
- "allowTemplateLiterals": true
29
- }
30
- ],
31
- "no-unused-vars": "off",
32
- "curly": "error",
33
- "brace-style": [
34
- "error",
35
- "1tbs",
36
- {
37
- "allowSingleLine": true
38
- }
39
- ],
40
- "no-nested-ternary": "off",
41
- // we need exceptions to be only "warn" because
42
- // there are valid use cases for generic variables being
43
- // used before being defined
44
- "no-use-before-define": [
45
- "warn"
46
- ],
47
- "@typescript-eslint/semi": [
48
- "error",
49
- "always"
50
- ],
51
- "@typescript-eslint/no-unsafe-member-access": "off",
52
- "@typescript-eslint/no-unsafe-call": "off",
53
- "@typescript-eslint/no-unsafe-assignment": "off",
54
- "@typescript-eslint/member-delimiter-style": [
55
- "error",
56
- {
57
- "multiline": {
58
- "delimiter": "semi",
59
- "requireLast": true
60
- },
61
- "singleline": {
62
- "delimiter": "semi",
63
- "requireLast": false
64
- }
65
- }
66
- ],
67
- // "cases" allows for graceful use of that variable
68
- // name in Typescript test cases
69
- "@typescript-eslint/no-unused-vars": [
70
- "error",
71
- {
72
- "varsIgnorePattern": "cases|^_",
73
- "argsIgnorePattern": "^_"
74
- }
75
- ]
76
- }
77
- }
@@ -1,34 +0,0 @@
1
- name: Continuous Integration
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - master
8
-
9
- jobs:
10
- testing:
11
- name: testing
12
- uses: yankeeinlondon/gha/.github/workflows/test.yml@main
13
-
14
- publish:
15
- name: npm
16
- if: ( contains(github.event.head_commit.message, 'release v') )
17
- needs:
18
- - testing
19
- uses: yankeeinlondon/gha/.github/workflows/npm.yml@main
20
- with:
21
- nodeVersion: 16
22
- secrets:
23
- npm_token: ${{secrets.NPM_TOKEN}}
24
-
25
- do_not_publish:
26
- name: npm / no publication
27
- if: ( !contains(github.event.head_commit.message, 'release v') )
28
- runs-on: ubuntu-latest
29
- needs:
30
- - testing
31
- steps:
32
- - name: Done
33
- run: |
34
- echo "::notice ::No need to publish to NPM"
@@ -1,15 +0,0 @@
1
- name: CI (features & PRs)
2
-
3
- on:
4
- push:
5
- branches:
6
- - feature/*
7
-
8
- pull_request:
9
- branches:
10
- - main
11
- - master
12
-
13
- jobs:
14
- testing:
15
- uses: yankeeinlondon/gha/.github/workflows/test.yml@main
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v14.15.3
package/.prettierrc.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- printWidth: 100,
3
- };
@@ -1,27 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "name": "Debug Jest Tests",
6
- "type": "node",
7
- "request": "launch",
8
- "runtimeArgs": ["--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", "--runInBand"],
9
- "console": "integratedTerminal",
10
- "internalConsoleOptions": "neverOpen",
11
- "port": 9229
12
- },
13
- {
14
- "type": "node",
15
- "request": "launch",
16
- "name": "Jest Current File",
17
- "program": "${workspaceFolder}/node_modules/.bin/jest",
18
- "args": ["${fileBasenameNoExtension}", "--config", "jest.config.js"],
19
- "console": "integratedTerminal",
20
- "internalConsoleOptions": "neverOpen",
21
- "disableOptimisticBPs": true,
22
- "windows": {
23
- "program": "${workspaceFolder}/node_modules/jest/bin/jest"
24
- }
25
- }
26
- ]
27
- }
@@ -1,19 +0,0 @@
1
- {
2
- "git.ignoreLimitWarning": true,
3
- "editor.formatOnSave": true,
4
- "cSpell.words": [
5
- "Aint",
6
- "appr",
7
- "barbar",
8
- "combinators",
9
- "Dasherize",
10
- "dasherized",
11
- "Decomp",
12
- "foey",
13
- "foofoo",
14
- "fooy",
15
- "ruleset",
16
- "tokei",
17
- "Uncapitalize"
18
- ]
19
- }
package/devops/build.js DELETED
@@ -1,243 +0,0 @@
1
- /* eslint-disable import/order */
2
- /* eslint-disable @typescript-eslint/no-var-requires */
3
- const rollup = require("rollup");
4
- const commonjs = require("@rollup/plugin-commonjs");
5
- const resolve = require("@rollup/plugin-node-resolve").default;
6
- const terser = require("rollup-plugin-terser").terser;
7
- const pkg = require("../package.json");
8
- const { builtinModules } = require("module");
9
- const analyze = require("rollup-plugin-analyzer");
10
- const typescript = require("rollup-plugin-typescript2");
11
- const closure = require("@ampproject/rollup-plugin-closure-compiler");
12
- const { existsSync, statSync } = require("fs");
13
- const { exit } = require("process");
14
- const { join } = require("path");
15
-
16
- const moduleSystems = process.argv.slice(2).filter((i) => !i.startsWith("-"));
17
- const switches = new Set(
18
- process.argv
19
- .slice(2)
20
- .filter((i) => i.startsWith("-"))
21
- .map((i) => i.replace(/^-(-){0,1}/, ""))
22
- );
23
-
24
- // makes all non-core deps external; allowing consuming app to gain better reuse
25
- const external = [
26
- ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : []),
27
- ...(pkg.optionalDependencies ? Object.keys(pkg.optionalDependencies) : []),
28
- ...builtinModules,
29
- ].map((i) => i.replace("@types/", ""));
30
-
31
- // required for IIFE and UMD modules
32
- const globals = {};
33
-
34
- function getFilenameByModule(mod) {
35
- const shortname = getModuleShortname(mod);
36
- const outputFile = {
37
- es: pkg.module,
38
- cjs: pkg.main,
39
- typings: pkg.typings || pkg.types,
40
- };
41
-
42
- return Object.keys(outputFile).includes(shortname) && outputFile[shortname]
43
- ? outputFile[shortname]
44
- : `dist/${shortname}/index.js`;
45
- }
46
-
47
- /**
48
- * Reduce ES and CJS targets to just `es` and `cjs`
49
- *
50
- * @param {string} mod
51
- */
52
- function getModuleShortname(mod) {
53
- const lowered = mod.toLowerCase();
54
- return lowered.startsWith("es")
55
- ? "es"
56
- : lowered.startsWith("commonjs")
57
- ? "cjs"
58
- : mod.toLowerCase();
59
- }
60
-
61
- function inferDirectory(file) {
62
- if (!file) {
63
- return "";
64
- }
65
- const fileParts = file.split("/");
66
- return fileParts.slice(0, fileParts.length - 1).join("/");
67
- }
68
-
69
- /**
70
- * create Rollup configuration
71
- *
72
- * @param {string} moduleSystem
73
- * @param {string} file
74
- * @param {boolean} minimized
75
- * @param {boolean} emitDeclaration
76
- */
77
- const moduleConfig = (moduleSystem, file, minimized, emitDeclaration) => {
78
- try {
79
- const input = "src/index.ts";
80
- if (!existsSync(input)) {
81
- console.log(`The source entry point was set as "${input}" but this was not found!`);
82
- console.log();
83
- exit(1);
84
- }
85
- const outDir = inferDirectory(file);
86
- const declarationDir = pkg.typings ? inferDirectory(pkg.typings) : `dist/types`;
87
- console.log(
88
- `- the source's entrypoint is "${input}" and output will be put in "${outDir}" folder`
89
- );
90
- if (emitDeclaration) {
91
- console.log(
92
- `- the typings will also be generated and placed in the "${declarationDir}" directory`
93
- );
94
- }
95
- const tsconfigOverride = {
96
- compilerOptions: {
97
- ...(emitDeclaration ? { declaration: emitDeclaration, declarationDir } : {}),
98
- outDir,
99
- module: "esnext",
100
- },
101
- exclude: ["test", "tests", "node_modules"],
102
- };
103
-
104
- return {
105
- input,
106
- external,
107
- plugins: [
108
- commonjs(),
109
- resolve(),
110
- typescript({
111
- tsconfig: "tsconfig.json",
112
- useTsconfigDeclarationDir: true,
113
- tsconfigOverride,
114
- }),
115
-
116
- ...(getModuleShortname(moduleSystem) === "es" && (process.env.ANALYZE || switches.analyze)
117
- ? [analyze()]
118
- : []),
119
- ...(switches.has("closure") ? [closure()] : []),
120
- ...(switches.has("minimize") ? [terser()] : []),
121
- ],
122
- };
123
- } catch (e) {
124
- console.warn(`- 👎 the build failed building Rollup configuration: ${e.message}`);
125
- console.log(`\n${e.stack}\n`);
126
- process.exit(1);
127
- }
128
- };
129
-
130
- /**
131
- * Takes a path and filename and adds `.min` before the filename's extension.
132
- *
133
- * @param {string} filename
134
- * @param {boolean} isMin
135
- */
136
- function minimizeFilename(filename, isMin) {
137
- if (isMin) {
138
- const parts = filename.split(".");
139
- filename = join(parts.slice(0, parts.length - 1).join("."), `.min.${parts.slice(-1)}`);
140
- }
141
-
142
- return filename;
143
- }
144
-
145
- /**
146
- * Uses Rollup API to bundle the repo.
147
- *
148
- * @param {string} m
149
- * @param {boolean} min
150
- * @param {boolean} emitDeclaration
151
- */
152
- async function buildModule(m, min, emitDeclaration) {
153
- try {
154
- console.log(`- 📦 starting bundling of ${m.toUpperCase()} module ${min ? "(minimized)" : ""}`);
155
- if (switches.has("closure")) {
156
- console.log(`- using closure compiler to minimize file size`);
157
- }
158
- if (getModuleShortname(m) === "es" && !pkg.module) {
159
- console.log(
160
- `- 🤨 while you are building for the ES module system your package.json doesn't specify a "module" entrypoint.`
161
- );
162
- }
163
- const file = minimizeFilename(getFilenameByModule(m), min);
164
- console.log(`- transpiled source will be saved as: ${file}`);
165
- // build the configuration
166
- const config = moduleConfig(m, file, min, emitDeclaration);
167
- if (switches.has("v") || switches.has("verbose")) {
168
- console.log("- bundle config is:\n", JSON.stringify(config, null, 2));
169
- }
170
- const bundle = await rollup.rollup(config);
171
-
172
- await bundle.write({
173
- ...(usesGlobalVars(m) ? { name: pkg.name.replace(/-/g, ""), globals } : {}),
174
- file,
175
- format: getModuleShortname(m).startsWith("es") ? "es" : m,
176
- exports: "auto",
177
- sourcemap: false,
178
- });
179
- const output = statSync(file);
180
- console.log(
181
- `- 🚀 bundling saved to the "${file}" file [ ${Math.floor(output.size / 100) / 10} kb ].\n`
182
- );
183
- } catch (e) {
184
- console.warn(`- 👎 the build failed during Rollup bundling`);
185
- console.log(`\n${e.stack}\n`);
186
- process.exit(1);
187
- }
188
- }
189
-
190
- const usesGlobalVars = (mod) => {
191
- return ["umd", "iife"].includes(mod);
192
- };
193
-
194
- (async () => {
195
- const validModules = ["esnext", "es2020", "es2015", "commonjs", "iife", "umd"];
196
- const hasValidModules = moduleSystems.every((m) => validModules.includes(m));
197
- if (!hasValidModules) {
198
- console.log(
199
- `You specified an invalid module system. Valid module systems are: ${validModules.join(
200
- ", "
201
- )}; and you specified: ${moduleSystems.join(", ")}!\n`
202
- );
203
- process.exit(0);
204
- }
205
-
206
- console.log(
207
- `- Building library to ${moduleSystems.map((m) => m.toUpperCase()).join(", ")} modules.`
208
- );
209
- const relevantModules = external.filter((i) => !builtinModules.includes(i));
210
-
211
- if (Object.keys(relevantModules).length > 0) {
212
- console.log(
213
- `- While bundling will configure the following to be "external modules": ${relevantModules.join(
214
- ", "
215
- )}`
216
- );
217
- }
218
- if (moduleSystems.includes("iife") || moduleSystems.includes("umd")) {
219
- console.log(
220
- `- The IIFE and UMD modules will link to global scope:\n\t${Object.keys(globals)
221
- .map((g) => `- "${g}" module found in global scope as "${globals[g]}"\n\t`)
222
- .join("")}`
223
- );
224
- }
225
- console.log();
226
-
227
- for (const m of moduleSystems) {
228
- const emitDeclaration = moduleSystems.length === 1 || getModuleShortname(m) === "es";
229
- await buildModule(m, false, emitDeclaration);
230
- }
231
-
232
- if (switches.has("min")) {
233
- if (!moduleSystems.includes("commonjs")) {
234
- throw new Error(
235
- "Minimization was requested but no CJS module was built; either include CJS module build or remove minimization"
236
- );
237
- }
238
- console.log("Building minimized version of CJS module system");
239
- await buildModule("commonjs", true);
240
- }
241
-
242
- console.log("\n- Build completed!\n");
243
- })();
@@ -1,45 +0,0 @@
1
- ## Builder API States
2
-
3
- ### Mutation Identity Functions
4
-
5
- Initially the user defines the API, to do this they need a reference to _state_ prior to it actually being set. This is achieved with a higher order function called a `MutationIdentity`:
6
-
7
- // f(a) => a
8
- // a === a + 0
9
- // a === a * 1
10
-
11
- ```ts
12
- type State = { foo: number, bar: number };
13
- const f1 = (s: State) => (addToFoo: number) => { ...s, foo: s.foo + addToFoo };
14
- ```
15
-
16
- ### Identity API
17
-
18
- Ultimately functions like the one above are brought together into a dictionary to form a `MutationIdentityApi`. This is passed into the **Builder** along type a _type-guard_ which validates when configuration can be considered "done".
19
-
20
- ```ts
21
- const api = { ...f1, ...f2 };
22
- const validation = (state: unknown): state is State {...};
23
- const b = Builder(api, validation, {});
24
- ```
25
-
26
- ### Mutation API
27
-
28
- The builder converts the dictionary mutation identity function into mutation functions. So, the `f1` function we defined earlier exposes a function that looks like this:
29
-
30
- ```ts
31
- f1: (addToFoo: number) => { ...s, foo: s.foo + addToFoo };
32
- ```
33
-
34
- this is a first step but can't be exposed as a builder as it returns _state_ rather than the same fluent API.
35
-
36
- ### Fluent API Proxy
37
-
38
- The builder instead, wraps this function into a proxy which allows calls that the user makes to this into Fluent API:
39
-
40
- ```ts
41
- const fluentApi: FluentApi<MutationApi> = {
42
- f1: (addToFoo: number) => FluentApi<MutationApi>,
43
- f2: () => FleuntApi<MutationApi>
44
- }
45
- ```
package/docs/builder.md DELETED
@@ -1,94 +0,0 @@
1
- # Builder
2
-
3
- Aim is to pass in an API and a _target_ state and let the `Builder()` function manage the process. This includes:
4
-
5
- 1. Allowing the API to indicate which API endpoints can only be called once
6
- 2. Indicate when the configuration has reached a "completed" state (aka, there may be _more_ config you **can** do but no more that is **required**)
7
-
8
-
9
- ## Key Builder States
10
-
11
- A builder's primary responsibility is about building up a _target state_ **`TS`** from an _initial state_ **`IS`**.
12
-
13
- - The consumer of the builder must explicitly state **`TS`** as part of initialization
14
-
15
- ```ts
16
- type TS = { foo: number, bar: number, baz?: string };
17
- const config = Builder<TS>(api, { foo:0, bar: 0 });
18
- ```
19
-
20
- - The _initial state_ **`IS`** will automatically be assigned to `Partial<TS>`
21
- - The consumer's API should not mutate state directly but instead return a `Partial<TS>` representing the updated state.
22
-
23
- ```ts
24
- const api = ApiBuilder<TS>({
25
- incFoo: (s) => () => {
26
- return { ...s, foo: foo++};
27
- },
28
- setBar: (s) => (bar: number) => {
29
- return { ...s, bar };
30
- }
31
- });
32
- ```
33
-
34
- - If the API wants to exclude _itself_ or other parts of the API to the caller after being called then a rather than returning `T` it would instead return a tuple: `[ [T], "col", "col2" ]`:
35
-
36
- ```ts
37
- const api = ApiBuilder<TS>({
38
- name: (s) => (name: string) => {
39
- return [ { ...s, name }, "name" ];
40
- }
41
- });
42
- ```
43
-
44
- - The Builder will proxy requests to the API definition and when it gets the updated state, it will:
45
- - validate whether this new state represents a _completed_ state **`CS`**
46
- - If completed, the builder returns `Completed<Api<TS, E>>`
47
- - If _not_ completed the builder returns `Api<TS, E>`
48
- - in both cases:
49
- - the API that the consumer gets back is the same fluent API surface
50
- - the API is pruned from the column names in `E`
51
- - the `Completed<Api<T>>` typing is used to act as a hint to the `Unwrap()` function
52
- - The `Unwrap()` function is designed to unwrap the state contained by the builder:
53
-
54
- - if the API has been completed then **`TS`** will be returned
55
- - if not then **`Partial<TS>`** will be returned
56
-
57
-
58
- ## Interaction Diagram
59
- The below diagram is meant to represent the Key States flow described above:
60
-
61
- ```mermaid
62
- sequenceDiagram
63
- participant App;
64
- participant Builder;
65
- participant API;
66
-
67
- App->>App: create TS target STATE
68
-
69
-
70
- App->>Builder: configure Builder w/ API and initial STATE
71
- activate Builder
72
- Builder->>API: store API
73
- activate API
74
- API-->>Builder:
75
- deactivate API
76
-
77
- Builder->>App: returns <TApi> proxy interface
78
- deactivate Builder;
79
-
80
-
81
- App->>Builder: call API
82
- activate Builder
83
-
84
- Builder->>API: proxy through API req
85
- activate API
86
- API-->>API: mutate state
87
- API->>Builder: response
88
- deactivate API
89
- Builder-->>Builder: validate whether completed
90
- Builder->>App: return either <TApi> or Completed<TApi>
91
- deactivate Builder
92
- ```
93
-
94
-
@@ -1,3 +0,0 @@
1
- import { createError } from "brilliant-errors";
2
-
3
- export default createError("read-only-violation", "inferred-types")()()()();
@@ -1,12 +0,0 @@
1
- // #autoindex
2
- // #region auto-indexed files
3
- // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
- // hash-code: 30d9ddb2
5
-
6
- // file exports
7
- export * from "./ReadOnlyViolation";
8
-
9
- // #endregion auto-indexed files
10
-
11
- // see https://github.com/inocan-group/do-devops/docs/autoindex.md
12
- // for more info
package/src/index.ts DELETED
@@ -1,14 +0,0 @@
1
- // #autoindex
2
-
3
- // #region auto-indexed files
4
- // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
5
- // hash-code: 5ddbbf55
6
-
7
- // directory exports
8
- export * from "./types/index";
9
- export * from "./runtime/index";
10
-
11
- // #endregion auto-indexed files
12
-
13
- // see https://github.com/inocan-group/do-devops/docs/autoindex.md
14
- // for more info
@@ -1,3 +0,0 @@
1
- # Helpers
2
-
3
- Small utility-belt functions which are exported directly (as well as potentially being used internally).