@cube-nl/dmp-sdk 1.1.0-rc.3 → 1.1.0-rc.4

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest": 1,
3
3
  "package": "@cube-nl/dmp-sdk",
4
- "version": "1.1.0-rc.3",
4
+ "version": "1.1.0-rc.4",
5
5
  "file": "cube-sdk.js",
6
6
  "blocks": {
7
7
  "cube-state": {
@@ -9,6 +9,7 @@
9
9
  "since": "1.1.0",
10
10
  "summary": "A loading, empty, error, no-access or signed-out message. Every data block shows it itself; use it alone only for a custom section.",
11
11
  "actions": [],
12
+ "optional_actions": [],
12
13
  "attributes": {
13
14
  "kind": {
14
15
  "type": "enum",
@@ -46,6 +47,7 @@
46
47
  "since": "1.1.0",
47
48
  "summary": "The frame of the app: a header with logo, app name and the signed-in user with sign-in/sign-out, and, with two or more cube-page children, a page navigation that follows the address (#/<name>). Put it once around everything on the page.",
48
49
  "actions": [],
50
+ "optional_actions": [],
49
51
  "attributes": {
50
52
  "name": {
51
53
  "type": "string",
@@ -79,6 +81,7 @@
79
81
  "since": "1.1.0",
80
82
  "summary": "One page of a cube-app-shell. Holds that page's blocks; the shell shows only the active page and lists every page in its navigation.",
81
83
  "actions": [],
84
+ "optional_actions": [],
82
85
  "attributes": {
83
86
  "name": {
84
87
  "type": "id",
@@ -100,6 +103,7 @@
100
103
  "since": "1.1.0",
101
104
  "summary": "How one field of a resource is shown and edited by the cube-table, cube-detail, cube-form or cube-board it is a direct child of: its label, format, choices, or that it is left out. Never rendered itself.",
102
105
  "actions": [],
106
+ "optional_actions": [],
103
107
  "attributes": {
104
108
  "name": {
105
109
  "type": "field",
@@ -152,6 +156,7 @@
152
156
  "since": "1.1.0",
153
157
  "summary": "A period choice (this month, last 12 months, this year, or two dates) that period-aware blocks follow through their period attribute. Place it once above the blocks it drives.",
154
158
  "actions": [],
159
+ "optional_actions": [],
155
160
  "attributes": {
156
161
  "default": {
157
162
  "type": "enum",
@@ -194,6 +199,7 @@
194
199
  "actions": [
195
200
  "aggregate"
196
201
  ],
202
+ "optional_actions": [],
197
203
  "attributes": {
198
204
  "resource": {
199
205
  "type": "resource",
@@ -268,6 +274,7 @@
268
274
  "actions": [
269
275
  "aggregate"
270
276
  ],
277
+ "optional_actions": [],
271
278
  "attributes": {
272
279
  "resource": {
273
280
  "type": "resource",
@@ -374,6 +381,7 @@
374
381
  "actions": [
375
382
  "aggregate"
376
383
  ],
384
+ "optional_actions": [],
377
385
  "attributes": {
378
386
  "resource": {
379
387
  "type": "resource",
@@ -477,6 +485,7 @@
477
485
  "actions": [
478
486
  "list"
479
487
  ],
488
+ "optional_actions": [],
480
489
  "attributes": {
481
490
  "resource": {
482
491
  "type": "resource",
@@ -560,7 +569,11 @@
560
569
  "since": "1.1.0",
561
570
  "summary": "One row of a resource as a list of label and value, for the row a cube-table chose. With editable, \"Bewerken\" turns the writable fields into editors; \"Opslaan\" sends only what changed and only if nobody changed the row meanwhile, else it asks to load the newest version first.",
562
571
  "actions": [
563
- "get"
572
+ "get",
573
+ "update"
574
+ ],
575
+ "optional_actions": [
576
+ "update"
564
577
  ],
565
578
  "attributes": {
566
579
  "resource": {
@@ -569,7 +582,8 @@
569
582
  "summary": "The resource the row belongs to.",
570
583
  "example": "orders",
571
584
  "actions": [
572
- "get"
585
+ "get",
586
+ "update"
573
587
  ]
574
588
  },
575
589
  "record-id": {
@@ -609,6 +623,7 @@
609
623
  "actions": [
610
624
  "create"
611
625
  ],
626
+ "optional_actions": [],
612
627
  "attributes": {
613
628
  "resource": {
614
629
  "type": "resource",
@@ -652,6 +667,7 @@
652
667
  "since": "1.1.0",
653
668
  "summary": "A calculator that needs no data: an editor per cube-input and an output per cube-result, recalculated on every keystroke by the formula property, a JavaScript function the app sets. A formula that throws or gives NaN or Infinity shows \"—\" and one alert; the inputs keep working.",
654
669
  "actions": [],
670
+ "optional_actions": [],
655
671
  "attributes": {
656
672
  "label": {
657
673
  "type": "string",
@@ -679,6 +695,7 @@
679
695
  "since": "1.1.0",
680
696
  "summary": "One input of the cube-calc it is a direct child of. Numbers are typed the Dutch way (7,5). Never rendered itself.",
681
697
  "actions": [],
698
+ "optional_actions": [],
682
699
  "attributes": {
683
700
  "name": {
684
701
  "type": "id",
@@ -745,6 +762,7 @@
745
762
  "since": "1.1.0",
746
763
  "summary": "One labelled output of the cube-calc it is a direct child of. Never rendered itself.",
747
764
  "actions": [],
765
+ "optional_actions": [],
748
766
  "attributes": {
749
767
  "name": {
750
768
  "type": "id",
@@ -793,6 +811,9 @@
793
811
  "list",
794
812
  "update"
795
813
  ],
814
+ "optional_actions": [
815
+ "update"
816
+ ],
796
817
  "attributes": {
797
818
  "resource": {
798
819
  "type": "resource",
@@ -862,6 +883,7 @@
862
883
  "since": "1.1.0",
863
884
  "summary": "One column of the cube-board it is a direct child of, in order. Never rendered itself.",
864
885
  "actions": [],
886
+ "optional_actions": [],
865
887
  "attributes": {
866
888
  "value": {
867
889
  "type": "string",
@@ -883,6 +905,7 @@
883
905
  "since": "1.1.0",
884
906
  "summary": "Only for a wireframe (soort \"wireframe\" in cube-app.json): one card per thing the proposal shows that the DMP does not have yet, from ontbreekt in cube-app.json: the resource or resource.field as its heading, then the screen, the kind of data and why. Without gaps (or in any other app) it says that nothing is missing. In a wireframe every block that shows invented data is marked \"Voorbeeld — bestaat nog niet\" and every write is only simulated, marked \"Voorbeeld — wordt niet opgeslagen\"; this block is not marked itself.",
885
907
  "actions": [],
908
+ "optional_actions": [],
886
909
  "attributes": {
887
910
  "scherm": {
888
911
  "type": "string",
package/dist/size.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "core_gzip": 18169,
3
- "total_gzip": 46959,
4
- "ui_gzip": 28790,
3
+ "total_gzip": 46995,
4
+ "ui_gzip": 28826,
5
5
  "budget_gzip": 40960
6
6
  }
@@ -13,6 +13,7 @@ export interface BlockSpec {
13
13
  since: string;
14
14
  summary: string;
15
15
  actions: readonly string[];
16
+ optional_actions?: readonly string[];
16
17
  attributes: Readonly<Record<string, AttributeSpec>>;
17
18
  children?: readonly string[];
18
19
  events?: Readonly<Record<string, string>>;
@@ -24,7 +25,9 @@ export interface BlockManifest {
24
25
  package: '@cube-nl/dmp-sdk';
25
26
  version: string;
26
27
  file: 'cube-sdk.js';
27
- blocks: Record<string, BlockSpec>;
28
+ blocks: Record<string, BlockSpec & {
29
+ optional_actions: readonly string[];
30
+ }>;
28
31
  tokens: string[];
29
32
  fonts: Record<string, {
30
33
  family: string;
@@ -528,14 +528,15 @@ export const BLOCK_SPECS = {
528
528
  summary: 'One row of a resource as a list of label and value, for the row a cube-table chose. With editable, '
529
529
  + '"Bewerken" turns the writable fields into editors; "Opslaan" sends only what changed and only if '
530
530
  + 'nobody changed the row meanwhile, else it asks to load the newest version first.',
531
- actions: ['get'],
531
+ actions: ['get', 'update'],
532
+ optional_actions: ['update'],
532
533
  attributes: {
533
534
  resource: {
534
535
  type: 'resource',
535
536
  required: true,
536
537
  summary: 'The resource the row belongs to.',
537
538
  example: 'orders',
538
- actions: ['get'],
539
+ actions: ['get', 'update'],
539
540
  },
540
541
  'record-id': {
541
542
  type: 'id',
@@ -764,6 +765,7 @@ export const BLOCK_SPECS = {
764
765
  + 'Choosing a card (click, Enter or Space) emits cube-select and can fill a cube-detail. '
765
766
  + 'Columns stack on a narrow screen.',
766
767
  actions: ['list', 'update'],
768
+ optional_actions: ['update'],
767
769
  attributes: {
768
770
  resource: {
769
771
  type: 'resource',
@@ -873,13 +875,20 @@ export const BLOCK_SPECS = {
873
875
  example: '<cube-gap-list scherm="Klanten"></cube-gap-list>',
874
876
  },
875
877
  };
878
+ // Rebuilds the spec with optional_actions right after actions and every other key in its source place.
879
+ function withOptionalActions(spec) {
880
+ const entries = Object.entries(spec).filter(([key]) => key !== 'optional_actions');
881
+ const at = entries.findIndex(([key]) => key === 'actions') + 1;
882
+ entries.splice(at, 0, ['optional_actions', spec.optional_actions ?? []]);
883
+ return Object.fromEntries(entries);
884
+ }
876
885
  export function blockManifest(version) {
877
886
  return {
878
887
  manifest: 1,
879
888
  package: '@cube-nl/dmp-sdk',
880
889
  version,
881
890
  file: 'cube-sdk.js',
882
- blocks: structuredClone(BLOCK_SPECS),
891
+ blocks: Object.fromEntries(Object.entries(structuredClone(BLOCK_SPECS)).map(([tag, spec]) => [tag, withOptionalActions(spec)])),
883
892
  tokens: [...TOKEN_NAMES],
884
893
  fonts: Object.fromEntries(Object.entries(FONTS).map(([id, font]) => [
885
894
  id,
@@ -25,9 +25,23 @@ export function showTrialBanner(scope, config) {
25
25
  const now = scope.now ?? Date.now;
26
26
  const expiresAt = Date.parse(config.expiresAt);
27
27
  const known = Number.isFinite(expiresAt);
28
- const time = known
29
- ? new Intl.DateTimeFormat('nl-NL', { hour: '2-digit', minute: '2-digit', timeZoneName: 'short' }).format(new Date(expiresAt))
30
- : null;
28
+ const options = {
29
+ hour: '2-digit',
30
+ minute: '2-digit',
31
+ hourCycle: 'h23',
32
+ timeZoneName: 'short',
33
+ };
34
+ let time = null;
35
+ if (known) {
36
+ let format;
37
+ try {
38
+ format = new Intl.DateTimeFormat(doc.documentElement.lang || 'nl-NL', options);
39
+ }
40
+ catch {
41
+ format = new Intl.DateTimeFormat('nl-NL', options);
42
+ }
43
+ time = format.format(new Date(expiresAt));
44
+ }
31
45
  const host = doc.createElement('cube-trial-banner');
32
46
  const root = host.attachShadow({ mode: 'open' });
33
47
  const sheets = [BASE_CSS, CSS].map((css) => {
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** This package's version. A test holds it equal to package.json's. */
2
- export declare const VERSION = "1.1.0-rc.3";
2
+ export declare const VERSION = "1.1.0-rc.4";
3
3
  /** The `"sdk"` value a `cube-app.json` manifest names for the API `CubeApp` offers here. */
4
4
  export declare const MANIFEST_SDK = "1";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /** This package's version. A test holds it equal to package.json's. */
2
- export const VERSION = '1.1.0-rc.3';
2
+ export const VERSION = '1.1.0-rc.4';
3
3
  /** The `"sdk"` value a `cube-app.json` manifest names for the API `CubeApp` offers here. */
4
4
  export const MANIFEST_SDK = '1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cube-nl/dmp-sdk",
3
- "version": "1.1.0-rc.3",
3
+ "version": "1.1.0-rc.4",
4
4
  "description": "Dependency-free TypeScript client for the Cube DMP REST API (cube/api), with OAuth 2.1 + PKCE, and CubeApp for no-build apps (preview on mock data, live on the DMP).",
5
5
  "license": "MIT",
6
6
  "type": "module",