@starlightcms/js-sdk 0.3.6 → 0.4.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 (253) hide show
  1. package/dist/{client.d.ts → cjs/client.d.ts} +1 -1
  2. package/dist/cjs/client.d.ts.map +1 -0
  3. package/dist/cjs/client.js +79 -0
  4. package/dist/cjs/client.js.map +1 -0
  5. package/dist/cjs/errors.d.ts +5 -0
  6. package/dist/cjs/errors.d.ts.map +1 -0
  7. package/dist/cjs/errors.js +11 -0
  8. package/dist/cjs/errors.js.map +1 -0
  9. package/dist/cjs/index.d.ts +9 -0
  10. package/dist/cjs/index.d.ts.map +1 -0
  11. package/dist/cjs/index.js +22 -0
  12. package/dist/cjs/index.js.map +1 -0
  13. package/dist/cjs/instances/Collection/index.d.ts +5 -0
  14. package/dist/cjs/instances/Collection/index.d.ts.map +1 -0
  15. package/dist/cjs/instances/Collection/index.js +14 -0
  16. package/dist/cjs/instances/Collection/index.js.map +1 -0
  17. package/dist/cjs/instances/Collection/types.d.ts +15 -0
  18. package/dist/cjs/instances/Collection/types.d.ts.map +1 -0
  19. package/dist/cjs/instances/Collection/types.js +3 -0
  20. package/dist/cjs/instances/Collection/types.js.map +1 -0
  21. package/dist/cjs/instances/Model/index.d.ts +5 -0
  22. package/dist/cjs/instances/Model/index.d.ts.map +1 -0
  23. package/dist/cjs/instances/Model/index.js +22 -0
  24. package/dist/cjs/instances/Model/index.js.map +1 -0
  25. package/dist/cjs/instances/Model/types.d.ts +9 -0
  26. package/dist/cjs/instances/Model/types.d.ts.map +1 -0
  27. package/dist/cjs/instances/Model/types.js +3 -0
  28. package/dist/cjs/instances/Model/types.js.map +1 -0
  29. package/dist/cjs/instances/ModelCategory/index.d.ts +5 -0
  30. package/dist/cjs/instances/ModelCategory/index.d.ts.map +1 -0
  31. package/dist/cjs/instances/ModelCategory/index.js +14 -0
  32. package/dist/cjs/instances/ModelCategory/index.js.map +1 -0
  33. package/dist/cjs/instances/ModelCategory/types.d.ts +15 -0
  34. package/dist/cjs/instances/ModelCategory/types.d.ts.map +1 -0
  35. package/dist/cjs/instances/ModelCategory/types.js +3 -0
  36. package/dist/cjs/instances/ModelCategory/types.js.map +1 -0
  37. package/dist/cjs/selectors/Collection/index.d.ts +5 -0
  38. package/dist/cjs/selectors/Collection/index.d.ts.map +1 -0
  39. package/dist/cjs/selectors/Collection/index.js +26 -0
  40. package/dist/cjs/selectors/Collection/index.js.map +1 -0
  41. package/dist/cjs/selectors/Collection/types.d.ts +16 -0
  42. package/dist/cjs/selectors/Collection/types.d.ts.map +1 -0
  43. package/dist/cjs/selectors/Collection/types.js +3 -0
  44. package/dist/cjs/selectors/Collection/types.js.map +1 -0
  45. package/dist/{selectors → cjs/selectors}/Entry/index.d.ts +1 -1
  46. package/dist/cjs/selectors/Entry/index.d.ts.map +1 -0
  47. package/dist/cjs/selectors/Entry/index.js +14 -0
  48. package/dist/cjs/selectors/Entry/index.js.map +1 -0
  49. package/dist/cjs/selectors/Entry/types.d.ts +15 -0
  50. package/dist/cjs/selectors/Entry/types.d.ts.map +1 -0
  51. package/dist/cjs/selectors/Entry/types.js +3 -0
  52. package/dist/cjs/selectors/Entry/types.js.map +1 -0
  53. package/dist/cjs/selectors/Media/index.d.ts +5 -0
  54. package/dist/cjs/selectors/Media/index.d.ts.map +1 -0
  55. package/dist/cjs/selectors/Media/index.js +14 -0
  56. package/dist/cjs/selectors/Media/index.js.map +1 -0
  57. package/dist/cjs/selectors/Media/types.d.ts +6 -0
  58. package/dist/cjs/selectors/Media/types.d.ts.map +1 -0
  59. package/dist/cjs/selectors/Media/types.js +3 -0
  60. package/dist/cjs/selectors/Media/types.js.map +1 -0
  61. package/dist/{selectors → cjs/selectors}/Model/index.d.ts +1 -1
  62. package/dist/cjs/selectors/Model/index.d.ts.map +1 -0
  63. package/dist/cjs/selectors/Model/index.js +26 -0
  64. package/dist/cjs/selectors/Model/index.js.map +1 -0
  65. package/dist/{selectors → cjs/selectors}/Model/types.d.ts +3 -3
  66. package/dist/cjs/selectors/Model/types.d.ts.map +1 -0
  67. package/dist/cjs/selectors/Model/types.js +3 -0
  68. package/dist/cjs/selectors/Model/types.js.map +1 -0
  69. package/dist/{selectors → cjs/selectors}/ModelCategory/index.d.ts +1 -1
  70. package/dist/cjs/selectors/ModelCategory/index.d.ts.map +1 -0
  71. package/dist/cjs/selectors/ModelCategory/index.js +26 -0
  72. package/dist/cjs/selectors/ModelCategory/index.js.map +1 -0
  73. package/dist/cjs/selectors/ModelCategory/types.d.ts +16 -0
  74. package/dist/cjs/selectors/ModelCategory/types.d.ts.map +1 -0
  75. package/dist/cjs/selectors/ModelCategory/types.js +3 -0
  76. package/dist/cjs/selectors/ModelCategory/types.js.map +1 -0
  77. package/dist/cjs/selectors/Singleton/index.d.ts +5 -0
  78. package/dist/cjs/selectors/Singleton/index.d.ts.map +1 -0
  79. package/dist/cjs/selectors/Singleton/index.js +14 -0
  80. package/dist/cjs/selectors/Singleton/index.js.map +1 -0
  81. package/dist/cjs/selectors/Singleton/types.d.ts +6 -0
  82. package/dist/cjs/selectors/Singleton/types.d.ts.map +1 -0
  83. package/dist/cjs/selectors/Singleton/types.js +3 -0
  84. package/dist/cjs/selectors/Singleton/types.js.map +1 -0
  85. package/dist/{types → cjs/types}/entities.d.ts +4 -0
  86. package/dist/cjs/types/entities.d.ts.map +1 -0
  87. package/dist/cjs/types/entities.js +3 -0
  88. package/dist/cjs/types/entities.js.map +1 -0
  89. package/dist/{types → cjs/types}/fields.d.ts +0 -0
  90. package/dist/cjs/types/fields.d.ts.map +1 -0
  91. package/dist/cjs/types/fields.js +3 -0
  92. package/dist/cjs/types/fields.js.map +1 -0
  93. package/dist/{types → cjs/types}/index.d.ts +13 -4
  94. package/dist/cjs/types/index.d.ts.map +1 -0
  95. package/dist/cjs/types/index.js +16 -0
  96. package/dist/cjs/types/index.js.map +1 -0
  97. package/dist/{types → cjs/types}/visual.d.ts +0 -0
  98. package/dist/cjs/types/visual.d.ts.map +1 -0
  99. package/dist/cjs/types/visual.js +3 -0
  100. package/dist/cjs/types/visual.js.map +1 -0
  101. package/dist/esm/client.d.ts +3 -0
  102. package/dist/esm/client.d.ts.map +1 -0
  103. package/dist/{client.js → esm/client.js} +22 -8
  104. package/dist/esm/client.js.map +1 -0
  105. package/dist/esm/errors.d.ts +5 -0
  106. package/dist/esm/errors.d.ts.map +1 -0
  107. package/dist/esm/errors.js +7 -0
  108. package/dist/esm/errors.js.map +1 -0
  109. package/dist/esm/index.d.ts +9 -0
  110. package/dist/esm/index.d.ts.map +1 -0
  111. package/dist/esm/index.js +8 -0
  112. package/dist/esm/index.js.map +1 -0
  113. package/dist/esm/instances/Collection/index.d.ts +5 -0
  114. package/dist/esm/instances/Collection/index.d.ts.map +1 -0
  115. package/dist/esm/instances/Collection/index.js +11 -0
  116. package/dist/esm/instances/Collection/index.js.map +1 -0
  117. package/dist/esm/instances/Collection/types.d.ts +15 -0
  118. package/dist/esm/instances/Collection/types.d.ts.map +1 -0
  119. package/dist/{elements/Model → esm/instances/Collection}/types.js +0 -0
  120. package/dist/esm/instances/Collection/types.js.map +1 -0
  121. package/dist/esm/instances/Model/index.d.ts +5 -0
  122. package/dist/esm/instances/Model/index.d.ts.map +1 -0
  123. package/dist/{elements → esm/instances}/Model/index.js +3 -3
  124. package/dist/esm/instances/Model/index.js.map +1 -0
  125. package/dist/esm/instances/Model/types.d.ts +9 -0
  126. package/dist/esm/instances/Model/types.d.ts.map +1 -0
  127. package/dist/{elements/ModelCategory → esm/instances/Model}/types.js +0 -0
  128. package/dist/esm/instances/Model/types.js.map +1 -0
  129. package/dist/esm/instances/ModelCategory/index.d.ts +5 -0
  130. package/dist/esm/instances/ModelCategory/index.d.ts.map +1 -0
  131. package/dist/esm/instances/ModelCategory/index.js +11 -0
  132. package/dist/esm/instances/ModelCategory/index.js.map +1 -0
  133. package/dist/esm/instances/ModelCategory/types.d.ts +15 -0
  134. package/dist/esm/instances/ModelCategory/types.d.ts.map +1 -0
  135. package/dist/{selectors/Entry → esm/instances/ModelCategory}/types.js +0 -0
  136. package/dist/esm/instances/ModelCategory/types.js.map +1 -0
  137. package/dist/esm/selectors/Collection/index.d.ts +5 -0
  138. package/dist/esm/selectors/Collection/index.d.ts.map +1 -0
  139. package/dist/esm/selectors/Collection/index.js +20 -0
  140. package/dist/esm/selectors/Collection/index.js.map +1 -0
  141. package/dist/esm/selectors/Collection/types.d.ts +16 -0
  142. package/dist/esm/selectors/Collection/types.d.ts.map +1 -0
  143. package/dist/{selectors/Model → esm/selectors/Collection}/types.js +0 -0
  144. package/dist/esm/selectors/Collection/types.js.map +1 -0
  145. package/dist/esm/selectors/Entry/index.d.ts +5 -0
  146. package/dist/esm/selectors/Entry/index.d.ts.map +1 -0
  147. package/dist/{selectors → esm/selectors}/Entry/index.js +2 -2
  148. package/dist/esm/selectors/Entry/index.js.map +1 -0
  149. package/dist/esm/selectors/Entry/types.d.ts +15 -0
  150. package/dist/esm/selectors/Entry/types.d.ts.map +1 -0
  151. package/dist/{selectors/ModelCategory → esm/selectors/Entry}/types.js +0 -0
  152. package/dist/esm/selectors/Entry/types.js.map +1 -0
  153. package/dist/esm/selectors/Media/index.d.ts +5 -0
  154. package/dist/esm/selectors/Media/index.d.ts.map +1 -0
  155. package/dist/esm/selectors/Media/index.js +11 -0
  156. package/dist/esm/selectors/Media/index.js.map +1 -0
  157. package/dist/esm/selectors/Media/types.d.ts +6 -0
  158. package/dist/esm/selectors/Media/types.d.ts.map +1 -0
  159. package/dist/{selectors/ModelCategoryItem → esm/selectors/Media}/types.js +0 -0
  160. package/dist/esm/selectors/Media/types.js.map +1 -0
  161. package/dist/esm/selectors/Model/index.d.ts +5 -0
  162. package/dist/esm/selectors/Model/index.d.ts.map +1 -0
  163. package/dist/{selectors → esm/selectors}/Model/index.js +2 -2
  164. package/dist/esm/selectors/Model/index.js.map +1 -0
  165. package/dist/esm/selectors/Model/types.d.ts +10 -0
  166. package/dist/esm/selectors/Model/types.d.ts.map +1 -0
  167. package/dist/esm/selectors/Model/types.js +2 -0
  168. package/dist/esm/selectors/Model/types.js.map +1 -0
  169. package/dist/esm/selectors/ModelCategory/index.d.ts +5 -0
  170. package/dist/esm/selectors/ModelCategory/index.d.ts.map +1 -0
  171. package/dist/{selectors → esm/selectors}/ModelCategory/index.js +4 -4
  172. package/dist/esm/selectors/ModelCategory/index.js.map +1 -0
  173. package/dist/esm/selectors/ModelCategory/types.d.ts +16 -0
  174. package/dist/esm/selectors/ModelCategory/types.d.ts.map +1 -0
  175. package/dist/esm/selectors/ModelCategory/types.js +2 -0
  176. package/dist/esm/selectors/ModelCategory/types.js.map +1 -0
  177. package/dist/esm/selectors/Singleton/index.d.ts +5 -0
  178. package/dist/esm/selectors/Singleton/index.d.ts.map +1 -0
  179. package/dist/esm/selectors/Singleton/index.js +11 -0
  180. package/dist/esm/selectors/Singleton/index.js.map +1 -0
  181. package/dist/esm/selectors/Singleton/types.d.ts +6 -0
  182. package/dist/esm/selectors/Singleton/types.d.ts.map +1 -0
  183. package/dist/esm/selectors/Singleton/types.js +2 -0
  184. package/dist/esm/selectors/Singleton/types.js.map +1 -0
  185. package/dist/esm/types/entities.d.ts +65 -0
  186. package/dist/esm/types/entities.d.ts.map +1 -0
  187. package/dist/{types → esm/types}/entities.js +0 -0
  188. package/dist/esm/types/entities.js.map +1 -0
  189. package/dist/esm/types/fields.d.ts +10 -0
  190. package/dist/esm/types/fields.d.ts.map +1 -0
  191. package/dist/{types → esm/types}/fields.js +0 -0
  192. package/dist/esm/types/fields.js.map +1 -0
  193. package/dist/esm/types/index.d.ts +60 -0
  194. package/dist/esm/types/index.d.ts.map +1 -0
  195. package/dist/{types → esm/types}/index.js +0 -0
  196. package/dist/esm/types/index.js.map +1 -0
  197. package/dist/esm/types/visual.d.ts +30 -0
  198. package/dist/esm/types/visual.d.ts.map +1 -0
  199. package/dist/{types → esm/types}/visual.js +0 -0
  200. package/dist/esm/types/visual.js.map +1 -0
  201. package/package.json +9 -3
  202. package/dist/client.d.ts.map +0 -1
  203. package/dist/client.js.map +0 -1
  204. package/dist/elements/Model/index.d.ts +0 -5
  205. package/dist/elements/Model/index.d.ts.map +0 -1
  206. package/dist/elements/Model/index.js.map +0 -1
  207. package/dist/elements/Model/types.d.ts +0 -9
  208. package/dist/elements/Model/types.d.ts.map +0 -1
  209. package/dist/elements/Model/types.js.map +0 -1
  210. package/dist/elements/ModelCategory/index.d.ts +0 -5
  211. package/dist/elements/ModelCategory/index.d.ts.map +0 -1
  212. package/dist/elements/ModelCategory/index.js +0 -12
  213. package/dist/elements/ModelCategory/index.js.map +0 -1
  214. package/dist/elements/ModelCategory/types.d.ts +0 -7
  215. package/dist/elements/ModelCategory/types.d.ts.map +0 -1
  216. package/dist/elements/ModelCategory/types.js.map +0 -1
  217. package/dist/errors.d.ts +0 -3
  218. package/dist/errors.d.ts.map +0 -1
  219. package/dist/errors.js +0 -3
  220. package/dist/errors.js.map +0 -1
  221. package/dist/index.d.ts +0 -9
  222. package/dist/index.d.ts.map +0 -1
  223. package/dist/index.js +0 -8
  224. package/dist/index.js.map +0 -1
  225. package/dist/selectors/Entry/index.d.ts.map +0 -1
  226. package/dist/selectors/Entry/index.js.map +0 -1
  227. package/dist/selectors/Entry/types.d.ts +0 -6
  228. package/dist/selectors/Entry/types.d.ts.map +0 -1
  229. package/dist/selectors/Entry/types.js.map +0 -1
  230. package/dist/selectors/Model/index.d.ts.map +0 -1
  231. package/dist/selectors/Model/index.js.map +0 -1
  232. package/dist/selectors/Model/types.d.ts.map +0 -1
  233. package/dist/selectors/Model/types.js.map +0 -1
  234. package/dist/selectors/ModelCategory/index.d.ts.map +0 -1
  235. package/dist/selectors/ModelCategory/index.js.map +0 -1
  236. package/dist/selectors/ModelCategory/types.d.ts +0 -10
  237. package/dist/selectors/ModelCategory/types.d.ts.map +0 -1
  238. package/dist/selectors/ModelCategory/types.js.map +0 -1
  239. package/dist/selectors/ModelCategoryItem/index.d.ts +0 -5
  240. package/dist/selectors/ModelCategoryItem/index.d.ts.map +0 -1
  241. package/dist/selectors/ModelCategoryItem/index.js +0 -11
  242. package/dist/selectors/ModelCategoryItem/index.js.map +0 -1
  243. package/dist/selectors/ModelCategoryItem/types.d.ts +0 -6
  244. package/dist/selectors/ModelCategoryItem/types.d.ts.map +0 -1
  245. package/dist/selectors/ModelCategoryItem/types.js.map +0 -1
  246. package/dist/types/entities.d.ts.map +0 -1
  247. package/dist/types/entities.js.map +0 -1
  248. package/dist/types/fields.d.ts.map +0 -1
  249. package/dist/types/fields.js.map +0 -1
  250. package/dist/types/index.d.ts.map +0 -1
  251. package/dist/types/index.js.map +0 -1
  252. package/dist/types/visual.d.ts.map +0 -1
  253. package/dist/types/visual.js.map +0 -1
@@ -1,3 +1,3 @@
1
- import { DefaultModelDefinition, ProxiedStarlightClient, StarlightConfig, WorkspaceModelDefinition } from 'types';
1
+ import { DefaultModelDefinition, ProxiedStarlightClient, StarlightConfig, WorkspaceModelDefinition } from './types';
2
2
  export declare function makeClient<D extends WorkspaceModelDefinition = DefaultModelDefinition>(config?: StarlightConfig): ProxiedStarlightClient<D>;
3
3
  //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EAEtB,eAAe,EACf,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAQhB,wBAAgB,UAAU,CACxB,CAAC,SAAS,wBAAwB,GAAG,sBAAsB,EAC3D,MAAM,GAAE,eAAoB,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAgEzD"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.makeClient = void 0;
16
+ const errors_1 = require("./errors");
17
+ const Model_1 = __importDefault(require("./selectors/Model"));
18
+ const Model_2 = __importDefault(require("./instances/Model"));
19
+ const Singleton_1 = __importDefault(require("./selectors/Singleton"));
20
+ const Collection_1 = __importDefault(require("./selectors/Collection"));
21
+ const Media_1 = __importDefault(require("./selectors/Media"));
22
+ function makeClient(config = {}) {
23
+ var _a, _b, _c;
24
+ let baseUrl = (_a = config.baseUrl) !== null && _a !== void 0 ? _a : 'https://query.starlight.sh/v2';
25
+ let workspace = (_b = config.workspace) !== null && _b !== void 0 ? _b : '';
26
+ let debug = (_c = config.debug) !== null && _c !== void 0 ? _c : false;
27
+ const client = {
28
+ configure(config) {
29
+ var _a, _b, _c;
30
+ baseUrl = (_a = config.baseUrl) !== null && _a !== void 0 ? _a : baseUrl;
31
+ workspace = (_b = config.workspace) !== null && _b !== void 0 ? _b : workspace;
32
+ debug = (_c = config.debug) !== null && _c !== void 0 ? _c : debug;
33
+ },
34
+ log(message, ...optionalParams) {
35
+ if (debug)
36
+ console.log(message, ...optionalParams);
37
+ },
38
+ getBaseUrl() {
39
+ return `${baseUrl}/workspaces/${workspace}`;
40
+ },
41
+ get(path, params, options) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const searchParams = new URLSearchParams(params).toString();
44
+ const finalPath = searchParams ? `${path}?${searchParams}` : path;
45
+ this.log(`Starlight - GET ${finalPath}`);
46
+ const response = yield fetch(`${this.getBaseUrl()}${finalPath}`, options);
47
+ if (response.status >= 200 && response.status < 300) {
48
+ return yield response.json();
49
+ }
50
+ else {
51
+ const message = `Starlight - GET ${path} returned ${response.status}: ${response.statusText}`;
52
+ throw new errors_1.StarlightError(message, response);
53
+ }
54
+ });
55
+ },
56
+ get models() {
57
+ return (0, Model_1.default)(this);
58
+ },
59
+ get singletons() {
60
+ return (0, Singleton_1.default)(this);
61
+ },
62
+ get collections() {
63
+ return (0, Collection_1.default)(this);
64
+ },
65
+ get media() {
66
+ return (0, Media_1.default)(this);
67
+ },
68
+ };
69
+ return new Proxy(client, {
70
+ get(target, prop) {
71
+ if (typeof prop === 'string' && !Reflect.has(target, prop)) {
72
+ return (0, Model_2.default)(target, prop);
73
+ }
74
+ return Reflect.get(target, prop);
75
+ },
76
+ });
77
+ }
78
+ exports.makeClient = makeClient;
79
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA,qCAAyC;AACzC,8DAAiD;AACjD,8DAAiD;AACjD,sEAAyD;AACzD,wEAA2D;AAC3D,8DAAiD;AAEjD,SAAgB,UAAU,CAExB,SAA0B,EAAE;;IAC5B,IAAI,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,+BAA+B,CAAA;IAC/D,IAAI,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,EAAE,CAAA;IACtC,IAAI,KAAK,GAAG,MAAA,MAAM,CAAC,KAAK,mCAAI,KAAK,CAAA;IAEjC,MAAM,MAAM,GAAoB;QAC9B,SAAS,CAAC,MAAM;;YACd,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,OAAO,CAAA;YACnC,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,SAAS,CAAA;YACzC,KAAK,GAAG,MAAA,MAAM,CAAC,KAAK,mCAAI,KAAK,CAAA;QAC/B,CAAC;QAED,GAAG,CAAC,OAAO,EAAE,GAAG,cAAc;YAC5B,IAAI,KAAK;gBAAE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;QACpD,CAAC;QAED,UAAU;YACR,OAAO,GAAG,OAAO,eAAe,SAAS,EAAE,CAAA;QAC7C,CAAC;QAEK,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO;;gBAC7B,MAAM,YAAY,GAAG,IAAI,eAAe,CACtC,MAAgC,CACjC,CAAC,QAAQ,EAAE,CAAA;gBACZ,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;gBAEjE,IAAI,CAAC,GAAG,CAAC,mBAAmB,SAAS,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,CAAA;gBAEzE,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE;oBACnD,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;iBAC7B;qBAAM;oBACL,MAAM,OAAO,GAAG,mBAAmB,IAAI,aAAa,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAA;oBAC7F,MAAM,IAAI,uBAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;iBAC5C;YACH,CAAC;SAAA;QAED,IAAI,MAAM;YACR,OAAO,IAAA,eAAiB,EAAC,IAAI,CAAC,CAAA;QAChC,CAAC;QAED,IAAI,UAAU;YACZ,OAAO,IAAA,mBAAqB,EAAC,IAAI,CAAC,CAAA;QACpC,CAAC;QAED,IAAI,WAAW;YACb,OAAO,IAAA,oBAAsB,EAAC,IAAI,CAAC,CAAA;QACrC,CAAC;QAED,IAAI,KAAK;YACP,OAAO,IAAA,eAAiB,EAAC,IAAI,CAAC,CAAA;QAChC,CAAC;KACF,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;gBAC1D,OAAO,IAAA,eAAiB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAA;aACvC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA8B,CAAA;AACjC,CAAC;AAlED,gCAkEC","sourcesContent":["import {\n DefaultModelDefinition,\n ProxiedStarlightClient,\n StarlightClient,\n StarlightConfig,\n WorkspaceModelDefinition,\n} from './types'\nimport { StarlightError } from './errors'\nimport makeModelSelector from './selectors/Model'\nimport makeModelInstance from './instances/Model'\nimport makeSingletonSelector from './selectors/Singleton'\nimport makeCollectionSelector from './selectors/Collection'\nimport makeMediaSelector from './selectors/Media'\n\nexport function makeClient<\n D extends WorkspaceModelDefinition = DefaultModelDefinition\n>(config: StarlightConfig = {}): ProxiedStarlightClient<D> {\n let baseUrl = config.baseUrl ?? 'https://query.starlight.sh/v2'\n let workspace = config.workspace ?? ''\n let debug = config.debug ?? false\n\n const client: StarlightClient = {\n configure(config) {\n baseUrl = config.baseUrl ?? baseUrl\n workspace = config.workspace ?? workspace\n debug = config.debug ?? debug\n },\n\n log(message, ...optionalParams) {\n if (debug) console.log(message, ...optionalParams)\n },\n\n getBaseUrl() {\n return `${baseUrl}/workspaces/${workspace}`\n },\n\n async get(path, params, options) {\n const searchParams = new URLSearchParams(\n params as Record<string, string>\n ).toString()\n const finalPath = searchParams ? `${path}?${searchParams}` : path\n\n this.log(`Starlight - GET ${finalPath}`)\n\n const response = await fetch(`${this.getBaseUrl()}${finalPath}`, options)\n\n if (response.status >= 200 && response.status < 300) {\n return await response.json()\n } else {\n const message = `Starlight - GET ${path} returned ${response.status}: ${response.statusText}`\n throw new StarlightError(message, response)\n }\n },\n\n get models() {\n return makeModelSelector(this)\n },\n\n get singletons() {\n return makeSingletonSelector(this)\n },\n\n get collections() {\n return makeCollectionSelector(this)\n },\n\n get media() {\n return makeMediaSelector(this)\n },\n }\n\n return new Proxy(client, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelInstance(target, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as ProxiedStarlightClient<D>\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare class StarlightError extends Error {
2
+ response: Response;
3
+ constructor(message: string, response: Response);
4
+ }
5
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;IAChC,QAAQ,EAAE,QAAQ,CAAA;gBAEb,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;CAIhD"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StarlightError = void 0;
4
+ class StarlightError extends Error {
5
+ constructor(message, response) {
6
+ super(message);
7
+ this.response = response;
8
+ }
9
+ }
10
+ exports.StarlightError = StarlightError;
11
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAe,SAAQ,KAAK;IAGvC,YAAY,OAAe,EAAE,QAAkB;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AAPD,wCAOC","sourcesContent":["export class StarlightError extends Error {\n public response: Response\n\n constructor(message: string, response: Response) {\n super(message)\n this.response = response\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { makeClient } from './client';
2
+ export { DefaultModelDefinition } from './types';
3
+ export { StarlightError } from './errors';
4
+ export * from './types/fields';
5
+ export * from './types/visual';
6
+ declare const Starlight: import("./types").ProxiedStarlightClient<import("./types").DefaultModelDefinition>;
7
+ export { makeClient as makeStarlightClient };
8
+ export default Starlight;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAE9B,QAAA,MAAM,SAAS,oFAAe,CAAA;AAE9B,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,CAAA;AAE5C,eAAe,SAAS,CAAA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.makeStarlightClient = exports.StarlightError = void 0;
14
+ const client_1 = require("./client");
15
+ Object.defineProperty(exports, "makeStarlightClient", { enumerable: true, get: function () { return client_1.makeClient; } });
16
+ var errors_1 = require("./errors");
17
+ Object.defineProperty(exports, "StarlightError", { enumerable: true, get: function () { return errors_1.StarlightError; } });
18
+ __exportStar(require("./types/fields"), exports);
19
+ __exportStar(require("./types/visual"), exports);
20
+ const Starlight = (0, client_1.makeClient)();
21
+ exports.default = Starlight;
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAqC;AAQd,oGARd,mBAAU,OAQuB;AAN1C,mCAAyC;AAAhC,wGAAA,cAAc,OAAA;AACvB,iDAA8B;AAC9B,iDAA8B;AAE9B,MAAM,SAAS,GAAG,IAAA,mBAAU,GAAE,CAAA;AAI9B,kBAAe,SAAS,CAAA","sourcesContent":["import { makeClient } from './client'\nexport { DefaultModelDefinition } from './types'\nexport { StarlightError } from './errors'\nexport * from './types/fields'\nexport * from './types/visual'\n\nconst Starlight = makeClient()\n\nexport { makeClient as makeStarlightClient }\n\nexport default Starlight\n"]}
@@ -0,0 +1,5 @@
1
+ import { StarlightClient } from '../../types';
2
+ import { CollectionInstance } from './types';
3
+ export default function makeCollectionInstance(client: StarlightClient, collection: string): CollectionInstance;
4
+ export { CollectionInstance };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/Collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE5C,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,MAAM,EAAE,eAAe,EACvB,UAAU,EAAE,MAAM,GACjB,kBAAkB,CAUpB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function makeCollectionInstance(client, collection) {
4
+ return {
5
+ get() {
6
+ return client.get(`/collections/${collection}`);
7
+ },
8
+ items(options) {
9
+ return client.get(`/collections/${collection}/items`, options);
10
+ },
11
+ };
12
+ }
13
+ exports.default = makeCollectionInstance;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/Collection/index.ts"],"names":[],"mappings":";;AAGA,SAAwB,sBAAsB,CAC5C,MAAuB,EACvB,UAAkB;IAElB,OAAO;QACL,GAAG;YACD,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAA;QACjD,CAAC;QAED,KAAK,CAAC,OAAO;YACX,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,UAAU,QAAQ,EAAE,OAAO,CAAC,CAAA;QAChE,CAAC;KACF,CAAA;AACH,CAAC;AAbD,yCAaC","sourcesContent":["import { StarlightClient } from '../../types'\nimport { CollectionInstance } from './types'\n\nexport default function makeCollectionInstance(\n client: StarlightClient,\n collection: string\n): CollectionInstance {\n return {\n get() {\n return client.get(`/collections/${collection}`)\n },\n\n items(options) {\n return client.get(`/collections/${collection}/items`, options)\n },\n }\n}\n\nexport { CollectionInstance }\n"]}
@@ -0,0 +1,15 @@
1
+ import { Collection, ModelFieldOptions, SerializedData, StarlightItemResponse, StarlightListResponse } from '../../types';
2
+ export declare type ListCollectionItemsOptions<T> = {
3
+ page?: number;
4
+ limit?: number;
5
+ query?: string;
6
+ 'query:word'?: string;
7
+ fields?: string;
8
+ order?: 'title:asc' | 'title:desc' | 'published_at:asc' | 'published_at:desc' | 'views:asc' | 'views:desc';
9
+ except?: number;
10
+ } & (T extends SerializedData ? ModelFieldOptions<T> : unknown);
11
+ export interface CollectionInstance {
12
+ get(): Promise<StarlightItemResponse<Collection>>;
13
+ items<T>(options?: ListCollectionItemsOptions<T>): Promise<StarlightListResponse<T>>;
14
+ }
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/Collection/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB,oBAAY,0BAA0B,CAAC,CAAC,IAAI;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,CAAC,CAAC,SAAS,cAAc,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAA;AAE/D,MAAM,WAAW,kBAAkB;IACjC,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAA;IACjD,KAAK,CAAC,CAAC,EACL,OAAO,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACtC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAA;CACrC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/Collection/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Collection,\n ModelFieldOptions,\n SerializedData,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\n\nexport type ListCollectionItemsOptions<T> = {\n page?: number\n limit?: number\n query?: string\n 'query:word'?: string\n fields?: string\n order?:\n | 'title:asc'\n | 'title:desc'\n | 'published_at:asc'\n | 'published_at:desc'\n | 'views:asc'\n | 'views:desc'\n except?: number\n} & (T extends SerializedData ? ModelFieldOptions<T> : unknown)\n\nexport interface CollectionInstance {\n get(): Promise<StarlightItemResponse<Collection>>\n items<T>(\n options?: ListCollectionItemsOptions<T>\n ): Promise<StarlightListResponse<T>>\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { SerializedData, StarlightClient } from '../../types';
2
+ import { ModelInstance } from './types';
3
+ export default function makeModelInstance<D extends SerializedData>(client: StarlightClient, model: string): ModelInstance<D>;
4
+ export { ModelInstance };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/Model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,eAAe,EAEhB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAMvC,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAChE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,GACZ,aAAa,CAAC,CAAC,CAAC,CAclB;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Entry_1 = __importDefault(require("../../selectors/Entry"));
7
+ const ModelCategory_1 = __importDefault(require("../../selectors/ModelCategory"));
8
+ function makeModelInstance(client, model) {
9
+ return {
10
+ get() {
11
+ return client.get(`/models/${model}`);
12
+ },
13
+ get entries() {
14
+ return (0, Entry_1.default)(client, model);
15
+ },
16
+ get categories() {
17
+ return (0, ModelCategory_1.default)(client, model);
18
+ },
19
+ };
20
+ }
21
+ exports.default = makeModelInstance;
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/Model/index.ts"],"names":[],"mappings":";;;;;AAOA,kEAAwE;AACxE,kFAEsC;AAEtC,SAAwB,iBAAiB,CACvC,MAAuB,EACvB,KAAa;IAEb,OAAO;QACL,GAAG;YACD,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,CAAC,CAAA;QACvC,CAAC;QAED,IAAI,OAAO;YACT,OAAO,IAAA,eAAiB,EAAI,MAAM,EAAE,KAAK,CAAC,CAAA;QAC5C,CAAC;QAED,IAAI,UAAU;YACZ,OAAO,IAAA,uBAAyB,EAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACjD,CAAC;KACF,CAAA;AACH,CAAC;AAjBD,oCAiBC","sourcesContent":["import {\n Model,\n SerializedData,\n StarlightClient,\n StarlightItemResponse,\n} from '../../types'\nimport { ModelInstance } from './types'\nimport makeEntrySelector, { EntrySelector } from '../../selectors/Entry'\nimport makeModelCategorySelector, {\n ProxiedModelCategorySelector,\n} from '../../selectors/ModelCategory'\n\nexport default function makeModelInstance<D extends SerializedData>(\n client: StarlightClient,\n model: string\n): ModelInstance<D> {\n return {\n get(): Promise<StarlightItemResponse<Model>> {\n return client.get(`/models/${model}`)\n },\n\n get entries(): EntrySelector<D> {\n return makeEntrySelector<D>(client, model)\n },\n\n get categories(): ProxiedModelCategorySelector<D> {\n return makeModelCategorySelector(client, model)\n },\n }\n}\n\nexport { ModelInstance }\n"]}
@@ -0,0 +1,9 @@
1
+ import { Model, SerializedData, StarlightItemResponse } from '../../types';
2
+ import { EntrySelector } from '../../selectors/Entry';
3
+ import { ProxiedModelCategorySelector } from '../../selectors/ModelCategory';
4
+ export interface ModelInstance<D extends SerializedData> {
5
+ get(): Promise<StarlightItemResponse<Model>>;
6
+ get entries(): EntrySelector<D>;
7
+ get categories(): ProxiedModelCategorySelector<D>;
8
+ }
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/Model/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAE5E,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,cAAc;IACrD,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5C,IAAI,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;IAC/B,IAAI,UAAU,IAAI,4BAA4B,CAAC,CAAC,CAAC,CAAA;CAClD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/Model/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Model, SerializedData, StarlightItemResponse } from '../../types'\nimport { EntrySelector } from '../../selectors/Entry'\nimport { ProxiedModelCategorySelector } from '../../selectors/ModelCategory'\n\nexport interface ModelInstance<D extends SerializedData> {\n get(): Promise<StarlightItemResponse<Model>>\n get entries(): EntrySelector<D>\n get categories(): ProxiedModelCategorySelector<D>\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { SerializedData, StarlightClient } from '../../types';
2
+ import { ModelCategoryInstance } from './types';
3
+ export default function makeModelCategoryInstance<D extends SerializedData>(client: StarlightClient, model: string, category: string): ModelCategoryInstance<D>;
4
+ export { ModelCategoryInstance };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EACd,eAAe,EAGhB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,qBAAqB,EAAiC,MAAM,SAAS,CAAA;AAE9E,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,CAAC,SAAS,cAAc,EACxE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,qBAAqB,CAAC,CAAC,CAAC,CAc1B;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function makeModelCategoryInstance(client, model, category) {
4
+ return {
5
+ get() {
6
+ return client.get(`/models/${model}/categories/${category}`);
7
+ },
8
+ entries(options) {
9
+ return client.get(`/models/${model}/categories/${category}/entries`, options);
10
+ },
11
+ };
12
+ }
13
+ exports.default = makeModelCategoryInstance;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/index.ts"],"names":[],"mappings":";;AAUA,SAAwB,yBAAyB,CAC/C,MAAuB,EACvB,KAAa,EACb,QAAgB;IAEhB,OAAO;QACL,GAAG;YACD,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,eAAe,QAAQ,EAAE,CAAC,CAAA;QAC9D,CAAC;QACD,OAAO,CACL,OAAyC;YAEzC,OAAO,MAAM,CAAC,GAAG,CACf,WAAW,KAAK,eAAe,QAAQ,UAAU,EACjD,OAAO,CACR,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAlBD,4CAkBC","sourcesContent":["import {\n Entry,\n ModelCategory,\n SerializedData,\n StarlightClient,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\nimport { ModelCategoryInstance, ModelCategoryEntryListOptions } from './types'\n\nexport default function makeModelCategoryInstance<D extends SerializedData>(\n client: StarlightClient,\n model: string,\n category: string\n): ModelCategoryInstance<D> {\n return {\n get(): Promise<StarlightItemResponse<ModelCategory>> {\n return client.get(`/models/${model}/categories/${category}`)\n },\n entries(\n options: ModelCategoryEntryListOptions<D>\n ): Promise<StarlightListResponse<Entry<D>>> {\n return client.get(\n `/models/${model}/categories/${category}/entries`,\n options\n )\n },\n }\n}\n\nexport { ModelCategoryInstance }\n"]}
@@ -0,0 +1,15 @@
1
+ import { Entry, ModelCategory, ModelFieldOptions, SerializedData, StarlightItemResponse, StarlightListResponse } from '../../types';
2
+ export declare type ModelCategoryEntryListOptions<D extends SerializedData> = {
3
+ page?: number;
4
+ limit?: number;
5
+ query?: string;
6
+ 'query:word'?: string;
7
+ fields?: string;
8
+ order?: 'title:asc' | 'title:desc' | 'published_at:asc' | 'published_at:desc' | 'views:asc' | 'views:desc';
9
+ except?: number;
10
+ } & ModelFieldOptions<D>;
11
+ export interface ModelCategoryInstance<D extends SerializedData> {
12
+ get(): Promise<StarlightItemResponse<ModelCategory>>;
13
+ entries(options?: ModelCategoryEntryListOptions<D>): Promise<StarlightListResponse<Entry<D>>>;
14
+ }
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB,oBAAY,6BAA6B,CAAC,CAAC,SAAS,cAAc,IAAI;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAExB,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,cAAc;IAC7D,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;IACpD,OAAO,CACL,OAAO,CAAC,EAAE,6BAA6B,CAAC,CAAC,CAAC,GACzC,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5C"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Entry,\n ModelCategory,\n ModelFieldOptions,\n SerializedData,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\n\nexport type ModelCategoryEntryListOptions<D extends SerializedData> = {\n page?: number\n limit?: number\n query?: string\n 'query:word'?: string\n fields?: string\n order?:\n | 'title:asc'\n | 'title:desc'\n | 'published_at:asc'\n | 'published_at:desc'\n | 'views:asc'\n | 'views:desc'\n except?: number\n} & ModelFieldOptions<D>\n\nexport interface ModelCategoryInstance<D extends SerializedData> {\n get(): Promise<StarlightItemResponse<ModelCategory>>\n entries(\n options?: ModelCategoryEntryListOptions<D>\n ): Promise<StarlightListResponse<Entry<D>>>\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { StarlightClient } from '../../types';
2
+ import { CollectionSelector, ProxiedCollectionSelector } from './types';
3
+ export default function makeCollectionSelector(client: StarlightClient): ProxiedCollectionSelector;
4
+ export { CollectionSelector, ProxiedCollectionSelector };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAGvE,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,MAAM,EAAE,eAAe,GACtB,yBAAyB,CAoB3B;AAED,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,CAAA"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Collection_1 = __importDefault(require("../../instances/Collection"));
7
+ function makeCollectionSelector(client) {
8
+ const selector = {
9
+ list(options) {
10
+ return client.get('/collections', options);
11
+ },
12
+ get(slug) {
13
+ return client.get(`/collections/${slug}`);
14
+ },
15
+ };
16
+ return new Proxy(selector, {
17
+ get(target, prop) {
18
+ if (typeof prop === 'string' && !Reflect.has(target, prop)) {
19
+ return (0, Collection_1.default)(client, prop);
20
+ }
21
+ return Reflect.get(target, prop);
22
+ },
23
+ });
24
+ }
25
+ exports.default = makeCollectionSelector;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Collection/index.ts"],"names":[],"mappings":";;;;;AAEA,4EAA+D;AAE/D,SAAwB,sBAAsB,CAC5C,MAAuB;IAEvB,MAAM,QAAQ,GAAuB;QACnC,IAAI,CAAC,OAAO;YACV,OAAO,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;QAC5C,CAAC;QAED,GAAG,CAAC,IAAI;YACN,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAA;QAC3C,CAAC;KACF,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE;QACzB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;gBAC1D,OAAO,IAAA,oBAAsB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAA;aAC5C;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA8B,CAAA;AACjC,CAAC;AAtBD,yCAsBC","sourcesContent":["import { StarlightClient } from '../../types'\nimport { CollectionSelector, ProxiedCollectionSelector } from './types'\nimport makeCollectionInstance from '../../instances/Collection'\n\nexport default function makeCollectionSelector(\n client: StarlightClient\n): ProxiedCollectionSelector {\n const selector: CollectionSelector = {\n list(options) {\n return client.get('/collections', options)\n },\n\n get(slug) {\n return client.get(`/collections/${slug}`)\n },\n }\n\n return new Proxy(selector, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeCollectionInstance(client, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as ProxiedCollectionSelector\n}\n\nexport { CollectionSelector, ProxiedCollectionSelector }\n"]}
@@ -0,0 +1,16 @@
1
+ import { Collection, StarlightItemResponse, StarlightListResponse } from '../../types';
2
+ import { CollectionInstance } from '../../instances/Collection';
3
+ export declare type ListCollectionsOptions = {
4
+ query?: string;
5
+ page?: number;
6
+ limit?: number;
7
+ order?: 'title:asc' | 'title:desc' | 'item_count:asc' | 'item_count:desc';
8
+ };
9
+ export interface CollectionSelector {
10
+ list(options?: ListCollectionsOptions): Promise<StarlightListResponse<Collection>>;
11
+ get(slug: string): Promise<StarlightItemResponse<Collection>>;
12
+ }
13
+ export declare type ProxiedCollectionSelector = CollectionSelector & {
14
+ [key: string]: CollectionInstance;
15
+ };
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Collection/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D,oBAAY,sBAAsB,GAAG;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,iBAAiB,CAAA;CAC1E,CAAA;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CACF,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAA;IAC7C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAA;CAC9D;AAED,oBAAY,yBAAyB,GAAG,kBAAkB,GAAG;IAC3D,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAA;CAClC,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Collection/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Collection,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\nimport { CollectionInstance } from '../../instances/Collection'\n\nexport type ListCollectionsOptions = {\n query?: string\n page?: number\n limit?: number\n order?: 'title:asc' | 'title:desc' | 'item_count:asc' | 'item_count:desc'\n}\n\nexport interface CollectionSelector {\n list(\n options?: ListCollectionsOptions\n ): Promise<StarlightListResponse<Collection>>\n get(slug: string): Promise<StarlightItemResponse<Collection>>\n}\n\nexport type ProxiedCollectionSelector = CollectionSelector & {\n [key: string]: CollectionInstance\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { SerializedData, StarlightClient } from 'types';
1
+ import { SerializedData, StarlightClient } from '../../types';
2
2
  import { EntrySelector } from './types';
3
3
  export default function makeEntrySelector<D extends SerializedData>(client: StarlightClient, model: string): EntrySelector<D>;
4
4
  export { EntrySelector };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Entry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,eAAe,EAGhB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAChE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,GACZ,aAAa,CAAC,CAAC,CAAC,CAUlB;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function makeEntrySelector(client, model) {
4
+ return {
5
+ list(options) {
6
+ return client.get(`/models/${model}/entries`, options);
7
+ },
8
+ get(slug) {
9
+ return client.get(`/models/${model}/entries/${slug}`);
10
+ },
11
+ };
12
+ }
13
+ exports.default = makeEntrySelector;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Entry/index.ts"],"names":[],"mappings":";;AASA,SAAwB,iBAAiB,CACvC,MAAuB,EACvB,KAAa;IAEb,OAAO;QACL,IAAI,CAAC,OAAO;YACV,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,UAAU,EAAE,OAAO,CAAC,CAAA;QACxD,CAAC;QAED,GAAG,CAAC,IAAY;YACd,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,YAAY,IAAI,EAAE,CAAC,CAAA;QACvD,CAAC;KACF,CAAA;AACH,CAAC;AAbD,oCAaC","sourcesContent":["import {\n Entry,\n SerializedData,\n StarlightClient,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\nimport { EntrySelector } from './types'\n\nexport default function makeEntrySelector<D extends SerializedData>(\n client: StarlightClient,\n model: string\n): EntrySelector<D> {\n return {\n list(options): Promise<StarlightListResponse<Entry<D>>> {\n return client.get(`/models/${model}/entries`, options)\n },\n\n get(slug: string): Promise<StarlightItemResponse<Entry<D>>> {\n return client.get(`/models/${model}/entries/${slug}`)\n },\n }\n}\n\nexport { EntrySelector }\n"]}
@@ -0,0 +1,15 @@
1
+ import { Entry, ModelFieldOptions, SerializedData, StarlightItemResponse, StarlightListResponse } from '../../types';
2
+ export declare type ListEntriesOptions<D extends SerializedData> = {
3
+ page?: number;
4
+ limit?: number;
5
+ query?: string;
6
+ 'query:word'?: string;
7
+ fields?: string;
8
+ order?: 'title:asc' | 'title:desc' | 'published_at:asc' | 'published_at:desc' | 'views:asc' | 'views:desc';
9
+ except?: number;
10
+ } & ModelFieldOptions<D>;
11
+ export interface EntrySelector<D extends SerializedData> {
12
+ get(slug: string): Promise<StarlightItemResponse<Entry<D>>>;
13
+ list(options?: ListEntriesOptions<D>): Promise<StarlightListResponse<Entry<D>>>;
14
+ }
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Entry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB,oBAAY,kBAAkB,CAAC,CAAC,SAAS,cAAc,IAAI;IACzD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAExB,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,cAAc;IACrD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3D,IAAI,CACF,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC9B,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5C"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Entry/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Entry,\n ModelFieldOptions,\n SerializedData,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\n\nexport type ListEntriesOptions<D extends SerializedData> = {\n page?: number\n limit?: number\n query?: string\n 'query:word'?: string\n fields?: string\n order?:\n | 'title:asc'\n | 'title:desc'\n | 'published_at:asc'\n | 'published_at:desc'\n | 'views:asc'\n | 'views:desc'\n except?: number\n} & ModelFieldOptions<D>\n\nexport interface EntrySelector<D extends SerializedData> {\n get(slug: string): Promise<StarlightItemResponse<Entry<D>>>\n list(\n options?: ListEntriesOptions<D>\n ): Promise<StarlightListResponse<Entry<D>>>\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { StarlightClient } from '../../types';
2
+ import { MediaSelector } from './types';
3
+ export default function makeMediaSelector(client: StarlightClient): MediaSelector;
4
+ export { MediaSelector };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Media/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAM,EAAE,eAAe,GACtB,aAAa,CAUf;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function makeMediaSelector(client) {
4
+ return {
5
+ list() {
6
+ return client.get('/media');
7
+ },
8
+ get(slug) {
9
+ return client.get(`/media/${slug}`);
10
+ },
11
+ };
12
+ }
13
+ exports.default = makeMediaSelector;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Media/index.ts"],"names":[],"mappings":";;AAGA,SAAwB,iBAAiB,CACvC,MAAuB;IAEvB,OAAO;QACL,IAAI;YACF,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QAC7B,CAAC;QAED,GAAG,CAAC,IAAI;YACN,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAA;QACrC,CAAC;KACF,CAAA;AACH,CAAC;AAZD,oCAYC","sourcesContent":["import { StarlightClient } from '../../types'\nimport { MediaSelector } from './types'\n\nexport default function makeMediaSelector(\n client: StarlightClient\n): MediaSelector {\n return {\n list() {\n return client.get('/media')\n },\n\n get(slug) {\n return client.get(`/media/${slug}`)\n },\n }\n}\n\nexport { MediaSelector }\n"]}
@@ -0,0 +1,6 @@
1
+ import { MediaObject, StarlightItemResponse, StarlightListResponse } from '../../types';
2
+ export interface MediaSelector {
3
+ get(slug: number | string): Promise<StarlightItemResponse<MediaObject>>;
4
+ list(): Promise<StarlightListResponse<MediaObject>>;
5
+ }
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Media/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAA;IACvE,IAAI,IAAI,OAAO,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAA;CACpD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Media/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n MediaObject,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\n\nexport interface MediaSelector {\n get(slug: number | string): Promise<StarlightItemResponse<MediaObject>>\n list(): Promise<StarlightListResponse<MediaObject>>\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { StarlightClient, WorkspaceModelDefinition } from 'types';
1
+ import { StarlightClient, WorkspaceModelDefinition } from '../../types';
2
2
  import { ModelSelector, ProxiedModelSelector } from './types';
3
3
  export default function makeModelSelector<D extends WorkspaceModelDefinition>(client: StarlightClient): ProxiedModelSelector<D>;
4
4
  export { ModelSelector, ProxiedModelSelector };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAGf,wBAAwB,EACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAG7D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,wBAAwB,EAC1E,MAAM,EAAE,eAAe,GACtB,oBAAoB,CAAC,CAAC,CAAC,CAoBzB;AAED,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAA"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Model_1 = __importDefault(require("../../instances/Model"));
7
+ function makeModelSelector(client) {
8
+ const modelClient = {
9
+ list() {
10
+ return client.get('/models');
11
+ },
12
+ get(slug) {
13
+ return client.get(`/models/${slug}`);
14
+ },
15
+ };
16
+ return new Proxy(modelClient, {
17
+ get(target, prop) {
18
+ if (typeof prop === 'string' && !Reflect.has(target, prop)) {
19
+ return (0, Model_1.default)(client, prop);
20
+ }
21
+ return Reflect.get(target, prop);
22
+ },
23
+ });
24
+ }
25
+ exports.default = makeModelSelector;
26
+ //# sourceMappingURL=index.js.map