@starlightcms/js-sdk 2.2.1 → 3.0.0

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 (84) hide show
  1. package/dist/cjs/client.js +3 -4
  2. package/dist/cjs/client.js.map +1 -1
  3. package/dist/cjs/instances/Collection/index.js +1 -1
  4. package/dist/cjs/instances/Collection/index.js.map +1 -1
  5. package/dist/cjs/instances/Form/index.js +1 -1
  6. package/dist/cjs/instances/Form/index.js.map +1 -1
  7. package/dist/cjs/instances/Model/index.js +1 -1
  8. package/dist/cjs/instances/Model/index.js.map +1 -1
  9. package/dist/cjs/instances/Model/types.d.ts +1 -1
  10. package/dist/cjs/instances/Model/types.d.ts.map +1 -1
  11. package/dist/cjs/instances/ModelCategory/index.js +1 -1
  12. package/dist/cjs/instances/ModelCategory/index.js.map +1 -1
  13. package/dist/cjs/selectors/Collection/index.js +1 -1
  14. package/dist/cjs/selectors/Collection/index.js.map +1 -1
  15. package/dist/cjs/selectors/Collection/types.d.ts +1 -1
  16. package/dist/cjs/selectors/Collection/types.d.ts.map +1 -1
  17. package/dist/cjs/selectors/Entry/index.js +1 -1
  18. package/dist/cjs/selectors/Entry/index.js.map +1 -1
  19. package/dist/cjs/selectors/Entry/types.d.ts +1 -1
  20. package/dist/cjs/selectors/Entry/types.d.ts.map +1 -1
  21. package/dist/cjs/selectors/Form/index.js +1 -1
  22. package/dist/cjs/selectors/Form/index.js.map +1 -1
  23. package/dist/cjs/selectors/Form/types.d.ts +1 -1
  24. package/dist/cjs/selectors/Form/types.d.ts.map +1 -1
  25. package/dist/cjs/selectors/Media/index.js +1 -1
  26. package/dist/cjs/selectors/Media/index.js.map +1 -1
  27. package/dist/cjs/selectors/Model/index.js +1 -1
  28. package/dist/cjs/selectors/Model/index.js.map +1 -1
  29. package/dist/cjs/selectors/Model/types.d.ts +1 -1
  30. package/dist/cjs/selectors/Model/types.d.ts.map +1 -1
  31. package/dist/cjs/selectors/ModelCategory/index.js +1 -1
  32. package/dist/cjs/selectors/ModelCategory/index.js.map +1 -1
  33. package/dist/cjs/selectors/ModelCategory/types.d.ts +1 -1
  34. package/dist/cjs/selectors/ModelCategory/types.d.ts.map +1 -1
  35. package/dist/cjs/selectors/Search/index.js +1 -1
  36. package/dist/cjs/selectors/Search/index.js.map +1 -1
  37. package/dist/cjs/selectors/Singleton/index.js +1 -1
  38. package/dist/cjs/selectors/Singleton/index.js.map +1 -1
  39. package/dist/cjs/types/entities.d.ts +8 -8
  40. package/dist/cjs/types/entities.d.ts.map +1 -1
  41. package/dist/cjs/types/entities.js.map +1 -1
  42. package/dist/cjs/types/fields.d.ts +7 -7
  43. package/dist/cjs/types/fields.d.ts.map +1 -1
  44. package/dist/cjs/types/index.d.ts +4 -4
  45. package/dist/cjs/types/index.d.ts.map +1 -1
  46. package/dist/cjs/types/index.js.map +1 -1
  47. package/dist/cjs/types/visual.d.ts +49 -17
  48. package/dist/cjs/types/visual.d.ts.map +1 -1
  49. package/dist/cjs/types/visual.js.map +1 -1
  50. package/dist/cjs/utils/image.d.ts.map +1 -1
  51. package/dist/cjs/utils/image.js.map +1 -1
  52. package/dist/esm/client.js +2 -2
  53. package/dist/esm/client.js.map +1 -1
  54. package/dist/esm/instances/Model/index.js.map +1 -1
  55. package/dist/esm/instances/Model/types.d.ts +1 -1
  56. package/dist/esm/instances/Model/types.d.ts.map +1 -1
  57. package/dist/esm/selectors/Collection/index.js.map +1 -1
  58. package/dist/esm/selectors/Collection/types.d.ts +1 -1
  59. package/dist/esm/selectors/Collection/types.d.ts.map +1 -1
  60. package/dist/esm/selectors/Entry/types.d.ts +1 -1
  61. package/dist/esm/selectors/Entry/types.d.ts.map +1 -1
  62. package/dist/esm/selectors/Form/index.js.map +1 -1
  63. package/dist/esm/selectors/Form/types.d.ts +1 -1
  64. package/dist/esm/selectors/Form/types.d.ts.map +1 -1
  65. package/dist/esm/selectors/Model/index.js.map +1 -1
  66. package/dist/esm/selectors/Model/types.d.ts +1 -1
  67. package/dist/esm/selectors/Model/types.d.ts.map +1 -1
  68. package/dist/esm/selectors/ModelCategory/index.js.map +1 -1
  69. package/dist/esm/selectors/ModelCategory/types.d.ts +1 -1
  70. package/dist/esm/selectors/ModelCategory/types.d.ts.map +1 -1
  71. package/dist/esm/types/entities.d.ts +8 -8
  72. package/dist/esm/types/entities.d.ts.map +1 -1
  73. package/dist/esm/types/entities.js.map +1 -1
  74. package/dist/esm/types/fields.d.ts +7 -7
  75. package/dist/esm/types/fields.d.ts.map +1 -1
  76. package/dist/esm/types/index.d.ts +4 -4
  77. package/dist/esm/types/index.d.ts.map +1 -1
  78. package/dist/esm/types/index.js.map +1 -1
  79. package/dist/esm/types/visual.d.ts +49 -17
  80. package/dist/esm/types/visual.d.ts.map +1 -1
  81. package/dist/esm/types/visual.js.map +1 -1
  82. package/dist/esm/utils/image.d.ts.map +1 -1
  83. package/dist/esm/utils/image.js.map +1 -1
  84. package/package.json +15 -16
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Entry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,eAAe,EACf,0BAA0B,EAC1B,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,iBACf,SAAQ,qBAAqB,EAC3B,0BAA0B;IAC5B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;GAMG;AACH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;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,cAAc;IACrD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,GAAG,CACD,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,IAAI,CACF,OAAO,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC,CAAC,CAAC,GAC/C,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Form/index.ts"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,MAAM,sBAAsB,CAAA;AAEnD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAuB;IAEvB,OAAO,IAAI,KAAK,CACd,EAAE,EACF;QACE,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;gBAC1D,OAAO,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;aACtC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CACF,CAAA;AACH,CAAC","sourcesContent":["import { StarlightClient } from '../../types'\nimport { DynamicFormSelector } from './types'\nimport makeFormInstance from '../../instances/Form'\n\nexport default function makeFormSelector(\n client: StarlightClient\n): DynamicFormSelector {\n return new Proxy(\n {},\n {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeFormInstance(client, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }\n )\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Form/index.ts"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,MAAM,sBAAsB,CAAA;AAEnD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAuB;IAEvB,OAAO,IAAI,KAAK,CACd,EAAE,EACF;QACE,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC3D,OAAO,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YACvC,CAAC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CACF,CAAA;AACH,CAAC","sourcesContent":["import { StarlightClient } from '../../types'\nimport { DynamicFormSelector } from './types'\nimport makeFormInstance from '../../instances/Form'\n\nexport default function makeFormSelector(\n client: StarlightClient\n): DynamicFormSelector {\n return new Proxy(\n {},\n {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeFormInstance(client, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }\n )\n}\n"]}
@@ -16,7 +16,7 @@ import { FormInstance } from '../../instances/Form';
16
16
  *
17
17
  * @category Selectors
18
18
  */
19
- export declare type DynamicFormSelector = {
19
+ export type DynamicFormSelector = {
20
20
  [slug: string]: FormInstance;
21
21
  };
22
22
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Form/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,oBAAY,mBAAmB,GAAG;IAChC,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAA;CAC7B,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Form/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAA;CAC7B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Model/index.ts"],"names":[],"mappings":"AAQA,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AAErD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAuB;IAEvB,MAAM,WAAW,GAAkB;QACjC,IAAI;YACF,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAC9B,CAAC;QAED,GAAG,CAAC,IAAI;YACN,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;QACtC,CAAC;KACF,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;QAC5B,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;gBAC1D,OAAO,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;aACvC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA4B,CAAA;AAC/B,CAAC","sourcesContent":["import {\n Model,\n StarlightClient,\n StarlightItemResponse,\n StarlightListResponse,\n WorkspaceModelDefinition,\n} from '../../types'\nimport { ModelSelector, DynamicModelSelector } from './types'\nimport makeModelInstance from '../../instances/Model'\n\nexport default function makeModelSelector<D extends WorkspaceModelDefinition>(\n client: StarlightClient\n): DynamicModelSelector<D> {\n const modelClient: ModelSelector = {\n list(): Promise<StarlightListResponse<Model>> {\n return client.get('/models')\n },\n\n get(slug): Promise<StarlightItemResponse<Model>> {\n return client.get(`/models/${slug}`)\n },\n }\n\n return new Proxy(modelClient, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelInstance(client, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicModelSelector<D>\n}\n\nexport { ModelSelector, DynamicModelSelector }\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Model/index.ts"],"names":[],"mappings":"AAQA,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AAErD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAuB;IAEvB,MAAM,WAAW,GAAkB;QACjC,IAAI;YACF,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAC9B,CAAC;QAED,GAAG,CAAC,IAAI;YACN,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;QACtC,CAAC;KACF,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;QAC5B,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC3D,OAAO,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YACxC,CAAC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA4B,CAAA;AAC/B,CAAC","sourcesContent":["import {\n Model,\n StarlightClient,\n StarlightItemResponse,\n StarlightListResponse,\n WorkspaceModelDefinition,\n} from '../../types'\nimport { ModelSelector, DynamicModelSelector } from './types'\nimport makeModelInstance from '../../instances/Model'\n\nexport default function makeModelSelector<D extends WorkspaceModelDefinition>(\n client: StarlightClient\n): DynamicModelSelector<D> {\n const modelClient: ModelSelector = {\n list(): Promise<StarlightListResponse<Model>> {\n return client.get('/models')\n },\n\n get(slug): Promise<StarlightItemResponse<Model>> {\n return client.get(`/models/${slug}`)\n },\n }\n\n return new Proxy(modelClient, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelInstance(client, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicModelSelector<D>\n}\n\nexport { ModelSelector, DynamicModelSelector }\n"]}
@@ -63,7 +63,7 @@ export interface ModelSelector {
63
63
  *
64
64
  * @category Selectors
65
65
  */
66
- export declare type DynamicModelSelector<T extends WorkspaceModelDefinition> = ModelSelector & {
66
+ export type DynamicModelSelector<T extends WorkspaceModelDefinition> = ModelSelector & {
67
67
  [K in keyof T]: DynamicModelInstance<T[K]>;
68
68
  };
69
69
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Model/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;OAUG;IACH,IAAI,IAAI,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;IAE7C;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;CACzD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,oBAAY,oBAAoB,CAAC,CAAC,SAAS,wBAAwB,IACjE,aAAa,GAAG;KACb,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Model/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;OAUG;IACH,IAAI,IAAI,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;IAE7C;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;CACzD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,wBAAwB,IACjE,aAAa,GAAG;KACb,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/index.ts"],"names":[],"mappings":"AAYA,OAAO,yBAAyB,MAAM,+BAA+B,CAAA;AAErE,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,MAAuB,EACvB,KAAa;IAEb,MAAM,QAAQ,GAA0B;QACtC,IAAI,CAAC,OAAO;YACV,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,aAAa,oBAAO,OAAO,EAAG,CAAA;QAClE,CAAC;QAED,GAAG,CAAC,IAAI;YACN,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,eAAe,IAAI,EAAE,CAAC,CAAA;QAC1D,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,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;aACtD;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAAoC,CAAA;AACvC,CAAC","sourcesContent":["import {\n ModelCategory,\n SerializedData,\n StarlightClient,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\nimport {\n ModelCategorySelector,\n DynamicModelCategorySelector,\n ListModelCategoriesOptions,\n} from './types'\nimport makeModelCategoryInstance from '../../instances/ModelCategory'\n\nexport default function makeModelCategorySelector<D extends SerializedData>(\n client: StarlightClient,\n model: string\n): DynamicModelCategorySelector<D> {\n const selector: ModelCategorySelector = {\n list(options): Promise<StarlightListResponse<ModelCategory>> {\n return client.get(`/models/${model}/categories`, { ...options })\n },\n\n get(slug): Promise<StarlightItemResponse<ModelCategory>> {\n return client.get(`/models/${model}/categories/${slug}`)\n },\n }\n\n return new Proxy(selector, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelCategoryInstance(client, model, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicModelCategorySelector<D>\n}\n\nexport {\n ModelCategorySelector,\n DynamicModelCategorySelector,\n ListModelCategoriesOptions,\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/index.ts"],"names":[],"mappings":"AAYA,OAAO,yBAAyB,MAAM,+BAA+B,CAAA;AAErE,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,MAAuB,EACvB,KAAa;IAEb,MAAM,QAAQ,GAA0B;QACtC,IAAI,CAAC,OAAO;YACV,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,aAAa,oBAAO,OAAO,EAAG,CAAA;QAClE,CAAC;QAED,GAAG,CAAC,IAAI;YACN,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,eAAe,IAAI,EAAE,CAAC,CAAA;QAC1D,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,CAAC;gBAC3D,OAAO,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;YACvD,CAAC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAAoC,CAAA;AACvC,CAAC","sourcesContent":["import {\n ModelCategory,\n SerializedData,\n StarlightClient,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\nimport {\n ModelCategorySelector,\n DynamicModelCategorySelector,\n ListModelCategoriesOptions,\n} from './types'\nimport makeModelCategoryInstance from '../../instances/ModelCategory'\n\nexport default function makeModelCategorySelector<D extends SerializedData>(\n client: StarlightClient,\n model: string\n): DynamicModelCategorySelector<D> {\n const selector: ModelCategorySelector = {\n list(options): Promise<StarlightListResponse<ModelCategory>> {\n return client.get(`/models/${model}/categories`, { ...options })\n },\n\n get(slug): Promise<StarlightItemResponse<ModelCategory>> {\n return client.get(`/models/${model}/categories/${slug}`)\n },\n }\n\n return new Proxy(selector, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelCategoryInstance(client, model, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicModelCategorySelector<D>\n}\n\nexport {\n ModelCategorySelector,\n DynamicModelCategorySelector,\n ListModelCategoriesOptions,\n}\n"]}
@@ -74,7 +74,7 @@ export interface ModelCategorySelector {
74
74
  *
75
75
  * @category Instances
76
76
  */
77
- export declare type DynamicModelCategorySelector<D extends SerializedData> = ModelCategorySelector & {
77
+ export type DynamicModelCategorySelector<D extends SerializedData> = ModelCategorySelector & {
78
78
  [slug: string]: ModelCategoryInstance<D>;
79
79
  };
80
80
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAErE;;;;;;GAMG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,GACV,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,iBAAiB,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;;OAaG;IACH,IAAI,CACF,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;IAEhD;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;CACjE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oBAAY,4BAA4B,CAAC,CAAC,SAAS,cAAc,IAC/D,qBAAqB,GAAG;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;CACzC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAErE;;;;;;GAMG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,GACV,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,iBAAiB,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;;OAaG;IACH,IAAI,CACF,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;IAEhD;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;CACjE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,cAAc,IAC/D,qBAAqB,GAAG;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;CACzC,CAAA"}
@@ -78,7 +78,7 @@ export interface Field {
78
78
  is_private: boolean;
79
79
  is_archived: boolean;
80
80
  rules?: {
81
- [rule: string]: any;
81
+ [rule: string]: unknown;
82
82
  };
83
83
  }
84
84
  /**
@@ -128,7 +128,7 @@ export interface FormSchema extends ModelSchema {
128
128
  *
129
129
  * @category Internal Types
130
130
  */
131
- export declare type SerializedData = Record<string, unknown> | undefined;
131
+ export type SerializedData = Record<string, unknown> | undefined;
132
132
  /**
133
133
  * Utility type that creates a string map of all fields of the given
134
134
  * SerializedData type with the `field:` prefix. This syntax allows to filter
@@ -196,7 +196,7 @@ export declare type SerializedData = Record<string, unknown> | undefined;
196
196
  *
197
197
  * @category Internal Types
198
198
  */
199
- export declare type QueryableFields<D extends SerializedData> = {
199
+ export type QueryableFields<D extends SerializedData> = {
200
200
  [K in keyof D as `field:${string & K}`]?: string | boolean;
201
201
  };
202
202
  /**
@@ -209,7 +209,7 @@ export declare type QueryableFields<D extends SerializedData> = {
209
209
  *
210
210
  * @category Internal Types
211
211
  */
212
- export declare type WithQueryableFieldsOnModelables<T> = T extends Entry<never> | Singleton<never> ? QueryableFields<T['data']> : never;
212
+ export type WithQueryableFieldsOnModelables<T> = T extends Entry<never> | Singleton<never> ? QueryableFields<T['data']> : never;
213
213
  /**
214
214
  * Represents an Entry entity returned by the API.
215
215
  *
@@ -309,7 +309,7 @@ export interface Singleton<D extends SerializedData> extends Omit<StarlightEntit
309
309
  *
310
310
  * @internal
311
311
  */
312
- export declare type CollectionTypes = 'entry' | 'singleton' | 'media' | string;
312
+ export type CollectionTypes = 'entry' | 'singleton' | 'media' | string;
313
313
  /**
314
314
  * Currently supported Collection entities. This type is mainly used to infer
315
315
  * the collection type string (see {@link CollectionTypes}) from the type of
@@ -317,14 +317,14 @@ export declare type CollectionTypes = 'entry' | 'singleton' | 'media' | string;
317
317
  *
318
318
  * @internal
319
319
  */
320
- export declare type CollectionEntityTypes = Entry<never> | Singleton<never> | MediaObject | unknown;
320
+ export type CollectionEntityTypes = Entry<never> | Singleton<never> | MediaObject | unknown;
321
321
  /**
322
322
  * Infers a Collection type from an entity type. See {@link CollectionTypes} and
323
323
  * {@link CollectionEntityTypes} to know more.
324
324
  *
325
325
  * @internal
326
326
  */
327
- export declare type CollectionTypeMapper<T extends CollectionEntityTypes> = T extends Entry<any> ? 'entry' : T extends Singleton<any> ? 'singleton' : T extends MediaObject ? 'media' : string;
327
+ export type CollectionTypeMapper<T extends CollectionEntityTypes> = T extends Entry<any> ? 'entry' : T extends Singleton<any> ? 'singleton' : T extends MediaObject ? 'media' : string;
328
328
  /**
329
329
  * Represents a Collection entity returned by the API.
330
330
  *
@@ -342,7 +342,7 @@ export interface Collection<T extends CollectionTypes = string> extends Starligh
342
342
  /**
343
343
  * Currently supported Relation types.
344
344
  */
345
- declare type RelationTypes = Entry<never> | Singleton<never> | MediaObject | Collection | unknown;
345
+ type RelationTypes = Entry<never> | Singleton<never> | MediaObject | Collection | unknown;
346
346
  /**
347
347
  * Represents a Relation entity returned by the API.
348
348
  *
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,eAAe;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM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aAAa,GACd,KAAK,CAAC,KAAK,CAAC,GACZ,SAAS,CAAC,KAAK,CAAC,GAChB,WAAW,GACX,UAAU,GACV,OAAO,CAAA;AAEX;;;;GAIG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,aAAa;IAC/C;;;;OAIG;IACH,IAAI,EAAE,CAAC,SAAS,KAAK,CAAC,KAAK,CAAC,GACxB,OAAO,GACP,CAAC,SAAS,SAAS,CAAC,KAAK,CAAC,GACxB,WAAW,GACX,CAAC,SAAS,WAAW,GACnB,OAAO,GACP,CAAC,SAAS,UAAU,GAClB,YAAY,GACZ,MAAM,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,CAAA;CACV"}
@@ -1 +1 @@
1
- {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Base interface used by all entities returned by the API.\n *\n * @internal\n */\ninterface StarlightEntity {\n id: number\n created_at: string\n updated_at?: string\n}\n\n/**\n * Represents a Model Category entity returned by the API.\n *\n * @group API Entities\n */\nexport interface ModelCategory extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\n/**\n * Represents a Media File entity returned by the API.\n *\n * @group API Entities\n */\nexport interface MediaFile extends StarlightEntity {\n variation: string\n path: string\n mime: string\n background_color?: string\n filesize: number\n meta?: Record<string, unknown>\n}\n\n/**\n * Represents a Media Object entity returned by the API.\n *\n * @group API Entities\n */\nexport interface MediaObject extends StarlightEntity {\n name: string\n extension: string\n mime: string\n files: MediaFile[]\n alt?: string\n description?: string\n}\n\n/**\n * Represents an Author entity returned by the API. Authors are returned in\n * {@link Entry} requests.\n *\n * @group API Entities\n */\nexport interface Author {\n id: number\n name: string\n}\n\n/**\n * Represents a Model entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Model extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\n/**\n * Represents a field returned by the API in Model schemas.\n *\n * @group API Entities\n */\nexport interface Field {\n title: string\n key: string\n type: string\n is_required: boolean\n is_listable: boolean\n is_private: boolean\n is_archived: boolean\n rules?: {\n [rule: string]: any\n }\n}\n\n/**\n * Represents a group of fields returned by the API in Model schemas.\n *\n * @group API Entities\n */\nexport interface FieldGroup {\n title: string\n type: string\n fields: Field[]\n}\n\n/**\n * Represents a Model schema entity returned by the API.\n *\n * @group API Entities\n */\nexport interface ModelSchema {\n version: number\n groups: FieldGroup[]\n}\n\n/**\n * Represents a Form entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Form extends StarlightEntity {\n title: string\n slug: string\n action_url: string\n}\n\n/**\n * Represents a Form schema entity returned by the API.\n *\n * @group API Entities\n */\nexport interface FormSchema extends ModelSchema {\n action_url: string\n}\n\n/**\n * Represents content data returned by either an {@link Entry} or\n * {@link Singleton} entity from the API.\n *\n * This is a utility type used internally by the SDK and you don't\n * need to use it. Its purpose is to constraint Entry and Singleton\n * data to the shape of a JS object.\n *\n * @category Internal Types\n */\nexport type SerializedData = Record<string, unknown> | undefined\n\n/**\n * Utility type that creates a string map of all fields of the given\n * SerializedData type with the `field:` prefix. This syntax allows to filter\n * specific fields when listing {@apilink Entry | Entries}:\n *\n * - Text fields can be filtered by a string query. This works just like\n * passing a `query` parameter, but it only applies to one field.\n * - Boolean fields can be filtered by \"true\" or \"false\".\n *\n * If a request uses this type, it means that this syntax can be used in their\n * parameters:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.entries.list({\n * // EntrySelector.list() supports the \"field:foo\" syntax:\n * 'field:content': 'hello world',\n * 'field:is_featured': true,\n *\n * // EntrySelector.list() also support other parameters,\n * // which are passed in this object too:\n * page: 42,\n * limit: 20,\n * })\n * ```\n *\n * @remark\n *\n * The information below is only useful for SDK maintainers.\n *\n * This type receives a {@link SerializedData}-like structure, like an object.\n * For instance, for an {@link Entry} with fields \"content\" and \"summary\",\n * the generated type would look like this:\n *\n * ```ts\n * type GeneratedType = {\n * 'field:content'?: string\n * 'field:summary'?: string\n * }\n * ```\n *\n * However, note that QueryableFields receive a {@link SerializedData}, not an\n * {@link Entry}:\n *\n * ```ts\n * import { VisualField, StringField } from '@starlightcms/js-sdk'\n *\n * type EntryFields = {\n * content: VisualField\n * summary: StringField\n * }\n *\n * type MyEntry = Entry<EntryFields>\n *\n * // Error TS2344: Type does not satisfy the constraint 'SerializedData'\n * type GeneratedType = QueryableFields<MyEntry>\n *\n * // Works!\n * type GeneratedType = QueryableFields<EntryFields>\n * ```\n *\n * This type is only useful to request methods that support\n * field querying using the \"field:foo\" syntax.\n *\n * @category Internal Types\n */\nexport type QueryableFields<D extends SerializedData> = {\n [K in keyof D as `field:${string & K}`]?: string | boolean\n}\n\n/**\n * Utility type that return {@link QueryableFields} if the given type T\n * is an {@link Entry} or a {@link Singleton}, but generates an empty object\n * otherwise.\n *\n * Fun fact: internally, Entries and Singletons have parent Models,\n * which is why they are called \"modelables\" here.\n *\n * @category Internal Types\n */\nexport type WithQueryableFieldsOnModelables<T> = T extends\n | Entry<never>\n | Singleton<never>\n ? QueryableFields<T['data']>\n : never\n\n/**\n * Represents an Entry entity returned by the API.\n *\n * An Entry's `data` field can be further typed by passing an object-like\n * structure as the D generic type. This is useful to provide type-safety to\n * your application, since the `data` field is a generic JS object by default.\n *\n * It's recommended to use the Field types provided by this SDK to type your\n * entities using a type definition file on your project. For instance:\n *\n * ```ts\n * // starlight.d.ts file\n * import { VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * declare module '@starlightcms/js-sdk' {\n * export interface DefaultModelDefinition {\n * posts: PostFields\n * }\n * }\n * ```\n *\n * You can place this type definition file anywhere in your repository, but it's\n * good practice to place it at the same level as your root index.ts file. Then,\n * in your files, all SDK calls will correctly type `posts`:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry<PostFields>> on request success\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<PostFields>\n * const helloWorld = response.data\n * ```\n *\n * See {@apilink DefaultModelDefinition} for more info.\n *\n * @group API Entities\n */\nexport interface Entry<D extends SerializedData>\n extends Omit<StarlightEntity, 'created_at'> {\n title: string\n slug: string\n data: D\n author: Author\n model?: Model\n category: ModelCategory | null\n published_at: string | null\n}\n\n/**\n * Represents a Singleton entity returned by the API.\n *\n * A Singleton's `data` field can be further typed by passing an object-like\n * structure as the D generic type. This is useful to provide type-safety to\n * your application, since the `data` field is a generic JS object by default.\n *\n * It's recommended to use the Field types provided by this SDK to type your\n * Singletons. For instance:\n *\n * ```ts\n * import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type HomeFields = {\n * site_title: StringField\n * hero_image: MediaField\n * hero_content: VisualField\n * }\n *\n * // response type will be StarlightItemResponse<Singleton<HomeFields>> on request success\n * const response = Starlight.singletons.get<HomeFields>('home')\n *\n * // home type is Singleton<HomeFields>\n * const home = response.data\n * ```\n *\n * You could also place all your Singleton field types in the same type\n * definition file used to configure Entry fields, which makes it easier to\n * import these types in other files on your project. See\n * {@apilink DefaultModelDefinition} for more info.\n *\n * @group API Entities\n */\nexport interface Singleton<D extends SerializedData>\n extends Omit<StarlightEntity, 'created_at'> {\n title: string\n slug: string\n data: D\n published_at: string | null\n}\n\n/**\n * Currently supported Collection types. This type is mainly used to provide\n * autocompletion on IDEs, since it lets users use any string as well as the\n * known supported types.\n *\n * @internal\n */\nexport type CollectionTypes = 'entry' | 'singleton' | 'media' | string\n\n/**\n * Currently supported Collection entities. This type is mainly used to infer\n * the collection type string (see {@link CollectionTypes}) from the type of\n * entity that that Collection holds.\n *\n * @internal\n */\nexport type CollectionEntityTypes =\n | Entry<never>\n | Singleton<never>\n | MediaObject\n | unknown\n\n/**\n * Infers a Collection type from an entity type. See {@link CollectionTypes} and\n * {@link CollectionEntityTypes} to know more.\n *\n * @internal\n */\nexport type CollectionTypeMapper<T extends CollectionEntityTypes> =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Entry<any>\n ? 'entry'\n : T extends Singleton<any> // eslint-disable-line @typescript-eslint/no-explicit-any\n ? 'singleton'\n : T extends MediaObject\n ? 'media'\n : string\n\n/**\n * Represents a Collection entity returned by the API.\n *\n * You can request collections using a {@link CollectionInstance} or a\n * {@link CollectionSelector}.\n *\n * @group API Entities\n */\nexport interface Collection<T extends CollectionTypes = string>\n extends StarlightEntity {\n title: string\n slug: string\n type: T\n item_count?: number\n}\n\n/**\n * Currently supported Relation types.\n */\ntype RelationTypes =\n | Entry<never>\n | Singleton<never>\n | MediaObject\n | Collection\n | unknown\n\n/**\n * Represents a Relation entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Relation<T extends RelationTypes> {\n /**\n * The relation type, which is always a string. If the `object` field of this\n * Relation is an Entry, type will be `entry`, if it's a Singleton, type will\n * be `singleton`, and so on.\n */\n type: T extends Entry<never>\n ? 'entry'\n : T extends Singleton<never>\n ? 'singleton'\n : T extends MediaObject\n ? 'media'\n : T extends Collection\n ? 'collection'\n : string\n id: number\n object: T\n}\n"]}
1
+ {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Base interface used by all entities returned by the API.\n *\n * @internal\n */\ninterface StarlightEntity {\n id: number\n created_at: string\n updated_at?: string\n}\n\n/**\n * Represents a Model Category entity returned by the API.\n *\n * @group API Entities\n */\nexport interface ModelCategory extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\n/**\n * Represents a Media File entity returned by the API.\n *\n * @group API Entities\n */\nexport interface MediaFile extends StarlightEntity {\n variation: string\n path: string\n mime: string\n background_color?: string\n filesize: number\n meta?: Record<string, unknown>\n}\n\n/**\n * Represents a Media Object entity returned by the API.\n *\n * @group API Entities\n */\nexport interface MediaObject extends StarlightEntity {\n name: string\n extension: string\n mime: string\n files: MediaFile[]\n alt?: string\n description?: string\n}\n\n/**\n * Represents an Author entity returned by the API. Authors are returned in\n * {@link Entry} requests.\n *\n * @group API Entities\n */\nexport interface Author {\n id: number\n name: string\n}\n\n/**\n * Represents a Model entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Model extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\n/**\n * Represents a field returned by the API in Model schemas.\n *\n * @group API Entities\n */\nexport interface Field {\n title: string\n key: string\n type: string\n is_required: boolean\n is_listable: boolean\n is_private: boolean\n is_archived: boolean\n rules?: {\n [rule: string]: unknown\n }\n}\n\n/**\n * Represents a group of fields returned by the API in Model schemas.\n *\n * @group API Entities\n */\nexport interface FieldGroup {\n title: string\n type: string\n fields: Field[]\n}\n\n/**\n * Represents a Model schema entity returned by the API.\n *\n * @group API Entities\n */\nexport interface ModelSchema {\n version: number\n groups: FieldGroup[]\n}\n\n/**\n * Represents a Form entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Form extends StarlightEntity {\n title: string\n slug: string\n action_url: string\n}\n\n/**\n * Represents a Form schema entity returned by the API.\n *\n * @group API Entities\n */\nexport interface FormSchema extends ModelSchema {\n action_url: string\n}\n\n/**\n * Represents content data returned by either an {@link Entry} or\n * {@link Singleton} entity from the API.\n *\n * This is a utility type used internally by the SDK and you don't\n * need to use it. Its purpose is to constraint Entry and Singleton\n * data to the shape of a JS object.\n *\n * @category Internal Types\n */\nexport type SerializedData = Record<string, unknown> | undefined\n\n/**\n * Utility type that creates a string map of all fields of the given\n * SerializedData type with the `field:` prefix. This syntax allows to filter\n * specific fields when listing {@apilink Entry | Entries}:\n *\n * - Text fields can be filtered by a string query. This works just like\n * passing a `query` parameter, but it only applies to one field.\n * - Boolean fields can be filtered by \"true\" or \"false\".\n *\n * If a request uses this type, it means that this syntax can be used in their\n * parameters:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.entries.list({\n * // EntrySelector.list() supports the \"field:foo\" syntax:\n * 'field:content': 'hello world',\n * 'field:is_featured': true,\n *\n * // EntrySelector.list() also support other parameters,\n * // which are passed in this object too:\n * page: 42,\n * limit: 20,\n * })\n * ```\n *\n * @remark\n *\n * The information below is only useful for SDK maintainers.\n *\n * This type receives a {@link SerializedData}-like structure, like an object.\n * For instance, for an {@link Entry} with fields \"content\" and \"summary\",\n * the generated type would look like this:\n *\n * ```ts\n * type GeneratedType = {\n * 'field:content'?: string\n * 'field:summary'?: string\n * }\n * ```\n *\n * However, note that QueryableFields receive a {@link SerializedData}, not an\n * {@link Entry}:\n *\n * ```ts\n * import { VisualField, StringField } from '@starlightcms/js-sdk'\n *\n * type EntryFields = {\n * content: VisualField\n * summary: StringField\n * }\n *\n * type MyEntry = Entry<EntryFields>\n *\n * // Error TS2344: Type does not satisfy the constraint 'SerializedData'\n * type GeneratedType = QueryableFields<MyEntry>\n *\n * // Works!\n * type GeneratedType = QueryableFields<EntryFields>\n * ```\n *\n * This type is only useful to request methods that support\n * field querying using the \"field:foo\" syntax.\n *\n * @category Internal Types\n */\nexport type QueryableFields<D extends SerializedData> = {\n [K in keyof D as `field:${string & K}`]?: string | boolean\n}\n\n/**\n * Utility type that return {@link QueryableFields} if the given type T\n * is an {@link Entry} or a {@link Singleton}, but generates an empty object\n * otherwise.\n *\n * Fun fact: internally, Entries and Singletons have parent Models,\n * which is why they are called \"modelables\" here.\n *\n * @category Internal Types\n */\nexport type WithQueryableFieldsOnModelables<T> = T extends\n | Entry<never>\n | Singleton<never>\n ? QueryableFields<T['data']>\n : never\n\n/**\n * Represents an Entry entity returned by the API.\n *\n * An Entry's `data` field can be further typed by passing an object-like\n * structure as the D generic type. This is useful to provide type-safety to\n * your application, since the `data` field is a generic JS object by default.\n *\n * It's recommended to use the Field types provided by this SDK to type your\n * entities using a type definition file on your project. For instance:\n *\n * ```ts\n * // starlight.d.ts file\n * import { VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * declare module '@starlightcms/js-sdk' {\n * export interface DefaultModelDefinition {\n * posts: PostFields\n * }\n * }\n * ```\n *\n * You can place this type definition file anywhere in your repository, but it's\n * good practice to place it at the same level as your root index.ts file. Then,\n * in your files, all SDK calls will correctly type `posts`:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry<PostFields>> on request success\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<PostFields>\n * const helloWorld = response.data\n * ```\n *\n * See {@apilink DefaultModelDefinition} for more info.\n *\n * @group API Entities\n */\nexport interface Entry<D extends SerializedData> extends Omit<\n StarlightEntity,\n 'created_at'\n> {\n title: string\n slug: string\n data: D\n author: Author\n model?: Model\n category: ModelCategory | null\n published_at: string | null\n}\n\n/**\n * Represents a Singleton entity returned by the API.\n *\n * A Singleton's `data` field can be further typed by passing an object-like\n * structure as the D generic type. This is useful to provide type-safety to\n * your application, since the `data` field is a generic JS object by default.\n *\n * It's recommended to use the Field types provided by this SDK to type your\n * Singletons. For instance:\n *\n * ```ts\n * import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type HomeFields = {\n * site_title: StringField\n * hero_image: MediaField\n * hero_content: VisualField\n * }\n *\n * // response type will be StarlightItemResponse<Singleton<HomeFields>> on request success\n * const response = Starlight.singletons.get<HomeFields>('home')\n *\n * // home type is Singleton<HomeFields>\n * const home = response.data\n * ```\n *\n * You could also place all your Singleton field types in the same type\n * definition file used to configure Entry fields, which makes it easier to\n * import these types in other files on your project. See\n * {@apilink DefaultModelDefinition} for more info.\n *\n * @group API Entities\n */\nexport interface Singleton<D extends SerializedData> extends Omit<\n StarlightEntity,\n 'created_at'\n> {\n title: string\n slug: string\n data: D\n published_at: string | null\n}\n\n/**\n * Currently supported Collection types. This type is mainly used to provide\n * autocompletion on IDEs, since it lets users use any string as well as the\n * known supported types.\n *\n * @internal\n */\nexport type CollectionTypes = 'entry' | 'singleton' | 'media' | string\n\n/**\n * Currently supported Collection entities. This type is mainly used to infer\n * the collection type string (see {@link CollectionTypes}) from the type of\n * entity that that Collection holds.\n *\n * @internal\n */\nexport type CollectionEntityTypes =\n | Entry<never>\n | Singleton<never>\n | MediaObject\n | unknown\n\n/**\n * Infers a Collection type from an entity type. See {@link CollectionTypes} and\n * {@link CollectionEntityTypes} to know more.\n *\n * @internal\n */\nexport type CollectionTypeMapper<T extends CollectionEntityTypes> =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Entry<any>\n ? 'entry'\n : T extends Singleton<any> // eslint-disable-line @typescript-eslint/no-explicit-any\n ? 'singleton'\n : T extends MediaObject\n ? 'media'\n : string\n\n/**\n * Represents a Collection entity returned by the API.\n *\n * You can request collections using a {@link CollectionInstance} or a\n * {@link CollectionSelector}.\n *\n * @group API Entities\n */\nexport interface Collection<\n T extends CollectionTypes = string,\n> extends StarlightEntity {\n title: string\n slug: string\n type: T\n item_count?: number\n}\n\n/**\n * Currently supported Relation types.\n */\ntype RelationTypes =\n | Entry<never>\n | Singleton<never>\n | MediaObject\n | Collection\n | unknown\n\n/**\n * Represents a Relation entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Relation<T extends RelationTypes> {\n /**\n * The relation type, which is always a string. If the `object` field of this\n * Relation is an Entry, type will be `entry`, if it's a Singleton, type will\n * be `singleton`, and so on.\n */\n type: T extends Entry<never>\n ? 'entry'\n : T extends Singleton<never>\n ? 'singleton'\n : T extends MediaObject\n ? 'media'\n : T extends Collection\n ? 'collection'\n : string\n id: number\n object: T\n}\n"]}
@@ -9,7 +9,7 @@ import { VisualData } from './visual';
9
9
  *
10
10
  * @group Data Fields
11
11
  */
12
- export declare type BooleanField = boolean;
12
+ export type BooleanField = boolean;
13
13
  /**
14
14
  * Represents a HTML Field returned by the API.
15
15
  *
@@ -19,7 +19,7 @@ export declare type BooleanField = boolean;
19
19
  *
20
20
  * @group Data Fields
21
21
  */
22
- export declare type HtmlField = string;
22
+ export type HtmlField = string;
23
23
  /**
24
24
  * Represents a Media Field returned by the API.
25
25
  *
@@ -29,7 +29,7 @@ export declare type HtmlField = string;
29
29
  *
30
30
  * @group Data Fields
31
31
  */
32
- export declare type MediaField = MediaObject;
32
+ export type MediaField = MediaObject;
33
33
  /**
34
34
  * Represents a Relation Field returned by the API.
35
35
  *
@@ -39,7 +39,7 @@ export declare type MediaField = MediaObject;
39
39
  *
40
40
  * @group Data Fields
41
41
  */
42
- export declare type RelationField<T> = Relation<T>;
42
+ export type RelationField<T> = Relation<T>;
43
43
  /**
44
44
  * Represents a String Field returned by the API.
45
45
  *
@@ -49,7 +49,7 @@ export declare type RelationField<T> = Relation<T>;
49
49
  *
50
50
  * @group Data Fields
51
51
  */
52
- export declare type StringField = string;
52
+ export type StringField = string;
53
53
  /**
54
54
  * Represents a Text Field returned by the API.
55
55
  *
@@ -59,7 +59,7 @@ export declare type StringField = string;
59
59
  *
60
60
  * @group Data Fields
61
61
  */
62
- export declare type TextField = string;
62
+ export type TextField = string;
63
63
  /**
64
64
  * Represents a Visual Field returned by the API.
65
65
  *
@@ -69,5 +69,5 @@ export declare type TextField = string;
69
69
  *
70
70
  * @group Data Fields
71
71
  */
72
- export declare type VisualField = VisualData;
72
+ export type VisualField = VisualData;
73
73
  //# sourceMappingURL=fields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/types/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC;;;;;;;;GAQG;AACH,oBAAY,YAAY,GAAG,OAAO,CAAA;AAElC;;;;;;;;GAQG;AACH,oBAAY,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;;;;;GAQG;AACH,oBAAY,UAAU,GAAG,WAAW,CAAA;AAEpC;;;;;;;;GAQG;AACH,oBAAY,aAAa,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAA;AAE1C;;;;;;;;GAQG;AACH,oBAAY,WAAW,GAAG,MAAM,CAAA;AAEhC;;;;;;;;GAQG;AACH,oBAAY,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;;;;;GAQG;AACH,oBAAY,WAAW,GAAG,UAAU,CAAA"}
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/types/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,CAAA;AAElC;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,CAAA;AAEpC;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAA;AAE1C;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAA"}
@@ -18,7 +18,7 @@ export * from './selectors';
18
18
  * provides a default one which can be used by IDEs to provide auto-completion.
19
19
  * The default URL points to version 2 of the Query API.
20
20
  */
21
- export declare type BaseUrl = 'https://query.starlightcms.io/v2' | string;
21
+ export type BaseUrl = 'https://query.starlightcms.io/v2' | string;
22
22
  /**
23
23
  * The available options to configure a {@link StarlightClient}.
24
24
  *
@@ -26,7 +26,7 @@ export declare type BaseUrl = 'https://query.starlightcms.io/v2' | string;
26
26
  * {@apilink default | default client}.
27
27
  * @group Client
28
28
  */
29
- export declare type StarlightConfig = {
29
+ export type StarlightConfig = {
30
30
  /**
31
31
  * The ID of the workspace that the client should use to request data.
32
32
  *
@@ -205,7 +205,7 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
205
205
  * const response = await Starlight.form('signup').schema()
206
206
  * ```
207
207
  *
208
- * See {@link DynamicFormInstance} for more info.
208
+ * See {@link FormInstance} for more info.
209
209
  *
210
210
  * @category Instance Methods
211
211
  */
@@ -323,7 +323,7 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
323
323
  *
324
324
  * @group Client
325
325
  */
326
- export declare type DynamicStarlightClient<T extends WorkspaceModelDefinition> = StarlightClient<T> & {
326
+ export type DynamicStarlightClient<T extends WorkspaceModelDefinition> = StarlightClient<T> & {
327
327
  [K in keyof T]: DynamicModelInstance<T[K]>;
328
328
  };
329
329
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAE7D,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAE3B;;;;GAIG;AACH,oBAAY,OAAO,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M,CAAA;IACd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAWA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA","sourcesContent":["import { CollectionEntityTypes, SerializedData } from './entities'\nimport { DynamicModelSelector } from '../selectors/Model'\nimport { DynamicModelInstance } from '../instances/Model'\nimport { SingletonSelector } from '../selectors/Singleton'\nimport { DynamicCollectionSelector } from '../selectors/Collection'\nimport { MediaSelector } from '../selectors/Media'\nimport { SearchSelector } from '../selectors/Search'\nimport { CollectionInstance } from '../instances/Collection'\nimport { FormInstance } from '../instances/Form'\nimport { DynamicFormSelector } from '../selectors/Form/types'\n\nexport * from './fields'\nexport * from './entities'\nexport * from './visual'\nexport * from './instances'\nexport * from './selectors'\n\n/**\n * This is a utility type that allows any string to be used as a URL, but\n * provides a default one which can be used by IDEs to provide auto-completion.\n * The default URL points to version 2 of the Query API.\n */\nexport type BaseUrl = 'https://query.starlightcms.io/v2' | string\n\n/**\n * The available options to configure a {@link StarlightClient}.\n *\n * `workspace` is required when creating new clients or configuring the\n * {@apilink default | default client}.\n * @group Client\n */\nexport type StarlightConfig = {\n /**\n * The ID of the workspace that the client should use to request data.\n *\n * Note: the current APIs only support using workspace IDs as identifiers,\n * and **not** slugs. Slug support will be added in the future. You can find\n * the workspace ID in the left-side menu on the Starlight interface or below\n * the workspace name in the workspace list.\n */\n workspace?: string\n /**\n * The Starlight Query API URL, including the version, and without a trailing\n * slash. Defaults to the production Query API URL.\n *\n * You only need to set this if you're not using Starlight's production APIs.\n */\n baseUrl?: BaseUrl\n /**\n * When true, logs all API requests in the console. Defaults to false.\n */\n debug?: boolean\n}\n\n/**\n * The Starlight client is the main entry point for any requests you might want\n * to make to Starlight's APIs.\n *\n * There's two ways of interacting with a client: using the\n * {@apilink default | default client} exported by the SDK or creating a new\n * client instance using the\n * {@apilink makeStarlightClient | makeStarlightClient function}. Follow the\n * provided links to learn how to use each method.\n *\n * Either way you choose to interact, all clients expose the same methods and\n * accessors that provide ways to request data. These methods and accessors\n * return Selector or Instance objects, which are documented in the sections\n * of the same name found in this API's sidebar.\n *\n * @group Client\n */\nexport interface StarlightClient<\n D extends WorkspaceModelDefinition = DefaultModelDefinition\n> {\n /**\n * Updates the client configuration. See {@link StarlightConfig} to see all\n * the available options.\n *\n * If you want to use the {@apilink default | default SDK client}, you need to\n * set its workspace using this method in your application. You should run\n * this method only once, and as soon as possible in your application\n * lifecycle. For instance, when using React:\n *\n * ```js\n * // src/index.js\n * import { createRoot } from \"react-dom/client\"\n * import Starlight from '@starlightcms/js-sdk'\n * import MyApp from './MyApp.js'\n *\n * // We only need to run this once. In this case, we're\n * // running it before initializing our React app.\n * Starlight.configure({\n * workspace: '1234567890'\n * })\n *\n * const rootElement = document.getElementById(\"root\")\n * const root = createRoot(rootElement)\n *\n * root.render(<MyApp />)\n * ```\n *\n * @param config A configuration object. See {@link StarlightConfig} to view\n * all available options.\n * @category Other Methods\n */\n configure(config: StarlightConfig): void\n\n /**\n * Logs a message (or any kind of data, really) into the console if the debug\n * configuration is true. Uses `console.log` internally.\n *\n * This function's type definition is the same as the `console.log` function.\n *\n * @param message The data that will be logged.\n * @param optionalParams Additional data to be logged or string substitutions.\n * @see [MDN documentation on console.log](https://developer.mozilla.org/en-US/docs/web/api/console/log)\n * @internal\n */\n log(message?: unknown, ...optionalParams: unknown[]): void\n\n /**\n * Returns the base API URL for requests, including the configured workspace.\n * Doesn't include a trailing slash.\n *\n * @internal\n */\n getBaseUrl(): string\n\n /**\n * Returns a Promise that results in a response or throws a StarlightError.\n * The response will be the parsed JSON data sent by the API.\n *\n * This method is used internally by all Selectors and Instances to request\n * data to Starlight's Query API, but it can also be used standalone if\n * desired.\n *\n * This method automatically prefixes the given path with the API URL, but it\n * doesn't include a trailing slash, so be sure to include one at the start\n * of your path.\n *\n * @param path The path to GET. Will be prefixed with the API URL. Must start\n * with a forward slash (/).\n * @param params An optional object of values that will be converted to a\n * string and passed as GET params.\n * @param options An optional configuration object passed to the fetch method.\n * Check [MDN documentation on fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch)\n * to see the available options.\n * @typeParam T - The shape of the expected response on success. Client\n * methods generally pass {@link StarlightItemResponse} or\n * {@link StarlightListResponse} types here.\n * @throws {@link StarlightError} on any errors.\n * @category Other Methods\n */\n get<T = Record<string, unknown>>(\n path: string,\n params?: Record<string, string | number | boolean | undefined>,\n options?: RequestInit\n ): Promise<T>\n\n /**\n * Returns a {@link DynamicModelSelector}, which is a {@link ModelSelector}\n * with support for creating {@apilink ModelInstance | ModelInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.models.list()\n * ```\n *\n * See {@link DynamicModelSelector} for more info.\n *\n * @category Selector Accessors\n */\n get models(): DynamicModelSelector<D>\n\n /**\n * Returns a {@link DynamicModelInstance}, which is a\n * {@link ModelInstance} with support for creating\n * {@apilink ModelCategoryInstance | ModelCategoryInstances} using the dynamic syntax. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.model('posts').entries.list()\n * ```\n *\n * See {@link DynamicModelInstance} for more info.\n *\n * @category Instance Methods\n */\n model<S extends keyof D>(slug: S): DynamicModelInstance<D[S]>\n\n /**\n * Returns a {@link DynamicFormSelector}, which provides support for creating\n * {@apilink FormInstance | FormInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.forms.signup.get()\n * ```\n *\n * See {@link DynamicFormSelector} for more info.\n *\n * @category Selector Accessors\n */\n get forms(): DynamicFormSelector\n\n /**\n * Returns a {@link FormInstance}, which provides methods to retrieve basic information\n * about a Starlight form and its schema. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.form('signup').schema()\n * ```\n *\n * See {@link DynamicFormInstance} for more info.\n *\n * @category Instance Methods\n */\n form(slug: string | number): FormInstance\n\n /**\n * Returns a {@link SingletonSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.singletons.list()\n * ```\n *\n * See {@link SingletonSelector} for more info.\n *\n * @category Selector Accessors\n */\n get singletons(): SingletonSelector\n\n /**\n * Returns a {@link DynamicCollectionSelector}, which is a\n * {@link CollectionSelector} with support for creating\n * {@apilink CollectionInstance | CollectionInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collections.list()\n * ```\n *\n * See {@link DynamicCollectionSelector} for more info.\n *\n * @category Selector Accessors\n */\n get collections(): DynamicCollectionSelector\n\n /**\n * Returns a {@link CollectionInstance}. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection('featured-posts').items()\n * ```\n *\n * See {@link CollectionInstance} for more info.\n *\n * @example Typing the returned CollectionInstance.\n * ```ts\n * import Starlight, { MediaObject } from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection<MediaObject>('carousel-images').items()\n * ```\n *\n * @typeParam T - The type of entity this Collection holds. You can pass this\n * type parameter to correctly type the response of the\n * {@apilink CollectionInstance.items} method.\n * @category Instance Methods\n */\n collection<T extends CollectionEntityTypes>(\n slug: string | number\n ): CollectionInstance<T>\n\n /**\n * Returns a {@link MediaSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.media.list()\n * ```\n *\n * See {@link MediaSelector} for more info.\n *\n * @category Selector Accessors\n */\n get media(): MediaSelector\n\n /**\n * Returns a {@link SearchSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.search.entries()\n * ```\n *\n * See {@link SearchSelector} for more info.\n *\n * @category Selector Accessors\n */\n get search(): SearchSelector\n}\n\n/**\n * This type adds support for the dynamic syntax to the StarlightClient\n * interface, which allows users to create\n * {@apilink DynamicModelInstance| DynamicModelInstances} dynamically.\n * See {@link StarlightClient} to learn which methods it provides. Also see\n * {@doclink requests-and-responses#dynamic-syntax | Dynamic Instances}\n * documentation to learn more about the dynamic syntax.\n *\n *\n * This allows TypeScript to correctly type all models defined by the user\n * in the DefaultModelDefinition type, aside from letting the user using any\n * \"unknown\" model slug, which is provided by the WorkspaceModelDefinition type.\n *\n * This type is only aware of the DefaultModelDefinition type because the\n * StarlightClient uses it by default when no model definition type is passed.\n *\n * @group Client\n */\nexport type DynamicStarlightClient<T extends WorkspaceModelDefinition> =\n StarlightClient<T> & {\n [K in keyof T]: DynamicModelInstance<T[K]>\n }\n\n/**\n * This interface represents an API response that returns a single entity, like\n * a single {@link Entry} or a single {@link MediaObject}, for instance.\n *\n * It contains only one field: `data`. This field type is generic and\n * depends on the kind of request that was made to the API.\n *\n * All SDK request methods that returna single entity\n * will return this interface.\n *\n * @group Client\n */\nexport interface StarlightItemResponse<T> {\n /**\n * The entity returned by the API request. Its type depends on which request\n * was made. SDK methods will generally type this parameter automatically.\n */\n data: T\n}\n\n/**\n * This interface represents an API response that returns a list of entities,\n * like a list of {@apilink Entry | Entries} or a list of items from a\n * {@link Collection}.\n *\n * It contains a `data` parameter, which is an array of items with a generic\n * type that depends on the kind of request that was made, and two metadata\n * objects: `links` and `meta`. Metadata is useful for pagination.\n *\n * All SDK request methods that return a list of entities will return this\n * interface.\n *\n * @group Client\n */\nexport interface StarlightListResponse<T> {\n /**\n * The list of entities returned by the API request. Its type depends on which\n * request was made. SDK methods will generally type\n * this parameter automatically.\n */\n data: T[]\n /**\n * An object containing useful links for easier pagination. All links points\n * to the same list requested, but with a varying `page` parameter.\n */\n links: {\n /**\n * A link for the first page of the list.\n */\n first: string\n /**\n * A link for the last page of the list.\n */\n last: string\n /**\n * A link to the previous page of the list, if there's any.\n */\n prev?: string\n /**\n * A link to the next page of the list, if there's any.\n */\n next?: string\n }\n /**\n * An object with useful metadata related to the current list. It can be used\n * in applications to create pagination logic and interfaces.\n *\n * `from` and `to` are indexes indicating which items start and finish the\n * current page of the list. For instance, in a list with 100 items with 15\n * items per page, on the first page, `from` and `to` will be `1` and `15`\n * respectively.\n */\n meta: {\n /**\n * The number of the current page.\n */\n current_page: number\n /**\n * The number of the last page for the current list.\n */\n last_page: number\n /**\n * The index of the first item on this page out of all list items.\n */\n from: number\n /**\n * The index of the last item on this page out of all list items.\n */\n to: number\n /**\n * The number of items per page.\n */\n per_page: number\n /**\n * The total number of items in the current list.\n */\n total: number\n }\n}\n\n/**\n * The DefaultModelDefinition type is used to correctly type Entry data when\n * requesting it using a StarlightClient.\n *\n * Without using a DefaultModelDefinition, Entry data will be typed as a\n * \"generic\" JS object which can hold any kind of data:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry> on request success.\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<Record<string, unknown>>. This means that\n * // `data` can hold anything, which is not type-safe.\n * const helloWorld = response.data\n * ```\n *\n * One way of safely adding type information to Entry objects is by passing a\n * data definition type to the EntrySelector when requesting something:\n *\n * ```ts\n * import Starlight, { VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * // response type will now be StarlightItemResponse<Entry<PostsFields>>.\n * const response = await Starlight.posts.entries<PostFields>.get('hello-world')\n *\n * // Now, helloWorld type is Entry<PostsFields>.\n * const helloWorld = response.data\n *\n * // Which means we can safely access its data, and IDEs will\n * // auto-complete the data field name below:\n * console.log(helloWorld.data.featured_image)\n * ```\n *\n * Note that we used \"Fields\" to define our data shape. We recommend using these\n * types, which are exported by this SDK, because they map to the field types\n * available in the Starlight admin when creating models, and should simplify\n * the type definition process. All available Field types are documented in the\n * {@apilink BooleanField | Data Fields section of this API}.\n *\n * However, passing model definition types around your application is not ideal,\n * and actually unnecessary. Using the DefaultModelDefinition type, all model\n * definitions can be automatically inferred.\n *\n * To get started, you need to create a\n * [type declaration file](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)\n * in which you'll define all your types. You can name it anything and place it\n * anywhere inside your project, but we recommend naming it `starlight.d.ts` and\n * placing it in the root folder of your source code, so it can be easily\n * imported later in your application if you ever need to reference these types.\n *\n * In this file, you can place all your model type definitions (including type\n * definitions for Singleton data, if you want!). Finally, you just need to\n * add a \"module definition block\" that will tell the SDK which types you expect\n * to receive when requesting models.\n *\n * Here's a complete exemple defining two models, Posts and Magazines:\n *\n * ```ts\n * import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * type MagazineFields = {\n * cover_image: MediaField\n * content: VisualField\n * issue_number: StringField\n * issue_year: StringField\n * }\n *\n * declare module '@starlightcms/js-sdk' {\n * export interface DefaultModelDefinition {\n * // Notice that each key in this interface is a Model slug!\n * posts: PostFields\n * magazines: MagazineFields\n * }\n * }\n * ```\n *\n * After creating this file, types should be automatically inferred without the\n * need to pass these types around:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry<PostsFields>>,\n * // which was implicitly inferred by the SDK!\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<PostsFields>\n * const helloWorld = response.data\n *\n * // Auto-complete will work just as before when we explicitly type the Entry!\n * console.log(helloWorld.data.featured_image)\n * ```\n *\n * @group Client\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface DefaultModelDefinition extends WorkspaceModelDefinition {}\n\n/**\n * This type is only used as a base for the DefaultModelDefinition type.\n *\n * @internal\n */\nexport interface WorkspaceModelDefinition {\n [slug: string]: SerializedData\n}\n\n/**\n * Request parameters used by most SDK `list()` methods.\n *\n * @group Request Parameters\n */\nexport interface BaseRequestParameters {\n [key: string]: string | number | boolean | undefined\n /**\n * The page requested.\n */\n page?: number\n /**\n * The limit of items per page.\n */\n limit?: number\n /**\n * A search query string.\n *\n * For instance, searching for \"out\" will match both \"check out!\" and\n * \"about us\". Search is not case-sensitive.\n */\n query?: string\n}\n\n/**\n * Request parameters used by most SDK methods that support advanced querying.\n *\n * @group Request Parameters\n */\nexport interface QueryableRequestParameters {\n /**\n * A search query string that matches a specific word within boundaries.\n * Search is not case-sensitive.\n *\n * For instance, searching for \"phone\" will match \"This is my phone!\"\n * but won't match \"This is my telephone!\".\n */\n 'query:word'?: string\n /**\n * A comma-separated list of fields to look up on when searching using\n * `query` or `query:word`. If undefined, all text fields will be searched on,\n * including Visual Editor fields. Search is not case-sensitive.\n *\n * For instance, to limit search on the \"content\" and \"summary\" fields of a\n * model, pass `'content,summary'`.\n */\n fields?: string\n /**\n * If defined, removes the given item from the list. Useful to create \"related\n * posts\" lists.\n *\n * Note: this field only accepts IDs, and not slugs. Only one ID is allowed.\n */\n except?: number\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAWA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA","sourcesContent":["import { CollectionEntityTypes, SerializedData } from './entities'\nimport { DynamicModelSelector } from '../selectors/Model'\nimport { DynamicModelInstance } from '../instances/Model'\nimport { SingletonSelector } from '../selectors/Singleton'\nimport { DynamicCollectionSelector } from '../selectors/Collection'\nimport { MediaSelector } from '../selectors/Media'\nimport { SearchSelector } from '../selectors/Search'\nimport { CollectionInstance } from '../instances/Collection'\nimport { FormInstance } from '../instances/Form'\nimport { DynamicFormSelector } from '../selectors/Form/types'\n\nexport * from './fields'\nexport * from './entities'\nexport * from './visual'\nexport * from './instances'\nexport * from './selectors'\n\n/**\n * This is a utility type that allows any string to be used as a URL, but\n * provides a default one which can be used by IDEs to provide auto-completion.\n * The default URL points to version 2 of the Query API.\n */\nexport type BaseUrl = 'https://query.starlightcms.io/v2' | string\n\n/**\n * The available options to configure a {@link StarlightClient}.\n *\n * `workspace` is required when creating new clients or configuring the\n * {@apilink default | default client}.\n * @group Client\n */\nexport type StarlightConfig = {\n /**\n * The ID of the workspace that the client should use to request data.\n *\n * Note: the current APIs only support using workspace IDs as identifiers,\n * and **not** slugs. Slug support will be added in the future. You can find\n * the workspace ID in the left-side menu on the Starlight interface or below\n * the workspace name in the workspace list.\n */\n workspace?: string\n /**\n * The Starlight Query API URL, including the version, and without a trailing\n * slash. Defaults to the production Query API URL.\n *\n * You only need to set this if you're not using Starlight's production APIs.\n */\n baseUrl?: BaseUrl\n /**\n * When true, logs all API requests in the console. Defaults to false.\n */\n debug?: boolean\n}\n\n/**\n * The Starlight client is the main entry point for any requests you might want\n * to make to Starlight's APIs.\n *\n * There's two ways of interacting with a client: using the\n * {@apilink default | default client} exported by the SDK or creating a new\n * client instance using the\n * {@apilink makeStarlightClient | makeStarlightClient function}. Follow the\n * provided links to learn how to use each method.\n *\n * Either way you choose to interact, all clients expose the same methods and\n * accessors that provide ways to request data. These methods and accessors\n * return Selector or Instance objects, which are documented in the sections\n * of the same name found in this API's sidebar.\n *\n * @group Client\n */\nexport interface StarlightClient<\n D extends WorkspaceModelDefinition = DefaultModelDefinition,\n> {\n /**\n * Updates the client configuration. See {@link StarlightConfig} to see all\n * the available options.\n *\n * If you want to use the {@apilink default | default SDK client}, you need to\n * set its workspace using this method in your application. You should run\n * this method only once, and as soon as possible in your application\n * lifecycle. For instance, when using React:\n *\n * ```js\n * // src/index.js\n * import { createRoot } from \"react-dom/client\"\n * import Starlight from '@starlightcms/js-sdk'\n * import MyApp from './MyApp.js'\n *\n * // We only need to run this once. In this case, we're\n * // running it before initializing our React app.\n * Starlight.configure({\n * workspace: '1234567890'\n * })\n *\n * const rootElement = document.getElementById(\"root\")\n * const root = createRoot(rootElement)\n *\n * root.render(<MyApp />)\n * ```\n *\n * @param config A configuration object. See {@link StarlightConfig} to view\n * all available options.\n * @category Other Methods\n */\n configure(config: StarlightConfig): void\n\n /**\n * Logs a message (or any kind of data, really) into the console if the debug\n * configuration is true. Uses `console.log` internally.\n *\n * This function's type definition is the same as the `console.log` function.\n *\n * @param message The data that will be logged.\n * @param optionalParams Additional data to be logged or string substitutions.\n * @see [MDN documentation on console.log](https://developer.mozilla.org/en-US/docs/web/api/console/log)\n * @internal\n */\n log(message?: unknown, ...optionalParams: unknown[]): void\n\n /**\n * Returns the base API URL for requests, including the configured workspace.\n * Doesn't include a trailing slash.\n *\n * @internal\n */\n getBaseUrl(): string\n\n /**\n * Returns a Promise that results in a response or throws a StarlightError.\n * The response will be the parsed JSON data sent by the API.\n *\n * This method is used internally by all Selectors and Instances to request\n * data to Starlight's Query API, but it can also be used standalone if\n * desired.\n *\n * This method automatically prefixes the given path with the API URL, but it\n * doesn't include a trailing slash, so be sure to include one at the start\n * of your path.\n *\n * @param path The path to GET. Will be prefixed with the API URL. Must start\n * with a forward slash (/).\n * @param params An optional object of values that will be converted to a\n * string and passed as GET params.\n * @param options An optional configuration object passed to the fetch method.\n * Check [MDN documentation on fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch)\n * to see the available options.\n * @typeParam T - The shape of the expected response on success. Client\n * methods generally pass {@link StarlightItemResponse} or\n * {@link StarlightListResponse} types here.\n * @throws {@link StarlightError} on any errors.\n * @category Other Methods\n */\n get<T = Record<string, unknown>>(\n path: string,\n params?: Record<string, string | number | boolean | undefined>,\n options?: RequestInit,\n ): Promise<T>\n\n /**\n * Returns a {@link DynamicModelSelector}, which is a {@link ModelSelector}\n * with support for creating {@apilink ModelInstance | ModelInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.models.list()\n * ```\n *\n * See {@link DynamicModelSelector} for more info.\n *\n * @category Selector Accessors\n */\n get models(): DynamicModelSelector<D>\n\n /**\n * Returns a {@link DynamicModelInstance}, which is a\n * {@link ModelInstance} with support for creating\n * {@apilink ModelCategoryInstance | ModelCategoryInstances} using the dynamic syntax. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.model('posts').entries.list()\n * ```\n *\n * See {@link DynamicModelInstance} for more info.\n *\n * @category Instance Methods\n */\n model<S extends keyof D>(slug: S): DynamicModelInstance<D[S]>\n\n /**\n * Returns a {@link DynamicFormSelector}, which provides support for creating\n * {@apilink FormInstance | FormInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.forms.signup.get()\n * ```\n *\n * See {@link DynamicFormSelector} for more info.\n *\n * @category Selector Accessors\n */\n get forms(): DynamicFormSelector\n\n /**\n * Returns a {@link FormInstance}, which provides methods to retrieve basic information\n * about a Starlight form and its schema. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.form('signup').schema()\n * ```\n *\n * See {@link FormInstance} for more info.\n *\n * @category Instance Methods\n */\n form(slug: string | number): FormInstance\n\n /**\n * Returns a {@link SingletonSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.singletons.list()\n * ```\n *\n * See {@link SingletonSelector} for more info.\n *\n * @category Selector Accessors\n */\n get singletons(): SingletonSelector\n\n /**\n * Returns a {@link DynamicCollectionSelector}, which is a\n * {@link CollectionSelector} with support for creating\n * {@apilink CollectionInstance | CollectionInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collections.list()\n * ```\n *\n * See {@link DynamicCollectionSelector} for more info.\n *\n * @category Selector Accessors\n */\n get collections(): DynamicCollectionSelector\n\n /**\n * Returns a {@link CollectionInstance}. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection('featured-posts').items()\n * ```\n *\n * See {@link CollectionInstance} for more info.\n *\n * @example Typing the returned CollectionInstance.\n * ```ts\n * import Starlight, { MediaObject } from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection<MediaObject>('carousel-images').items()\n * ```\n *\n * @typeParam T - The type of entity this Collection holds. You can pass this\n * type parameter to correctly type the response of the\n * {@apilink CollectionInstance.items} method.\n * @category Instance Methods\n */\n collection<T extends CollectionEntityTypes>(\n slug: string | number,\n ): CollectionInstance<T>\n\n /**\n * Returns a {@link MediaSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.media.list()\n * ```\n *\n * See {@link MediaSelector} for more info.\n *\n * @category Selector Accessors\n */\n get media(): MediaSelector\n\n /**\n * Returns a {@link SearchSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.search.entries()\n * ```\n *\n * See {@link SearchSelector} for more info.\n *\n * @category Selector Accessors\n */\n get search(): SearchSelector\n}\n\n/**\n * This type adds support for the dynamic syntax to the StarlightClient\n * interface, which allows users to create\n * {@apilink DynamicModelInstance| DynamicModelInstances} dynamically.\n * See {@link StarlightClient} to learn which methods it provides. Also see\n * {@doclink requests-and-responses#dynamic-syntax | Dynamic Instances}\n * documentation to learn more about the dynamic syntax.\n *\n *\n * This allows TypeScript to correctly type all models defined by the user\n * in the DefaultModelDefinition type, aside from letting the user using any\n * \"unknown\" model slug, which is provided by the WorkspaceModelDefinition type.\n *\n * This type is only aware of the DefaultModelDefinition type because the\n * StarlightClient uses it by default when no model definition type is passed.\n *\n * @group Client\n */\nexport type DynamicStarlightClient<T extends WorkspaceModelDefinition> =\n StarlightClient<T> & {\n [K in keyof T]: DynamicModelInstance<T[K]>\n }\n\n/**\n * This interface represents an API response that returns a single entity, like\n * a single {@link Entry} or a single {@link MediaObject}, for instance.\n *\n * It contains only one field: `data`. This field type is generic and\n * depends on the kind of request that was made to the API.\n *\n * All SDK request methods that returna single entity\n * will return this interface.\n *\n * @group Client\n */\nexport interface StarlightItemResponse<T> {\n /**\n * The entity returned by the API request. Its type depends on which request\n * was made. SDK methods will generally type this parameter automatically.\n */\n data: T\n}\n\n/**\n * This interface represents an API response that returns a list of entities,\n * like a list of {@apilink Entry | Entries} or a list of items from a\n * {@link Collection}.\n *\n * It contains a `data` parameter, which is an array of items with a generic\n * type that depends on the kind of request that was made, and two metadata\n * objects: `links` and `meta`. Metadata is useful for pagination.\n *\n * All SDK request methods that return a list of entities will return this\n * interface.\n *\n * @group Client\n */\nexport interface StarlightListResponse<T> {\n /**\n * The list of entities returned by the API request. Its type depends on which\n * request was made. SDK methods will generally type\n * this parameter automatically.\n */\n data: T[]\n /**\n * An object containing useful links for easier pagination. All links points\n * to the same list requested, but with a varying `page` parameter.\n */\n links: {\n /**\n * A link for the first page of the list.\n */\n first: string\n /**\n * A link for the last page of the list.\n */\n last: string\n /**\n * A link to the previous page of the list, if there's any.\n */\n prev?: string\n /**\n * A link to the next page of the list, if there's any.\n */\n next?: string\n }\n /**\n * An object with useful metadata related to the current list. It can be used\n * in applications to create pagination logic and interfaces.\n *\n * `from` and `to` are indexes indicating which items start and finish the\n * current page of the list. For instance, in a list with 100 items with 15\n * items per page, on the first page, `from` and `to` will be `1` and `15`\n * respectively.\n */\n meta: {\n /**\n * The number of the current page.\n */\n current_page: number\n /**\n * The number of the last page for the current list.\n */\n last_page: number\n /**\n * The index of the first item on this page out of all list items.\n */\n from: number\n /**\n * The index of the last item on this page out of all list items.\n */\n to: number\n /**\n * The number of items per page.\n */\n per_page: number\n /**\n * The total number of items in the current list.\n */\n total: number\n }\n}\n\n/**\n * The DefaultModelDefinition type is used to correctly type Entry data when\n * requesting it using a StarlightClient.\n *\n * Without using a DefaultModelDefinition, Entry data will be typed as a\n * \"generic\" JS object which can hold any kind of data:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry> on request success.\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<Record<string, unknown>>. This means that\n * // `data` can hold anything, which is not type-safe.\n * const helloWorld = response.data\n * ```\n *\n * One way of safely adding type information to Entry objects is by passing a\n * data definition type to the EntrySelector when requesting something:\n *\n * ```ts\n * import Starlight, { VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * // response type will now be StarlightItemResponse<Entry<PostsFields>>.\n * const response = await Starlight.posts.entries<PostFields>.get('hello-world')\n *\n * // Now, helloWorld type is Entry<PostsFields>.\n * const helloWorld = response.data\n *\n * // Which means we can safely access its data, and IDEs will\n * // auto-complete the data field name below:\n * console.log(helloWorld.data.featured_image)\n * ```\n *\n * Note that we used \"Fields\" to define our data shape. We recommend using these\n * types, which are exported by this SDK, because they map to the field types\n * available in the Starlight admin when creating models, and should simplify\n * the type definition process. All available Field types are documented in the\n * {@apilink BooleanField | Data Fields section of this API}.\n *\n * However, passing model definition types around your application is not ideal,\n * and actually unnecessary. Using the DefaultModelDefinition type, all model\n * definitions can be automatically inferred.\n *\n * To get started, you need to create a\n * [type declaration file](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)\n * in which you'll define all your types. You can name it anything and place it\n * anywhere inside your project, but we recommend naming it `starlight.d.ts` and\n * placing it in the root folder of your source code, so it can be easily\n * imported later in your application if you ever need to reference these types.\n *\n * In this file, you can place all your model type definitions (including type\n * definitions for Singleton data, if you want!). Finally, you just need to\n * add a \"module definition block\" that will tell the SDK which types you expect\n * to receive when requesting models.\n *\n * Here's a complete exemple defining two models, Posts and Magazines:\n *\n * ```ts\n * import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * type MagazineFields = {\n * cover_image: MediaField\n * content: VisualField\n * issue_number: StringField\n * issue_year: StringField\n * }\n *\n * declare module '@starlightcms/js-sdk' {\n * export interface DefaultModelDefinition {\n * // Notice that each key in this interface is a Model slug!\n * posts: PostFields\n * magazines: MagazineFields\n * }\n * }\n * ```\n *\n * After creating this file, types should be automatically inferred without the\n * need to pass these types around:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry<PostsFields>>,\n * // which was implicitly inferred by the SDK!\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<PostsFields>\n * const helloWorld = response.data\n *\n * // Auto-complete will work just as before when we explicitly type the Entry!\n * console.log(helloWorld.data.featured_image)\n * ```\n *\n * @group Client\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface DefaultModelDefinition extends WorkspaceModelDefinition {}\n\n/**\n * This type is only used as a base for the DefaultModelDefinition type.\n *\n * @internal\n */\nexport interface WorkspaceModelDefinition {\n [slug: string]: SerializedData\n}\n\n/**\n * Request parameters used by most SDK `list()` methods.\n *\n * @group Request Parameters\n */\nexport interface BaseRequestParameters {\n [key: string]: string | number | boolean | undefined\n /**\n * The page requested.\n */\n page?: number\n /**\n * The limit of items per page.\n */\n limit?: number\n /**\n * A search query string.\n *\n * For instance, searching for \"out\" will match both \"check out!\" and\n * \"about us\". Search is not case-sensitive.\n */\n query?: string\n}\n\n/**\n * Request parameters used by most SDK methods that support advanced querying.\n *\n * @group Request Parameters\n */\nexport interface QueryableRequestParameters {\n /**\n * A search query string that matches a specific word within boundaries.\n * Search is not case-sensitive.\n *\n * For instance, searching for \"phone\" will match \"This is my phone!\"\n * but won't match \"This is my telephone!\".\n */\n 'query:word'?: string\n /**\n * A comma-separated list of fields to look up on when searching using\n * `query` or `query:word`. If undefined, all text fields will be searched on,\n * including Visual Editor fields. Search is not case-sensitive.\n *\n * For instance, to limit search on the \"content\" and \"summary\" fields of a\n * model, pass `'content,summary'`.\n */\n fields?: string\n /**\n * If defined, removes the given item from the list. Useful to create \"related\n * posts\" lists.\n *\n * Note: this field only accepts IDs, and not slugs. Only one ID is allowed.\n */\n except?: number\n}\n"]}
@@ -4,7 +4,39 @@
4
4
  * @group Visual Data Blocks
5
5
  * @internal
6
6
  */
7
- export declare type BlockType = 'paragraph' | 'quote' | 'header' | 'image' | 'raw' | 'list' | 'video';
7
+ export type BlockType = 'paragraph' | 'quote' | 'header' | 'image' | 'raw' | 'list' | 'video';
8
+ /**
9
+ * Represents the possible block widths, used by some blocks.
10
+ *
11
+ * @group Visual Data Blocks
12
+ * @internal
13
+ */
14
+ type BlockWidth = 'auto' | 'justify' | 'max' | string;
15
+ /**
16
+ * Alignable block type extension
17
+ *
18
+ * @group Visual Data Blocks
19
+ * @internal
20
+ */
21
+ export type AlignableBlock<Base> = Base & {
22
+ alignment: Alignment;
23
+ };
24
+ /**
25
+ * Represents the possible alignments, used by some blocks.
26
+ *
27
+ * @group Visual Data Blocks
28
+ * @internal
29
+ */
30
+ export type Alignment = 'start' | 'center' | 'end' | 'justify';
31
+ /**
32
+ * Stretchable block type extension
33
+ *
34
+ * @group Visual Data Blocks
35
+ * @internal
36
+ */
37
+ export type StretchableBlock<Base> = Base & {
38
+ isStretched: boolean;
39
+ };
8
40
  /**
9
41
  * Base interface for types that represent block data.
10
42
  *
@@ -19,7 +51,8 @@ export interface BlockData {
19
51
  *
20
52
  * @group Visual Data Blocks
21
53
  */
22
- export interface ParagraphBlock extends BlockData {
54
+ export type ParagraphBlock = StretchableBlock<AlignableBlock<BaseParagraphBlock>>;
55
+ interface BaseParagraphBlock extends BlockData {
23
56
  text: string | null;
24
57
  }
25
58
  /**
@@ -27,7 +60,8 @@ export interface ParagraphBlock extends BlockData {
27
60
  *
28
61
  * @group Visual Data Blocks
29
62
  */
30
- export interface HeaderBlock extends BlockData {
63
+ export type HeaderBlock = StretchableBlock<AlignableBlock<BaseHeaderBlock>>;
64
+ interface BaseHeaderBlock extends BlockData {
31
65
  text: string;
32
66
  level: number;
33
67
  }
@@ -41,20 +75,13 @@ export interface QuoteBlock extends BlockData {
41
75
  caption: string;
42
76
  alignment: 'left' | 'center';
43
77
  }
44
- /**
45
- * Represents the possible block widths, used by some blocks.
46
- *
47
- * @group Visual Data Blocks
48
- * @internal
49
- */
50
- declare type BlockWidth = 'auto' | 'justify' | 'max' | string;
51
78
  /**
52
79
  * Represents an image file, used in Image blocks.
53
80
  *
54
81
  * @group Visual Data Blocks
55
82
  * @internal
56
83
  */
57
- export declare type ImageFile = {
84
+ export type ImageFile = {
58
85
  url: string;
59
86
  variation: string;
60
87
  width: number;
@@ -65,7 +92,8 @@ export declare type ImageFile = {
65
92
  *
66
93
  * @group Visual Data Blocks
67
94
  */
68
- export interface ImageBlock extends BlockData {
95
+ export type ImageBlock = StretchableBlock<AlignableBlock<BaseImageBlock>>;
96
+ interface BaseImageBlock extends BlockData {
69
97
  id: number | undefined;
70
98
  url: string;
71
99
  files: ImageFile[];
@@ -82,7 +110,8 @@ export interface ImageBlock extends BlockData {
82
110
  *
83
111
  * @group Visual Data Blocks
84
112
  */
85
- export interface HTMLBlock extends BlockData {
113
+ export type HTMLBlock = StretchableBlock<BaseHTMLBlock>;
114
+ interface BaseHTMLBlock extends BlockData {
86
115
  html: string;
87
116
  }
88
117
  /**
@@ -100,7 +129,8 @@ export interface ListItem {
100
129
  *
101
130
  * @group Visual Data Blocks
102
131
  */
103
- export interface ListBlock extends BlockData {
132
+ export type ListBlock = StretchableBlock<BaseListBlock>;
133
+ interface BaseListBlock extends BlockData {
104
134
  style: 'ordered' | 'unordered';
105
135
  items: ListItem[];
106
136
  }
@@ -110,13 +140,14 @@ export interface ListBlock extends BlockData {
110
140
  * @group Visual Data Blocks
111
141
  * @internal
112
142
  */
113
- export declare type SupportedServices = 'youtube' | 'vimeo';
143
+ export type SupportedServices = 'youtube' | 'vimeo';
114
144
  /**
115
145
  * Represents a Video block, which is used to render embed video elements.
116
146
  *
117
147
  * @group Visual Data Blocks
118
148
  */
119
- export declare type VideoBlock = {
149
+ export type VideoBlock = StretchableBlock<AlignableBlock<BaseVideoBlock>>;
150
+ interface BaseVideoBlock extends BlockData {
120
151
  type: 'embed';
121
152
  service: SupportedServices;
122
153
  videoId: string;
@@ -124,7 +155,8 @@ export declare type VideoBlock = {
124
155
  html: string;
125
156
  width: BlockWidth;
126
157
  caption?: string;
127
- };
158
+ alignment: Alignment;
159
+ }
128
160
  /**
129
161
  * A VisualDataBlock object represents a piece of content. Each block has a
130
162
  * specific type and some data associated with it. For instance, a Paragraph