diff --git a/json-schemas/definitions.json b/json-schemas/definitions.json index bbe5afe96..cd08533ba 100644 --- a/json-schemas/definitions.json +++ b/json-schemas/definitions.json @@ -14,6 +14,10 @@ "did": { "type": "string", "pattern": "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(#.*)?$" + }, + "date-time": { + "type": "string", + "pattern": "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$" } } -} +} \ No newline at end of file diff --git a/json-schemas/hooks/hooks-write.json b/json-schemas/hooks/hooks-write.json index 092657ef4..808893be9 100644 --- a/json-schemas/hooks/hooks-write.json +++ b/json-schemas/hooks/hooks-write.json @@ -35,7 +35,7 @@ "type": "string" }, "dateCreated": { - "type": "string" + "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time" }, "schema": { "type": "string" diff --git a/json-schemas/records/records-query.json b/json-schemas/records/records-query.json index 0c1c1d212..09c5b5813 100644 --- a/json-schemas/records/records-query.json +++ b/json-schemas/records/records-query.json @@ -34,7 +34,7 @@ "type": "string" }, "dateCreated": { - "type": "string" + "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time" }, "filter": { "type": "object", @@ -71,10 +71,10 @@ "additionalProperties": false, "properties": { "from": { - "type": "string" + "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time" }, "to": { - "type": "string" + "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time" } } } diff --git a/json-schemas/records/records-write.json b/json-schemas/records/records-write.json index bb0613a6e..722aeb9d3 100644 --- a/json-schemas/records/records-write.json +++ b/json-schemas/records/records-write.json @@ -121,16 +121,16 @@ "type": "number" }, "dateCreated": { - "type": "string" + "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time" }, "dateModified": { - "type": "string" + "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time" }, "published": { "type": "boolean" }, "datePublished": { - "type": "string" + "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time" }, "dataFormat": { "type": "string" diff --git a/package-lock.json b/package-lock.json index 2599925bd..a5a41ea53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tbd54566975/dwn-sdk-js", - "version": "0.0.30", + "version": "0.0.31", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@tbd54566975/dwn-sdk-js", - "version": "0.0.30", + "version": "0.0.31", "license": "Apache-2.0", "dependencies": { "@ipld/dag-cbor": "9.0.0", @@ -21,7 +21,7 @@ "@types/readable-stream": "2.3.15", "@types/secp256k1": "4.0.3", "abstract-level": "1.0.3", - "ajv": "8.11.0", + "ajv": "8.12.0", "blockstore-core": "3.0.0", "cross-fetch": "3.1.5", "date-fns": "2.28.0", @@ -1243,9 +1243,9 @@ } }, "node_modules/ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -8803,9 +8803,9 @@ "requires": {} }, "ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", diff --git a/package.json b/package.json index 11f05b8c6..307c3a7ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tbd54566975/dwn-sdk-js", - "version": "0.0.30", + "version": "0.0.31", "description": "A reference implementation of https://identity.foundation/decentralized-web-node/spec/", "type": "module", "types": "./dist/esm/src/index.d.ts", @@ -60,7 +60,7 @@ "@types/readable-stream": "2.3.15", "@types/secp256k1": "4.0.3", "abstract-level": "1.0.3", - "ajv": "8.11.0", + "ajv": "8.12.0", "blockstore-core": "3.0.0", "cross-fetch": "3.1.5", "date-fns": "2.28.0", @@ -143,4 +143,4 @@ "url": "https://github.com/TBD54566975/dwn-sdk-js/issues" }, "homepage": "https://github.com/TBD54566975/dwn-sdk-js#readme" -} +} \ No newline at end of file diff --git a/tests/interfaces/records/handlers/records-query.spec.ts b/tests/interfaces/records/handlers/records-query.spec.ts index 6d90db65a..45693330a 100644 --- a/tests/interfaces/records/handlers/records-query.spec.ts +++ b/tests/interfaces/records/handlers/records-query.spec.ts @@ -19,9 +19,9 @@ import { Message } from '../../../../src/core/message.js'; import { MessageStoreLevel } from '../../../../src/store/message-store-level.js'; import { RecordsQueryHandler } from '../../../../src/interfaces/records/handlers/records-query.js'; import { StorageController } from '../../../../src/store/storage-controller.js'; -import { Temporal } from '@js-temporal/polyfill'; import { TestDataGenerator } from '../../../utils/test-data-generator.js'; import { TestStubGenerator } from '../../../utils/test-stub-generator.js'; +import { toTemporalInstant } from '@js-temporal/polyfill'; import { constructRecordsWriteIndexes } from '../../../../src/interfaces/records/handlers/records-write.js'; import { DataStream, DidResolver, Dwn, HdKey, KeyDerivationScheme, Records } from '../../../../src/index.js'; @@ -29,6 +29,10 @@ import { DateSort, RecordsQuery } from '../../../../src/interfaces/records/messa chai.use(chaiAsPromised); +function createDateString(d: Date): string { + return toTemporalInstant.call(d).toString({ smallestUnit: 'microseconds' }); +} + describe('RecordsQueryHandler.handle()', () => { describe('functional tests', () => { let didResolver: DidResolver; @@ -183,11 +187,12 @@ describe('RecordsQueryHandler.handle()', () => { expect(reply3.entries?.length).to.equal(0); }); + it('should be able to range query by `dateCreated`', async () => { // scenario: 3 records authored by alice, created on first of 2021, 2022, and 2023 respectively, only the first 2 records share the same schema - const firstDayOf2021 = Temporal.PlainDateTime.from({ year: 2021, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' }); - const firstDayOf2022 = Temporal.PlainDateTime.from({ year: 2022, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' }); - const firstDayOf2023 = Temporal.PlainDateTime.from({ year: 2023, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' }); + const firstDayOf2021 = createDateString(new Date(2021, 1, 1)); + const firstDayOf2022 = createDateString(new Date(2022, 1, 1)); + const firstDayOf2023 = createDateString(new Date(2023, 1, 1)); const alice = await DidKeyResolver.generate(); const write1 = await TestDataGenerator.generateRecordsWrite({ requester: alice, dateCreated: firstDayOf2021, dateModified: firstDayOf2021 }); const write2 = await TestDataGenerator.generateRecordsWrite({ requester: alice, dateCreated: firstDayOf2022, dateModified: firstDayOf2022 }); @@ -202,7 +207,7 @@ describe('RecordsQueryHandler.handle()', () => { expect(writeReply3.status.code).to.equal(202); // testing `from` range - const lastDayOf2021 = Temporal.PlainDateTime.from({ year: 2021, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' }); + const lastDayOf2021 = createDateString(new Date(2021, 12, 31)); const recordsQuery1 = await TestDataGenerator.generateRecordsQuery({ requester : alice, filter : { dateCreated: { from: lastDayOf2021 } }, @@ -214,7 +219,7 @@ describe('RecordsQueryHandler.handle()', () => { expect(reply1.entries![1].encodedData).to.equal(Encoder.bytesToBase64Url(write3.dataBytes!)); // testing `to` range - const lastDayOf2022 = Temporal.PlainDateTime.from({ year: 2022, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' }); + const lastDayOf2022 = createDateString(new Date(2022, 12, 31)); const recordsQuery2 = await TestDataGenerator.generateRecordsQuery({ requester : alice, filter : { dateCreated: { to: lastDayOf2022 } }, @@ -226,7 +231,7 @@ describe('RecordsQueryHandler.handle()', () => { expect(reply2.entries![1].encodedData).to.equal(Encoder.bytesToBase64Url(write2.dataBytes!)); // testing `from` and `to` range - const lastDayOf2023 = Temporal.PlainDateTime.from({ year: 2023, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' }); + const lastDayOf2023 = createDateString(new Date(2023, 12, 31)); const recordsQuery3 = await TestDataGenerator.generateRecordsQuery({ requester : alice, filter : { dateCreated: { from: lastDayOf2022, to: lastDayOf2023 } }, @@ -249,9 +254,9 @@ describe('RecordsQueryHandler.handle()', () => { it('should be able use range and exact match queries at the same time', async () => { // scenario: 3 records authored by alice, created on first of 2021, 2022, and 2023 respectively, only the first 2 records share the same schema - const firstDayOf2021 = Temporal.PlainDateTime.from({ year: 2021, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' }); - const firstDayOf2022 = Temporal.PlainDateTime.from({ year: 2022, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' }); - const firstDayOf2023 = Temporal.PlainDateTime.from({ year: 2023, month: 1, day: 1 }).toString({ smallestUnit: 'microseconds' }); + const firstDayOf2021 = createDateString(new Date(2021, 1, 1)); + const firstDayOf2022 = createDateString(new Date(2022, 1, 1)); + const firstDayOf2023 = createDateString(new Date(2023, 1, 1)); const alice = await DidKeyResolver.generate(); const schema = '2021And2022Schema'; const write1 = await TestDataGenerator.generateRecordsWrite({ @@ -273,8 +278,8 @@ describe('RecordsQueryHandler.handle()', () => { expect(writeReply3.status.code).to.equal(202); // testing range criterion with another exact match - const lastDayOf2021 = Temporal.PlainDateTime.from({ year: 2021, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' }); - const lastDayOf2023 = Temporal.PlainDateTime.from({ year: 2023, month: 12, day: 31 }).toString({ smallestUnit: 'microseconds' }); + const lastDayOf2021 = createDateString(new Date(2021, 12, 31)); + const lastDayOf2023 = createDateString(new Date(2023, 12, 31)); const recordsQuery5 = await TestDataGenerator.generateRecordsQuery({ requester : alice, filter : { diff --git a/tests/interfaces/records/handlers/records-write.spec.ts b/tests/interfaces/records/handlers/records-write.spec.ts index bdac62e3c..5d690b2d2 100644 --- a/tests/interfaces/records/handlers/records-write.spec.ts +++ b/tests/interfaces/records/handlers/records-write.spec.ts @@ -425,7 +425,7 @@ describe('RecordsWriteHandler.handle()', () => { it('should return 400 if `dateCreated` and `dateModified` are not the same in an initial write', async () => { const { requester, message, dataStream } = await TestDataGenerator.generateRecordsWrite({ - dateCreated : '2023-01-10T10:20:30.405060', + dateCreated : '2023-01-10T10:20:30.405060Z', dateModified : getCurrentTimeInHighPrecision() // this always generate a different timestamp }); const tenant = requester.did; diff --git a/tests/interfaces/records/messages/records-write.spec.ts b/tests/interfaces/records/messages/records-write.spec.ts index bde006bba..bc0a753d3 100644 --- a/tests/interfaces/records/messages/records-write.spec.ts +++ b/tests/interfaces/records/messages/records-write.spec.ts @@ -25,7 +25,7 @@ describe('RecordsWrite', () => { recipient : alice.did, data : TestDataGenerator.randomBytes(10), dataFormat : 'application/json', - dateCreated : '2022-10-14T10:20:30.405060', + dateCreated : '2022-10-14T10:20:30.405060Z', recordId : await TestDataGenerator.randomCborSha256Cid(), authorizationSignatureInput : Jws.createSignatureInput(alice) }; diff --git a/tests/validation/json-schemas/definitions.spec.ts b/tests/validation/json-schemas/definitions.spec.ts new file mode 100644 index 000000000..6b92c0841 --- /dev/null +++ b/tests/validation/json-schemas/definitions.spec.ts @@ -0,0 +1,29 @@ +import Ajv from 'ajv'; +import definitions from '../../../json-schemas/definitions.json' assert { type: 'json' }; + +import { expect } from 'chai'; + +describe('date-time schema', async () => { + + const ajv = new Ajv.default(); + const validateDateTime = ajv.compile(definitions.definitions['date-time']); + + it('should accept ISO 8601 date-time strings accepted by DWN', () => { + expect(validateDateTime('2022-04-29T10:30:00.123456Z')).to.be.true; + }); + + it('should reject ISO 8601 date-time strings not accepted by DWN', () => { + const unacceptableDateTimeStrings = [ + '2023-04-27T13:30:00.123456', + '2023-04-27T13:30:00.123456z', + '2023-04-27T13:30:00.1234Z', + '2023-04-27T13:30:00Z', + '2023-04-27T13:30:00.000000+00:00', + '2023-04-27 13:30:00.000000Z' + ]; + + for (const dateTime of unacceptableDateTimeStrings) { + expect(validateDateTime(dateTime)).to.be.false; + } + }); +}); diff --git a/tests/validation/json-schemas/protocols/protocols-configure.spec.ts b/tests/validation/json-schemas/protocols/protocols-configure.spec.ts index 610f37d81..60b221d64 100644 --- a/tests/validation/json-schemas/protocols/protocols-configure.spec.ts +++ b/tests/validation/json-schemas/protocols/protocols-configure.spec.ts @@ -25,7 +25,7 @@ describe('ProtocolsConfigure schema definition', () => { descriptor: { interface : 'Protocols', method : 'Configure', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', protocol : 'anyProtocolUri', definition : protocolDefinition }, diff --git a/tests/validation/json-schemas/records/records-query.spec.ts b/tests/validation/json-schemas/records/records-query.spec.ts index 3b5e06724..729b8d120 100644 --- a/tests/validation/json-schemas/records/records-query.spec.ts +++ b/tests/validation/json-schemas/records/records-query.spec.ts @@ -7,7 +7,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { schema: 'anySchema' } }, authorization: { @@ -26,7 +26,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { schema: 'anySchema' } } }; @@ -41,7 +41,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { schema: 'anySchema' } }, authorization: { @@ -64,7 +64,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { schema: 'anySchema' }, unknownProperty : 'unknownProperty' // unknown property }, @@ -90,7 +90,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { schema: 'anySchema' }, dateSort : dateSortValue }, @@ -111,7 +111,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { schema: 'anySchema' }, dateSort : 'unacceptable', // bad value }, @@ -135,7 +135,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { } }, authorization: { @@ -157,7 +157,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { dateCreated: { } } // empty `dateCreated` criteria }, authorization: { @@ -179,7 +179,7 @@ describe('RecordsQuery schema validation', () => { descriptor: { interface : 'Records', method : 'Query', - dateCreated : '123', + dateCreated : '2022-10-14T10:20:30.405060Z', filter : { dateCreated: { unexpectedProperty: 'anyValue' } } // unexpected property in `dateCreated` criteria }, authorization: { diff --git a/tests/validation/json-schemas/records/records-write.spec.ts b/tests/validation/json-schemas/records/records-write.spec.ts index 10cc85de4..a812e31f7 100644 --- a/tests/validation/json-schemas/records/records-write.spec.ts +++ b/tests/validation/json-schemas/records/records-write.spec.ts @@ -11,8 +11,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456', + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z', }, authorization: { payload : 'anyPayload', @@ -33,8 +33,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -59,8 +59,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' } }; @@ -78,8 +78,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -105,8 +105,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456', + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z', unknownProperty : 'unknownProperty' // unknown property }, authorization: { @@ -136,8 +136,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -164,8 +164,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -190,8 +190,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -215,8 +215,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -242,8 +242,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -271,8 +271,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -300,8 +300,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -330,8 +330,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456' + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z' }, authorization: { payload : 'anyPayload', @@ -356,10 +356,10 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateModified : '2022-12-19T10:20:30.123456', + dateModified : '2022-12-19T10:20:30.123456Z', published : false, - dateCreated : '2022-12-19T10:20:30.123456', - datePublished : '2022-12-19T10:20:30.123456' // must not be present when not published + dateCreated : '2022-12-19T10:20:30.123456Z', + datePublished : '2022-12-19T10:20:30.123456Z' // must not be present when not published }, authorization: { payload : 'anyPayload', @@ -384,8 +384,8 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456', + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z', published : true //datePublished must be present }, authorization: { @@ -411,9 +411,9 @@ describe('RecordsWrite schema definition', () => { dataCid : 'anyCid', dataFormat : 'application/json', dataSize : 123, - dateCreated : '2022-12-19T10:20:30.123456', - dateModified : '2022-12-19T10:20:30.123456', - datePublished : '2022-12-19T10:20:30.123456' //published must be present + dateCreated : '2022-12-19T10:20:30.123456Z', + dateModified : '2022-12-19T10:20:30.123456Z', + datePublished : '2022-12-19T10:20:30.123456Z' //published must be present }, authorization: { payload : 'anyPayload',