@oblax/cms 0.0.0-stage → 2.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 (54) hide show
  1. package/dist/cms-module.d.ts +57 -0
  2. package/dist/cms-module.d.ts.map +1 -0
  3. package/dist/cms-module.js +56 -0
  4. package/dist/cms-module.js.map +1 -0
  5. package/dist/content-types.d.ts +36 -0
  6. package/dist/content-types.d.ts.map +1 -0
  7. package/dist/content-types.js +69 -0
  8. package/dist/content-types.js.map +1 -0
  9. package/dist/entries.d.ts +84 -0
  10. package/dist/entries.d.ts.map +1 -0
  11. package/dist/entries.js +170 -0
  12. package/dist/entries.js.map +1 -0
  13. package/dist/index.d.ts +42 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +46 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/navigations.d.ts +49 -0
  18. package/dist/navigations.d.ts.map +1 -0
  19. package/dist/navigations.js +79 -0
  20. package/dist/navigations.js.map +1 -0
  21. package/dist/public.d.ts +57 -0
  22. package/dist/public.d.ts.map +1 -0
  23. package/dist/public.js +106 -0
  24. package/dist/public.js.map +1 -0
  25. package/dist/redirects.d.ts +31 -0
  26. package/dist/redirects.d.ts.map +1 -0
  27. package/dist/redirects.js +51 -0
  28. package/dist/redirects.js.map +1 -0
  29. package/dist/references.d.ts +18 -0
  30. package/dist/references.d.ts.map +1 -0
  31. package/dist/references.js +20 -0
  32. package/dist/references.js.map +1 -0
  33. package/dist/sections.d.ts +32 -0
  34. package/dist/sections.d.ts.map +1 -0
  35. package/dist/sections.js +51 -0
  36. package/dist/sections.js.map +1 -0
  37. package/dist/settings.d.ts +22 -0
  38. package/dist/settings.d.ts.map +1 -0
  39. package/dist/settings.js +28 -0
  40. package/dist/settings.js.map +1 -0
  41. package/dist/terms.d.ts +40 -0
  42. package/dist/terms.d.ts.map +1 -0
  43. package/dist/terms.js +74 -0
  44. package/dist/terms.js.map +1 -0
  45. package/dist/types.d.ts +789 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +2 -0
  48. package/dist/types.js.map +1 -0
  49. package/dist/vocabularies.d.ts +32 -0
  50. package/dist/vocabularies.d.ts.map +1 -0
  51. package/dist/vocabularies.js +45 -0
  52. package/dist/vocabularies.js.map +1 -0
  53. package/package.json +48 -3
  54. package/README.md +0 -3
@@ -0,0 +1,57 @@
1
+ import type { OblaxContext } from '@oblax/core';
2
+ import { ContentTypesSubmodule } from './content-types.js';
3
+ import { SectionsSubmodule } from './sections.js';
4
+ import { SettingsSubmodule } from './settings.js';
5
+ import { EntriesSubmodule } from './entries.js';
6
+ import { ReferencesSubmodule } from './references.js';
7
+ import { RedirectsSubmodule } from './redirects.js';
8
+ import { VocabulariesSubmodule } from './vocabularies.js';
9
+ import { TermsSubmodule } from './terms.js';
10
+ import { NavigationsSubmodule } from './navigations.js';
11
+ import { PublicSubmodule } from './public.js';
12
+ import type { CmsConfig } from './types.js';
13
+ /**
14
+ * The CMS module.
15
+ *
16
+ * Editor and admin APIs:
17
+ *
18
+ * - `types` — content types and their custom-field rules.
19
+ * - `sections` — where articles live and how their paths are built.
20
+ * - `settings` — home pages and reserved paths.
21
+ * - `entries` — working copies, publishing, scheduling, review, translations, revisions.
22
+ * - `references` — which entries point at a file, entry, term or author.
23
+ * - `redirects` — automatic and manual redirects.
24
+ * - `vocabularies` — tag and category sets.
25
+ * - `terms` — a vocabulary's terms.
26
+ * - `navigations` — menus, with versions.
27
+ *
28
+ * Reader API:
29
+ *
30
+ * - `public` — live content as a website shows it: resolve a path, list
31
+ * entries, terms and navigations.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const oblax = new Oblax({
36
+ * endpoint: 'https://api.my-app.oblax.io',
37
+ * clientId: 'my-web-app',
38
+ * modules: [PlatformBrowser(), Cms({ filesBase: 'https://cdn.example.com' })],
39
+ * })
40
+ *
41
+ * const page = await oblax.cms.public.resolve({ path: '/about', locale: 'en' })
42
+ * ```
43
+ */
44
+ export declare class CmsModule {
45
+ readonly types: ContentTypesSubmodule;
46
+ readonly sections: SectionsSubmodule;
47
+ readonly settings: SettingsSubmodule;
48
+ readonly entries: EntriesSubmodule;
49
+ readonly references: ReferencesSubmodule;
50
+ readonly redirects: RedirectsSubmodule;
51
+ readonly vocabularies: VocabulariesSubmodule;
52
+ readonly terms: TermsSubmodule;
53
+ readonly navigations: NavigationsSubmodule;
54
+ readonly public: PublicSubmodule;
55
+ constructor(ctx: OblaxContext, config: CmsConfig);
56
+ }
57
+ //# sourceMappingURL=cms-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cms-module.d.ts","sourceRoot":"","sources":["../src/cms-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,SAAS;IACpB,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;IAClC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAA;IACxC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAA;IACtC,QAAQ,CAAC,YAAY,EAAE,qBAAqB,CAAA;IAC5C,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAA;IAC1C,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;gBAEpB,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS;CAYjD"}
@@ -0,0 +1,56 @@
1
+ import { ContentTypesSubmodule } from './content-types.js';
2
+ import { SectionsSubmodule } from './sections.js';
3
+ import { SettingsSubmodule } from './settings.js';
4
+ import { EntriesSubmodule } from './entries.js';
5
+ import { ReferencesSubmodule } from './references.js';
6
+ import { RedirectsSubmodule } from './redirects.js';
7
+ import { VocabulariesSubmodule } from './vocabularies.js';
8
+ import { TermsSubmodule } from './terms.js';
9
+ import { NavigationsSubmodule } from './navigations.js';
10
+ import { PublicSubmodule } from './public.js';
11
+ /**
12
+ * The CMS module.
13
+ *
14
+ * Editor and admin APIs:
15
+ *
16
+ * - `types` — content types and their custom-field rules.
17
+ * - `sections` — where articles live and how their paths are built.
18
+ * - `settings` — home pages and reserved paths.
19
+ * - `entries` — working copies, publishing, scheduling, review, translations, revisions.
20
+ * - `references` — which entries point at a file, entry, term or author.
21
+ * - `redirects` — automatic and manual redirects.
22
+ * - `vocabularies` — tag and category sets.
23
+ * - `terms` — a vocabulary's terms.
24
+ * - `navigations` — menus, with versions.
25
+ *
26
+ * Reader API:
27
+ *
28
+ * - `public` — live content as a website shows it: resolve a path, list
29
+ * entries, terms and navigations.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const oblax = new Oblax({
34
+ * endpoint: 'https://api.my-app.oblax.io',
35
+ * clientId: 'my-web-app',
36
+ * modules: [PlatformBrowser(), Cms({ filesBase: 'https://cdn.example.com' })],
37
+ * })
38
+ *
39
+ * const page = await oblax.cms.public.resolve({ path: '/about', locale: 'en' })
40
+ * ```
41
+ */
42
+ export class CmsModule {
43
+ constructor(ctx, config) {
44
+ this.types = new ContentTypesSubmodule(ctx);
45
+ this.sections = new SectionsSubmodule(ctx);
46
+ this.settings = new SettingsSubmodule(ctx);
47
+ this.entries = new EntriesSubmodule(ctx);
48
+ this.references = new ReferencesSubmodule(ctx);
49
+ this.redirects = new RedirectsSubmodule(ctx);
50
+ this.vocabularies = new VocabulariesSubmodule(ctx);
51
+ this.terms = new TermsSubmodule(ctx);
52
+ this.navigations = new NavigationsSubmodule(ctx);
53
+ this.public = new PublicSubmodule(ctx, config);
54
+ }
55
+ }
56
+ //# sourceMappingURL=cms-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cms-module.js","sourceRoot":"","sources":["../src/cms-module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAG7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,SAAS;IAYpB,YAAY,GAAiB,EAAE,MAAiB;QAC9C,IAAI,CAAC,KAAK,GAAU,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAAA;QAClD,IAAI,CAAC,QAAQ,GAAO,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAC9C,IAAI,CAAC,QAAQ,GAAO,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAC9C,IAAI,CAAC,OAAO,GAAQ,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAC7C,IAAI,CAAC,UAAU,GAAK,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAA;QAChD,IAAI,CAAC,SAAS,GAAM,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAAA;QAC/C,IAAI,CAAC,YAAY,GAAG,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAAA;QAClD,IAAI,CAAC,KAAK,GAAU,IAAI,cAAc,CAAC,GAAG,CAAC,CAAA;QAC3C,IAAI,CAAC,WAAW,GAAI,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAA;QACjD,IAAI,CAAC,MAAM,GAAS,IAAI,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IACtD,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import type { OblaxContext } from '@oblax/core';
2
+ import type { CmsList, CodeParams, ContentType, CreateContentTypeParams, QueuedJob, UpdateContentTypeParams } from './types.js';
3
+ /**
4
+ * Manages content types: the kinds of entries a project has (pages, articles,
5
+ * items, singles) and the rules of their custom fields.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * await oblax.cms.types.create({
10
+ * code: 'recipe',
11
+ * name: 'Recipe',
12
+ * kind: 'item',
13
+ * fields: [{ path: 'minutes', type: 'int', required: true }],
14
+ * })
15
+ * const { data } = await oblax.cms.types.list()
16
+ * ```
17
+ */
18
+ export declare class ContentTypesSubmodule {
19
+ private readonly ctx;
20
+ constructor(ctx: OblaxContext);
21
+ /** Lists every type, the built-in `page` and `article` included. */
22
+ list(): Promise<CmsList<ContentType>>;
23
+ get(params: CodeParams): Promise<ContentType>;
24
+ /** Creates a type; settings left out take the defaults (optional body, no review). */
25
+ create(params: CreateContentTypeParams): Promise<ContentType>;
26
+ /** Updates a type; settings left out keep their values. The code and kind can't change. */
27
+ update(params: UpdateContentTypeParams): Promise<void>;
28
+ /** Deletes a type no entries use. Built-in types can't be deleted. */
29
+ delete(params: CodeParams): Promise<void>;
30
+ /**
31
+ * Queues the job that brings the type's entries in line with its fields.
32
+ * A field change queues it on its own; this is for when that one couldn't be.
33
+ */
34
+ reindex(params: CodeParams): Promise<QueuedJob>;
35
+ }
36
+ //# sourceMappingURL=content-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-types.d.ts","sourceRoot":"","sources":["../src/content-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,WAAW,EAEX,uBAAuB,EACvB,SAAS,EACT,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAoBnB;;;;;;;;;;;;;;GAcG;AACH,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,YAAY;IAE9C,oEAAoE;IAC9D,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAIrC,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAInD,sFAAsF;IAChF,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;IAQnE,2FAA2F;IACrF,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5D,sEAAsE;IAChE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;;OAGG;IACG,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;CAGtD"}
@@ -0,0 +1,69 @@
1
+ import { pathSegment as seg } from '@oblax/core';
2
+ function toApi(p) {
3
+ return {
4
+ name: p.name,
5
+ description: p.description,
6
+ body: p.body,
7
+ body_formats: p.bodyFormats,
8
+ fields: p.fields,
9
+ shared_paths: p.sharedPaths,
10
+ sections: p.sections,
11
+ vocabularies: p.vocabularies,
12
+ review: p.review,
13
+ approval: p.approval,
14
+ approver_roles: p.approverRoles,
15
+ allow_self_approval: p.allowSelfApproval,
16
+ review_bypass_roles: p.reviewBypassRoles,
17
+ };
18
+ }
19
+ /**
20
+ * Manages content types: the kinds of entries a project has (pages, articles,
21
+ * items, singles) and the rules of their custom fields.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * await oblax.cms.types.create({
26
+ * code: 'recipe',
27
+ * name: 'Recipe',
28
+ * kind: 'item',
29
+ * fields: [{ path: 'minutes', type: 'int', required: true }],
30
+ * })
31
+ * const { data } = await oblax.cms.types.list()
32
+ * ```
33
+ */
34
+ export class ContentTypesSubmodule {
35
+ constructor(ctx) {
36
+ this.ctx = ctx;
37
+ }
38
+ /** Lists every type, the built-in `page` and `article` included. */
39
+ async list() {
40
+ return this.ctx.http.get('/cms/types');
41
+ }
42
+ async get(params) {
43
+ return this.ctx.http.get(`/cms/types/${seg(params.code)}`);
44
+ }
45
+ /** Creates a type; settings left out take the defaults (optional body, no review). */
46
+ async create(params) {
47
+ return this.ctx.http.post('/cms/types', {
48
+ ...toApi(params),
49
+ code: params.code,
50
+ kind: params.kind,
51
+ });
52
+ }
53
+ /** Updates a type; settings left out keep their values. The code and kind can't change. */
54
+ async update(params) {
55
+ return this.ctx.http.put(`/cms/types/${seg(params.code)}`, toApi(params));
56
+ }
57
+ /** Deletes a type no entries use. Built-in types can't be deleted. */
58
+ async delete(params) {
59
+ return this.ctx.http.delete(`/cms/types/${seg(params.code)}`);
60
+ }
61
+ /**
62
+ * Queues the job that brings the type's entries in line with its fields.
63
+ * A field change queues it on its own; this is for when that one couldn't be.
64
+ */
65
+ async reindex(params) {
66
+ return this.ctx.http.post(`/cms/types/${seg(params.code)}:reindex`);
67
+ }
68
+ }
69
+ //# sourceMappingURL=content-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-types.js","sourceRoot":"","sources":["../src/content-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,IAAI,GAAG,EAAE,MAAM,aAAa,CAAA;AAWhD,SAAS,KAAK,CAAC,CAAmB;IAChC,OAAO;QACL,IAAI,EAAiB,CAAC,CAAC,IAAI;QAC3B,WAAW,EAAU,CAAC,CAAC,WAAW;QAClC,IAAI,EAAiB,CAAC,CAAC,IAAI;QAC3B,YAAY,EAAS,CAAC,CAAC,WAAW;QAClC,MAAM,EAAe,CAAC,CAAC,MAAM;QAC7B,YAAY,EAAS,CAAC,CAAC,WAAW;QAClC,QAAQ,EAAa,CAAC,CAAC,QAAQ;QAC/B,YAAY,EAAS,CAAC,CAAC,YAAY;QACnC,MAAM,EAAe,CAAC,CAAC,MAAM;QAC7B,QAAQ,EAAa,CAAC,CAAC,QAAQ;QAC/B,cAAc,EAAO,CAAC,CAAC,aAAa;QACpC,mBAAmB,EAAE,CAAC,CAAC,iBAAiB;QACxC,mBAAmB,EAAE,CAAC,CAAC,iBAAiB;KACzC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,qBAAqB;IAChC,YAA6B,GAAiB;QAAjB,QAAG,GAAH,GAAG,CAAc;IAAG,CAAC;IAElD,oEAAoE;IACpE,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAuB,YAAY,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAkB;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAc,cAAc,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACzE,CAAC;IAED,sFAAsF;IACtF,KAAK,CAAC,MAAM,CAAC,MAA+B;QAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAc,YAAY,EAAE;YACnD,GAAG,KAAK,CAAC,MAAM,CAAC;YAChB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,2FAA2F;IAC3F,KAAK,CAAC,MAAM,CAAC,MAA+B;QAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAO,cAAc,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;IACjF,CAAC;IAED,sEAAsE;IACtE,KAAK,CAAC,MAAM,CAAC,MAAkB;QAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAO,cAAc,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACrE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,MAAkB;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAY,cAAc,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAChF,CAAC;CACF"}
@@ -0,0 +1,84 @@
1
+ import type { OblaxContext } from '@oblax/core';
2
+ import type { ApproveEntryParams, CmsList, CreateEntryParams, DeleteEntryParams, DeleteEntryResult, Entry, EntryIdParams, ListEntriesParams, ListRevisionsParams, PreviewToken, RejectEntryParams, RestoreEntryParams, Revision, RevisionIdParams, ScheduleEntryParams, SubmitEntryParams, TranslateEntryParams, UnpublishEntryParams, UpdateEntryParams } from './types.js';
3
+ /**
4
+ * Manages entries: their working copies, publishing, scheduling, review,
5
+ * translations and revisions.
6
+ *
7
+ * Each entry has a working copy that editors save, and a live copy readers
8
+ * get (see `cms.public`). Saves send the `_modified` they loaded, so a save
9
+ * over someone else's newer one fails with 409.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const entry = await oblax.cms.entries.create({
14
+ * type: 'article',
15
+ * title: 'Hello',
16
+ * sectionId: 'section-id',
17
+ * body: '# Hello',
18
+ * })
19
+ *
20
+ * const saved = await oblax.cms.entries.update({
21
+ * id: entry.id,
22
+ * modified: entry._modified!,
23
+ * excerpt: 'A first post',
24
+ * })
25
+ *
26
+ * await oblax.cms.entries.publish({ id: saved.id })
27
+ *
28
+ * // Reviewers' queue
29
+ * const { data } = await oblax.cms.entries.list({
30
+ * filters: [{ field: 'review', op: 'eq', value: 'pending' }],
31
+ * })
32
+ * ```
33
+ */
34
+ export declare class EntriesSubmodule {
35
+ private readonly ctx;
36
+ constructor(ctx: OblaxContext);
37
+ /**
38
+ * Lists working copies, newest first, without their bodies. Filter on
39
+ * `type_id`, `locale`, `translation_group_id`, `title`, `review`, ...
40
+ * `count` is the total across pages.
41
+ */
42
+ list(params?: ListEntriesParams): Promise<CmsList<Entry>>;
43
+ get(params: EntryIdParams): Promise<Entry>;
44
+ /** Creates a working copy; with `submit: true` it's also sent for review. */
45
+ create(params: CreateEntryParams): Promise<Entry>;
46
+ /**
47
+ * Saves onto the working copy; content left out keeps its values. Resolves
48
+ * to the saved entry, whose `_modified` the next save sends.
49
+ */
50
+ update(params: UpdateEntryParams): Promise<Entry>;
51
+ /**
52
+ * Moves the working copy to the trash and takes the live copy down; its
53
+ * translations stay. Resolves to what still links to the entry, or
54
+ * `undefined` when nothing does.
55
+ */
56
+ delete(params: DeleteEntryParams): Promise<DeleteEntryResult | undefined>;
57
+ /** Checks the working copy fully and makes it live. */
58
+ publish(params: EntryIdParams): Promise<Entry>;
59
+ /** Takes the live copy down; the working copy stays. */
60
+ unpublish(params: UnpublishEntryParams): Promise<Entry>;
61
+ /** Starts a translation into another locale, with the type's shared fields copied. */
62
+ translate(params: TranslateEntryParams): Promise<Entry>;
63
+ /** Saves a revision's content onto the working copy. */
64
+ restore(params: RestoreEntryParams): Promise<Entry>;
65
+ /** Issues a token for reading the working copy without signing in, for 30 minutes. */
66
+ preview(params: EntryIdParams): Promise<PreviewToken>;
67
+ /** Snapshots the working copy to go live at `publishAt`, and/or takes it down at `unpublishAt`. */
68
+ schedule(params: ScheduleEntryParams): Promise<Entry>;
69
+ /** Drops the entry's schedule. */
70
+ unschedule(params: EntryIdParams): Promise<Entry>;
71
+ /** Sends the working copy for review and locks it. */
72
+ submit(params: SubmitEntryParams): Promise<Entry>;
73
+ /** Takes the entry out of review and unlocks it. */
74
+ withdraw(params: EntryIdParams): Promise<Entry>;
75
+ /** Publishes the revision in review, or schedules it when there's a publish date. */
76
+ approve(params: ApproveEntryParams): Promise<Entry>;
77
+ /** Sends the revision in review back to its author. */
78
+ reject(params: RejectEntryParams): Promise<Entry>;
79
+ /** Lists the entry's revisions, newest first, without their content. */
80
+ listRevisions(params: ListRevisionsParams): Promise<CmsList<Revision>>;
81
+ /** Returns one of the entry's revisions, with its content. */
82
+ getRevision(params: RevisionIdParams): Promise<Revision>;
83
+ }
84
+ //# sourceMappingURL=entries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../src/entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EACV,kBAAkB,EAClB,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,EACL,aAAa,EAEb,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAoBnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,gBAAgB;IAC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AC,KAAK,CAAC;IAIrD,qFAAqF;IAC/E,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC;IAQzD,uDAAuD;IACjD,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAOvD,wEAAwE;IAClE,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAM5E,8DAA8D;IACxD,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;CAK/D"}
@@ -0,0 +1,170 @@
1
+ import { listPairs, buildQuery as query, pathSegment as seg } from '@oblax/core';
2
+ function toApi(p) {
3
+ return {
4
+ title: p.title,
5
+ excerpt: p.excerpt,
6
+ body: p.body,
7
+ body_format: p.bodyFormat,
8
+ fields: p.fields,
9
+ cover_file_id: p.coverFileId,
10
+ seo: p.seo,
11
+ author_ids: p.authorIds,
12
+ terms: p.terms,
13
+ section_id: p.sectionId,
14
+ parent_id: p.parentId,
15
+ slug: p.slug,
16
+ published_at: p.publishedAt,
17
+ };
18
+ }
19
+ /**
20
+ * Manages entries: their working copies, publishing, scheduling, review,
21
+ * translations and revisions.
22
+ *
23
+ * Each entry has a working copy that editors save, and a live copy readers
24
+ * get (see `cms.public`). Saves send the `_modified` they loaded, so a save
25
+ * over someone else's newer one fails with 409.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const entry = await oblax.cms.entries.create({
30
+ * type: 'article',
31
+ * title: 'Hello',
32
+ * sectionId: 'section-id',
33
+ * body: '# Hello',
34
+ * })
35
+ *
36
+ * const saved = await oblax.cms.entries.update({
37
+ * id: entry.id,
38
+ * modified: entry._modified!,
39
+ * excerpt: 'A first post',
40
+ * })
41
+ *
42
+ * await oblax.cms.entries.publish({ id: saved.id })
43
+ *
44
+ * // Reviewers' queue
45
+ * const { data } = await oblax.cms.entries.list({
46
+ * filters: [{ field: 'review', op: 'eq', value: 'pending' }],
47
+ * })
48
+ * ```
49
+ */
50
+ export class EntriesSubmodule {
51
+ constructor(ctx) {
52
+ this.ctx = ctx;
53
+ }
54
+ /**
55
+ * Lists working copies, newest first, without their bodies. Filter on
56
+ * `type_id`, `locale`, `translation_group_id`, `title`, `review`, ...
57
+ * `count` is the total across pages.
58
+ */
59
+ async list(params = {}) {
60
+ return this.ctx.http.get(`/cms/entries${query({}, listPairs(params))}`);
61
+ }
62
+ async get(params) {
63
+ return this.ctx.http.get(`/cms/entries/${seg(params.id)}`);
64
+ }
65
+ /** Creates a working copy; with `submit: true` it's also sent for review. */
66
+ async create(params) {
67
+ return this.ctx.http.post('/cms/entries', {
68
+ ...toApi(params),
69
+ type: params.type,
70
+ locale: params.locale,
71
+ submit: params.submit,
72
+ note: params.note,
73
+ publish_at: params.publishAt,
74
+ });
75
+ }
76
+ /**
77
+ * Saves onto the working copy; content left out keeps its values. Resolves
78
+ * to the saved entry, whose `_modified` the next save sends.
79
+ */
80
+ async update(params) {
81
+ return this.ctx.http.put(`/cms/entries/${seg(params.id)}`, {
82
+ ...toApi(params),
83
+ _modified: params.modified,
84
+ autosave: params.autosave,
85
+ note: params.note,
86
+ });
87
+ }
88
+ /**
89
+ * Moves the working copy to the trash and takes the live copy down; its
90
+ * translations stay. Resolves to what still links to the entry, or
91
+ * `undefined` when nothing does.
92
+ */
93
+ async delete(params) {
94
+ return this.ctx.http.delete(`/cms/entries/${seg(params.id)}${query({ gone: params.gone })}`);
95
+ }
96
+ /** Checks the working copy fully and makes it live. */
97
+ async publish(params) {
98
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:publish`);
99
+ }
100
+ /** Takes the live copy down; the working copy stays. */
101
+ async unpublish(params) {
102
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:unpublish`, {
103
+ gone: params.gone,
104
+ });
105
+ }
106
+ /** Starts a translation into another locale, with the type's shared fields copied. */
107
+ async translate(params) {
108
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:translate`, {
109
+ locale: params.locale,
110
+ title: params.title,
111
+ });
112
+ }
113
+ /** Saves a revision's content onto the working copy. */
114
+ async restore(params) {
115
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:restore`, {
116
+ revision_id: params.revisionId,
117
+ _modified: params.modified,
118
+ });
119
+ }
120
+ /** Issues a token for reading the working copy without signing in, for 30 minutes. */
121
+ async preview(params) {
122
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:preview`);
123
+ }
124
+ /** Snapshots the working copy to go live at `publishAt`, and/or takes it down at `unpublishAt`. */
125
+ async schedule(params) {
126
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:schedule`, {
127
+ publish_at: params.publishAt,
128
+ unpublish_at: params.unpublishAt,
129
+ });
130
+ }
131
+ /** Drops the entry's schedule. */
132
+ async unschedule(params) {
133
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:unschedule`);
134
+ }
135
+ /** Sends the working copy for review and locks it. */
136
+ async submit(params) {
137
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:submit`, {
138
+ note: params.note,
139
+ publish_at: params.publishAt,
140
+ });
141
+ }
142
+ /** Takes the entry out of review and unlocks it. */
143
+ async withdraw(params) {
144
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:withdraw`);
145
+ }
146
+ /** Publishes the revision in review, or schedules it when there's a publish date. */
147
+ async approve(params) {
148
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:approve`, {
149
+ revision_id: params.revisionId,
150
+ note: params.note,
151
+ publish_at: params.publishAt,
152
+ });
153
+ }
154
+ /** Sends the revision in review back to its author. */
155
+ async reject(params) {
156
+ return this.ctx.http.post(`/cms/entries/${seg(params.id)}:reject`, {
157
+ revision_id: params.revisionId,
158
+ note: params.note,
159
+ });
160
+ }
161
+ /** Lists the entry's revisions, newest first, without their content. */
162
+ async listRevisions(params) {
163
+ return this.ctx.http.get(`/cms/entries/${seg(params.id)}/revisions${query({ limit: params.limit, before: params.before })}`);
164
+ }
165
+ /** Returns one of the entry's revisions, with its content. */
166
+ async getRevision(params) {
167
+ return this.ctx.http.get(`/cms/entries/${seg(params.id)}/revisions/${seg(params.revisionId)}`);
168
+ }
169
+ }
170
+ //# sourceMappingURL=entries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entries.js","sourceRoot":"","sources":["../src/entries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,IAAI,KAAK,EAAE,WAAW,IAAI,GAAG,EAAE,MAAM,aAAa,CAAA;AAwBhF,SAAS,KAAK,CAAC,CAAa;IAC1B,OAAO;QACL,KAAK,EAAU,CAAC,CAAC,KAAK;QACtB,OAAO,EAAQ,CAAC,CAAC,OAAO;QACxB,IAAI,EAAW,CAAC,CAAC,IAAI;QACrB,WAAW,EAAI,CAAC,CAAC,UAAU;QAC3B,MAAM,EAAS,CAAC,CAAC,MAAM;QACvB,aAAa,EAAE,CAAC,CAAC,WAAW;QAC5B,GAAG,EAAY,CAAC,CAAC,GAAG;QACpB,UAAU,EAAK,CAAC,CAAC,SAAS;QAC1B,KAAK,EAAU,CAAC,CAAC,KAAK;QACtB,UAAU,EAAK,CAAC,CAAC,SAAS;QAC1B,SAAS,EAAM,CAAC,CAAC,QAAQ;QACzB,IAAI,EAAW,CAAC,CAAC,IAAI;QACrB,YAAY,EAAG,CAAC,CAAC,WAAW;KAC7B,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,gBAAgB;IAC3B,YAA6B,GAAiB;QAAjB,QAAG,GAAH,GAAG,CAAc;IAAG,CAAC;IAElD;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,SAA4B,EAAE;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAiB,eAAe,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAA;IACzF,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AAC,SAAS,EAAE;YACxE,WAAW,EAAE,MAAM,CAAC,UAAU;YAC9B,IAAI,EAAS,MAAM,CAAC,IAAI;SACzB,CAAC,CAAA;IACJ,CAAC;IAED,wEAAwE;IACxE,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CACtB,gBAAgB,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,aAAa,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CACnG,CAAA;IACH,CAAC;IAED,8DAA8D;IAC9D,KAAK,CAAC,WAAW,CAAC,MAAwB;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CACtB,gBAAgB,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,cAAc,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CACrE,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,42 @@
1
+ import type { OblaxModulePlugin } from '@oblax/core';
2
+ import { CmsModule } from './cms-module.js';
3
+ import type { CmsConfig } from './types.js';
4
+ export { CmsModule } from './cms-module.js';
5
+ export { ContentTypesSubmodule } from './content-types.js';
6
+ export { SectionsSubmodule } from './sections.js';
7
+ export { SettingsSubmodule } from './settings.js';
8
+ export { EntriesSubmodule } from './entries.js';
9
+ export { ReferencesSubmodule } from './references.js';
10
+ export { RedirectsSubmodule } from './redirects.js';
11
+ export { VocabulariesSubmodule } from './vocabularies.js';
12
+ export { TermsSubmodule } from './terms.js';
13
+ export { NavigationsSubmodule } from './navigations.js';
14
+ export { PublicSubmodule } from './public.js';
15
+ export type { CmsConfig, CmsRecord, CmsList, CmsCursorList, Localized, JsonObject, FilterOp, ListFilter, ListQuery, FieldRule, ContentTypeKind, VocabularyUsage, ContentType, ContentTypeInput, CreateContentTypeParams, UpdateContentTypeParams, CodeParams, QueuedJob, SectionSort, Section, SectionInput, CreateSectionParams, UpdateSectionParams, CmsSettings, UpdateSettingsParams, EntryStatus, EntryReviewState, EntrySeo, CmsFile, CmsAuthor, EntryTerms, EntryContent, Entry, EntryInput, CreateEntryParams, UpdateEntryParams, ListEntriesParams, EntryIdParams, DeleteEntryParams, NavigationUse, ReferenceUse, DeleteEntryResult, UnpublishEntryParams, TranslateEntryParams, RestoreEntryParams, PreviewToken, ScheduleEntryParams, SubmitEntryParams, ApproveEntryParams, RejectEntryParams, RevisionKind, Revision, ListRevisionsParams, RevisionIdParams, ListReferencesParams, RedirectTarget, Redirect, RedirectInput, CreateRedirectParams, UpdateRedirectParams, ListRedirectsParams, IdParams, VocabularySettings, Vocabulary, VocabularyInput, CreateVocabularyParams, UpdateVocabularyParams, TermLabel, Term, ListTermsParams, CreateTermParams, UpdateTermParams, MoveTermParams, MergeTermParams, NavigationItemKind, NavigationProblem, NavigationItem, Navigation, NavigationInput, CreateNavigationParams, UpdateNavigationParams, GetNavigationParams, NavigationVersion, ListNavigationVersionsParams, RestoreNavigationParams, PublicFile, PublicSeo, PublicAuthor, PublicTerm, PublicEntry, PublicSection, Alternate, Breadcrumb, Resolved, PublicPage, PublicRoute, PublicNavItem, PublicNavigation, PublicReadOptions, ResolveParams, PublicRoutesParams, PublicEntriesParams, PublicEntryParams, PublicTermsParams, PublicTermParams, PublicNavigationsParams, PublicNavigationParams, } from './types.js';
16
+ /**
17
+ * CMS module factory.
18
+ *
19
+ * @param config - `filesBase` (optional) makes file URLs in public reads absolute.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { Oblax } from '@oblax/core'
24
+ * import { PlatformBrowser } from '@oblax/platform-browser'
25
+ * import { Cms } from '@oblax/cms'
26
+ *
27
+ * const oblax = new Oblax({
28
+ * endpoint: 'https://api.my-app.oblax.io',
29
+ * clientId: 'my-web-app',
30
+ * modules: [PlatformBrowser(), Cms({ filesBase: 'https://cdn.example.com' })],
31
+ * })
32
+ *
33
+ * // Editors
34
+ * const entry = await oblax.cms.entries.create({ type: 'page', title: 'About' })
35
+ * await oblax.cms.entries.publish({ id: entry.id })
36
+ *
37
+ * // Readers
38
+ * const page = await oblax.cms.public.resolve({ path: '/about', locale: 'en' })
39
+ * ```
40
+ */
41
+ export declare function Cms(config?: CmsConfig): OblaxModulePlugin<'cms', CmsModule>;
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,YAAY,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,aAAa,EACb,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,eAAe,EACf,eAAe,EACf,WAAW,EACX,gBAAgB,EACh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;;;;;;;;;;GAwBG;AACH,wBAAgB,GAAG,CAAC,MAAM,GAAE,SAAc,GAAG,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,CAO/E"}
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ import { CmsModule } from './cms-module.js';
2
+ export { CmsModule } from './cms-module.js';
3
+ export { ContentTypesSubmodule } from './content-types.js';
4
+ export { SectionsSubmodule } from './sections.js';
5
+ export { SettingsSubmodule } from './settings.js';
6
+ export { EntriesSubmodule } from './entries.js';
7
+ export { ReferencesSubmodule } from './references.js';
8
+ export { RedirectsSubmodule } from './redirects.js';
9
+ export { VocabulariesSubmodule } from './vocabularies.js';
10
+ export { TermsSubmodule } from './terms.js';
11
+ export { NavigationsSubmodule } from './navigations.js';
12
+ export { PublicSubmodule } from './public.js';
13
+ /**
14
+ * CMS module factory.
15
+ *
16
+ * @param config - `filesBase` (optional) makes file URLs in public reads absolute.
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * import { Oblax } from '@oblax/core'
21
+ * import { PlatformBrowser } from '@oblax/platform-browser'
22
+ * import { Cms } from '@oblax/cms'
23
+ *
24
+ * const oblax = new Oblax({
25
+ * endpoint: 'https://api.my-app.oblax.io',
26
+ * clientId: 'my-web-app',
27
+ * modules: [PlatformBrowser(), Cms({ filesBase: 'https://cdn.example.com' })],
28
+ * })
29
+ *
30
+ * // Editors
31
+ * const entry = await oblax.cms.entries.create({ type: 'page', title: 'About' })
32
+ * await oblax.cms.entries.publish({ id: entry.id })
33
+ *
34
+ * // Readers
35
+ * const page = await oblax.cms.public.resolve({ path: '/about', locale: 'en' })
36
+ * ```
37
+ */
38
+ export function Cms(config = {}) {
39
+ return {
40
+ name: 'cms',
41
+ create(ctx) {
42
+ return new CmsModule(ctx, config);
43
+ },
44
+ };
45
+ }
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAgH7C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,GAAG,CAAC,SAAoB,EAAE;IACxC,OAAO;QACL,IAAI,EAAE,KAAK;QACX,MAAM,CAAC,GAAiB;YACtB,OAAO,IAAI,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACnC,CAAC;KACF,CAAA;AACH,CAAC"}