Skip to content

Commit 1d28d56

Browse files
committed
Fix long timestamps, update types
1 parent 94b8b27 commit 1d28d56

File tree

3 files changed

+18
-31
lines changed

3 files changed

+18
-31
lines changed

src/#apmg#cl_pacote.clas.abap

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ CLASS /apmg/cl_pacote IMPLEMENTATION.
174174

175175
METHOD /apmg/if_pacote~get_version.
176176

177-
result = pacote-packument-versions[ key = version ].
177+
result = pacote-packument-versions[ key = version ]-manifest.
178178

179179
ENDMETHOD.
180180

@@ -330,25 +330,18 @@ CLASS /apmg/cl_pacote IMPLEMENTATION.
330330
TYPES:
331331
" Copy of schema but without object attributes (which need to be converted to tables)
332332
BEGIN OF ty_packument_partial,
333-
name TYPE string,
333+
name TYPE /apmg/if_types=>ty_name,
334334
description TYPE string,
335335
readme TYPE string,
336336
homepage TYPE string,
337337
icon TYPE string,
338-
BEGIN OF bugs,
339-
url TYPE /apmg/if_types=>ty_uri,
340-
email TYPE /apmg/if_types=>ty_email,
341-
END OF bugs,
338+
bugs TYPE /apmg/if_types=>ty_bugs,
342339
license TYPE string,
343340
keywords TYPE string_table,
344341
main TYPE string,
345342
man TYPE string_table,
346343
author TYPE /apmg/if_types=>ty_person,
347-
BEGIN OF repository,
348-
type TYPE string,
349-
url TYPE /apmg/if_types=>ty_uri,
350-
directory TYPE string,
351-
END OF repository,
344+
repository TYPE /apmg/if_types=>ty_repository,
352345
_id TYPE string,
353346
_rev TYPE string,
354347
access TYPE string,
@@ -360,7 +353,7 @@ CLASS /apmg/cl_pacote IMPLEMENTATION.
360353
time TYPE /apmg/if_types=>ty_time,
361354
person TYPE /apmg/if_types=>ty_person,
362355
user TYPE /apmg/if_types=>ty_user,
363-
version TYPE /apmg/if_types=>ty_version,
356+
version TYPE /apmg/if_types=>ty_version_manifest,
364357
attachment TYPE /apmg/if_types=>ty_attachment,
365358
packument TYPE /apmg/if_types=>ty_packument.
366359

@@ -380,7 +373,7 @@ CLASS /apmg/cl_pacote IMPLEMENTATION.
380373
ENDLOOP.
381374

382375
LOOP AT ajson->members( '/time' ) INTO time-key.
383-
time-timestamp = ajson->get_timestamp( '/time/' && time-key ).
376+
time-timestamp = ajson->get_timestampl( '/time/' && time-key ).
384377
INSERT time INTO TABLE packument-time.
385378
ENDLOOP.
386379

@@ -407,7 +400,7 @@ CLASS /apmg/cl_pacote IMPLEMENTATION.
407400
LOOP AT ajson->members( '/versions' ) INTO version-key.
408401
DATA(ajson_version) = ajson->slice( '/versions/' && version-key ).
409402
" this also validates the version manifest
410-
version-version = /apmg/cl_package_json=>convert_json_to_manifest( ajson_version->stringify( ) ).
403+
version-manifest = /apmg/cl_package_json=>convert_json_to_manifest( ajson_version->stringify( ) ).
411404
INSERT version INTO TABLE packument-versions.
412405
ENDLOOP.
413406

@@ -445,10 +438,9 @@ CLASS /apmg/cl_pacote IMPLEMENTATION.
445438

446439
ajson->setx( '/time:{ }' ).
447440
LOOP AT packument-time INTO DATA(time).
448-
" TODO: Replace with long timestamp
449-
ajson->set_timestamp(
441+
ajson->set_timestampl(
450442
iv_path = 'time/' && time-key
451-
iv_val = cl_abap_tstmp=>move_to_short( time-timestamp ) ).
443+
iv_val = time-timestamp ).
452444
ENDLOOP.
453445

454446
ajson->setx( '/users:{ }' ).
@@ -474,7 +466,7 @@ CLASS /apmg/cl_pacote IMPLEMENTATION.
474466
ajson->setx( '/versions:{ }' ).
475467
LOOP AT packument-versions ASSIGNING FIELD-SYMBOL(<version>).
476468
DATA(version_json) = /apmg/cl_package_json=>convert_manifest_to_json(
477-
manifest = <version>-version
469+
manifest = <version>-manifest
478470
is_complete = is_complete ).
479471

480472
DATA(ajson_version) = zcl_ajson=>parse(

src/#apmg#cl_pacote.clas.testclasses.abap

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,9 @@ CLASS ltcl_pacote IMPLEMENTATION.
3535
&& `| "latest": "1.0.0"`
3636
&& `| },`
3737
&& `| "time": {`
38-
* TODO: needs timestampl support in AJSON
39-
* && `| "1.0.0": "2024-05-02T12:17:47.805Z",`
40-
* && `| "created": "2024-05-02T17:59:06.250Z",`
41-
* && `| "modified": "2024-11-10T19:51:04.774Z"`
42-
&& `| "1.0.0": "2024-05-02T12:17:47Z",`
43-
&& `| "created": "2024-05-02T17:59:06Z",`
44-
&& `| "modified": "2024-11-10T19:51:04Z"`
38+
&& `| "1.0.0": "2024-05-02T12:17:47.805Z",`
39+
&& `| "created": "2024-05-02T17:59:06.251Z",`
40+
&& `| "modified": "2024-11-10T19:51:04.774Z"`
4541
&& `| },`
4642
&& `| "versions": {`
4743
&& `| "1.0.0": {`
@@ -226,25 +222,24 @@ CLASS ltcl_pacote IMPLEMENTATION.
226222
value = `1.0.0`
227223
)
228224
)
229-
* TODO: needs timestampl support in AJSON
230225
time = VALUE #(
231226
(
232227
key = `1.0.0`
233-
timestamp = 20240502121747
228+
timestamp = '20240502121747.805'
234229
)
235230
(
236231
key = `created`
237-
timestamp = 20240502175906
232+
timestamp = '20240502175906.251'
238233
)
239234
(
240235
key = `modified`
241-
timestamp = 20241110195104
236+
timestamp = '20241110195104.774'
242237
)
243238
)
244239
versions = VALUE #(
245240
(
246241
key = `1.0.0`
247-
version = VALUE #(
242+
manifest = VALUE #(
248243
name = `@registrytest/package`
249244
version = `1.0.0`
250245
description = `This is an example package`

src/#apmg#if_pacote.intf.abap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ INTERFACE /apmg/if_pacote PUBLIC.
3232
IMPORTING
3333
!version TYPE string
3434
RETURNING
35-
VALUE(result) TYPE /apmg/if_types=>ty_version.
35+
VALUE(result) TYPE /apmg/if_types=>ty_manifest.
3636

3737
METHODS set
3838
IMPORTING

0 commit comments

Comments
 (0)